Inintal commit

This commit is contained in:
2026-02-14 15:05:12 +01:00
commit fbbd357ee2
17 changed files with 3729 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
; Folds for SCL code blocks
[
(organization_block)
(function_block)
(var_declaration)
(if_statement)
(case_statement)
(for_statement)
(while_statement)
(repeat_statement)
(region_statement)
(block_comment)
] @fold
+230
View File
@@ -0,0 +1,230 @@
; 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)
+41
View File
@@ -0,0 +1,41 @@
; Indentation rules for SCL
; Indent after block keywords
[
(organization_block)
(function_block)
(var_declaration)
(if_statement)
(case_statement)
(for_statement)
(while_statement)
(repeat_statement)
(region_statement)
] @indent.begin
; Indent after THEN, DO, etc.
[
"THEN"
"DO"
"ELSE"
"ELSIF"
] @indent.branch
; Outdent at end keywords
[
"END_VAR"
"END_IF"
"END_CASE"
"END_FOR"
"END_WHILE"
"END_REPEAT"
"END_REGION"
"END_ORGANIZATION_BLOCK"
"END_FUNCTION_BLOCK"
] @indent.end
; Outdent for ELSE and ELSIF
[
"ELSE"
"ELSIF"
] @indent.dedent
+15
View File
@@ -0,0 +1,15 @@
; Local variable scoping for SCL - matches grammar.js structure
; Variable declarations define local variables
(var_item
name: (identifier) @definition.var)
; Variable sections create scopes
(var_declaration) @local.scope
; Blocks create scopes
(organization_block) @local.scope
(function_block) @local.scope
; Identifiers are references
(identifier) @reference
+27
View File
@@ -0,0 +1,27 @@
; Tag queries for SCL - matches grammar.js structure
; Organization blocks
(organization_block
name: (string) @name) @definition.function
; Function blocks
(function_block
name: (string) @name) @definition.function
; Variable definitions within blocks
(var_item
name: (identifier) @name
type: (type) @type) @definition.variable
; Parameter definitions (inputs/outputs)
(var_declaration
(var_item
name: (identifier) @name
type: (type) @type)) @definition.variable
; Function calls (references)
(function_call
(identifier) @name) @reference.call
(function_call
(string) @name) @reference.call