Compare commits
4 commits
main
...
wip-update
| Author | SHA1 | Date | |
|---|---|---|---|
| e7a123141f | |||
| ff1535431b | |||
| bb47813d0b | |||
| e99b94405f |
16 changed files with 1284 additions and 1259 deletions
7
Makefile
7
Makefile
|
|
@ -1,16 +1,17 @@
|
||||||
.PHONE: all
|
.PHONY: all
|
||||||
all:
|
all:
|
||||||
tree-sitter generate
|
tree-sitter generate
|
||||||
|
|
||||||
.PHONE: test
|
.PHONY: test
|
||||||
test: all
|
test: all
|
||||||
tree-sitter test
|
tree-sitter test
|
||||||
nvim-test
|
nvim-test
|
||||||
|
|
||||||
.PHONE: update-tests
|
.PHONY: update-tests
|
||||||
update-tests: all
|
update-tests: all
|
||||||
tree-sitter test -u
|
tree-sitter test -u
|
||||||
|
|
||||||
|
.PHONY: playground
|
||||||
playground:
|
playground:
|
||||||
nix shell pkgs#emscripten --command tree-sitter build-wasm
|
nix shell pkgs#emscripten --command tree-sitter build-wasm
|
||||||
tree-sitter playground
|
tree-sitter playground
|
||||||
|
|
|
||||||
32
flake.lock
generated
32
flake.lock
generated
|
|
@ -1,28 +1,31 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1667395993,
|
"lastModified": 1731533236,
|
||||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"ref": "master",
|
"ref": "main",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1669045945,
|
"lastModified": 1712482522,
|
||||||
"narHash": "sha256-BQxzijvZpLQ7R+KuQzCPcFgIS6OK0Onb29pYFe2pzJo=",
|
"narHash": "sha256-Ai/xNgZpbwGcw0TSXwEPwwbPi8Iu906sB9M9z3o6UgA=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "6b5019a48f876f3288efc626fa8b70ad0c64eb46",
|
"rev": "efe8ce06ca261f370d672def5b1e0be300c726e1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -62,6 +65,21 @@
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"pre-commit-hooks": "pre-commit-hooks"
|
"pre-commit-hooks": "pre-commit-hooks"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
type = "github";
|
type = "github";
|
||||||
owner = "numtide";
|
owner = "numtide";
|
||||||
repo = "flake-utils";
|
repo = "flake-utils";
|
||||||
ref = "master";
|
ref = "main";
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs = {
|
nixpkgs = {
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,7 @@
|
||||||
(let_expression)
|
(let_expression)
|
||||||
(function_declaration)
|
(function_declaration)
|
||||||
(primitive_declaration)
|
(primitive_declaration)
|
||||||
|
|
||||||
(record_type)
|
(record_type)
|
||||||
|
|
||||||
(class_declaration)
|
(class_declaration)
|
||||||
(class_type)
|
(class_type)
|
||||||
(method_declaration)
|
(method_declaration)
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,22 @@
|
||||||
; Built-ins {{{
|
; Built-ins {{{
|
||||||
((function_call
|
((function_call
|
||||||
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)$")
|
(#any-of? @function.builtin
|
||||||
(#is-not? local))
|
"chr" "concat" "exit" "flush" "getchar" "not" "ord" "print" "print_err" "print_int" "size"
|
||||||
|
"strcmp" "streq" "substring"))
|
||||||
|
|
||||||
((type_identifier) @type.builtin
|
((type_identifier) @type.builtin
|
||||||
(#match? @type.builtin "^(int|string|Object)$")
|
(#any-of? @type.builtin "int" "string" "Object"))
|
||||||
(#is-not? local))
|
|
||||||
|
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#match? @variable.builtin "^self$")
|
(#eq? @variable.builtin "self"))
|
||||||
(#is-not? local))
|
|
||||||
; }}}
|
|
||||||
|
|
||||||
|
; }}}
|
||||||
; Keywords {{{
|
; Keywords {{{
|
||||||
[
|
[
|
||||||
"function"
|
"function"
|
||||||
"method"
|
"primitive"
|
||||||
"primitive"
|
"method"
|
||||||
] @keyword.function
|
] @keyword.function
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -27,14 +26,9 @@
|
||||||
"while"
|
"while"
|
||||||
] @keyword.repeat
|
] @keyword.repeat
|
||||||
|
|
||||||
[
|
"new" @keyword.operator
|
||||||
"new"
|
|
||||||
] @keyword.constructor
|
|
||||||
|
|
||||||
|
"import" @keyword.import
|
||||||
[
|
|
||||||
"import"
|
|
||||||
] @include
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"array"
|
"array"
|
||||||
|
|
@ -48,73 +42,80 @@
|
||||||
"then"
|
"then"
|
||||||
"type"
|
"type"
|
||||||
"var"
|
"var"
|
||||||
|
|
||||||
"class"
|
|
||||||
"extends"
|
"extends"
|
||||||
|
|
||||||
"_cast"
|
"_cast"
|
||||||
"_chunks"
|
"_chunks"
|
||||||
"_exp"
|
"_exp"
|
||||||
"_lvalue"
|
"_lvalue"
|
||||||
"_namety"
|
"_namety"
|
||||||
] @keyword
|
] @keyword
|
||||||
; }}}
|
|
||||||
|
|
||||||
|
"class" @keyword.type
|
||||||
|
|
||||||
|
; }}}
|
||||||
; Operators {{{
|
; Operators {{{
|
||||||
(operator) @operator
|
(operator) @operator
|
||||||
|
|
||||||
[
|
[
|
||||||
","
|
","
|
||||||
";"
|
";"
|
||||||
":"
|
":"
|
||||||
"."
|
"."
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[
|
[
|
||||||
"("
|
"("
|
||||||
")"
|
")"
|
||||||
"["
|
"["
|
||||||
"]"
|
"]"
|
||||||
"{"
|
"{"
|
||||||
"}"
|
"}"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
; }}}
|
|
||||||
|
|
||||||
|
; }}}
|
||||||
; Functions and methods {{{
|
; Functions and methods {{{
|
||||||
(function_call
|
(function_call
|
||||||
function: (identifier) @function)
|
function: (identifier) @function)
|
||||||
|
|
||||||
(function_declaration
|
(function_declaration
|
||||||
name: (identifier) @function)
|
name: (identifier) @function)
|
||||||
|
|
||||||
(primitive_declaration
|
(primitive_declaration
|
||||||
name: (identifier) @function)
|
name: (identifier) @function)
|
||||||
|
|
||||||
(method_call
|
(method_call
|
||||||
method: (identifier) @method)
|
method: (identifier) @function.method)
|
||||||
|
|
||||||
(method_declaration
|
(method_declaration
|
||||||
name: (identifier) @method)
|
name: (identifier) @function.method)
|
||||||
|
|
||||||
(parameters
|
(parameters
|
||||||
name: (identifier) @parameter)
|
name: (identifier) @variable.parameter)
|
||||||
; }}}
|
|
||||||
|
|
||||||
|
; }}}
|
||||||
; Declarations {{{
|
; Declarations {{{
|
||||||
(import_declaration
|
(import_declaration
|
||||||
file: (string_literal) @string.special.path)
|
file: (string_literal) @string.special.path)
|
||||||
; }}}
|
|
||||||
|
|
||||||
|
; }}}
|
||||||
; Literals {{{
|
; Literals {{{
|
||||||
(nil_literal) @constant.builtin
|
(nil_literal) @constant.builtin
|
||||||
(integer_literal) @number
|
|
||||||
(string_literal) @string
|
|
||||||
(escape_sequence) @string.escape
|
|
||||||
; }}}
|
|
||||||
|
|
||||||
|
(integer_literal) @number
|
||||||
|
|
||||||
|
(string_literal) @string
|
||||||
|
|
||||||
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
|
; }}}
|
||||||
; Misc {{{
|
; Misc {{{
|
||||||
(comment) @comment
|
(comment) @comment ; @spell
|
||||||
|
|
||||||
(type_identifier) @type
|
(type_identifier) @type
|
||||||
(field_identifier) @property
|
|
||||||
(identifier) @variable
|
|
||||||
; }}}
|
|
||||||
|
|
||||||
|
(field_identifier) @variable.member
|
||||||
|
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
|
; }}}
|
||||||
; vim: sw=2 foldmethod=marker
|
; vim: sw=2 foldmethod=marker
|
||||||
|
|
|
||||||
|
|
@ -1,69 +1,104 @@
|
||||||
; Control flow {{{
|
; Control flow {{{
|
||||||
(if_expression) @indent
|
(if_expression) @indent.begin
|
||||||
"then" @branch
|
|
||||||
"else" @branch
|
|
||||||
|
|
||||||
(while_expression) @indent
|
"then" @indent.branch
|
||||||
"do" @branch
|
|
||||||
|
"else" @indent.branch
|
||||||
|
|
||||||
|
(while_expression) @indent.begin
|
||||||
|
|
||||||
|
"do" @indent.branch
|
||||||
|
|
||||||
|
(for_expression) @indent.begin
|
||||||
|
|
||||||
|
"to" @indent.branch
|
||||||
|
|
||||||
(for_expression) @indent
|
|
||||||
"to" @branch
|
|
||||||
; }}}
|
; }}}
|
||||||
|
|
||||||
; Class {{{
|
; Class {{{
|
||||||
(class_declaration) @indent
|
(class_declaration) @indent.begin
|
||||||
(class_declaration "}" @indent_end)
|
|
||||||
|
(class_declaration
|
||||||
|
"}" @indent.end)
|
||||||
|
|
||||||
|
(class_type) @indent.begin
|
||||||
|
|
||||||
|
(class_type
|
||||||
|
"}" @indent.end)
|
||||||
|
|
||||||
(class_type) @indent
|
|
||||||
(class_type "}" @indent_end)
|
|
||||||
; }}}
|
; }}}
|
||||||
|
|
||||||
; Groups {{{
|
; Groups {{{
|
||||||
(let_expression) @indent
|
(let_expression) @indent.begin
|
||||||
"in" @branch
|
|
||||||
"end" @branch
|
"in" @indent.branch
|
||||||
(let_expression "end" @indent_end)
|
|
||||||
|
"end" @indent.branch
|
||||||
|
|
||||||
|
(let_expression
|
||||||
|
"end" @indent.end)
|
||||||
|
|
||||||
|
(sequence_expression) @indent.begin
|
||||||
|
|
||||||
|
")" @indent.branch
|
||||||
|
|
||||||
|
(sequence_expression
|
||||||
|
")" @indent.end)
|
||||||
|
|
||||||
(sequence_expression) @indent
|
|
||||||
")" @branch
|
|
||||||
(sequence_expression ")" @indent_end)
|
|
||||||
; }}}
|
; }}}
|
||||||
|
|
||||||
; Functions and methods {{{
|
; Functions and methods {{{
|
||||||
(parameters) @indent
|
(parameters) @indent.begin
|
||||||
(parameters ")" @indent_end)
|
|
||||||
|
|
||||||
(function_call) @indent
|
(parameters
|
||||||
(method_call) @indent
|
")" @indent.end)
|
||||||
")" @branch
|
|
||||||
|
(function_call) @indent.begin
|
||||||
|
|
||||||
|
(function_call
|
||||||
|
")" @indent.end)
|
||||||
|
|
||||||
|
(method_call) @indent.begin
|
||||||
|
|
||||||
|
")" @indent.branch
|
||||||
|
|
||||||
|
(function_declaration) @indent.begin
|
||||||
|
|
||||||
|
(primitive_declaration) @indent.begin
|
||||||
|
|
||||||
|
(method_declaration) @indent.begin
|
||||||
|
|
||||||
(function_declaration) @indent
|
|
||||||
(primitive_declaration) @indent
|
|
||||||
(method_declaration) @indent
|
|
||||||
; }}}
|
; }}}
|
||||||
|
|
||||||
; Values and expressions {{{
|
; Values and expressions {{{
|
||||||
(array_value) @indent
|
(array_value) @indent.begin
|
||||||
"]" @branch
|
|
||||||
(array_value "]" @indent_end)
|
|
||||||
|
|
||||||
(array_expression) @indent
|
"]" @indent.branch
|
||||||
"of" @branch
|
|
||||||
|
|
||||||
(record_expression) @indent
|
(array_value
|
||||||
"}" @branch
|
"]" @indent.end)
|
||||||
(record_expression "}" @indent_end)
|
|
||||||
|
|
||||||
(record_type) @indent
|
(array_expression) @indent.begin
|
||||||
"}" @branch
|
|
||||||
(record_type "}" @indent_end)
|
"of" @indent.branch
|
||||||
|
|
||||||
|
(record_expression) @indent.begin
|
||||||
|
|
||||||
|
"}" @indent.branch
|
||||||
|
|
||||||
|
(record_expression
|
||||||
|
"}" @indent.end)
|
||||||
|
|
||||||
|
(record_type) @indent.begin
|
||||||
|
|
||||||
|
"}" @indent.branch
|
||||||
|
|
||||||
|
(record_type
|
||||||
|
"}" @indent.end)
|
||||||
|
|
||||||
|
(variable_declaration) @indent.begin
|
||||||
|
|
||||||
(variable_declaration) @indent
|
|
||||||
; }}}
|
; }}}
|
||||||
|
|
||||||
; Misc{{{
|
; Misc{{{
|
||||||
(comment) @ignore
|
(comment) @indent.ignore
|
||||||
(string_literal) @ignore
|
|
||||||
; }}}
|
|
||||||
|
|
||||||
|
(string_literal) @indent.ignore
|
||||||
|
|
||||||
|
; }}}
|
||||||
; vim: sw=2 foldmethod=marker
|
; vim: sw=2 foldmethod=marker
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
(comment) @comment
|
((comment) @injection.content
|
||||||
|
(#set! injection.language "comment"))
|
||||||
|
|
||||||
; vim: sw=2 foldmethod=marker
|
; vim: sw=2 foldmethod=marker
|
||||||
|
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
; See this issue [1] for support for "lazy scoping" which is somewhat needed
|
|
||||||
; for Tiger semantics (e.g: one can call a function before it has been defined
|
|
||||||
; top-to-bottom).
|
|
||||||
;
|
|
||||||
; [1]: https://github.com/tree-sitter/tree-sitter/issues/918
|
|
||||||
|
|
||||||
; Scopes {{{
|
|
||||||
[
|
|
||||||
(for_expression)
|
|
||||||
(let_expression)
|
|
||||||
(function_declaration)
|
|
||||||
] @local.scope
|
|
||||||
; }}}
|
|
||||||
|
|
||||||
; Definitions {{{
|
|
||||||
(type_declaration
|
|
||||||
name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(parameters
|
|
||||||
name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(function_declaration
|
|
||||||
name: (identifier) @local.definition)
|
|
||||||
(primitive_declaration
|
|
||||||
name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(variable_declaration
|
|
||||||
name: (identifier) @local.definition)
|
|
||||||
; }}}
|
|
||||||
|
|
||||||
; References {{{
|
|
||||||
(identifier) @local.reference
|
|
||||||
; }}}
|
|
||||||
|
|
||||||
; vim: sw=2 foldmethod=marker
|
|
||||||
2188
src/parser.c
generated
2188
src/parser.c
generated
File diff suppressed because it is too large
Load diff
16
src/tree_sitter/parser.h
generated
16
src/tree_sitter/parser.h
generated
|
|
@ -13,9 +13,8 @@ extern "C" {
|
||||||
#define ts_builtin_sym_end 0
|
#define ts_builtin_sym_end 0
|
||||||
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
|
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
|
||||||
|
|
||||||
typedef uint16_t TSStateId;
|
|
||||||
|
|
||||||
#ifndef TREE_SITTER_API_H_
|
#ifndef TREE_SITTER_API_H_
|
||||||
|
typedef uint16_t TSStateId;
|
||||||
typedef uint16_t TSSymbol;
|
typedef uint16_t TSSymbol;
|
||||||
typedef uint16_t TSFieldId;
|
typedef uint16_t TSFieldId;
|
||||||
typedef struct TSLanguage TSLanguage;
|
typedef struct TSLanguage TSLanguage;
|
||||||
|
|
@ -130,9 +129,16 @@ struct TSLanguage {
|
||||||
* Lexer Macros
|
* Lexer Macros
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define UNUSED __pragma(warning(suppress : 4101))
|
||||||
|
#else
|
||||||
|
#define UNUSED __attribute__((unused))
|
||||||
|
#endif
|
||||||
|
|
||||||
#define START_LEXER() \
|
#define START_LEXER() \
|
||||||
bool result = false; \
|
bool result = false; \
|
||||||
bool skip = false; \
|
bool skip = false; \
|
||||||
|
UNUSED \
|
||||||
bool eof = false; \
|
bool eof = false; \
|
||||||
int32_t lookahead; \
|
int32_t lookahead; \
|
||||||
goto start; \
|
goto start; \
|
||||||
|
|
@ -166,7 +172,7 @@ struct TSLanguage {
|
||||||
* Parse Table Macros
|
* Parse Table Macros
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SMALL_STATE(id) id - LARGE_STATE_COUNT
|
#define SMALL_STATE(id) ((id) - LARGE_STATE_COUNT)
|
||||||
|
|
||||||
#define STATE(id) id
|
#define STATE(id) id
|
||||||
|
|
||||||
|
|
@ -176,7 +182,7 @@ struct TSLanguage {
|
||||||
{{ \
|
{{ \
|
||||||
.shift = { \
|
.shift = { \
|
||||||
.type = TSParseActionTypeShift, \
|
.type = TSParseActionTypeShift, \
|
||||||
.state = state_value \
|
.state = (state_value) \
|
||||||
} \
|
} \
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
@ -184,7 +190,7 @@ struct TSLanguage {
|
||||||
{{ \
|
{{ \
|
||||||
.shift = { \
|
.shift = { \
|
||||||
.type = TSParseActionTypeShift, \
|
.type = TSParseActionTypeShift, \
|
||||||
.state = state_value, \
|
.state = (state_value), \
|
||||||
.repetition = true \
|
.repetition = true \
|
||||||
} \
|
} \
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ let
|
||||||
/* ^ type.builtin */
|
/* ^ type.builtin */
|
||||||
|
|
||||||
var b := exit(0)
|
var b := exit(0)
|
||||||
/* ^ function */
|
/* ^ function.builtin */
|
||||||
|
|
||||||
type int = string /* Shadowing the built-in type */
|
type int = string /* Shadowing the built-in type */
|
||||||
/* ^ type.builtin */
|
/* ^ type.builtin */
|
||||||
|
|
@ -30,13 +30,13 @@ in
|
||||||
end;
|
end;
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
/* <- function */
|
/* <- function.builtin */
|
||||||
|
|
||||||
print("shadowing is fun");
|
print("shadowing is fun");
|
||||||
/* <- function.builtin */
|
/* <- function.builtin */
|
||||||
|
|
||||||
self;
|
self;
|
||||||
/* <- variable */
|
/* <- variable.builtin */
|
||||||
|
|
||||||
b := print
|
b := print
|
||||||
/* ^ variable */
|
/* ^ variable */
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
primitive print(s: string)
|
primitive print(s: string)
|
||||||
/* ^ function */
|
/* ^ function */
|
||||||
/* ^ parameter */
|
/* ^ variable.parameter */
|
||||||
|
|
||||||
function func(a: int) : int = (print("Hello World!"); a)
|
function func(a: int) : int = (print("Hello World!"); a)
|
||||||
/* ^ function */
|
/* ^ function */
|
||||||
/* ^ parameter */
|
/* ^ variable.parameter */
|
||||||
/* ^ function */
|
/* ^ function.builtin */
|
||||||
|
|
|
||||||
|
|
@ -6,24 +6,24 @@ type int_array = array of int
|
||||||
/* ^ type.builtin */
|
/* ^ type.builtin */
|
||||||
|
|
||||||
type record = {a: int, b: string}
|
type record = {a: int, b: string}
|
||||||
/* ^ property */
|
/* ^ variable.member */
|
||||||
/* ^ type.builtin */
|
/* ^ type.builtin */
|
||||||
/* ^ property */
|
/* ^ variable.member */
|
||||||
/* ^ type.builtin */
|
/* ^ type.builtin */
|
||||||
|
|
||||||
var record := record {a = 12, b = "27"}
|
var record := record {a = 12, b = "27"}
|
||||||
/* ^ variable */
|
/* ^ variable */
|
||||||
/* ^ type */
|
/* ^ type */
|
||||||
/* ^ property */
|
/* ^ variable.member */
|
||||||
/* ^ property */
|
/* ^ variable.member */
|
||||||
|
|
||||||
var array := int_array[12] of 27;
|
var array := int_array[12] of 27;
|
||||||
/* ^ variable */
|
/* ^ variable */
|
||||||
/* ^ type */
|
/* ^ type */
|
||||||
|
|
||||||
primitive func(a: int, b: string) : array
|
primitive func(a: int, b: string) : array
|
||||||
/* ^ parameter */
|
/* ^ variable.parameter */
|
||||||
/* ^ type.builtin */
|
/* ^ type.builtin */
|
||||||
/* ^ parameter */
|
/* ^ variable.parameter */
|
||||||
/* ^ type.builtin */
|
/* ^ type.builtin */
|
||||||
/* ^ type */
|
/* ^ type */
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
import "lib.tih"
|
import "lib.tih"
|
||||||
/* <- include */
|
/* <- keyword.import */
|
||||||
/* ^ string.special.path */
|
/* ^ string.special.path */
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ let
|
||||||
/* <- keyword.function */
|
/* <- keyword.function */
|
||||||
|
|
||||||
import "lib.tih"
|
import "lib.tih"
|
||||||
/* <- include */
|
/* <- keyword.import */
|
||||||
|
|
||||||
type array_of_int = array of int
|
type array_of_int = array of int
|
||||||
/* <- keyword */
|
/* <- keyword */
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
let
|
let
|
||||||
class A extends Object {}
|
class A extends Object {}
|
||||||
/* <- keyword */
|
/* <- keyword.type */
|
||||||
/* ^ keyword */
|
/* ^ keyword */
|
||||||
/* ^ type.builtin */
|
/* ^ type.builtin */
|
||||||
|
|
||||||
type B = class extends A {
|
type B = class extends A {
|
||||||
/* ^ keyword */
|
/* ^ keyword.type */
|
||||||
/* ^ keyword */
|
/* ^ keyword */
|
||||||
/* ^ type */
|
/* ^ type */
|
||||||
|
|
||||||
|
|
@ -13,16 +13,16 @@ let
|
||||||
|
|
||||||
method meth() : int = self.a
|
method meth() : int = self.a
|
||||||
/* <- keyword.function */
|
/* <- keyword.function */
|
||||||
/* ^ method */
|
/* ^ function.method */
|
||||||
/* ^ variable.builtin */
|
/* ^ variable.builtin */
|
||||||
}
|
}
|
||||||
|
|
||||||
var object := new B
|
var object := new B
|
||||||
/* ^ keyword.constructor */
|
/* ^ keyword.operator */
|
||||||
in
|
in
|
||||||
object.a := 27;
|
object.a := 27;
|
||||||
/* ^ property */
|
/* ^ variable.member */
|
||||||
|
|
||||||
object.meth()
|
object.meth()
|
||||||
/* ^ method */
|
/* ^ function.method */
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue