mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 11:50:09 -04:00
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:
parent
e81a60b692
commit
b058034029
2 changed files with 52 additions and 4 deletions
|
|
@ -228,12 +228,20 @@
|
||||||
(literalNumber) @number
|
(literalNumber) @number
|
||||||
(literalString) @string
|
(literalString) @string
|
||||||
|
|
||||||
; -- Identifiers
|
; -- Variables
|
||||||
|
|
||||||
; Unless a more specific rule applies, treat identifiers as variables
|
(exprBinary (identifier) @variable)
|
||||||
(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
|
; -- Comments
|
||||||
|
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
(pp) @function.macro
|
(pp) @function.macro
|
||||||
|
|
||||||
|
|
@ -278,11 +286,12 @@
|
||||||
(genericTpl entity: (genericDot (identifier) @type))
|
(genericTpl entity: (genericDot (identifier) @type))
|
||||||
|
|
||||||
; -- Exception parameters
|
; -- Exception parameters
|
||||||
|
|
||||||
(exceptionHandler variable: (identifier) @parameter)
|
(exceptionHandler variable: (identifier) @parameter)
|
||||||
|
|
||||||
; -- Type usage
|
; -- Type usage
|
||||||
|
|
||||||
(typeref (_) @type)
|
(typeref) @type
|
||||||
|
|
||||||
; -- Constant usage
|
; -- Constant usage
|
||||||
|
|
||||||
|
|
|
||||||
39
tests/query/highlights/pascal/test.pas
Normal file
39
tests/query/highlights/pascal/test.pas
Normal 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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue