Add 'self' built-in variable high-lighting

This commit is contained in:
Bruno BELANYI 2022-06-04 21:38:21 +02:00
parent acb5765591
commit b1c2da4cb4
3 changed files with 10 additions and 1 deletions

View file

@ -7,6 +7,10 @@
((type_identifier) @type.builtin ((type_identifier) @type.builtin
(#match? @type.builtin "^(int|string|Object)$") (#match? @type.builtin "^(int|string|Object)$")
(#is-not? local)) (#is-not? local))
((identifier) @variable.builtin
(#match? @variable.builtin "^self$")
(#is-not? local))
; }}} ; }}}
; Keywords {{{ ; Keywords {{{

View file

@ -18,6 +18,8 @@ let
/* ^ type.builtin */ /* ^ type.builtin */
type Object = int type Object = int
var self := "self"
in in
let let
var c : int := "This is an int" var c : int := "This is an int"
@ -33,6 +35,9 @@ in
print("shadowing is fun"); print("shadowing is fun");
/* <- function.builtin */ /* <- function.builtin */
self;
/* <- variable */
b := print b := print
/* ^ variable */ /* ^ variable */
end end

View file

@ -14,7 +14,7 @@ let
method meth() : int = self.a method meth() : int = self.a
/* <- keyword.method */ /* <- keyword.method */
/* ^ method */ /* ^ method */
/* ^ variable */ /* ^ variable.builtin */
} }
var object := new B var object := new B