Debian Codegraph @

pephighlighter.cpp

raw symbols SCIP
1 //File: pephighlighter.cppcxx . . $ `<file>/pephighlighter.cpp`/
2 /*
3 Pep8-1 is a virtual machine for writing machine language and assembly
4 language programs.
5
6 Copyright (C) 2009 J. Stanley Warford, Pepperdine University
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #include "pephighlighter.h"cxx . . $ `<file>/pephighlighter.h`/
22
23 PepHighlightercxx . . $ PepHighlighter#::PepHighlightercxx . . $ PepHighlighter#PepHighlighter(68d7deb16251beb9).(QTextDocumentcxx . . $ QTextDocument# *parent)
24 : QSyntaxHighlightercxx . . $ QSyntaxHighlighter#QSyntaxHighlighter(68d7deb16251beb9).(parent)
25 {
26 HighlightingRulecxx . . $ PepHighlighter#HighlightingRule# rule;
27
28 oprndFormatcxx . . $ PepHighlighter#oprndFormat..setForegroundcxx . . $ QTextFormat#setForeground(ffc9f5d0bda78261).(Qtcxx . . $ QBrush#QBrush(1975e3c608654284).::darkBluecxx . . $ Qt/darkBlue.);
29 oprndFormatcxx . . $ PepHighlighter#oprndFormat..setFontWeightcxx . . $ QTextCharFormat#setFontWeight(d4f767463ce0a6b3).(QFontcxx . . $ QFont#::Boldcxx . . $ QFont#Bold.);
30 QStringListcxx . . $ QStringList# oprndPatternscxx . . $ QStringList#QStringList(ced63f7c635d850d).;
31 oprndPatterns <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bADD(A|SP|X)\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bAND(A|X)\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bASL(A|X)\\b"cxx . . $ QString#QString(85c52e162fed56f9).
32 <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bASR(A|X)\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bBR\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bBR(C|EQ|GE|GT|LE|LT|NE|V)\\b"cxx . . $ QString#QString(85c52e162fed56f9).
33 <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bCALL\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bCHAR(I|O)\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bCP(A|X)\\b"cxx . . $ QString#QString(85c52e162fed56f9).
34 <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bDEC(I|O)\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bLD(A|X|BYTEA|BYTEX)\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bMOV(FLGA|SPA)\\b"cxx . . $ QString#QString(85c52e162fed56f9).
35 <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bNEG(A|X)\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bNOP\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bNOP(0|1|2|3)\\b"cxx . . $ QString#QString(85c52e162fed56f9).
36 <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bNOT(A|X)\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bOR(A|X)\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bRET(0|1|2|3|4|5|6|7|TR)\\b"cxx . . $ QString#QString(85c52e162fed56f9).
37 <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bROL(A|X)\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bROR(A|X)\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bST(A|X|BYTEA|BYTEX)\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bSTOP\\b"cxx . . $ QString#QString(85c52e162fed56f9).
38 <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bSTRO\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bSTX\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "\\bSUB(A|X|SP)\\b"cxx . . $ QString#QString(85c52e162fed56f9).;
39 foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (const QString &pattern, oprndPatterns) {
40 rule.patterncxx . . $ PepHighlighter#HighlightingRule#pattern. =cxx . . $ QRegExp#`operator=`(ca041f4b0a7c2092). QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).(pattern);
41 rule.formatcxx . . $ PepHighlighter#HighlightingRule#format. =cxx . . $ QTextCharFormat#`operator=`(74fb0fd9fc0c28a7). oprndFormatcxx . . $ PepHighlighter#oprndFormat.;
42 highlightingRulescxx . . $ PepHighlighter#highlightingRules..appendcxx . . $ QVector#append(77d9f17553126ecb).(rule);
43 }
44
45 dotFormatcxx . . $ PepHighlighter#dotFormat..setForegroundcxx . . $ QTextFormat#setForeground(ffc9f5d0bda78261).(Qtcxx . . $ QBrush#QBrush(1975e3c608654284).::darkBluecxx . . $ Qt/darkBlue.);
46 dotFormatcxx . . $ PepHighlighter#dotFormat..setFontItaliccxx . . $ QTextCharFormat#setFontItalic(b45ddcbc8423892c).(true);
47 QStringListcxx . . $ QStringList# dotPatternscxx . . $ QStringList#QStringList(ced63f7c635d850d).;
48 dotPatterns <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "[\\.]\\bEQUATE\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "[\\.]\\bASCII\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "[\\.]\\bBLOCK\\b"cxx . . $ QString#QString(85c52e162fed56f9).
49 <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "[\\.]\\bBURN\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "[\\.]\\bBYTE\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "[\\.]\\bEND\\b"cxx . . $ QString#QString(85c52e162fed56f9).
50 <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "[\\.]\\bEQUATE\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "[\\.]\\bWORD\\b"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "[\\.]\\bADDRSS\\b"cxx . . $ QString#QString(85c52e162fed56f9).;
51 foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (const QString &pattern, dotPatterns) {
52 rule.patterncxx . . $ PepHighlighter#HighlightingRule#pattern. =cxx . . $ QRegExp#`operator=`(ca041f4b0a7c2092). QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).(pattern);
53 rule.formatcxx . . $ PepHighlighter#HighlightingRule#format. =cxx . . $ QTextCharFormat#`operator=`(74fb0fd9fc0c28a7). dotFormatcxx . . $ PepHighlighter#dotFormat.;
54 highlightingRulescxx . . $ PepHighlighter#highlightingRules..appendcxx . . $ QVector#append(77d9f17553126ecb).(rule);
55 }
56
57 symbolFormatcxx . . $ PepHighlighter#symbolFormat..setFontWeightcxx . . $ QTextCharFormat#setFontWeight(d4f767463ce0a6b3).(QFontcxx . . $ QFont#::Boldcxx . . $ QFont#Bold.);
58 symbolFormatcxx . . $ PepHighlighter#symbolFormat..setForegroundcxx . . $ QTextFormat#setForeground(ffc9f5d0bda78261).(Qtcxx . . $ QBrush#QBrush(1975e3c608654284).::darkMagentacxx . . $ Qt/darkMagenta.);
59 rule.patterncxx . . $ PepHighlighter#HighlightingRule#pattern. =cxx . . $ QRegExp#`operator=`(ca041f4b0a7c2092). QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("[A-Za-z0-9_]+(?=:)"cxx . . $ QString#QString(85c52e162fed56f9).);
60 rule.formatcxx . . $ PepHighlighter#HighlightingRule#format. =cxx . . $ QTextCharFormat#`operator=`(74fb0fd9fc0c28a7). symbolFormatcxx . . $ PepHighlighter#symbolFormat.;
61 highlightingRulescxx . . $ PepHighlighter#highlightingRules..appendcxx . . $ QVector#append(77d9f17553126ecb).(rule);
62
63 singleLineCommentFormatcxx . . $ PepHighlighter#singleLineCommentFormat..setForegroundcxx . . $ QTextFormat#setForeground(ffc9f5d0bda78261).(Qtcxx . . $ QBrush#QBrush(1975e3c608654284).::darkGreencxx . . $ Qt/darkGreen.);
64 rule.patterncxx . . $ PepHighlighter#HighlightingRule#pattern. =cxx . . $ QRegExp#`operator=`(ca041f4b0a7c2092). QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).(";.*"cxx . . $ QString#QString(85c52e162fed56f9).);
65 rule.formatcxx . . $ PepHighlighter#HighlightingRule#format. =cxx . . $ QTextCharFormat#`operator=`(74fb0fd9fc0c28a7). singleLineCommentFormatcxx . . $ PepHighlighter#singleLineCommentFormat.;
66 highlightingRulescxx . . $ PepHighlighter#highlightingRules..appendcxx . . $ QVector#append(77d9f17553126ecb).(rule);
67
68 multiLineCommentFormatcxx . . $ PepHighlighter#multiLineCommentFormat..setForegroundcxx . . $ QTextFormat#setForeground(ffc9f5d0bda78261).(Qtcxx . . $ QBrush#QBrush(1975e3c608654284).::whitecxx . . $ Qt/white.);
69 multiLineCommentFormatcxx . . $ PepHighlighter#multiLineCommentFormat..setBackgroundcxx . . $ QTextFormat#setBackground(ffc9f5d0bda78261).(Qtcxx . . $ QBrush#QBrush(1975e3c608654284).::redcxx . . $ Qt/red.);
70
71 singleQuotationFormatcxx . . $ PepHighlighter#singleQuotationFormat..setForegroundcxx . . $ QTextFormat#setForeground(ffc9f5d0bda78261).(Qtcxx . . $ QBrush#QBrush(1975e3c608654284).::redcxx . . $ Qt/red.);
72 rule.patterncxx . . $ PepHighlighter#HighlightingRule#pattern. =cxx . . $ QRegExp#`operator=`(ca041f4b0a7c2092). QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("((\')(?![\'])(([^\'|\\\\]){1}|((\\\\)([\'|b|f|n|r|t|v|\"|\\\\]))|((\\\\)(([x|X])([0-9|A-F|a-f]{2}))))(\'))"cxx . . $ QString#QString(85c52e162fed56f9).);
73 rule.formatcxx . . $ PepHighlighter#HighlightingRule#format. =cxx . . $ QTextCharFormat#`operator=`(74fb0fd9fc0c28a7). singleQuotationFormatcxx . . $ PepHighlighter#singleQuotationFormat.;
74 highlightingRulescxx . . $ PepHighlighter#highlightingRules..appendcxx . . $ QVector#append(77d9f17553126ecb).(rule);
75
76 doubleQuotationFormatcxx . . $ PepHighlighter#doubleQuotationFormat..setForegroundcxx . . $ QTextFormat#setForeground(ffc9f5d0bda78261).(Qtcxx . . $ QBrush#QBrush(1975e3c608654284).::redcxx . . $ Qt/red.);
77 rule.patterncxx . . $ PepHighlighter#HighlightingRule#pattern. =cxx . . $ QRegExp#`operator=`(ca041f4b0a7c2092). QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("((\")((([^\"|\\\\])|((\\\\)([\'|b|f|n|r|t|v|\"|\\\\]))|((\\\\)(([x|X])([0-9|A-F|a-f]{2}))))*)(\"))"cxx . . $ QString#QString(85c52e162fed56f9).);
78 rule.formatcxx . . $ PepHighlighter#HighlightingRule#format. =cxx . . $ QTextCharFormat#`operator=`(74fb0fd9fc0c28a7). doubleQuotationFormatcxx . . $ PepHighlighter#doubleQuotationFormat.;
79 highlightingRulescxx . . $ PepHighlighter#highlightingRules..appendcxx . . $ QVector#append(77d9f17553126ecb).(rule);
80
81 warningFormatcxx . . $ PepHighlighter#warningFormat..setForegroundcxx . . $ QTextFormat#setForeground(ffc9f5d0bda78261).(Qtcxx . . $ QBrush#QBrush(1975e3c608654284).::whitecxx . . $ Qt/white.);
82 warningFormatcxx . . $ PepHighlighter#warningFormat..setBackgroundcxx . . $ QTextFormat#setBackground(ffc9f5d0bda78261).(Qtcxx . . $ QBrush#QBrush(1975e3c608654284).::bluecxx . . $ Qt/blue.);
83 rule.patterncxx . . $ PepHighlighter#HighlightingRule#pattern. =cxx . . $ QRegExp#`operator=`(ca041f4b0a7c2092). QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).(";WARNING:[\\s].*$"cxx . . $ QString#QString(85c52e162fed56f9).);
84 rule.formatcxx . . $ PepHighlighter#HighlightingRule#format. =cxx . . $ QTextCharFormat#`operator=`(74fb0fd9fc0c28a7). warningFormatcxx . . $ PepHighlighter#warningFormat.;
85 highlightingRulescxx . . $ PepHighlighter#highlightingRules..appendcxx . . $ QVector#append(77d9f17553126ecb).(rule);
86
87 commentStartExpressioncxx . . $ PepHighlighter#commentStartExpression. =cxx . . $ QRegExp#`operator=`(ca041f4b0a7c2092). QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).(";ERROR:[\\s]"cxx . . $ QString#QString(85c52e162fed56f9).);
88 commentEndExpressioncxx . . $ PepHighlighter#commentEndExpression. =cxx . . $ QRegExp#`operator=`(ca041f4b0a7c2092). QRegExpcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("$"cxx . . $ QString#QString(85c52e162fed56f9).);
89 }
90
91 void PepHighlightercxx . . $ PepHighlighter#::highlightBlockcxx . . $ PepHighlighter#highlightBlock(3520e46b33348bf6).(const QStringcxx . . $ QString# &text)
92 {
93 foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (const HighlightingRule &rule, highlightingRules) {
94 QRegExpcxx . . $ QRegExp# expressioncxx . . $ QRegExp#QRegExp(ff80efdedf7b2ca0).(rule.patterncxx . . $ PepHighlighter#HighlightingRule#pattern.);
95 expression.setCaseSensitivitycxx . . $ QRegExp#setCaseSensitivity(dbd87adfa24451df).(Qtcxx . . $ Qt/::CaseInsensitivecxx . . $ Qt/CaseInsensitive.);
96 int index = expression.indexIncxx . . $ QRegExp#indexIn(46f502bdfc4aeb33).(text);
97 while (index >= 0) {
98 int length = expression.matchedLengthcxx . . $ QRegExp#matchedLength(455f465bc33b4cdf).();
99 setFormatcxx . . $ QSyntaxHighlighter#setFormat(c9121f7a6060c957).(index, length, rule.formatcxx . . $ PepHighlighter#HighlightingRule#format.);
100 index = expression.indexIncxx . . $ QRegExp#indexIn(46f502bdfc4aeb33).(text, index + length);
101 }
102 }
103 setCurrentBlockStatecxx . . $ QSyntaxHighlighter#setCurrentBlockState(d4f767463ce0a6b3).(0);
104
105 int startIndex = 0;
106 if (previousBlockStatecxx . . $ QSyntaxHighlighter#previousBlockState(455f465bc33b4cdf).() != 1)
107 startIndex = commentStartExpressioncxx . . $ PepHighlighter#commentStartExpression..indexIncxx . . $ QRegExp#indexIn(46f502bdfc4aeb33).(text);
108
109 while (startIndex >= 0) {
110 int endIndex = commentEndExpressioncxx . . $ PepHighlighter#commentEndExpression..indexIncxx . . $ QRegExp#indexIn(46f502bdfc4aeb33).(text, startIndex);
111 int commentLength;
112 if (endIndex == -1) {
113 setCurrentBlockStatecxx . . $ QSyntaxHighlighter#setCurrentBlockState(d4f767463ce0a6b3).(1);
114 commentLength = text.lengthcxx . . $ QString#length(455f465bc33b4cdf).() - startIndex;
115 } else {
116 commentLength = endIndex - startIndex
117 + commentEndExpressioncxx . . $ PepHighlighter#commentEndExpression..matchedLengthcxx . . $ QRegExp#matchedLength(455f465bc33b4cdf).();
118 }
119 setFormatcxx . . $ QSyntaxHighlighter#setFormat(c9121f7a6060c957).(startIndex, commentLength, multiLineCommentFormatcxx . . $ PepHighlighter#multiLineCommentFormat.);
120 startIndex = commentStartExpressioncxx . . $ PepHighlighter#commentStartExpression..indexIncxx . . $ QRegExp#indexIn(46f502bdfc4aeb33).(text, startIndex + commentLength);
121 }
122 }