Add built-in types

Not sure why it seems like the 'is-not? local' is not working.

Will investigate later
This commit is contained in:
Bruno BELANYI 2022-06-03 22:04:28 +02:00
parent 2d89ec8b20
commit 3e1068a336
3 changed files with 22 additions and 6 deletions

View file

@ -3,6 +3,10 @@
function: (identifier) @function.builtin) function: (identifier) @function.builtin)
(#match? @function.builtin "^(chr|concat|exit|flush|getchar|not|ord|print|print_err|print_int|size|strcmp|streq|substring)$") (#match? @function.builtin "^(chr|concat|exit|flush|getchar|not|ord|print|print_err|print_int|size|strcmp|streq|substring)$")
(#is-not? local)) (#is-not? local))
((type_identifier) @type.builtin
(#match? @type.builtin "^(int|string)$")
(#is-not? local))
; }}} ; }}}
; Keywords {{{ ; Keywords {{{

View file

@ -3,11 +3,23 @@ let
/* ^ function.builtin */ /* ^ function.builtin */
primitive exit(ret: int) /* Shadowing the prelude-included built-in */ primitive exit(ret: int) /* Shadowing the prelude-included built-in */
/* ^ type.builtin */
var b := exit(0) var b := exit(0)
/* ^ function */ /* ^ function */
type int = string /* Shadowing the built-in type */
/* ^ type.builtin */
var c : int := "This is an \"int\""
/* ^ type.builtin (not sure why it isn't 'type')*/
in in
let
var c : int := "This is an int"
/* ^ type.builtin (not sure why it isn't 'type')*/
in
end;
exit(1); exit(1);
/* <- function */ /* <- function */

View file

@ -1,15 +1,15 @@
type int = int type int = int
/* ^ variable */ /* ^ variable */
/* ^ type */ /* ^ type.builtin */
type int_array = array of int type int_array = array of int
/* ^ type */ /* ^ type.builtin */
type record = {a: int, b: string} type record = {a: int, b: string}
/* ^ property */ /* ^ property */
/* ^ type */ /* ^ type.builtin */
/* ^ property */ /* ^ property */
/* ^ type */ /* ^ type.builtin */
var record := record {a = 12, b = "27"} var record := record {a = 12, b = "27"}
/* ^ variable */ /* ^ variable */
@ -23,7 +23,7 @@ var array := int_array[12] of 27;
primitive func(a: int, b: string) : array primitive func(a: int, b: string) : array
/* ^ variable.parameter */ /* ^ variable.parameter */
/* ^ type */ /* ^ type.builtin */
/* ^ variable.parameter */ /* ^ variable.parameter */
/* ^ type */ /* ^ type.builtin */
/* ^ type */ /* ^ type */