Skip to content

Commit 6a89f47

Browse files
committed
syntax highlighter updated
1 parent a4a86d2 commit 6a89f47

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

src/SyntaxHighlighter.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ SyntaxHighlighter::SyntaxHighlighter(QTextDocument *parent) : QSyntaxHighlighter
3232
QStringList module_words = {"module", "endmodule", "input", "output", "inout"};
3333
QStringList pair_words = {"begin", "end", "if", "else", "case", "casex", "endcase"};
3434
QStringList connection_words = {"wire", "reg", "posedge", "negedge"};
35-
QStringList compiler_words = {"`include", "`define", "`timescale"};
35+
QStringList compiler_words = {"`include", "`define", "`timescale","`undef", "`ifdef", "`else","`endif", "`ifndef"};
3636
QStringList system_words = {"$display", "$fopen", "$fclose"};
37+
QStringList behavioural_words = {"initial", "always"};
38+
QStringList gate_level_words = {"and","or","not","nand","nor","xor","xnor"};
3739

3840
keywordFormat.setFontWeight(QFont::Bold);
3941

@@ -48,6 +50,14 @@ SyntaxHighlighter::SyntaxHighlighter(QTextDocument *parent) : QSyntaxHighlighter
4850
keywordFormat.setForeground(QColor("#f4d042"));
4951
for (const QString &word : connection_words)
5052
highlightingRules.append({QRegularExpression("\\b" + word + "\\b"), keywordFormat});
53+
54+
keywordFormat.setForeground(QColor("#ff9646"));
55+
for (const QString &word : behavioural_words)
56+
highlightingRules.append({QRegularExpression("\\b" + word + "\\b"), keywordFormat});
57+
58+
keywordFormat.setForeground(QColor("#ff4646"));
59+
for (const QString &word : gate_level_words)
60+
highlightingRules.append({QRegularExpression("\\b" + word + "\\b"), keywordFormat});
5161

5262
keywordFormat.setForeground(QColor("#eb3be8"));
5363
for (const QString &word : system_words)

src/SyntaxHighlighterPython.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ SyntaxHighlighterPython::SyntaxHighlighterPython(QTextDocument *parent) : QSynta
4545
for (const QString &word : loop_words)
4646
highlightingRules.append({QRegularExpression("\\b" + word + "\\b"), keywordFormat});
4747

48-
keywordFormat.setForeground(QColor("#42e5f4"));
48+
keywordFormat.setForeground(QColor("#f442bf"));
4949
for (const QString &word : logic_words)
5050
highlightingRules.append({QRegularExpression("\\b" + word + "\\b"), keywordFormat});
5151

52+
keywordFormat.setForeground(QColor("#f44242"));
53+
for (const QString &word : other_words)
54+
highlightingRules.append({QRegularExpression("\\b" + word + "\\b"), keywordFormat});
55+
5256

5357
/*
5458
Single Line Comment Highlight

src/TerminalDialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ TerminalDialog::TerminalDialog(const QString &program, const QStringList &argume
2121
outputDisplay = new QTextEdit(this);
2222
outputDisplay->setReadOnly(true);
2323

24-
outputDisplay->setStyleSheet("background-color: #000000; color: #00FF00; font-family: 'Consolas', 'Monospace'; font-size: 10pt; border: none; padding: 10px;");
24+
outputDisplay->setStyleSheet("background-color: #000000; color: #00FF00; font-family: 'Consolas', 'Monospace'; font-size: 12pt; border: none; padding: 10px;");
2525

2626
inputLine = new QLineEdit(this);
2727
inputLine->setPlaceholderText("Type your input and press Enter...");
28-
inputLine->setStyleSheet("background-color: #2c2c2c; color: #ffffff; border: 1px solid #444444; border-radius: 4px; padding: 8px; font-size: 10pt;");
28+
inputLine->setStyleSheet("background-color: #2c2c2c; color: #ffffff; border: 1px solid #444444; border-radius: 4px; padding: 12px; font-size: 10pt;");
2929

3030
QVBoxLayout *mainLayout = new QVBoxLayout(this);
3131
mainLayout->addWidget(outputDisplay);

0 commit comments

Comments
 (0)