Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/openscad/highlights.scm')
| -rw-r--r-- | runtime/queries/openscad/highlights.scm | 153 |
1 files changed, 26 insertions, 127 deletions
diff --git a/runtime/queries/openscad/highlights.scm b/runtime/queries/openscad/highlights.scm index a79dc41e..c06738e8 100644 --- a/runtime/queries/openscad/highlights.scm +++ b/runtime/queries/openscad/highlights.scm @@ -1,68 +1,39 @@ -; Includes -(identifier) @variable - -"include" @keyword.control.import - +(number) @constant.numeric +(string) @string +(boolean) @constant.builtin.boolean (include_path) @string.special.path -; Functions +(parameters_declaration (identifier) @variable.parameter) +(function_declaration name: (identifier) @function) -(function_item - (identifier) @function -) -(function_item - parameters: (parameters (parameter (assignment value: (_) @constant))) -) -(function_call name: (identifier) @function) -(function_call - arguments: (arguments (assignment name: _ @variable.parameter)) -) -; for the puroposes of distintion since modules are "coloured" impure functions, we will treat them as methods -(module_item (identifier) @function.method) -(module_item - parameters: (parameters (parameter (assignment value: (_) @constant))) -) -(module_call name: (identifier) @function.method) -(module_call - arguments: (arguments (assignment name: _ @variable.parameter)) -) +(function_call function: (identifier) @function) +(module_call name: (identifier) @function) -; assertion statements/expression arguments behave similar to function calls -(assert_expression - arguments: (arguments (assignment name: _ @variable.parameter)) -) -(assert_statement - arguments: (arguments (assignment name: _ @variable.parameter)) -) - -(echo_expression - arguments: (arguments (assignment name: _ @variable.parameter)) -) -(echo_expression "echo" @function.builtin) - -; Variables -(parameter - [_ @variable.parameter (assignment name: _ @variable.parameter)] -) +(identifier) @variable (special_variable) @variable.builtin -(undef) @constant.builtin -; Types/Properties/ -(dot_index_expression index: (_) @variable.other.member) - -; Keywords [ - "module" "function" "let" "assign" - "use" - "each" - (assert_statement "assert") - (assert_expression "assert") ] @keyword -; Operators +[ + "for" + "each" + "intersection_for" +] @keyword.control.repeat + +[ + "if" +] @keyword.control.conditional + +[ + "module" + "use" + "include" +] @keyword.control.import + [ "||" "&&" @@ -78,87 +49,15 @@ "/" "%" "^" + "?" "!" ":" - "=" ] @operator -; Builtin modules -(module_call - name: (identifier) @function.builtin - (#any-of? @function.builtin - "circle" - "color" - "cube" - "cylinder" - "difference" - "hull" - "intersection" - "linear_extrude" - "minkowski" - "mirror" - "multmatrix" - "offset" - "polygon" - "polyhedron" - "projection" - "resize" - "rotate" - "rotate_extrude" - "scale" - "sphere" - "square" - "surface" - "text" - "translate" - "union" - "echo" - ) -) -( - (identifier) @identifier - (#eq? @identifier "PI") -) @constant.builtin - -; Conditionals -[ - "if" - "else" -] @keyword.control.conditional -(ternary_expression - ["?" ":"] @keyword.control.conditional -) - -; Repeats -[ - "for" - "intersection_for" -] @keyword.control.repeat - -; Literals -(integer) @constant.numeric.integer -(float) @constant.numeric.float -(string) @string -(escape_sequence) @constant.character.escape -(boolean) @constant.builtin.boolean - -; Misc -(modifier - [ - "*" - "!" - "#" - "%" - ] @keyword.storage.modifier -) -["{" "}"] @punctuation.bracket -["(" ")"] @punctuation.bracket -["[" "]"] @punctuation.bracket [ ";" "," "." ] @punctuation.delimiter -; Comments -[(line_comment) (block_comment)] @comment +(comment) @comment
\ No newline at end of file |