231 lines
5.3 KiB
Scheme
231 lines
5.3 KiB
Scheme
; Comprehensive SCL highlight queries for Neovim
|
|
|
|
; ============================================
|
|
; Comments
|
|
; ============================================
|
|
(line_comment) @comment
|
|
(block_comment) @comment
|
|
(c_style_comment) @comment
|
|
|
|
; ============================================
|
|
; Literals
|
|
; ============================================
|
|
(number) @number
|
|
(hex_number) @number
|
|
(string) @string
|
|
(time_value) @number
|
|
|
|
; ============================================
|
|
; Constants
|
|
; ============================================
|
|
(
|
|
(identifier) @constant.builtin
|
|
(#match? @constant.builtin "^(TRUE|FALSE|TRUE#|FALSE#)$")
|
|
)
|
|
(
|
|
(type) @type.builtin
|
|
(#match? @type.builtin "^(TRUE|FALSE)$")
|
|
)
|
|
|
|
; ============================================
|
|
; Identifiers
|
|
; ============================================
|
|
(identifier) @variable
|
|
(prefixed_identifier) @variable
|
|
|
|
; ============================================
|
|
; Types - Basic
|
|
; ============================================
|
|
(
|
|
(type) @type.builtin
|
|
(#match? @type.builtin "^(BOOL|Bool|INT|Int|DINT|DInt|SINT|SInt|USINT|USInt|UINT|UInt|WORD|Word|DWORD|DWord|BYTE|Byte|REAL|Real|LREAL|LReal|TIME|Time|TOD|Tod|DT|Dt|String|STRING|CHAR|Char|WSTRING|WString)$")
|
|
)
|
|
|
|
; Types - User defined (quoted strings like "UDT_Type")
|
|
(type
|
|
(string) @type
|
|
)
|
|
|
|
; ============================================
|
|
; Keywords - Block definitions
|
|
; ============================================
|
|
"ORGANIZATION_BLOCK" @keyword
|
|
"FUNCTION_BLOCK" @keyword
|
|
"FUNCTION" @keyword
|
|
"END_ORGANIZATION_BLOCK" @keyword
|
|
"END_FUNCTION_BLOCK" @keyword
|
|
"END_FUNCTION" @keyword
|
|
"BEGIN" @keyword
|
|
|
|
; ============================================
|
|
; Keywords - Variable sections
|
|
; ============================================
|
|
"VAR_INPUT" @keyword
|
|
"VAR_OUTPUT" @keyword
|
|
"VAR_IN_OUT" @keyword
|
|
"VAR" @keyword
|
|
"VAR_TEMP" @keyword
|
|
"VAR_CONSTANT" @keyword
|
|
"END_VAR" @keyword
|
|
"CONSTANT" @keyword
|
|
"RETAIN" @keyword
|
|
"NON_RETAIN" @keyword
|
|
|
|
; ============================================
|
|
; Keywords - Control flow
|
|
; ============================================
|
|
"IF" @conditional
|
|
"THEN" @conditional
|
|
"ELSIF" @conditional
|
|
"ELSE" @conditional
|
|
"END_IF" @conditional
|
|
"CASE" @conditional
|
|
"OF" @conditional
|
|
"END_CASE" @conditional
|
|
|
|
; ============================================
|
|
; Keywords - Loops
|
|
; ============================================
|
|
"FOR" @repeat
|
|
"TO" @repeat
|
|
"BY" @repeat
|
|
"DO" @repeat
|
|
"END_FOR" @repeat
|
|
"WHILE" @repeat
|
|
"END_WHILE" @repeat
|
|
"REPEAT" @repeat
|
|
"UNTIL" @repeat
|
|
"END_REPEAT" @repeat
|
|
"EXIT" @keyword
|
|
"CONTINUE" @keyword
|
|
|
|
; ============================================
|
|
; Keywords - Regions
|
|
; ============================================
|
|
"REGION" @namespace
|
|
"END_REGION" @namespace
|
|
|
|
; ============================================
|
|
; Keywords - Other
|
|
; ============================================
|
|
"TITLE" @keyword
|
|
"VERSION" @keyword
|
|
"ARRAY" @keyword
|
|
"OF" @keyword
|
|
|
|
; ============================================
|
|
; Fields
|
|
; ============================================
|
|
(block
|
|
name: (string) @namespace)
|
|
|
|
(block
|
|
name: (identifier) @namespace)
|
|
|
|
(var_item
|
|
name: (identifier) @property)
|
|
|
|
(var_item
|
|
type: (type) @type)
|
|
|
|
; ============================================
|
|
; Functions and function calls
|
|
; ============================================
|
|
(function_call
|
|
(identifier) @function.call)
|
|
|
|
(function_call
|
|
(string) @function.call)
|
|
|
|
(parameter
|
|
(identifier) @parameter)
|
|
|
|
; ============================================
|
|
; Array access
|
|
; ============================================
|
|
(array_access
|
|
"[" @punctuation.bracket
|
|
"]" @punctuation.bracket)
|
|
|
|
; ============================================
|
|
; Field access
|
|
; ============================================
|
|
(field_access
|
|
"." @punctuation.delimiter)
|
|
|
|
; ============================================
|
|
; Attribute lists
|
|
; ============================================
|
|
(attribute_list
|
|
"{" @punctuation.bracket
|
|
"}" @punctuation.bracket)
|
|
|
|
(attribute_list
|
|
"," @punctuation.delimiter)
|
|
|
|
(attribute_list
|
|
";" @punctuation.delimiter)
|
|
|
|
(attribute
|
|
(identifier) @property)
|
|
|
|
; ============================================
|
|
; Operators - Logical
|
|
; ============================================
|
|
"AND" @operator
|
|
"OR" @operator
|
|
"XOR" @operator
|
|
"NOT" @operator
|
|
|
|
; ============================================
|
|
; Operators - Comparison
|
|
; ============================================
|
|
"=" @operator
|
|
"<>" @operator
|
|
"<" @operator
|
|
">" @operator
|
|
"<=" @operator
|
|
">=" @operator
|
|
|
|
; ============================================
|
|
; Operators - Arithmetic
|
|
; ============================================
|
|
"+" @operator
|
|
"-" @operator
|
|
"*" @operator
|
|
"/" @operator
|
|
"MOD" @operator
|
|
"**" @operator
|
|
|
|
; ============================================
|
|
; Operators - Assignment
|
|
; ============================================
|
|
":=" @operator
|
|
"=>" @operator
|
|
|
|
; ============================================
|
|
; Punctuation
|
|
; ============================================
|
|
";" @punctuation.delimiter
|
|
":" @punctuation.delimiter
|
|
"," @punctuation.delimiter
|
|
"(" @punctuation.bracket
|
|
")" @punctuation.bracket
|
|
"[" @punctuation.bracket
|
|
"]" @punctuation.bracket
|
|
"." @punctuation.delimiter
|
|
".." @punctuation.delimiter
|
|
"#" @punctuation.special
|
|
|
|
; ============================================
|
|
; Binary and unary expressions
|
|
; ============================================
|
|
(binary_expression) @operator
|
|
(unary_expression) @operator
|
|
|
|
; ============================================
|
|
; Range expressions
|
|
; ============================================
|
|
(range
|
|
".." @punctuation.delimiter)
|