highlights(Pascal): Fix highlighting of types

A recent change broke highlighting for namespaces & generic types like
`foo.bar` and `foo<t>`.
This commit is contained in:
Philip Zander 2022-01-02 18:12:58 +01:00 committed by Stephan Seitz
parent e81a60b692
commit b058034029
2 changed files with 52 additions and 4 deletions

View file

@ -228,12 +228,20 @@
(literalNumber) @number
(literalString) @string
; -- Identifiers
; -- Variables
; Unless a more specific rule applies, treat identifiers as variables
(identifier) @variable
(exprBinary (identifier) @variable)
(exprUnary (identifier) @variable)
(assignment (identifier) @variable)
(exprBrackets (identifier) @variable)
(exprParens (identifier) @variable)
(exprDot (identifier) @variable)
(exprTpl (identifier) @variable)
(exprArgs (identifier) @variable)
(defaultValue (identifier) @variable)
; -- Comments
(comment) @comment
(pp) @function.macro
@ -278,11 +286,12 @@
(genericTpl entity: (genericDot (identifier) @type))
; -- Exception parameters
(exceptionHandler variable: (identifier) @parameter)
; -- Type usage
(typeref (_) @type)
(typeref) @type
; -- Constant usage

View file

@ -0,0 +1,39 @@
program foobar;
// ^ keyword
var
// <- keyword
foo: bar;
// ^ variable
// ^ type
foo: foo.bar<t>;
// ^ variable
// ^ type
// ^ type
// ^ type
begin
// ^ keyword
foo := bar;
// ^ variable
// ^ variable
foo;
// ^ function
foo();
// ^ function
foo(bar(xyz));
// ^ function
// ^ function
// ^ variable
xx + yy;
// ^ variable
// ^ variable
xx := y + z + func(a, b, c);
// ^ variable
// ^ variable
// ^ variable
// ^ function
// ^ variable
// ^ variable
// ^ variable
end.
// <- keyword