aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qtmips_gui/highlighter.cpp10
-rw-r--r--qtmips_gui/mainwindow.cpp3
2 files changed, 10 insertions, 3 deletions
diff --git a/qtmips_gui/highlighter.cpp b/qtmips_gui/highlighter.cpp
index 5924eba..baaa8d0 100644
--- a/qtmips_gui/highlighter.cpp
+++ b/qtmips_gui/highlighter.cpp
@@ -47,7 +47,10 @@ Highlighter::Highlighter(QTextDocument *parent)
keywordFormat.setFontWeight(QFont::Bold);
const QString keywordPatterns[] = {
QStringLiteral("\\.org\\b"), QStringLiteral("\\.word\\b"),
- QStringLiteral("\\.text\\b"), QStringLiteral("\\.data\\b")
+ QStringLiteral("\\.text\\b"), QStringLiteral("\\.data\\b"),
+ QStringLiteral("\\.globl\\b"), QStringLiteral("\\.set\\b"),
+ QStringLiteral("\\.equ\\b"), QStringLiteral("\\.end\\b"),
+ QStringLiteral("\\.ent\\b")
};
for (const QString &pattern : keywordPatterns) {
@@ -84,11 +87,12 @@ Highlighter::Highlighter(QTextDocument *parent)
rule.pattern = QRegularExpression(QStringLiteral(";[^\n]*"));
rule.format = singleLineCommentFormat;
highlightingRules.append(rule);
-
- singleLineCommentFormat.setForeground(Qt::red);
rule.pattern = QRegularExpression(QStringLiteral("#[^\n]*"));
rule.format = singleLineCommentFormat;
highlightingRules.append(rule);
+ rule.pattern = QRegularExpression(QStringLiteral("//[^\n]*"));
+ rule.format = singleLineCommentFormat;
+ highlightingRules.append(rule);
multiLineCommentFormat.setForeground(Qt::red);
diff --git a/qtmips_gui/mainwindow.cpp b/qtmips_gui/mainwindow.cpp
index 306099a..46352ea 100644
--- a/qtmips_gui/mainwindow.cpp
+++ b/qtmips_gui/mainwindow.cpp
@@ -689,6 +689,9 @@ void MainWindow::compile_source() {
pos = line.indexOf(";");
if (pos >= 0)
line.truncate(pos);
+ pos = line.indexOf("//");
+ if (pos >= 0)
+ line.truncate(pos);
line = line.simplified();
pos = line.indexOf(":");
if (pos >= 0) {