chore: format query files

This commit is contained in:
TheLeoP
2025-05-29 13:32:52 -05:00
parent db9fe5d95d
commit bca8246d2a
25 changed files with 525 additions and 250 deletions

View File

@@ -20,8 +20,11 @@
(do_group
"done" @close.loop)) @scope.loop
((word) @mid.loop.1 (#eq? @mid.loop.1 "break"))
((word) @mid.loop.2 (#eq? @mid.loop.2 "continue"))
((word) @mid.loop.1
(#eq? @mid.loop.1 "break"))
((word) @mid.loop.2
(#eq? @mid.loop.2 "continue"))
(case_statement
"case" @open.case
@@ -29,5 +32,5 @@
"esac" @close.case) @scope.case
(heredoc_redirect
(heredoc_start) @open.rhrd
(heredoc_end ) @close.rhrd) @scope.rhrd
(heredoc_start) @open.rhrd
(heredoc_end) @close.rhrd) @scope.rhrd

View File

@@ -1,31 +1,40 @@
; inherits: quote
(preproc_ifdef
["#ifdef" "#ifndef"] @open.def
[
"#ifdef"
"#ifndef"
] @open.def
"#endif" @close.def) @scope.def
(preproc_if
"#if" @open.def
"#endif" @close.def) @scope.def
(preproc_elif "#elif" @mid.def.1)
(preproc_else "#else" @mid.def.2)
(preproc_elif
"#elif" @mid.def.1)
(preproc_else
"#else" @mid.def.2)
(switch_statement
"switch" @open.switch
body: (compound_statement
(case_statement "case" @mid.switch.1)?
(case_statement "default" @mid.switch.2)?)) @scope.switch
(case_statement
"case" @mid.switch.1)?
(case_statement
"default" @mid.switch.2)?)) @scope.switch
; 'else' and 'else if'
(else_clause
"else" @mid.if.1 (if_statement "if" @mid.if.1)?)
"else" @mid.if.1
(if_statement
"if" @mid.if.1)?)
; if
((if_statement
"if" @open.if) @scope.if
(#not-has-parent? @scope.if else_clause))
(#not-has-parent? @scope.if else_clause))
; if
(compound_statement
@@ -34,11 +43,23 @@
; Functions
(function_definition) @scope.function
(function_declarator declarator: (identifier) @open.function)
(return_statement "return" @mid.function.1)
(function_declarator
declarator: (identifier) @open.function)
(return_statement
"return" @mid.function.1)
; Loops
(for_statement "for" @open.loop) @scope.loop
(while_statement "while" @open.loop) @scope.loop
(do_statement "do" @open.loop "while" @close.loop) @scope.loop
(break_statement "break" @mid.loop.1)
(for_statement
"for" @open.loop) @scope.loop
(while_statement
"while" @open.loop) @scope.loop
(do_statement
"do" @open.loop
"while" @close.loop) @scope.loop
(break_statement
"break" @mid.loop.1)

View File

@@ -2,34 +2,53 @@
; functions
[
(arrow_function "=>" @open.function)
(function_expression "function" @open.function)
(function_declaration "function" @open.function)
(method_definition body: (statement_block "{" @open.function "}" @close.function))
(arrow_function
"=>" @open.function)
(function_expression
"function" @open.function)
(function_declaration
"function" @open.function)
(method_definition
body: (statement_block
"{" @open.function
"}" @close.function))
] @scope.function
(return_statement "return" @mid.function.1)
(return_statement
"return" @mid.function.1)
; switch case
(switch_statement "switch" @open.switch) @scope.switch
(switch_case "case" @mid.switch.1)
(switch_default "default" @mid.switch.2)
(switch_statement
"switch" @open.switch) @scope.switch
(switch_case
"case" @mid.switch.1)
(switch_default
"default" @mid.switch.2)
; 'else' and 'else if'
(else_clause
"else" @mid.if.1 (if_statement "if" @mid.if.1)?)
"else" @mid.if.1
(if_statement
"if" @mid.if.1)?)
; if
((if_statement
"if" @open.if) @scope.if
(#not-has-parent? @scope.if else_clause))
(#not-has-parent? @scope.if else_clause))
; try
(try_statement "try" @open.try) @scope.try
(catch_clause "catch" @mid.try.1)
(finally_clause "finally" @mid.try.2)
(try_statement
"try" @open.try) @scope.try
(catch_clause
"catch" @mid.try.1)
(finally_clause
"finally" @mid.try.2)
; template strings
(template_string
"`" @open.tmpl_str
"`" @close.tmpl_str) @scope.tmpl_str
"`" @open.tmpl_str
"`" @close.tmpl_str) @scope.tmpl_str

View File

@@ -1,9 +1,10 @@
(if_else_expr
. "if" @open.if) @scope.if
.
"if" @open.if) @scope.if
(if_else_expr
"else" @mid.if.1
"if"? @mid.if.1)
"else" @mid.if.1
"if"? @mid.if.1)
(let_in_expr
"let" @open.let
@@ -12,4 +13,4 @@
(case_of_expr
(case) @open.case
(case_of_branch
(arrow) @mid.case.1)) @scope.case
(arrow) @mid.case.1)) @scope.case

View File

@@ -1,21 +1,25 @@
(if_statement
"if" @open.if
(else_if_clause ("else" "if") @mid.if.1)?
(else_clause "else" @mid.if.2)?
"end" @close.if
) @scope.if
(else_if_clause
("else"
"if") @mid.if.1)?
(else_clause
"else" @mid.if.2)?
"end" @close.if) @scope.if
(switch_statement
"switch" @open.switch
(case_clause "case" @mid.switch.1)?
"end" @close.switch
) @scope.switch
(case_clause
"case" @mid.switch.1)?
"end" @close.switch) @scope.switch
(for_statement
"for" @open.loop
"in" @mid.loop.1
"end" @close.loop) @scope.loop
((break) @mid.loop.2)?
((continue) @mid.loop.3)?
(while_statement
@@ -29,4 +33,6 @@
(function_definition
"function" @open.func
"end" @close.func) @scope.func
(return "return" @mid.func.1)
(return
"return" @mid.func.1)

View File

@@ -2,33 +2,42 @@
(element_node) @scope.tag
(element_node_start (tag_name) @open.tag)
(element_node_start
(tag_name) @open.tag)
(element_node_end
(tag_name) @close.tag
(#offset! @close.tag 0 -1 0 0))
(block_statement
(block_statement_start) @open.block
(block_statement_end) @close.block
) @scope.block
(block_statement_end) @close.block) @scope.block
; {{else if ...}}
(mustache_statement
(helper_invocation helper: (identifier) @mid.block.1 (#lua-match? @mid.block.1 "else"))
)
(helper_invocation
helper: (identifier) @mid.block.1
(#lua-match? @mid.block.1 "else")))
; {{else}}
(mustache_statement ((identifier) @mid.block.2 (#lua-match? @mid.block.2 "else")))
(mustache_statement
((identifier) @mid.block.2
(#lua-match? @mid.block.2 "else")))
(element_node_void
(tag_name) @open.selftag
"/>" @close.selftag
) @scope.selftag
"/>" @close.selftag) @scope.selftag
(mustache_statement
[(helper_invocation) "{{"] @open.mustache
"}}" @close.mustache
) @scope.mustache
[
(helper_invocation)
"{{"
] @open.mustache
"}}" @close.mustache) @scope.mustache
(sub_expression
[(helper_invocation) "("] @open.subexpr
")" @close.subexpr
) @scope.subexpr
[
(helper_invocation)
"("
] @open.subexpr
")" @close.subexpr) @scope.subexpr

View File

@@ -1,20 +1,33 @@
(function_declaration "func" @open.func) @scope.func
(method_declaration "func" @open.func) @scope.func
(func_literal "func" @open.func) @scope.func
(function_declaration
"func" @open.func) @scope.func
(return_statement "return" @mid.func.1)
(method_declaration
"func" @open.func) @scope.func
(func_literal
"func" @open.func) @scope.func
(return_statement
"return" @mid.func.1)
; 'else' and 'else if'
(if_statement
"else" @mid.if.1 (if_statement "if" @mid.if.1)?)
"else" @mid.if.1
(if_statement
"if" @mid.if.1)?)
; if
(block (if_statement "if" @open.if) @scope.if)
(block
(if_statement
"if" @open.if) @scope.if)
; switch
(expression_switch_statement "switch" @open.switch
(expression_case "case" @mid.switch.1)
(default_case "default" @mid.switch.2)) @scope.switch
(expression_switch_statement
"switch" @open.switch
(expression_case
"case" @mid.switch.1)
(default_case
"default" @mid.switch.2)) @scope.switch
(_
"\"" @open.quote_double

View File

@@ -1,73 +1,67 @@
; --------------- module/where ---------------
(header (
("module" @open.module (module))
("where" @mid.module.1)
)) @scope.module
(header
(("module" @open.module
(module))
"where" @mid.module.1)) @scope.module
; ----------------- case/of ------------------
(expression/case
"case" @open.case (_)
(expression/case
"case" @open.case
(_)
"of" @mid.case.1
(alternatives
(alternative) @mid.case.2
)
) @scope.case
(alternative) @mid.case.2)) @scope.case
; --------------- lambda case ----------------
(expression/lambda_case
(expression/lambda_case
"\case" @open.case
(alternatives
(alternative) @mid.case.1
)
) @scope.case
(alternative) @mid.case.1)) @scope.case
; -------------- if/then/else ----------------
(expression/conditional
"if" @open.if (_)
"then" @mid.if.1 (_)
"else" @mid.if.2 (_)
) @scope.if
"if" @open.if
(_)
"then" @mid.if.1
(_)
"else" @mid.if.2
(_)) @scope.if
;------------------ let/in -------------------
(expression/let_in
("let" @open.let (local_binds))
("in" @mid.let.1 (_))
) @scope.let
("let" @open.let
(local_binds))
("in" @mid.let.1
(_))) @scope.let
; -------- ADT data/constructors -------------
(data_type
"data" @open.adt (_)
"data" @open.adt
(_)
constructors: (data_constructors
(data_constructor
constructor: (_) @mid.adt.2
))
) @scope.adt
constructor: (_) @mid.adt.2))) @scope.adt
; --------------- ADT record ------------------
(data_type
"data" @open.rec (_)
"data" @open.rec
(_)
constructors: (data_constructors
constructor: (data_constructor
(record
fields: (fields
"{" @mid.rec.1 (_)
"}" @mid.rec.2
)
)
)
)
) @scope.rec
"{" @mid.rec.1
(_)
"}" @mid.rec.2))))) @scope.rec
; ------------- GADT data/where ---------------
(data_type
"data" @open.gadt (_)
"data" @open.gadt
(_)
"where" @mid.gadt.1
constructors: (gadt_constructors
constructor: (gadt_constructor
name: (constructor) @mid.gadt.2
)
)
) @scope.gadt
name: (constructor) @mid.gadt.2))) @scope.gadt
; --------------- class/where -----------------
(class
@@ -75,7 +69,4 @@
"where" @mid.class.1
declarations: (class_declarations
declaration: (_
name: (variable) @mid.class.2
)
)
) @scope.class
name: (variable) @mid.class.2))) @scope.class

View File

@@ -1,12 +1,14 @@
; inherits: quote
[
(element)
(script_element)
(style_element)
(element)
(script_element)
(style_element)
] @scope.tag
(start_tag (tag_name) @open.tag)
(start_tag
(tag_name) @open.tag)
(end_tag
(tag_name) @close.tag
(#offset! @close.tag 0 -1 0 0))

View File

@@ -1,5 +1,8 @@
(jsx_element) @scope.tag
(jsx_opening_element (identifier) @open.tag)
(jsx_opening_element
(identifier) @open.tag)
(jsx_closing_element
(identifier) @close.tag
(#offset! @close.tag 0 -1 0 0))

View File

@@ -1,35 +1,46 @@
(function_definition
"function" @open.function
"end" @close.function) @scope.function
(return_statement
"return" @mid.function.1)
(if_statement
"if" @open.if
"end" @close.if) @scope.if
(else_clause "else" @mid.if.1)
(elseif_clause "elseif" @mid.if.2)
(else_clause
"else" @mid.if.1)
(elseif_clause
"elseif" @mid.if.2)
(for_statement
"for" @open.loop
"end" @close.loop) @scope.loop
(while_statement
"while" @open.loop
"end" @close.loop) @scope.loop
(break_statement) @mid.loop.1
(continue_statement) @mid.loop.2
(try_statement
"try" @open.try
"end" @close.try) @scope.try
(catch_clause
"catch" @mid.try.2)
(finally_clause
"finally" @mid.try.1)
(compound_statement
"begin" @open.block
"end" @close.block) @scope.block
(do_clause
"do" @open.block
"end" @close.block) @scope.block
@@ -37,6 +48,7 @@
(let_statement
"let" @open.let
"end" @close.let) @scope.let
(module_definition
"module" @open.module
"end" @close.module) @scope.module

View File

@@ -13,12 +13,17 @@
(if_statement
"if" @open.if
"end" @close.if) @scope.if
(else_statement "else" @mid.if.1)
(elseif_statement "elseif" @mid.if.2)
(else_statement
"else" @mid.if.1)
(elseif_statement
"elseif" @mid.if.2)
(function_declaration
"function" @open.function
"end" @close.function) @scope.function
(function_definition
"function" @open.function
"end" @close.function) @scope.function

View File

@@ -1,40 +1,87 @@
(for "for" @open.loop "in" @mid.loop.3) @scope.loop
(while "while" @open.loop) @scope.loop
(block "block" @open.loop) @scope.loop
(break_statement "break" @mid.loop.1)
(continue_statement "continue" @mid.loop.2)
(for
"for" @open.loop
"in" @mid.loop.3) @scope.loop
(if "if" @open.conditional) @scope.conditional
(when "when" @open.conditional) @scope.conditional
(elif_branch "elif" @mid.conditional.1)
(else_branch "else" @mid.conditional.2)
(while
"while" @open.loop) @scope.loop
(case "case" @open.conditional) @scope.conditional
(of_branch "of" @mid.conditional.3)
(block
"block" @open.loop) @scope.loop
(variant_declaration "case" @open.conditional) @scope.conditional
(conditional_declaration "when" @open.conditional) @scope.conditional
(break_statement
"break" @mid.loop.1)
(try "try" @open.try) @scope.try
(except_branch "except" @mid.try.1 )
(finally_branch "finally" @mid.try.2)
(continue_statement
"continue" @mid.loop.2)
(proc_declaration "proc" @open.routine) @scope.routine
(func_declaration "func" @open.routine) @scope.routine
(method_declaration "method" @open.routine) @scope.routine
(converter_declaration "converter" @open.routine) @scope.routine
(template_declaration "template" @open.routine) @scope.routine
(macro_declaration "macro" @open.routine) @scope.routine
(if
"if" @open.conditional) @scope.conditional
(proc_expression "proc" @open.routine) @scope.routine
(func_expression "func" @open.routine) @scope.routine
(when
"when" @open.conditional) @scope.conditional
(return_statement "return" @mid.routine.1)
(elif_branch
"elif" @mid.conditional.1)
(iterator_declaration "iterator" @open.iterator) @scope.iterator
(iterator_expression "iterator" @open.iterator) @scope.iterator
(else_branch
"else" @mid.conditional.2)
(yield_statement "yield" @mid.iterator.1)
(case
"case" @open.conditional) @scope.conditional
(of_branch
"of" @mid.conditional.3)
(variant_declaration
"case" @open.conditional) @scope.conditional
(conditional_declaration
"when" @open.conditional) @scope.conditional
(try
"try" @open.try) @scope.try
(except_branch
"except" @mid.try.1)
(finally_branch
"finally" @mid.try.2)
(proc_declaration
"proc" @open.routine) @scope.routine
(func_declaration
"func" @open.routine) @scope.routine
(method_declaration
"method" @open.routine) @scope.routine
(converter_declaration
"converter" @open.routine) @scope.routine
(template_declaration
"template" @open.routine) @scope.routine
(macro_declaration
"macro" @open.routine) @scope.routine
(proc_expression
"proc" @open.routine) @scope.routine
(func_expression
"func" @open.routine) @scope.routine
(return_statement
"return" @mid.routine.1)
(iterator_declaration
"iterator" @open.iterator) @scope.iterator
(iterator_expression
"iterator" @open.iterator) @scope.iterator
(yield_statement
"yield" @mid.iterator.1)
(import_statement
"import" @open.import
@@ -46,38 +93,63 @@
"import" @mid.from.1) @scope.from
(char_literal
. "'" @open.char
.
"'" @open.char
"'" @close.char .) @scope.char
(interpreted_string_literal
. "\"" @open.string
.
"\"" @open.string
"\"" @close.string .) @scope.string
(raw_string_literal
. ["r\"" "R\""] @open.string
.
[
"r\""
"R\""
] @open.string
"\"" @close.string .) @scope.string
(long_string_literal
. ["\"\"\"" "r\"\"\"" "R\"\"\""] @open.multistring
.
[
"\"\"\""
"r\"\"\""
"R\"\"\""
] @open.multistring
"\"\"\"" @close.multistring .) @scope.multistring
(generalized_string
function: (_)
. ["\"" "\"\"\""] @open.multistring
["\"" "\"\"\""] @close.multistring .) @scope.multistring
.
[
"\""
"\"\"\""
] @open.multistring
[
"\""
"\"\"\""
] @close.multistring .) @scope.multistring
(accent_quoted
. "`" @open.accent
.
"`" @open.accent
"`" @close.accent .) @scope.accent
(block_documentation_comment
. "##[" @open.doc_comment
.
"##[" @open.doc_comment
"]##" @close.doc_comment .) @scope.doc_comment
(block_comment
. "#[" @open.comment
.
"#[" @open.comment
"]#" @close.comment .) @scope.comment
(pragma_list
. "{." @open.pragma
["}" ".}"] @close.pragma .) @scope.pragma
.
"{." @open.pragma
[
"}"
".}"
] @close.pragma .) @scope.pragma

View File

@@ -1,9 +1,13 @@
; --------------- let/in ---------------
(let_expression
"let" @open.let (binding_set)
"in" @mid.let.1 (_)) @scope.let
"let" @open.let
(binding_set)
"in" @mid.let.1
(_)) @scope.let
; --------------- binding --------------
; (binding (_)+ (function_exppression) ";") tend to be many lines long
(binding
(attrpath) @open.binding (function_expression)
(attrpath) @open.binding
(function_expression)
";" @close.binding) @scope.binding

View File

@@ -1,34 +1,54 @@
; matches any conditional -> else type block -> end of final block
(conditional_statement
["if" "unless"] @open.if
"elsif"? @mid.if.1
"else"? @mid.if.2
(block "}" @close.if) .
) @scope.if
[
"if"
"unless"
] @open.if
"elsif"? @mid.if.1
"else"? @mid.if.2
(block
"}" @close.if) .) @scope.if
; matches any loop construct -> loop control (last, next) -> end of final block
(_
["for" "foreach" "while" "unless"] @open.loop
(block "}" @close.loop) .
) @scope.loop
[
"for"
"foreach"
"while"
"unless"
] @open.loop
(block
"}" @close.loop) .) @scope.loop
(loopex_expression) @mid.loop.1
; matches sub -> return -> end of block
(_
"sub" @open.fun
(block "}" @close.fun) .
) @scope.fun
(return_expression "return" @mid.fun.1)
"sub" @open.fun
(block
"}" @close.fun) .) @scope.fun
(return_expression
"return" @mid.fun.1)
; handling for all the different quote types; multi part quotes cycle through
[
(_ "'" @open.quotelike (string_content) "'" @close.quotelike)
(quoted_regexp "'" @open.quotelike "'" @close.quotelike)
(_ "'" @open.quotelike (_) "'"+ @mid.quotelike.1 (replacement) "'" @close.quotelike)
(_
"'" @open.quotelike
(string_content)
"'" @close.quotelike)
(quoted_regexp
"'" @open.quotelike
"'" @close.quotelike)
(_
"'" @open.quotelike
(_)
"'"+ @mid.quotelike.1
(replacement)
"'" @close.quotelike)
] @scope.quotelike
(try_statement
"try" @open.try
"catch"? @mid.try.1
"finally"? @close.try
) @scope.try
"finally"? @close.try) @scope.try

View File

@@ -1,31 +1,43 @@
(if_statement
"if" @open.if
alternative: (elif_clause "elif" @mid.if.1)?
alternative: (else_clause "else" @mid.if.2)?) @scope.if
alternative: (elif_clause
"elif" @mid.if.1)?
alternative: (else_clause
"else" @mid.if.2)?) @scope.if
(function_definition
"def" @open.function) @scope.function
(return_statement
"return" @mid.function.1)
(yield
"yield" @mid.function.2)
(for_statement
("for" @open.loop)
alternative: (else_clause "else" @mid.loop.1)?) @scope.loop
"for" @open.loop
alternative: (else_clause
"else" @mid.loop.1)?) @scope.loop
(while_statement
("while" @open.loop)
alternative: (else_clause "else" @mid.loop.1)?) @scope.loop
"while" @open.loop
alternative: (else_clause
"else" @mid.loop.1)?) @scope.loop
(break_statement
"break" @mid.loop.2)
(continue_statement
"continue" @mid.loop.3)
(try_statement
("try" @open.try)
(finally_clause "finally" @mid.try.1)?
(except_clause "except" @mid.try.2)?
(else_clause "else" @mid.try.3)?) @scope.try
"try" @open.try
(finally_clause
"finally" @mid.try.1)?
(except_clause
"except" @mid.try.2)?
(else_clause
"else" @mid.try.3)?) @scope.try
(string
(string_start) @open.quote_all

View File

@@ -1,49 +1,65 @@
(method
"def" @open.def
"end" @close.def) @scope.def
(singleton_method
"def" @open.def
"end" @close.def) @scope.def
(return
"return" @mid.def.1)
(yield
"yield" @mid.def.2)
(body_statement
(rescue "rescue" @mid.def.1))
(rescue
"rescue" @mid.def.1))
(body_statement
(ensure "ensure" @mid.def.2))
(ensure
"ensure" @mid.def.2))
(class
"class" @open.class
"end" @close.class) @scope.class
(singleton_class
"class" @open.class
"end" @close.class) @scope.class
(if
"if" @open.if
(else "else" @mid.if.2)?
(else
"else" @mid.if.2)?
"end" @close.if) @scope.if
(elsif (else "else" @mid.if.2))
(elsif "elsif" @mid.if.1)
(elsif
(else
"else" @mid.if.2))
(elsif
"elsif" @mid.if.1)
(unless
"unless" @open.unless
(else "else" @mid.unless.2)?
(else
"else" @mid.unless.2)?
"end" @close.unless) @scope.unless
(while
"while" @open.loop
"while" @open.loop
body: (do
"end" @close.loop)) @scope.loop
(for
"for" @open.loop
"for" @open.loop
body: (do
"end" @close.loop)) @scope.loop
(next
"next" @mid.loop.1)?
(break
"break" @mid.loop.2)?
@@ -72,12 +88,14 @@
"end" @close.do) @scope.do
(if_modifier) @skip
(unless_modifier) @skip
(while_modifier) @skip
(until_modifier) @skip
(block_parameters
("|") @open.block_param
"|" @open.block_param
(_)
("|") @close.block_param
) @scope.block_param
"|" @close.block_param) @scope.block_param

View File

@@ -10,23 +10,44 @@
">" @open.typeparams) @scope.typeparams
; --------------- if/else ---------------
(block (if_expression "if" @open.if_) @scope.if_)
(expression_statement (if_expression "if" @open.if_) @scope.if_)
(let_declaration (if_expression "if" @open.if_) @scope.if_)
(block
(if_expression
"if" @open.if_) @scope.if_)
(expression_statement
(if_expression
"if" @open.if_) @scope.if_)
(let_declaration
(if_expression
"if" @open.if_) @scope.if_)
(else_clause "else" @mid.if_.1 (block))
(else_clause
"else" @mid.if_.2 (if_expression "if" @mid.if_.2))
"else" @mid.if_.1
(block))
(else_clause
"else" @mid.if_.2
(if_expression
"if" @mid.if_.2))
; --------------- async/await ---------------
(function_item (function_modifiers "async" @open.async)) @scope.async
(async_block "async" @open.async) @scope.async
(await_expression "await" @mid.async.1)
(function_item
(function_modifiers
"async" @open.async)) @scope.async
(async_block
"async" @open.async) @scope.async
(await_expression
"await" @mid.async.1)
; --------------- fn/return ---------------
(function_item
"fn" @open.function) @scope.function
(closure_expression) @scope.function
(return_expression
"return" @mid.function.1)
@@ -36,10 +57,23 @@
"|" @close.closureparams) @scope.closureparams
; --------------- while/loop/for + break/continue ---------------
(for_expression . "for" @open.loop) @scope.loop
(while_expression . "while" @open.loop) @scope.loop
(loop_expression . "loop" @open.loop) @scope.loop
(for_expression
.
"for" @open.loop) @scope.loop
(break_expression "break" @mid.loop.1 .)
(break_expression "break" @mid.loop.1 .)
(continue_expression "continue" @mid.loop.1 .)
(while_expression
.
"while" @open.loop) @scope.loop
(loop_expression
.
"loop" @open.loop) @scope.loop
(break_expression
"break" @mid.loop.1 .)
(break_expression
"break" @mid.loop.1 .)
(continue_expression
"continue" @mid.loop.1 .)

View File

@@ -1,6 +1,6 @@
; inherits: quote
(method_definition
(method_definition
".method" @open.function
".end method" @close.function) @scope.function

View File

@@ -1,12 +1,13 @@
; inherits: quote
[
(element)
(script_element)
(style_element)
(element)
(script_element)
(style_element)
] @scope.tag
(start_tag (tag_name) @open.tag)
(start_tag
(tag_name) @open.tag)
(end_tag
(tag_name) @close.tag
@@ -17,7 +18,6 @@
"/>" @close.selftag) @scope.selftag
; await
(await_statement
(await_start
(block_start_tag
@@ -36,7 +36,6 @@
(#offset! @mid.await.2 0 -1 0 0))
; each
(each_statement
(each_start
(block_start_tag
@@ -49,7 +48,6 @@
(#offset! @close.each 0 -1 0 0)))
; if
(if_statement
(if_start
(block_start_tag
@@ -72,7 +70,6 @@
(#offset! @close.if 0 -1 0 0)))
; key
(key_statement
(key_start
(block_start_tag
@@ -85,7 +82,6 @@
(#offset! @close.key 0 -1 0 0)))
; snippet
(snippet_statement
(snippet_start
(block_start_tag

View File

@@ -1,27 +1,32 @@
; inherits: quote
[
(component_if_statement)
(conditional_attribute_if_statement)
(component_if_statement)
(conditional_attribute_if_statement)
] @scope.if
; 'else'
("else" @mid.if.1)
"else" @mid.if.1
; if
("if" @open.if)
"if" @open.if
; switch
(component_switch_statement "switch" @open.switch
(component_switch_expression_case "case" @mid.switch.1)
(component_switch_default_case "default" @mid.switch.2)) @scope.switch
(component_switch_statement
"switch" @open.switch
(component_switch_expression_case
"case" @mid.switch.1)
(component_switch_default_case
"default" @mid.switch.2)) @scope.switch
[
(element)
(script_element)
(element)
(script_element)
] @scope.tag
(tag_start (element_identifier) @open.tag)
(tag_start
(element_identifier) @open.tag)
(tag_end
(element_identifier) @close.tag
(#offset! @close.tag 0 -1 0 0))
@@ -30,8 +35,7 @@
(style_tag_start) @open.style
(#offset! @open.style 0 1 0 -1)
(style_tag_end) @close.style
(#offset! @close.style 0 1 0 -1)
) @scope.style
(#offset! @close.style 0 1 0 -1)) @scope.style
(self_closing_tag
(element_identifier) @open.selftag

View File

@@ -1,9 +1,21 @@
; inherits: ecma
(type_arguments) @scope.typeargs
(type_arguments) "<" @open.typeargs
(type_arguments) ">" @close.typeargs
(type_arguments)
"<" @open.typeargs
(type_arguments)
">" @close.typeargs
(type_parameters) @scope.typeparams
(type_parameters) "<" @open.typeparams
(type_parameters) ">" @close.typeparams
(type_parameters)
"<" @open.typeparams
(type_parameters)
">" @close.typeparams

View File

@@ -1,22 +1,30 @@
(function_definition
"function" @open.function
"endfunction" @close.function) @scope.function
(return_statement
"return" @mid.function.1)
(if_statement
"if" @open.if
"endif" @close.if) @scope.if
(elseif_statement
"elseif" @mid.if.1)
(else_statement
"else" @mid.if.2)
(for_loop
"for" @open.loop
"endfor" @close.loop) @scope.loop
(while_loop
"while" @open.loop
"endwhile" @close.loop) @scope.loop
(continue_statement "continue" @mid.loop.1)
(break_statement "break" @mid.loop.2)
(continue_statement
"continue" @mid.loop.1)
(break_statement
"break" @mid.loop.2)

View File

@@ -1,13 +1,15 @@
; inherits: quote
[
(element)
(script_element)
(style_element)
(template_element)
(element)
(script_element)
(style_element)
(template_element)
] @scope.tag
(start_tag (tag_name) @open.tag)
(start_tag
(tag_name) @open.tag)
(end_tag
(tag_name) @close.tag
(#offset! @close.tag 0 -1 0 0))

View File

@@ -2,19 +2,27 @@
(function_declaration
"fn" @open.function) @scope.function
(return_expression
"return" @mid.function.1)
; 'else' and 'else if'
(else_clause
"else" @mid.if.1 (if_statement "if" @mid.if.1)?)
"else" @mid.if.1
(if_statement
"if" @mid.if.1)?)
; if
((if_statement
"if" @open.if) @scope.if
(#not-has-parent? @scope.if else_clause))
(#not-has-parent? @scope.if else_clause))
; Loops
(while_statement "while" @open.loop) @scope.loop
(break_expression "break" @mid.loop.1)
(continue_expression "continue" @mid.loop.2)
(while_statement
"while" @open.loop) @scope.loop
(break_expression
"break" @mid.loop.1)
(continue_expression
"continue" @mid.loop.2)