summaryrefslogtreecommitdiff
path: root/src/highlighter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/highlighter.cc')
-rw-r--r--src/highlighter.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/highlighter.cc b/src/highlighter.cc
index bf80bb4..4b4aa30 100644
--- a/src/highlighter.cc
+++ b/src/highlighter.cc
@@ -132,11 +132,14 @@ Highlighter::Highlighter(QTextDocument *parent)
tokentypes["operator"] << "=" << "!" << "&&" << "||" << "+" << "-" << "*" << "/" << "%" << "!" << "#" << ";";
typeformats["operator"].setForeground(Qt::blue);
- tokentypes["keyword"] << "module" << "function" << "for" << "intersection_for" << "if" << "assign";
+ tokentypes["math"] << "abs" << "sign" << "acos" << "asin" << "atan" << "atan2" << "sin" << "cos" << "floor" << "round" << "ceil" << "ln" << "log" << "lookup" << "min" << "max" << "pow" << "sqrt" << "exp" << "rands";
+ typeformats["math"].setForeground(Qt::green);
+
+ tokentypes["keyword"] << "module" << "function" << "for" << "intersection_for" << "if" << "assign" << "echo"<< "search" << "str";
typeformats["keyword"].setForeground(QColor("Green"));
typeformats["keyword"].setToolTip("Keyword");
- tokentypes["transform"] << "scale" << "translate" << "rotate" << "multmatrix" << "color" << "projection" << "hull" << "resize";
+ tokentypes["transform"] << "scale" << "translate" << "rotate" << "multmatrix" << "color" << "projection" << "hull" << "resize" << "mirror" << "minkowski";
typeformats["transform"].setForeground(QColor("Indigo"));
tokentypes["csgop"] << "union" << "intersection" << "difference" << "render";
@@ -148,7 +151,7 @@ Highlighter::Highlighter(QTextDocument *parent)
tokentypes["prim2d"] << "square" << "polygon" << "circle";
typeformats["prim2d"].setForeground(QColor("MidnightBlue"));
- tokentypes["import"] << "include" << "use" << "import_stl" << "import" << "import_dxf" << "dxf_dim" << "dxf_cross";
+ tokentypes["import"] << "include" << "use" << "import_stl" << "import" << "import_dxf" << "dxf_dim" << "dxf_cross" << "surface";
typeformats["import"].setForeground(Qt::darkYellow);
tokentypes["special"] << "$children" << "child" << "$fn" << "$fa" << "$fs" << "$t" << "$vpt" << "$vpr";
@@ -285,6 +288,7 @@ void Highlighter::highlightBlock(const QString &text)
// Quoting and Comments.
state_e state = (state_e) previousBlockState();
+ int quote_esc_state = 0;
for (int n = 0; n < text.size(); ++n){
if (state == NORMAL){
if (text[n] == '"'){
@@ -301,7 +305,11 @@ void Highlighter::highlightBlock(const QString &text)
}
} else if (state == QUOTE){
setFormat(n,1,quoteFormat);
- if (text[n] == '"' && n-1 >=0 && text[n-1] != '\\')
+ if (quote_esc_state > 0)
+ quote_esc_state = 0;
+ else if (text[n] == '\\')
+ quote_esc_state = 1;
+ else if (text[n] == '"')
state = NORMAL;
} else if (state == COMMENT){
setFormat(n,1,commentFormat);
contact: Jan Huwald // Impressum