diff --git a/runtime/queries/p/highlights.scm b/runtime/queries/p/highlights.scm index 2381ef6e..7793bcef 100644 --- a/runtime/queries/p/highlights.scm +++ b/runtime/queries/p/highlights.scm @@ -2,6 +2,9 @@ (iden_type name: (identifier) @variable) +(fun_param + name: (identifier) @variable.parameter) + [ "this" ] @variable.builtin diff --git a/runtime/queries/p/locals.scm b/runtime/queries/p/locals.scm new file mode 100644 index 00000000..5a0ff0fa --- /dev/null +++ b/runtime/queries/p/locals.scm @@ -0,0 +1,19 @@ +; Scopes + +[ + (p_fun_decl) + (anon_event_handler) + (foreign_fun_decl) + (pure_decl) + (quant_expr) +] @local.scope + +; Definitions + +(fun_param + name: (identifier) @local.definition.variable.parameter) + +; References + +(primitive_expr (identifier) @local.reference) +(var_lvalue name: (identifier) @local.reference) diff --git a/tests/query/highlights/p/locals.p b/tests/query/highlights/p/locals.p new file mode 100644 index 00000000..6231dfb0 --- /dev/null +++ b/tests/query/highlights/p/locals.p @@ -0,0 +1,20 @@ +fun Add(x: int, y: int) : int { +// ^ @variable.parameter +// ^ @variable.parameter +// ^ @function +// ^ !@variable.parameter + return x + y; +// ^ @variable.parameter +// ^ @variable.parameter +} + +machine M { + start state Init { + entry (payload: int) { +// ^ @variable.parameter + payload = payload + 1; +// ^ @variable.parameter +// ^ @variable.parameter + } + } +}