~repos /plum
git clone https://pyrossh.dev/repos/plum.git
A statically typed, imperative programming language inspired by rust, python
9e7927c6
—
pyrossh 11 months ago
fix tests
- test/main.go +2 -0
- test/main.py +9 -2
- test/main.rs +2 -3
- tooling/tree-sitter-plum/Makefile +3 -1
- tooling/tree-sitter-plum/grammar.js +28 -50
- tooling/tree-sitter-plum/queries/plum/highlights.scm +4 -1
- tooling/tree-sitter-plum/src/grammar.json +0 -0
- tooling/tree-sitter-plum/src/node-types.json +0 -0
- tooling/tree-sitter-plum/src/parser.c +0 -0
- tooling/tree-sitter-plum/test/corpus/assert.txt +2 -54
- tooling/tree-sitter-plum/test/corpus/enum.txt +1 -1
- tooling/tree-sitter-plum/test/corpus/for.txt +1 -1
- tooling/tree-sitter-plum/test/corpus/function.txt +9 -65
- tooling/tree-sitter-plum/test/corpus/if.txt +14 -14
- tooling/tree-sitter-plum/test/corpus/literals.txt +1 -1
- tooling/tree-sitter-plum/test/corpus/type.txt +25 -23
test/main.go
CHANGED
|
@@ -13,6 +13,8 @@ type Game struct {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
func random() Int {
|
|
16
|
+
a := 123
|
|
17
|
+
println("Hellow")
|
|
16
18
|
panic("TODO")
|
|
17
19
|
}
|
|
18
20
|
|
test/main.py
CHANGED
|
@@ -5,10 +5,15 @@ class ToStr:
|
|
|
5
5
|
def main(data: str):
|
|
6
6
|
pass
|
|
7
7
|
|
|
8
|
+
|
|
9
|
+
class Dog:
|
|
10
|
+
|
|
11
|
+
def bark():
|
|
12
|
+
print("barking dog")
|
|
13
|
+
|
|
14
|
+
|
|
8
15
|
class Int(ToStr):
|
|
9
16
|
def __init__():
|
|
10
|
-
if a > 4"
|
|
11
|
-
pass
|
|
12
17
|
format("%d")
|
|
13
18
|
|
|
14
19
|
def toStr(self, name: Int):
|
|
@@ -16,3 +21,5 @@ class Int(ToStr):
|
|
|
16
21
|
|
|
17
22
|
|
|
18
23
|
raw_string = r"Python\nis\easy\to\learn"
|
|
24
|
+
v = Dog(a="123")
|
|
25
|
+
v.bark()
|
test/main.rs
CHANGED
|
@@ -2,8 +2,6 @@ mod 123
|
|
|
2
2
|
|
|
3
3
|
static data = ""
|
|
4
4
|
|
|
5
|
-
use std.asd
|
|
6
|
-
|
|
7
5
|
struct Row {
|
|
8
6
|
pub id: String
|
|
9
7
|
}
|
|
@@ -15,5 +13,6 @@ impl Row {
|
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
fn main() {
|
|
16
|
+
println("1231")
|
|
18
|
-
|
|
17
|
+
Row("123")
|
|
19
18
|
}
|
tooling/tree-sitter-plum/Makefile
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
build:
|
|
2
|
+
tree-sitter generate
|
|
2
3
|
tree-sitter build -o grammars/plum.so
|
|
3
4
|
|
|
4
5
|
corpus_test:
|
|
6
|
+
tree-sitter generate
|
|
5
|
-
tree-sitter
|
|
7
|
+
tree-sitter test -i "type"
|
tooling/tree-sitter-plum/grammar.js
CHANGED
|
@@ -67,7 +67,7 @@ module.exports = grammar({
|
|
|
67
67
|
repeat(choice($.class, $.trait, $.enum, $.fn)),
|
|
68
68
|
),
|
|
69
69
|
|
|
70
|
-
module: ($) => $.
|
|
70
|
+
module: ($) => $.var_identifier,
|
|
71
71
|
|
|
72
72
|
import: ($) => seq("import", $.url),
|
|
73
73
|
url: () => sep1(/[a-zA-Z_][a-zA-Z_0-9]*/, "/"),
|
|
@@ -96,7 +96,7 @@ module.exports = grammar({
|
|
|
96
96
|
field("fields", optional(repeat(alias($.class_field, $.field)))),
|
|
97
97
|
$._dedent,
|
|
98
98
|
),
|
|
99
|
-
class_field: ($) => seq(field("name", $.
|
|
99
|
+
class_field: ($) => seq(field("name", $.var_identifier), ":", field("type", $.type)),
|
|
100
100
|
|
|
101
101
|
trait: ($) =>
|
|
102
102
|
seq(
|
|
@@ -109,7 +109,7 @@ module.exports = grammar({
|
|
|
109
109
|
trait_field: ($) =>
|
|
110
110
|
seq(
|
|
111
111
|
"fn",
|
|
112
|
-
field("name", $.
|
|
112
|
+
field("name", $.fn_identifier),
|
|
113
113
|
field("params", seq("(", optional(commaSep1($.param)), ")")),
|
|
114
114
|
":",
|
|
115
115
|
field("returns", optional($.return_type)),
|
|
@@ -117,7 +117,7 @@ module.exports = grammar({
|
|
|
117
117
|
|
|
118
118
|
param: ($) =>
|
|
119
119
|
seq(
|
|
120
|
-
field("name", $.
|
|
120
|
+
field("name", $.var_identifier),
|
|
121
121
|
":",
|
|
122
122
|
field("type", choice($.type, $.variadic_type)),
|
|
123
123
|
optional(seq("=", field("value", $.expression))),
|
|
@@ -144,12 +144,14 @@ module.exports = grammar({
|
|
|
144
144
|
),
|
|
145
145
|
|
|
146
146
|
fn: ($) =>
|
|
147
|
+
prec.left(
|
|
147
|
-
|
|
148
|
+
seq(
|
|
148
|
-
|
|
149
|
+
field("name", $.fn_identifier),
|
|
149
|
-
|
|
150
|
+
field("type", optional(alias($.fn_type, $.type))),
|
|
150
|
-
|
|
151
|
+
field("params", seq("(", optional(commaSep1($.param)), ")")),
|
|
151
|
-
|
|
152
|
+
field("returns", optional(seq("->", $.return_type))),
|
|
152
|
-
|
|
153
|
+
field("body", seq("=", choice($.expression, $.body))),
|
|
154
|
+
)
|
|
153
155
|
),
|
|
154
156
|
|
|
155
157
|
fn_type: ($) => seq("<", commaSep1($.type_identifier), ">"),
|
|
@@ -171,14 +173,12 @@ module.exports = grammar({
|
|
|
171
173
|
),
|
|
172
174
|
|
|
173
175
|
assign: ($) =>
|
|
174
|
-
prec.right(
|
|
175
|
-
|
|
176
|
+
seq(
|
|
176
|
-
|
|
177
|
+
field("left", commaSep1($.var_identifier)),
|
|
177
|
-
|
|
178
|
+
"=",
|
|
178
|
-
|
|
179
|
+
field("right", commaSep1($.expression)),
|
|
179
|
-
),
|
|
180
180
|
),
|
|
181
|
-
|
|
181
|
+
try: ($) => prec.right(seq("try", optional($.fn_call))),
|
|
182
182
|
assert: ($) => seq("assert", $.expression),
|
|
183
183
|
return: ($) => prec.left(seq("return", optional($.expression))),
|
|
184
184
|
break: (_) => prec.left("break"),
|
|
@@ -191,24 +191,16 @@ module.exports = grammar({
|
|
|
191
191
|
field("condition", $.expression),
|
|
192
192
|
field("body", $.body),
|
|
193
193
|
repeat(field("alternative", $.else_if)),
|
|
194
|
-
optional(field("
|
|
194
|
+
optional(field("otherwise", $.else)),
|
|
195
195
|
),
|
|
196
|
-
|
|
197
196
|
else_if: ($) =>
|
|
198
197
|
seq("else if", field("condition", $.expression), field("body", $.body)),
|
|
199
|
-
|
|
200
198
|
else: ($) => seq("else", field("body", $.body)),
|
|
201
199
|
|
|
202
|
-
reference: ($) =>
|
|
203
|
-
prec(
|
|
204
|
-
PREC.call,
|
|
205
|
-
seq(choice($.var_identier, $.type_identifier), optional(seq(".", $.identifier))),
|
|
206
|
-
),
|
|
207
|
-
|
|
208
200
|
for: ($) =>
|
|
209
201
|
seq(
|
|
210
202
|
"for",
|
|
211
|
-
field("left", commaSep1($.
|
|
203
|
+
field("left", commaSep1($.var_identifier)),
|
|
212
204
|
"in",
|
|
213
205
|
field("right", $.primary_expression),
|
|
214
206
|
field("body", $.body),
|
|
@@ -216,8 +208,7 @@ module.exports = grammar({
|
|
|
216
208
|
|
|
217
209
|
while: ($) =>
|
|
218
210
|
seq("while", field("condition", $.expression), field("body", $.body)),
|
|
219
|
-
|
|
220
|
-
dotted_name: ($) => prec(1, sep1($.
|
|
211
|
+
dotted_name: ($) => prec(1, sep1($.var_identifier, ".")),
|
|
221
212
|
|
|
222
213
|
// Match cases
|
|
223
214
|
match: ($) =>
|
|
@@ -267,7 +258,7 @@ module.exports = grammar({
|
|
|
267
258
|
choice(
|
|
268
259
|
$.binary_operator,
|
|
269
260
|
$.self,
|
|
270
|
-
$.
|
|
261
|
+
$.var_identifier,
|
|
271
262
|
$.type_identifier,
|
|
272
263
|
$.string,
|
|
273
264
|
$.integer,
|
|
@@ -356,7 +347,7 @@ module.exports = grammar({
|
|
|
356
347
|
closure: ($) =>
|
|
357
348
|
seq(
|
|
358
349
|
"|",
|
|
359
|
-
field("parameters", optional(commaSep1($.
|
|
350
|
+
field("parameters", optional(commaSep1($.var_identifier))),
|
|
360
351
|
"|",
|
|
361
352
|
field("body", $.body),
|
|
362
353
|
),
|
|
@@ -368,7 +359,7 @@ module.exports = grammar({
|
|
|
368
359
|
field("object", $.primary_expression),
|
|
369
360
|
".",
|
|
370
361
|
choice(
|
|
371
|
-
$.
|
|
362
|
+
$.var_identifier,
|
|
372
363
|
$.fn_call,
|
|
373
364
|
)
|
|
374
365
|
),
|
|
@@ -376,7 +367,7 @@ module.exports = grammar({
|
|
|
376
367
|
|
|
377
368
|
fn_call: ($) =>
|
|
378
369
|
prec(PREC.call, seq(
|
|
379
|
-
field("function", $.
|
|
370
|
+
field("function", $.fn_identifier),
|
|
380
371
|
field(
|
|
381
372
|
"arguments",
|
|
382
373
|
$.argument_list,
|
|
@@ -394,7 +385,7 @@ module.exports = grammar({
|
|
|
394
385
|
),
|
|
395
386
|
|
|
396
387
|
keyword_argument: ($) =>
|
|
397
|
-
seq(field("name", $.
|
|
388
|
+
seq(field("name", $.var_identifier), "=", field("value", $.expression)),
|
|
398
389
|
|
|
399
390
|
pair_argument: ($) =>
|
|
400
391
|
seq(field("name", $.string), "=>", field("value", $.expression)),
|
|
@@ -412,7 +403,7 @@ module.exports = grammar({
|
|
|
412
403
|
seq(
|
|
413
404
|
"(",
|
|
414
405
|
optional(
|
|
415
|
-
commaSep1(seq(field("name", $.
|
|
406
|
+
commaSep1(seq(field("name", $.var_identifier), ":", field("value", $.expression)),),
|
|
416
407
|
),
|
|
417
408
|
optional(","),
|
|
418
409
|
")",
|
|
@@ -443,20 +434,7 @@ module.exports = grammar({
|
|
|
443
434
|
|
|
444
435
|
interpolation: $ => seq(
|
|
445
436
|
'{',
|
|
446
|
-
choice(
|
|
447
|
-
$.binary_operator,
|
|
448
|
-
$.self,
|
|
449
|
-
$.identifier,
|
|
450
|
-
$.type_identifier,
|
|
451
|
-
$.string,
|
|
452
|
-
$.integer,
|
|
453
|
-
$.float,
|
|
454
|
-
$.unary_operator,
|
|
455
|
-
$.attribute,
|
|
456
|
-
$.fn_call,
|
|
457
|
-
$.class_call,
|
|
458
|
-
|
|
437
|
+
$.primary_expression,
|
|
459
|
-
),
|
|
460
438
|
'}',
|
|
461
439
|
),
|
|
462
440
|
|
|
@@ -516,7 +494,7 @@ module.exports = grammar({
|
|
|
516
494
|
b: (_) => token("b"),
|
|
517
495
|
c: (_) => token("c"),
|
|
518
496
|
d: (_) => token("d"),
|
|
519
|
-
|
|
497
|
+
var_identifier: (_) => /[a-z]+(_[a-z0-9]+)*/, // lower snake case
|
|
520
498
|
fn_identifier: (_) => /[a-z][a-zA-Z0-9]*/, // camel case
|
|
521
499
|
type_identifier: (_) => /[A-Z][a-zA-Z0-9]*/, // capital case
|
|
522
500
|
},
|
tooling/tree-sitter-plum/queries/plum/highlights.scm
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
(fn
|
|
4
4
|
(identifier) @function)
|
|
5
5
|
|
|
6
|
+
;(fn_call
|
|
7
|
+
; (identifier) @function)
|
|
8
|
+
|
|
6
|
-
(
|
|
9
|
+
(var_identifier) @variable
|
|
7
10
|
(integer) @constant.numeric.integer
|
|
8
11
|
(float) @constant.numeric.float
|
|
9
12
|
(comment) @comment
|
tooling/tree-sitter-plum/src/grammar.json
CHANGED
|
Binary file
|
tooling/tree-sitter-plum/src/node-types.json
CHANGED
|
Binary file
|
tooling/tree-sitter-plum/src/parser.c
CHANGED
|
Binary file
|
tooling/tree-sitter-plum/test/corpus/assert.txt
CHANGED
|
@@ -6,14 +6,12 @@ main() =
|
|
|
6
6
|
assert 1 != 2
|
|
7
7
|
assert 5 > 4
|
|
8
8
|
assert 7 != 9
|
|
9
|
-
assert List(1, 2) == List(1, 2)
|
|
10
|
-
assert Map("1" => 2) == Map("1" => 2)
|
|
11
9
|
|
|
12
10
|
--------------------------------------------------------------------------------
|
|
13
11
|
|
|
14
12
|
(source
|
|
15
13
|
(fn
|
|
16
|
-
(
|
|
14
|
+
(fn_identifier)
|
|
17
15
|
(body
|
|
18
16
|
(assert
|
|
19
17
|
(expression
|
|
@@ -35,54 +33,4 @@ main() =
|
|
|
35
33
|
(primary_expression
|
|
36
34
|
(integer))
|
|
37
35
|
(primary_expression
|
|
38
|
-
(integer)))))
|
|
39
|
-
(assert
|
|
40
|
-
(expression
|
|
41
|
-
(comparison_operator
|
|
42
|
-
(primary_expression
|
|
43
|
-
(type_call
|
|
44
|
-
(type_identifier)
|
|
45
|
-
(argument_list
|
|
46
|
-
(expression
|
|
47
|
-
(primary_expression
|
|
48
|
-
(integer)))
|
|
49
|
-
(expression
|
|
50
|
-
(primary_expression
|
|
51
|
-
(integer))))))
|
|
52
|
-
(primary_expression
|
|
53
|
-
(type_call
|
|
54
|
-
(type_identifier)
|
|
55
|
-
(argument_list
|
|
56
|
-
(expression
|
|
57
|
-
(primary_expression
|
|
58
|
-
(integer)))
|
|
59
|
-
(expression
|
|
60
|
-
(primary_expression
|
|
61
|
-
|
|
36
|
+
(integer))))))))
|
|
62
|
-
(assert
|
|
63
|
-
(expression
|
|
64
|
-
(comparison_operator
|
|
65
|
-
(primary_expression
|
|
66
|
-
(type_call
|
|
67
|
-
(type_identifier)
|
|
68
|
-
(argument_list
|
|
69
|
-
(pair_argument
|
|
70
|
-
(string
|
|
71
|
-
(string_start)
|
|
72
|
-
(string_content)
|
|
73
|
-
(string_end))
|
|
74
|
-
(expression
|
|
75
|
-
(primary_expression
|
|
76
|
-
(integer)))))))
|
|
77
|
-
(primary_expression
|
|
78
|
-
(type_call
|
|
79
|
-
(type_identifier)
|
|
80
|
-
(argument_list
|
|
81
|
-
(pair_argument
|
|
82
|
-
(string
|
|
83
|
-
(string_start)
|
|
84
|
-
(string_content)
|
|
85
|
-
(string_end))
|
|
86
|
-
(expression
|
|
87
|
-
(primary_expression
|
|
88
|
-
(integer)))))))))))))
|
tooling/tree-sitter-plum/test/corpus/enum.txt
CHANGED
|
@@ -19,7 +19,7 @@ toStr<Bool>() -> Str =
|
|
|
19
19
|
(field
|
|
20
20
|
(type_identifier)))
|
|
21
21
|
(fn
|
|
22
|
-
(
|
|
22
|
+
(fn_identifier)
|
|
23
23
|
(type
|
|
24
24
|
(type_identifier))
|
|
25
25
|
(return_type
|
tooling/tree-sitter-plum/test/corpus/for.txt
CHANGED
|
@@ -10,7 +10,7 @@ main() =
|
|
|
10
10
|
|
|
11
11
|
(source
|
|
12
12
|
(fn
|
|
13
|
-
(
|
|
13
|
+
(fn_identifier)
|
|
14
14
|
(body
|
|
15
15
|
(for
|
|
16
16
|
(identifier)
|
tooling/tree-sitter-plum/test/corpus/function.txt
CHANGED
|
@@ -11,11 +11,11 @@ sum(a: Int, b: Int) =
|
|
|
11
11
|
(fn
|
|
12
12
|
(fn_identifier)
|
|
13
13
|
(param
|
|
14
|
-
(
|
|
14
|
+
(var_identifier)
|
|
15
15
|
(type
|
|
16
16
|
(type_identifier)))
|
|
17
17
|
(param
|
|
18
|
-
(
|
|
18
|
+
(var_identifier)
|
|
19
19
|
(type
|
|
20
20
|
(type_identifier)))
|
|
21
21
|
(body
|
|
@@ -34,11 +34,11 @@ sum(a: Int, b: Int) -> Int =
|
|
|
34
34
|
(fn
|
|
35
35
|
(fn_identifier)
|
|
36
36
|
(param
|
|
37
|
-
(
|
|
37
|
+
(var_identifier)
|
|
38
38
|
(type
|
|
39
39
|
(type_identifier)))
|
|
40
40
|
(param
|
|
41
|
-
(
|
|
41
|
+
(var_identifier)
|
|
42
42
|
(type
|
|
43
43
|
(type_identifier)))
|
|
44
44
|
(return_type
|
|
@@ -59,7 +59,7 @@ random(a: Int = 10) =
|
|
|
59
59
|
(fn
|
|
60
60
|
(fn_identifier)
|
|
61
61
|
(param
|
|
62
|
-
(
|
|
62
|
+
(var_identifier)
|
|
63
63
|
(type
|
|
64
64
|
(type_identifier))
|
|
65
65
|
(expression
|
|
@@ -81,11 +81,11 @@ add(param: a, param2: List(b)) -> List(b) =
|
|
|
81
81
|
(fn
|
|
82
82
|
(fn_identifier)
|
|
83
83
|
(param
|
|
84
|
-
(
|
|
84
|
+
(var_identifier)
|
|
85
85
|
(type
|
|
86
86
|
(a)))
|
|
87
87
|
(param
|
|
88
|
-
(
|
|
88
|
+
(var_identifier)
|
|
89
89
|
(type
|
|
90
90
|
(type_identifier)
|
|
91
91
|
(type
|
|
@@ -108,65 +108,9 @@ fullname<User>() -> String =
|
|
|
108
108
|
|
|
109
109
|
(source
|
|
110
110
|
(fn
|
|
111
|
-
(method_identifier
|
|
112
|
-
(type_identifier)
|
|
113
|
-
|
|
111
|
+
(fn_identifier)
|
|
114
|
-
(
|
|
112
|
+
(type
|
|
115
113
|
(type_identifier))
|
|
116
|
-
(body
|
|
117
|
-
(todo))))
|
|
118
|
-
|
|
119
|
-
================================================================================
|
|
120
|
-
function - construtor
|
|
121
|
-
================================================================================
|
|
122
|
-
|
|
123
|
-
List\init(items: ...a) -> List(a) =
|
|
124
|
-
List().add(items)
|
|
125
|
-
|
|
126
|
-
--------------------------------------------------------------------------------
|
|
127
|
-
|
|
128
|
-
(source
|
|
129
|
-
(fn
|
|
130
|
-
(method_identifier
|
|
131
|
-
(type_identifier)
|
|
132
|
-
(fn_identifier))
|
|
133
|
-
(param
|
|
134
|
-
(identifier)
|
|
135
|
-
(variadic_type
|
|
136
|
-
(type
|
|
137
|
-
(a))))
|
|
138
|
-
(return_type
|
|
139
|
-
(type_identifier)
|
|
140
|
-
(generics
|
|
141
|
-
(a)))
|
|
142
|
-
(body
|
|
143
|
-
(primary_expression
|
|
144
|
-
(attribute
|
|
145
|
-
(primary_expression
|
|
146
|
-
(type_call
|
|
147
|
-
(type_identifier)
|
|
148
|
-
(argument_list)))
|
|
149
|
-
(fn_call
|
|
150
|
-
(identifier)
|
|
151
|
-
(argument_list
|
|
152
|
-
(expression
|
|
153
|
-
(primary_expression
|
|
154
|
-
(identifier))))))))))
|
|
155
|
-
|
|
156
|
-
================================================================================
|
|
157
|
-
function - static method
|
|
158
|
-
================================================================================
|
|
159
|
-
|
|
160
|
-
Int::random() -> Int =
|
|
161
|
-
todo
|
|
162
|
-
|
|
163
|
-
--------------------------------------------------------------------------------
|
|
164
|
-
|
|
165
|
-
(source
|
|
166
|
-
(fn
|
|
167
|
-
(static_identifier
|
|
168
|
-
(type_identifier)
|
|
169
|
-
(fn_identifier))
|
|
170
114
|
(return_type
|
|
171
115
|
(type_identifier))
|
|
172
116
|
(body
|
tooling/tree-sitter-plum/test/corpus/if.txt
CHANGED
|
@@ -19,19 +19,19 @@ main() =
|
|
|
19
19
|
|
|
20
20
|
(source
|
|
21
21
|
(fn
|
|
22
|
-
(
|
|
22
|
+
(fn_identifier)
|
|
23
23
|
(body
|
|
24
24
|
(if
|
|
25
25
|
(expression
|
|
26
26
|
(comparison_operator
|
|
27
27
|
(primary_expression
|
|
28
|
-
(
|
|
28
|
+
(var_identifier))
|
|
29
29
|
(primary_expression
|
|
30
|
-
(
|
|
30
|
+
(var_identifier))))
|
|
31
31
|
(body
|
|
32
32
|
(primary_expression
|
|
33
33
|
(fn_call
|
|
34
|
-
(
|
|
34
|
+
(fn_identifier)
|
|
35
35
|
(argument_list
|
|
36
36
|
(expression
|
|
37
37
|
(primary_expression
|
|
@@ -43,36 +43,36 @@ main() =
|
|
|
43
43
|
(expression
|
|
44
44
|
(comparison_operator
|
|
45
45
|
(primary_expression
|
|
46
|
-
(
|
|
46
|
+
(var_identifier))
|
|
47
47
|
(primary_expression
|
|
48
48
|
(integer))))
|
|
49
49
|
(body
|
|
50
50
|
(primary_expression
|
|
51
51
|
(fn_call
|
|
52
|
-
(
|
|
52
|
+
(fn_identifier)
|
|
53
53
|
(argument_list
|
|
54
54
|
(expression
|
|
55
55
|
(comparison_operator
|
|
56
56
|
(primary_expression
|
|
57
|
-
(
|
|
57
|
+
(var_identifier))
|
|
58
58
|
(primary_expression
|
|
59
59
|
(integer)))))))))
|
|
60
60
|
(else_if
|
|
61
61
|
(expression
|
|
62
62
|
(comparison_operator
|
|
63
63
|
(primary_expression
|
|
64
|
-
(
|
|
64
|
+
(var_identifier))
|
|
65
65
|
(primary_expression
|
|
66
66
|
(integer))))
|
|
67
67
|
(body
|
|
68
68
|
(primary_expression
|
|
69
69
|
(fn_call
|
|
70
|
-
(
|
|
70
|
+
(fn_identifier)
|
|
71
71
|
(argument_list
|
|
72
72
|
(expression
|
|
73
73
|
(comparison_operator
|
|
74
74
|
(primary_expression
|
|
75
|
-
(
|
|
75
|
+
(var_identifier))
|
|
76
76
|
(primary_expression
|
|
77
77
|
(integer)))))))))
|
|
78
78
|
(else
|
|
@@ -81,22 +81,22 @@ main() =
|
|
|
81
81
|
(expression
|
|
82
82
|
(comparison_operator
|
|
83
83
|
(primary_expression
|
|
84
|
-
(
|
|
84
|
+
(var_identifier))
|
|
85
85
|
(primary_expression
|
|
86
86
|
(integer))))
|
|
87
87
|
(body
|
|
88
88
|
(primary_expression
|
|
89
89
|
(fn_call
|
|
90
|
-
(
|
|
90
|
+
(fn_identifier)
|
|
91
91
|
(argument_list
|
|
92
92
|
(expression
|
|
93
93
|
(primary_expression
|
|
94
|
-
(
|
|
94
|
+
(var_identifier)))))))
|
|
95
95
|
(else
|
|
96
96
|
(body
|
|
97
97
|
(primary_expression
|
|
98
98
|
(fn_call
|
|
99
|
-
(
|
|
99
|
+
(fn_identifier)
|
|
100
100
|
(argument_list
|
|
101
101
|
(expression
|
|
102
102
|
(primary_expression
|
tooling/tree-sitter-plum/test/corpus/literals.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
================================================================================
|
|
2
|
-
|
|
2
|
+
literals
|
|
3
3
|
================================================================================
|
|
4
4
|
|
|
5
5
|
main() =
|
tooling/tree-sitter-plum/test/corpus/type.txt
CHANGED
|
@@ -25,30 +25,30 @@ toStr<Cat>() -> Str =
|
|
|
25
25
|
(class
|
|
26
26
|
(type_identifier)
|
|
27
27
|
(field
|
|
28
|
-
(
|
|
28
|
+
(var_identifier)
|
|
29
29
|
(type
|
|
30
30
|
(type_identifier)))
|
|
31
31
|
(field
|
|
32
|
-
(
|
|
32
|
+
(var_identifier)
|
|
33
33
|
(type
|
|
34
34
|
(b))))
|
|
35
35
|
(class
|
|
36
36
|
(type_identifier)
|
|
37
37
|
(type_identifier)
|
|
38
38
|
(field
|
|
39
|
-
(
|
|
39
|
+
(var_identifier)
|
|
40
40
|
(type
|
|
41
41
|
(type_identifier)))
|
|
42
42
|
(field
|
|
43
|
-
(
|
|
43
|
+
(var_identifier)
|
|
44
44
|
(type
|
|
45
45
|
(type_identifier))))
|
|
46
46
|
(fn
|
|
47
|
-
(
|
|
47
|
+
(fn_identifier)
|
|
48
48
|
(type
|
|
49
49
|
(type_identifier))
|
|
50
50
|
(param
|
|
51
|
-
(
|
|
51
|
+
(var_identifier)
|
|
52
52
|
(type
|
|
53
53
|
(type_identifier)))
|
|
54
54
|
(return_type
|
|
@@ -58,20 +58,20 @@ toStr<Cat>() -> Str =
|
|
|
58
58
|
(class_call
|
|
59
59
|
(type_identifier)
|
|
60
60
|
(class_argument_list
|
|
61
|
-
(
|
|
61
|
+
(var_identifier)
|
|
62
62
|
(expression
|
|
63
63
|
(primary_expression
|
|
64
|
-
(
|
|
64
|
+
(var_identifier)))
|
|
65
|
-
(
|
|
65
|
+
(var_identifier)
|
|
66
66
|
(expression
|
|
67
67
|
(primary_expression
|
|
68
68
|
(integer))))))))
|
|
69
69
|
(fn
|
|
70
|
-
(
|
|
70
|
+
(fn_identifier)
|
|
71
71
|
(type
|
|
72
72
|
(type_identifier))
|
|
73
73
|
(param
|
|
74
|
-
(
|
|
74
|
+
(var_identifier)
|
|
75
75
|
(type
|
|
76
76
|
(type_identifier)))
|
|
77
77
|
(return_type
|
|
@@ -81,18 +81,18 @@ toStr<Cat>() -> Str =
|
|
|
81
81
|
(class_call
|
|
82
82
|
(type_identifier)
|
|
83
83
|
(class_argument_list
|
|
84
|
-
(
|
|
84
|
+
(var_identifier)
|
|
85
85
|
(expression
|
|
86
86
|
(primary_expression
|
|
87
87
|
(string
|
|
88
88
|
(string_start)
|
|
89
89
|
(string_end))))
|
|
90
|
-
(
|
|
90
|
+
(var_identifier)
|
|
91
91
|
(expression
|
|
92
92
|
(primary_expression
|
|
93
|
-
(
|
|
93
|
+
(var_identifier))))))))
|
|
94
94
|
(fn
|
|
95
|
-
(
|
|
95
|
+
(fn_identifier)
|
|
96
96
|
(type
|
|
97
97
|
(type_identifier))
|
|
98
98
|
(return_type
|
|
@@ -103,15 +103,17 @@ toStr<Cat>() -> Str =
|
|
|
103
103
|
(string_start)
|
|
104
104
|
(string_content)
|
|
105
105
|
(interpolation
|
|
106
|
+
(primary_expression
|
|
106
|
-
|
|
107
|
+
(attribute
|
|
107
|
-
|
|
108
|
+
(primary_expression
|
|
108
|
-
|
|
109
|
+
(self))
|
|
109
|
-
|
|
110
|
+
(var_identifier))))
|
|
110
111
|
(string_content)
|
|
111
112
|
(interpolation
|
|
113
|
+
(primary_expression
|
|
112
|
-
|
|
114
|
+
(attribute
|
|
113
|
-
|
|
115
|
+
(primary_expression
|
|
114
|
-
|
|
116
|
+
(self))
|
|
115
|
-
|
|
117
|
+
(var_identifier))))
|
|
116
118
|
(string_content)
|
|
117
119
|
(string_end))))))
|