diff --git a/queries/highlights.scm b/queries/highlights.scm index e9e8536..f8969cd 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -1,3 +1,10 @@ +; Built-ins {{{ +((function_call + function: (identifier) @function.builtin) + (#match? @function.builtin "^(chr|concat|exit|flush|getchar|not|ord|print|print_err|print_int|size|strcmp|streq|substring)$") + (#is-not? local)) +; }}} + ; Keywords {{{ [ "function" diff --git a/test/highlight/built-ins.tig b/test/highlight/built-ins.tig new file mode 100644 index 0000000..d30cb20 --- /dev/null +++ b/test/highlight/built-ins.tig @@ -0,0 +1,19 @@ +let + var a := exit(0) + /* ^ function.builtin */ + + primitive exit(ret: int) /* Shadowing the prelude-included built-in */ + + var b := exit(0) + /* ^ function */ + +in + exit(1); + /* <- function */ + + print("shadowing is fun"); + /* <- function.builtin */ + + b := print + /* ^ variable */ +end