diff options
Diffstat (limited to 'qtmips_asm')
-rw-r--r-- | qtmips_asm/simpleasm.cpp | 22 | ||||
-rw-r--r-- | qtmips_asm/simpleasm.h | 4 |
2 files changed, 24 insertions, 2 deletions
diff --git a/qtmips_asm/simpleasm.cpp b/qtmips_asm/simpleasm.cpp index 223b34d..8695624 100644 --- a/qtmips_asm/simpleasm.cpp +++ b/qtmips_asm/simpleasm.cpp @@ -114,6 +114,7 @@ bool SimpleAsm::process_line(QString line, QString filename, bool maybe_label = true; bool final = false; bool separator; + bool space_separated = false; int token_beg = -1; int token_last = -1; int operand_num = -1; @@ -129,6 +130,11 @@ bool SimpleAsm::process_line(QString line, QString filename, if (line.mid(pos).startsWith("#include")) { if ((line.count() > pos + 8) && !line.at(pos + 8).isSpace()) final = true; + } else if (line.mid(pos).startsWith("#pragma")) { + if ((line.count() > pos + 7) && !line.at(pos + 7).isSpace()) + final = true; + else + space_separated = true; } else { final = true; } @@ -140,7 +146,9 @@ bool SimpleAsm::process_line(QString line, QString filename, if (line.at(pos + 1) == '/') final = true; } - separator = final || (maybe_label && (ch == ':')) || ((operand_num >= 0) && (ch == ',')); + separator = final || (maybe_label && (ch == ':')) || + ((operand_num >= 0) && ((ch == ',') || + (space_separated && ch.isSpace() && (token_beg != -1)))); if (maybe_label && (ch == ':')) { maybe_label = false; if (token_beg == -1) { @@ -235,6 +243,9 @@ bool SimpleAsm::process_line(QString line, QString filename, return true; } + if (op == "#PRAGMA") { + return process_pragma(operands, filename, line_number, error_ptr); + } if (op == "#INCLUDE") { bool res = true; QString incname; @@ -633,3 +644,12 @@ bool SimpleAsm::finish(QString *error_ptr) { return !error_occured; } + +bool SimpleAsm::process_pragma(QStringList &operands, QString filename, + int line_number, QString *error_ptr) { + (void)operands; + (void)filename; + (void)line_number; + (void)error_ptr; + return true; +} diff --git a/qtmips_asm/simpleasm.h b/qtmips_asm/simpleasm.h index ac06ca1..8f74577 100644 --- a/qtmips_asm/simpleasm.h +++ b/qtmips_asm/simpleasm.h @@ -74,11 +74,13 @@ public: virtual bool process_file(QString filename, QString *error_ptr = nullptr); bool finish(QString *error_ptr = nullptr); protected: + virtual bool process_pragma(QStringList &operands, QString filename = "", + int line_number = 0, QString *error_ptr = nullptr); bool error_occured; bool fatal_occured; + SymbolTableDb *symtab; private: QStringList include_stack; - SymbolTableDb *symtab; machine::MemoryAccess *mem; machine::RelocExpressionList reloc; std::uint32_t address; |