From b1c2da4cb4cd79bfd153faddc48bc0e1074d0eae Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 4 Jun 2022 21:38:21 +0200 Subject: [PATCH] Add 'self' built-in variable high-lighting --- queries/highlights.scm | 4 ++++ test/highlight/built-ins.tig | 5 +++++ test/highlight/object-oriented.tig | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/queries/highlights.scm b/queries/highlights.scm index 66130bf..cadeed7 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -7,6 +7,10 @@ ((type_identifier) @type.builtin (#match? @type.builtin "^(int|string|Object)$") (#is-not? local)) + +((identifier) @variable.builtin + (#match? @variable.builtin "^self$") + (#is-not? local)) ; }}} ; Keywords {{{ diff --git a/test/highlight/built-ins.tig b/test/highlight/built-ins.tig index 9fe0487..6879054 100644 --- a/test/highlight/built-ins.tig +++ b/test/highlight/built-ins.tig @@ -18,6 +18,8 @@ let /* ^ type.builtin */ type Object = int + + var self := "self" in let var c : int := "This is an int" @@ -33,6 +35,9 @@ in print("shadowing is fun"); /* <- function.builtin */ + self; + /* <- variable */ + b := print /* ^ variable */ end diff --git a/test/highlight/object-oriented.tig b/test/highlight/object-oriented.tig index 79928bb..930eabf 100644 --- a/test/highlight/object-oriented.tig +++ b/test/highlight/object-oriented.tig @@ -14,7 +14,7 @@ let method meth() : int = self.a /* <- keyword.method */ /* ^ method */ - /* ^ variable */ + /* ^ variable.builtin */ } var object := new B