Skip to content

Commit

Permalink
fix: Fix erroneous code in keyword highlight test file
Browse files Browse the repository at this point in the history
  • Loading branch information
reiniscirpons committed Aug 29, 2024
1 parent e2ba306 commit 26dbe9f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 33 deletions.
41 changes: 19 additions & 22 deletions queries/locals.scm
Original file line number Diff line number Diff line change
@@ -1,33 +1,11 @@
; The only other scopes apart from the global scope occur in function
; definitions.
[
(source_file)
(lambda)
(function)
(atomic_function)
] @local.scope

; TODO: (reiniscirpons) figure out if last match wins for local queries as well.
; If not move this to end.
(identifier) @local.reference

(assignment_statement
left: (identifier) @local.definition.var)

(locals
(identifier) @variable.definition.var)

(for_statement
identifier: (identifier) @variable.definition.var)

(assignment_statement
left: (identifier) @local.definition.function
right: [
(lambda)
(function)
(atomic_function)
])

(parameters
(identifier) @local.definition.parameter)

Expand All @@ -41,8 +19,27 @@
(lambda_parameters
(identifier) @local.definition.parameter)

(locals
(identifier) @variable.definition.var)

(record_entry
left: [
(identifier)
(integer)
] @local.definition.field)

(assignment_statement
left: (identifier) @local.definition.var)

(for_statement
identifier: (identifier) @variable.definition.var)

(assignment_statement
left: (identifier) @local.definition.function
right: [
(lambda)
(function)
(atomic_function)
])

(identifier) @local.reference
4 changes: 2 additions & 2 deletions test/highlight/keywords.g
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ elif 1+1 = 2 then
Print(10);
else
# <- keyword.conditional
1+1;
a := 1+1;
fi;
# <- keyword.conditional

Expand All @@ -28,7 +28,7 @@ atomic function(x)
# ^ punctuation.bracket
return x;
# ^ keyword.return
# ^ variable.parameter
# ^ variable
# ^ punctuation.delimiter
end;
# <- keyword.function
Expand Down
18 changes: 9 additions & 9 deletions test/highlight/mini.g
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ f := function(x,y)
# ^ variable.parameter
# ^ punctuation.delimiter
z := 1 - y;
# ^ variable.parameter
# ^ variable
# ^ operator
# ^ number
# ^ operator
# ^ variable.parameter
# ^ variable
# ^ punctuation.delimiter
helper := function(bla)
# ^ variable.parameter
# ^ function
# ^ operator
# ^ keyword.function
# ^ punctuation.bracket
Expand All @@ -33,14 +33,14 @@ f := function(x,y)
# ^ variable
# ^ variable
# ^ operator
# ^ variable.parameter
# ^ variable
# ^ punctuation.delimiter
end;
# ^ keyword.function
# ^ punctuation.delimiter
return helper;
# ^ keyword.return
# ^ variable.parameter
# ^ variable
# ^ punctuation.delimiter
end;
# <- keyword.function
Expand Down Expand Up @@ -68,7 +68,7 @@ f("abc", 1.100e-20 : a:= 2, beta, 1:=10);
x -> x + 1;
# <- variable.parameter
# ^ operator
# ^ variable.parameter
# ^ variable
# ^ operator
# ^ number
# ^ punctuation.delimiter
Expand All @@ -79,9 +79,9 @@ x -> x + 1;
# ^ variable.parameter
# ^ punctuation.bracket
# ^ operator
# ^ variable.parameter
# ^ variable
# ^ operator
# ^ variable.parameter
# ^ variable
# ^ operator
# ^ number
# ^ punctuation.delimiter
Expand Down Expand Up @@ -305,7 +305,7 @@ InstallImmediateMethod( IsFinitelyGeneratedGroup,
# ^ punctuation.bracket
# ^ function.call
# ^ punctuation.bracket
# ^ variable.parameter
# ^ variable
# ^ punctuation.bracket
# ^ punctuation.bracket
# ^ keyword.conditional
Expand Down

0 comments on commit 26dbe9f

Please sign in to comment.