plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
512f582
— Peter John
2023-04-30T15:07:07+05:30
get more expressions working
Generated files not shown: src/parser.c
- grammar.js +47 -27
- src/grammar.json +160 -103
- src/node-types.json +427 -52
- test/corpus/expressions.txt +71 -0
- test/corpus/{function.txt → functions.txt} +23 -2
- test/corpus/import.txt +0 -40
- test/corpus/statements.txt +178 -0
grammar.js
CHANGED
|
@@ -2,17 +2,26 @@ const NEWLINE = /\r?\n/;
|
|
|
2
2
|
|
|
3
3
|
module.exports = grammar({
|
|
4
4
|
name: "palm",
|
|
5
|
-
|
|
5
|
+
extras: ($) => [
|
|
6
|
-
|
|
6
|
+
";",
|
|
7
|
-
|
|
7
|
+
NEWLINE,
|
|
8
|
-
|
|
8
|
+
/\s/,
|
|
9
|
+
$.module_comment,
|
|
10
|
+
$.statement_comment,
|
|
11
|
+
$.comment,
|
|
12
|
+
],
|
|
9
13
|
externals: ($) => [$.quoted_content],
|
|
10
14
|
rules: {
|
|
11
15
|
source_file: ($) =>
|
|
12
|
-
seq($.module, repeat($.import), repeat(choice($.struct, $.enum, $.function))),
|
|
16
|
+
seq($.module, repeat($.import), repeat(choice($.struct, $.enum, $.function, $.const))),
|
|
13
17
|
|
|
14
18
|
module: ($) => seq("module", field("module", $.module_name)),
|
|
15
19
|
|
|
20
|
+
/* Comments */
|
|
21
|
+
module_comment: ($) => token(seq("////", /.*/)),
|
|
22
|
+
statement_comment: ($) => token(seq("///", /.*/)),
|
|
23
|
+
comment: ($) => token(seq("//", /.*/)),
|
|
24
|
+
|
|
16
25
|
/* Import statements */
|
|
17
26
|
import: ($) =>
|
|
18
27
|
seq(
|
|
@@ -114,12 +123,18 @@ module.exports = grammar({
|
|
|
114
123
|
$.string,
|
|
115
124
|
$.integer,
|
|
116
125
|
$.float,
|
|
126
|
+
$.record,
|
|
127
|
+
// $.todo,
|
|
128
|
+
// $.panic,
|
|
129
|
+
// $.list,
|
|
117
130
|
$.identifier,
|
|
118
131
|
$.anonymous_function,
|
|
119
132
|
$.expression_group,
|
|
133
|
+
$.if,
|
|
120
134
|
$.when,
|
|
135
|
+
// $.assert,
|
|
121
136
|
$.negation,
|
|
122
|
-
|
|
137
|
+
$.record_update,
|
|
123
138
|
$.field_access,
|
|
124
139
|
$.function_call
|
|
125
140
|
),
|
|
@@ -181,6 +196,14 @@ module.exports = grammar({
|
|
|
181
196
|
"}"
|
|
182
197
|
),
|
|
183
198
|
|
|
199
|
+
if: $ => seq(
|
|
200
|
+
"if",
|
|
201
|
+
$._expression,
|
|
202
|
+
"{",
|
|
203
|
+
repeat($._expression),
|
|
204
|
+
"}"
|
|
205
|
+
),
|
|
206
|
+
|
|
184
207
|
when_entry: $ => seq(
|
|
185
208
|
choice(
|
|
186
209
|
seq($._expression, repeat(seq(",", $._expression))),
|
|
@@ -196,10 +219,24 @@ module.exports = grammar({
|
|
|
196
219
|
$.identifier,
|
|
197
220
|
$.function_call,
|
|
198
221
|
$.expression_group,
|
|
222
|
+
$.if,
|
|
199
223
|
$.when,
|
|
200
224
|
// $.record_update,
|
|
201
225
|
$.field_access,
|
|
202
226
|
),
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
_maybe_function_expression: ($) =>
|
|
230
|
+
choice(
|
|
231
|
+
$.identifier,
|
|
232
|
+
$.anonymous_function,
|
|
233
|
+
$.expression_group,
|
|
234
|
+
$.if,
|
|
235
|
+
$.when,
|
|
236
|
+
$.field_access,
|
|
237
|
+
$.function_call
|
|
238
|
+
),
|
|
239
|
+
|
|
203
240
|
field_access: ($) =>
|
|
204
241
|
prec.left(
|
|
205
242
|
seq(
|
|
@@ -223,21 +260,12 @@ module.exports = grammar({
|
|
|
223
260
|
field("arguments", $.arguments)
|
|
224
261
|
),
|
|
225
262
|
|
|
226
|
-
_maybe_function_expression: ($) =>
|
|
227
|
-
choice(
|
|
228
|
-
$.identifier,
|
|
229
|
-
$.anonymous_function,
|
|
230
|
-
$.expression_group,
|
|
231
|
-
$.when,
|
|
232
|
-
$.field_access,
|
|
233
|
-
$.function_call
|
|
234
|
-
),
|
|
235
|
-
|
|
236
263
|
negation: ($) => seq("!", $._expression_unit),
|
|
264
|
+
const: ($) => seq("const", $._assignment),
|
|
237
265
|
let: ($) => seq("let", $._assignment),
|
|
238
266
|
_assignment: ($) =>
|
|
239
267
|
seq(
|
|
240
|
-
field("pattern", $.
|
|
268
|
+
field("pattern", $._pattern_expression),
|
|
241
269
|
optional($._type_annotation),
|
|
242
270
|
"=",
|
|
243
271
|
field("value", $._expression)
|
|
@@ -259,11 +287,6 @@ module.exports = grammar({
|
|
|
259
287
|
record_update_argument: ($) =>
|
|
260
288
|
seq(field("label", $.label), ":", field("value", $._expression)),
|
|
261
289
|
|
|
262
|
-
_pattern: ($) =>
|
|
263
|
-
seq(
|
|
264
|
-
$._pattern_expression,
|
|
265
|
-
optional(field("assign", seq("as", $.identifier)))
|
|
266
|
-
),
|
|
267
290
|
_pattern_expression: ($) =>
|
|
268
291
|
choice(
|
|
269
292
|
$.identifier,
|
|
@@ -272,10 +295,7 @@ module.exports = grammar({
|
|
|
272
295
|
$.string,
|
|
273
296
|
$.integer,
|
|
274
297
|
$.float,
|
|
275
|
-
alias($._pattern_binary_expression, $.binary_expression)
|
|
276
298
|
),
|
|
277
|
-
_pattern_binary_expression: ($) =>
|
|
278
|
-
binaryExpr(prec.left, 1, "<>", $._pattern_expression),
|
|
279
299
|
|
|
280
300
|
record_pattern: ($) =>
|
|
281
301
|
seq(
|
|
@@ -292,7 +312,7 @@ module.exports = grammar({
|
|
|
292
312
|
record_pattern_argument: ($) =>
|
|
293
313
|
seq(
|
|
294
314
|
optional(seq(field("label", $.label), ":")),
|
|
295
|
-
field("pattern", $.
|
|
315
|
+
field("pattern", $._pattern_expression)
|
|
296
316
|
),
|
|
297
317
|
pattern_spread: ($) => seq("..", optional(",")),
|
|
298
318
|
|
|
@@ -325,7 +345,7 @@ module.exports = grammar({
|
|
|
325
345
|
visibility_modifier: ($) => "pub",
|
|
326
346
|
|
|
327
347
|
/* Literals */
|
|
328
|
-
float: ($) => /-?[0-
|
|
348
|
+
float: ($) => /-?[0-9]+\.[0-9]*/,
|
|
329
349
|
integer: ($) =>
|
|
330
350
|
seq(optional("-"), choice($._hex, $._decimal, $._octal, $._binary)),
|
|
331
351
|
string: ($) =>
|
src/grammar.json
CHANGED
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
{
|
|
32
32
|
"type": "SYMBOL",
|
|
33
33
|
"name": "function"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"type": "SYMBOL",
|
|
37
|
+
"name": "const"
|
|
34
38
|
}
|
|
35
39
|
]
|
|
36
40
|
}
|
|
@@ -54,6 +58,54 @@
|
|
|
54
58
|
}
|
|
55
59
|
]
|
|
56
60
|
},
|
|
61
|
+
"module_comment": {
|
|
62
|
+
"type": "TOKEN",
|
|
63
|
+
"content": {
|
|
64
|
+
"type": "SEQ",
|
|
65
|
+
"members": [
|
|
66
|
+
{
|
|
67
|
+
"type": "STRING",
|
|
68
|
+
"value": "////"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"type": "PATTERN",
|
|
72
|
+
"value": ".*"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"statement_comment": {
|
|
78
|
+
"type": "TOKEN",
|
|
79
|
+
"content": {
|
|
80
|
+
"type": "SEQ",
|
|
81
|
+
"members": [
|
|
82
|
+
{
|
|
83
|
+
"type": "STRING",
|
|
84
|
+
"value": "///"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"type": "PATTERN",
|
|
88
|
+
"value": ".*"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"comment": {
|
|
94
|
+
"type": "TOKEN",
|
|
95
|
+
"content": {
|
|
96
|
+
"type": "SEQ",
|
|
97
|
+
"members": [
|
|
98
|
+
{
|
|
99
|
+
"type": "STRING",
|
|
100
|
+
"value": "//"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"type": "PATTERN",
|
|
104
|
+
"value": ".*"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
57
109
|
"import": {
|
|
58
110
|
"type": "SEQ",
|
|
59
111
|
"members": [
|
|
@@ -1216,6 +1268,10 @@
|
|
|
1216
1268
|
"type": "SYMBOL",
|
|
1217
1269
|
"name": "float"
|
|
1218
1270
|
},
|
|
1271
|
+
{
|
|
1272
|
+
"type": "SYMBOL",
|
|
1273
|
+
"name": "record"
|
|
1274
|
+
},
|
|
1219
1275
|
{
|
|
1220
1276
|
"type": "SYMBOL",
|
|
1221
1277
|
"name": "identifier"
|
|
@@ -1228,6 +1284,10 @@
|
|
|
1228
1284
|
"type": "SYMBOL",
|
|
1229
1285
|
"name": "expression_group"
|
|
1230
1286
|
},
|
|
1287
|
+
{
|
|
1288
|
+
"type": "SYMBOL",
|
|
1289
|
+
"name": "if"
|
|
1290
|
+
},
|
|
1231
1291
|
{
|
|
1232
1292
|
"type": "SYMBOL",
|
|
1233
1293
|
"name": "when"
|
|
@@ -1236,6 +1296,10 @@
|
|
|
1236
1296
|
"type": "SYMBOL",
|
|
1237
1297
|
"name": "negation"
|
|
1238
1298
|
},
|
|
1299
|
+
{
|
|
1300
|
+
"type": "SYMBOL",
|
|
1301
|
+
"name": "record_update"
|
|
1302
|
+
},
|
|
1239
1303
|
{
|
|
1240
1304
|
"type": "SYMBOL",
|
|
1241
1305
|
"name": "field_access"
|
|
@@ -1593,6 +1657,34 @@
|
|
|
1593
1657
|
}
|
|
1594
1658
|
]
|
|
1595
1659
|
},
|
|
1660
|
+
"if": {
|
|
1661
|
+
"type": "SEQ",
|
|
1662
|
+
"members": [
|
|
1663
|
+
{
|
|
1664
|
+
"type": "STRING",
|
|
1665
|
+
"value": "if"
|
|
1666
|
+
},
|
|
1667
|
+
{
|
|
1668
|
+
"type": "SYMBOL",
|
|
1669
|
+
"name": "_expression"
|
|
1670
|
+
},
|
|
1671
|
+
{
|
|
1672
|
+
"type": "STRING",
|
|
1673
|
+
"value": "{"
|
|
1674
|
+
},
|
|
1675
|
+
{
|
|
1676
|
+
"type": "REPEAT",
|
|
1677
|
+
"content": {
|
|
1678
|
+
"type": "SYMBOL",
|
|
1679
|
+
"name": "_expression"
|
|
1680
|
+
}
|
|
1681
|
+
},
|
|
1682
|
+
{
|
|
1683
|
+
"type": "STRING",
|
|
1684
|
+
"value": "}"
|
|
1685
|
+
}
|
|
1686
|
+
]
|
|
1687
|
+
},
|
|
1596
1688
|
"when_entry": {
|
|
1597
1689
|
"type": "SEQ",
|
|
1598
1690
|
"members": [
|
|
@@ -1659,6 +1751,10 @@
|
|
|
1659
1751
|
"type": "SYMBOL",
|
|
1660
1752
|
"name": "expression_group"
|
|
1661
1753
|
},
|
|
1754
|
+
{
|
|
1755
|
+
"type": "SYMBOL",
|
|
1756
|
+
"name": "if"
|
|
1757
|
+
},
|
|
1662
1758
|
{
|
|
1663
1759
|
"type": "SYMBOL",
|
|
1664
1760
|
"name": "when"
|
|
@@ -1669,6 +1765,39 @@
|
|
|
1669
1765
|
}
|
|
1670
1766
|
]
|
|
1671
1767
|
},
|
|
1768
|
+
"_maybe_function_expression": {
|
|
1769
|
+
"type": "CHOICE",
|
|
1770
|
+
"members": [
|
|
1771
|
+
{
|
|
1772
|
+
"type": "SYMBOL",
|
|
1773
|
+
"name": "identifier"
|
|
1774
|
+
},
|
|
1775
|
+
{
|
|
1776
|
+
"type": "SYMBOL",
|
|
1777
|
+
"name": "anonymous_function"
|
|
1778
|
+
},
|
|
1779
|
+
{
|
|
1780
|
+
"type": "SYMBOL",
|
|
1781
|
+
"name": "expression_group"
|
|
1782
|
+
},
|
|
1783
|
+
{
|
|
1784
|
+
"type": "SYMBOL",
|
|
1785
|
+
"name": "if"
|
|
1786
|
+
},
|
|
1787
|
+
{
|
|
1788
|
+
"type": "SYMBOL",
|
|
1789
|
+
"name": "when"
|
|
1790
|
+
},
|
|
1791
|
+
{
|
|
1792
|
+
"type": "SYMBOL",
|
|
1793
|
+
"name": "field_access"
|
|
1794
|
+
},
|
|
1795
|
+
{
|
|
1796
|
+
"type": "SYMBOL",
|
|
1797
|
+
"name": "function_call"
|
|
1798
|
+
}
|
|
1799
|
+
]
|
|
1800
|
+
},
|
|
1672
1801
|
"field_access": {
|
|
1673
1802
|
"type": "PREC_LEFT",
|
|
1674
1803
|
"value": 0,
|
|
@@ -1828,45 +1957,29 @@
|
|
|
1828
1957
|
}
|
|
1829
1958
|
]
|
|
1830
1959
|
},
|
|
1831
|
-
"
|
|
1960
|
+
"negation": {
|
|
1832
|
-
"type": "
|
|
1961
|
+
"type": "SEQ",
|
|
1833
1962
|
"members": [
|
|
1834
1963
|
{
|
|
1835
|
-
"type": "
|
|
1964
|
+
"type": "STRING",
|
|
1836
|
-
"name": "identifier"
|
|
1837
|
-
},
|
|
1838
|
-
{
|
|
1839
|
-
"type": "SYMBOL",
|
|
1840
|
-
"name": "anonymous_function"
|
|
1841
|
-
},
|
|
1842
|
-
{
|
|
1843
|
-
"type": "SYMBOL",
|
|
1844
|
-
"name": "expression_group"
|
|
1845
|
-
},
|
|
1846
|
-
{
|
|
1847
|
-
"type": "SYMBOL",
|
|
1848
|
-
"
|
|
1965
|
+
"value": "!"
|
|
1849
|
-
},
|
|
1850
|
-
{
|
|
1851
|
-
"type": "SYMBOL",
|
|
1852
|
-
"name": "field_access"
|
|
1853
1966
|
},
|
|
1854
1967
|
{
|
|
1855
1968
|
"type": "SYMBOL",
|
|
1856
|
-
"name": "
|
|
1969
|
+
"name": "_expression_unit"
|
|
1857
1970
|
}
|
|
1858
1971
|
]
|
|
1859
1972
|
},
|
|
1860
|
-
"
|
|
1973
|
+
"const": {
|
|
1861
1974
|
"type": "SEQ",
|
|
1862
1975
|
"members": [
|
|
1863
1976
|
{
|
|
1864
1977
|
"type": "STRING",
|
|
1865
|
-
"value": "
|
|
1978
|
+
"value": "const"
|
|
1866
1979
|
},
|
|
1867
1980
|
{
|
|
1868
1981
|
"type": "SYMBOL",
|
|
1869
|
-
"name": "
|
|
1982
|
+
"name": "_assignment"
|
|
1870
1983
|
}
|
|
1871
1984
|
]
|
|
1872
1985
|
},
|
|
@@ -1891,7 +2004,7 @@
|
|
|
1891
2004
|
"name": "pattern",
|
|
1892
2005
|
"content": {
|
|
1893
2006
|
"type": "SYMBOL",
|
|
1894
|
-
"name": "
|
|
2007
|
+
"name": "_pattern_expression"
|
|
1895
2008
|
}
|
|
1896
2009
|
},
|
|
1897
2010
|
{
|
|
@@ -2027,40 +2140,6 @@
|
|
|
2027
2140
|
}
|
|
2028
2141
|
]
|
|
2029
2142
|
},
|
|
2030
|
-
"_pattern": {
|
|
2031
|
-
"type": "SEQ",
|
|
2032
|
-
"members": [
|
|
2033
|
-
{
|
|
2034
|
-
"type": "SYMBOL",
|
|
2035
|
-
"name": "_pattern_expression"
|
|
2036
|
-
},
|
|
2037
|
-
{
|
|
2038
|
-
"type": "CHOICE",
|
|
2039
|
-
"members": [
|
|
2040
|
-
{
|
|
2041
|
-
"type": "FIELD",
|
|
2042
|
-
"name": "assign",
|
|
2043
|
-
"content": {
|
|
2044
|
-
"type": "SEQ",
|
|
2045
|
-
"members": [
|
|
2046
|
-
{
|
|
2047
|
-
"type": "STRING",
|
|
2048
|
-
"value": "as"
|
|
2049
|
-
},
|
|
2050
|
-
{
|
|
2051
|
-
"type": "SYMBOL",
|
|
2052
|
-
"name": "identifier"
|
|
2053
|
-
}
|
|
2054
|
-
]
|
|
2055
|
-
}
|
|
2056
|
-
},
|
|
2057
|
-
{
|
|
2058
|
-
"type": "BLANK"
|
|
2059
|
-
}
|
|
2060
|
-
]
|
|
2061
|
-
}
|
|
2062
|
-
]
|
|
2063
|
-
},
|
|
2064
2143
|
"_pattern_expression": {
|
|
2065
2144
|
"type": "CHOICE",
|
|
2066
2145
|
"members": [
|
|
@@ -2087,51 +2166,9 @@
|
|
|
2087
2166
|
{
|
|
2088
2167
|
"type": "SYMBOL",
|
|
2089
2168
|
"name": "float"
|
|
2090
|
-
},
|
|
2091
|
-
{
|
|
2092
|
-
"type": "ALIAS",
|
|
2093
|
-
"content": {
|
|
2094
|
-
"type": "SYMBOL",
|
|
2095
|
-
"name": "_pattern_binary_expression"
|
|
2096
|
-
},
|
|
2097
|
-
"named": true,
|
|
2098
|
-
"value": "binary_expression"
|
|
2099
2169
|
}
|
|
2100
2170
|
]
|
|
2101
2171
|
},
|
|
2102
|
-
"_pattern_binary_expression": {
|
|
2103
|
-
"type": "PREC_LEFT",
|
|
2104
|
-
"value": 1,
|
|
2105
|
-
"content": {
|
|
2106
|
-
"type": "SEQ",
|
|
2107
|
-
"members": [
|
|
2108
|
-
{
|
|
2109
|
-
"type": "FIELD",
|
|
2110
|
-
"name": "left",
|
|
2111
|
-
"content": {
|
|
2112
|
-
"type": "SYMBOL",
|
|
2113
|
-
"name": "_pattern_expression"
|
|
2114
|
-
}
|
|
2115
|
-
},
|
|
2116
|
-
{
|
|
2117
|
-
"type": "FIELD",
|
|
2118
|
-
"name": "operator",
|
|
2119
|
-
"content": {
|
|
2120
|
-
"type": "STRING",
|
|
2121
|
-
"value": "<>"
|
|
2122
|
-
}
|
|
2123
|
-
},
|
|
2124
|
-
{
|
|
2125
|
-
"type": "FIELD",
|
|
2126
|
-
"name": "right",
|
|
2127
|
-
"content": {
|
|
2128
|
-
"type": "SYMBOL",
|
|
2129
|
-
"name": "_pattern_expression"
|
|
2130
|
-
}
|
|
2131
|
-
}
|
|
2132
|
-
]
|
|
2133
|
-
}
|
|
2134
|
-
},
|
|
2135
2172
|
"record_pattern": {
|
|
2136
2173
|
"type": "SEQ",
|
|
2137
2174
|
"members": [
|
|
@@ -2264,7 +2301,7 @@
|
|
|
2264
2301
|
"name": "pattern",
|
|
2265
2302
|
"content": {
|
|
2266
2303
|
"type": "SYMBOL",
|
|
2267
|
-
"name": "
|
|
2304
|
+
"name": "_pattern_expression"
|
|
2268
2305
|
}
|
|
2269
2306
|
}
|
|
2270
2307
|
]
|
|
@@ -2578,7 +2615,7 @@
|
|
|
2578
2615
|
},
|
|
2579
2616
|
"float": {
|
|
2580
2617
|
"type": "PATTERN",
|
|
2581
|
-
"value": "-?[0-
|
|
2618
|
+
"value": "-?[0-9]+\\.[0-9]*"
|
|
2582
2619
|
},
|
|
2583
2620
|
"integer": {
|
|
2584
2621
|
"type": "SEQ",
|
|
@@ -2788,9 +2825,29 @@
|
|
|
2788
2825
|
}
|
|
2789
2826
|
},
|
|
2790
2827
|
"extras": [
|
|
2828
|
+
{
|
|
2829
|
+
"type": "STRING",
|
|
2830
|
+
"value": ";"
|
|
2831
|
+
},
|
|
2832
|
+
{
|
|
2833
|
+
"type": "PATTERN",
|
|
2834
|
+
"value": "\\r?\\n"
|
|
2835
|
+
},
|
|
2791
2836
|
{
|
|
2792
2837
|
"type": "PATTERN",
|
|
2793
2838
|
"value": "\\s"
|
|
2839
|
+
},
|
|
2840
|
+
{
|
|
2841
|
+
"type": "SYMBOL",
|
|
2842
|
+
"name": "module_comment"
|
|
2843
|
+
},
|
|
2844
|
+
{
|
|
2845
|
+
"type": "SYMBOL",
|
|
2846
|
+
"name": "statement_comment"
|
|
2847
|
+
},
|
|
2848
|
+
{
|
|
2849
|
+
"type": "SYMBOL",
|
|
2850
|
+
"name": "comment"
|
|
2794
2851
|
}
|
|
2795
2852
|
],
|
|
2796
2853
|
"conflicts": [],
|
src/node-types.json
CHANGED
|
@@ -93,6 +93,10 @@
|
|
|
93
93
|
"type": "identifier",
|
|
94
94
|
"named": true
|
|
95
95
|
},
|
|
96
|
+
{
|
|
97
|
+
"type": "if",
|
|
98
|
+
"named": true
|
|
99
|
+
},
|
|
96
100
|
{
|
|
97
101
|
"type": "integer",
|
|
98
102
|
"named": true
|
|
@@ -101,6 +105,14 @@
|
|
|
101
105
|
"type": "negation",
|
|
102
106
|
"named": true
|
|
103
107
|
},
|
|
108
|
+
{
|
|
109
|
+
"type": "record",
|
|
110
|
+
"named": true
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"type": "record_update",
|
|
114
|
+
"named": true
|
|
115
|
+
},
|
|
104
116
|
{
|
|
105
117
|
"type": "string",
|
|
106
118
|
"named": true
|
|
@@ -144,10 +156,6 @@
|
|
|
144
156
|
"type": "binary_expression",
|
|
145
157
|
"named": true
|
|
146
158
|
},
|
|
147
|
-
{
|
|
148
|
-
"type": "discard",
|
|
149
|
-
"named": true
|
|
150
|
-
},
|
|
151
159
|
{
|
|
152
160
|
"type": "expression_group",
|
|
153
161
|
"named": true
|
|
@@ -168,6 +176,10 @@
|
|
|
168
176
|
"type": "identifier",
|
|
169
177
|
"named": true
|
|
170
178
|
},
|
|
179
|
+
{
|
|
180
|
+
"type": "if",
|
|
181
|
+
"named": true
|
|
182
|
+
},
|
|
171
183
|
{
|
|
172
184
|
"type": "integer",
|
|
173
185
|
"named": true
|
|
@@ -177,7 +189,11 @@
|
|
|
177
189
|
"named": true
|
|
178
190
|
},
|
|
179
191
|
{
|
|
192
|
+
"type": "record",
|
|
193
|
+
"named": true
|
|
194
|
+
},
|
|
195
|
+
{
|
|
180
|
-
"type": "
|
|
196
|
+
"type": "record_update",
|
|
181
197
|
"named": true
|
|
182
198
|
},
|
|
183
199
|
{
|
|
@@ -268,10 +284,122 @@
|
|
|
268
284
|
"type": "binary_expression",
|
|
269
285
|
"named": true
|
|
270
286
|
},
|
|
287
|
+
{
|
|
288
|
+
"type": "expression_group",
|
|
289
|
+
"named": true
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"type": "field_access",
|
|
293
|
+
"named": true
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"type": "float",
|
|
297
|
+
"named": true
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"type": "function_call",
|
|
301
|
+
"named": true
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"type": "identifier",
|
|
305
|
+
"named": true
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"type": "if",
|
|
309
|
+
"named": true
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"type": "integer",
|
|
313
|
+
"named": true
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"type": "negation",
|
|
317
|
+
"named": true
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"type": "record",
|
|
321
|
+
"named": true
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"type": "record_update",
|
|
325
|
+
"named": true
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"type": "string",
|
|
329
|
+
"named": true
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"type": "when",
|
|
333
|
+
"named": true
|
|
334
|
+
}
|
|
335
|
+
]
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"type": "const",
|
|
341
|
+
"named": true,
|
|
342
|
+
"fields": {
|
|
343
|
+
"pattern": {
|
|
344
|
+
"multiple": false,
|
|
345
|
+
"required": true,
|
|
346
|
+
"types": [
|
|
271
347
|
{
|
|
272
348
|
"type": "discard",
|
|
273
349
|
"named": true
|
|
274
350
|
},
|
|
351
|
+
{
|
|
352
|
+
"type": "float",
|
|
353
|
+
"named": true
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"type": "identifier",
|
|
357
|
+
"named": true
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"type": "integer",
|
|
361
|
+
"named": true
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"type": "record_pattern",
|
|
365
|
+
"named": true
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"type": "string",
|
|
369
|
+
"named": true
|
|
370
|
+
}
|
|
371
|
+
]
|
|
372
|
+
},
|
|
373
|
+
"type": {
|
|
374
|
+
"multiple": false,
|
|
375
|
+
"required": false,
|
|
376
|
+
"types": [
|
|
377
|
+
{
|
|
378
|
+
"type": "function_type",
|
|
379
|
+
"named": true
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"type": "generic",
|
|
383
|
+
"named": true
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"type": "type",
|
|
387
|
+
"named": true
|
|
388
|
+
}
|
|
389
|
+
]
|
|
390
|
+
},
|
|
391
|
+
"value": {
|
|
392
|
+
"multiple": false,
|
|
393
|
+
"required": true,
|
|
394
|
+
"types": [
|
|
395
|
+
{
|
|
396
|
+
"type": "anonymous_function",
|
|
397
|
+
"named": true
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"type": "binary_expression",
|
|
401
|
+
"named": true
|
|
402
|
+
},
|
|
275
403
|
{
|
|
276
404
|
"type": "expression_group",
|
|
277
405
|
"named": true
|
|
@@ -292,6 +420,10 @@
|
|
|
292
420
|
"type": "identifier",
|
|
293
421
|
"named": true
|
|
294
422
|
},
|
|
423
|
+
{
|
|
424
|
+
"type": "if",
|
|
425
|
+
"named": true
|
|
426
|
+
},
|
|
295
427
|
{
|
|
296
428
|
"type": "integer",
|
|
297
429
|
"named": true
|
|
@@ -301,7 +433,11 @@
|
|
|
301
433
|
"named": true
|
|
302
434
|
},
|
|
303
435
|
{
|
|
436
|
+
"type": "record",
|
|
437
|
+
"named": true
|
|
438
|
+
},
|
|
439
|
+
{
|
|
304
|
-
"type": "
|
|
440
|
+
"type": "record_update",
|
|
305
441
|
"named": true
|
|
306
442
|
},
|
|
307
443
|
{
|
|
@@ -436,6 +572,10 @@
|
|
|
436
572
|
"type": "identifier",
|
|
437
573
|
"named": true
|
|
438
574
|
},
|
|
575
|
+
{
|
|
576
|
+
"type": "if",
|
|
577
|
+
"named": true
|
|
578
|
+
},
|
|
439
579
|
{
|
|
440
580
|
"type": "integer",
|
|
441
581
|
"named": true
|
|
@@ -448,6 +588,14 @@
|
|
|
448
588
|
"type": "negation",
|
|
449
589
|
"named": true
|
|
450
590
|
},
|
|
591
|
+
{
|
|
592
|
+
"type": "record",
|
|
593
|
+
"named": true
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
"type": "record_update",
|
|
597
|
+
"named": true
|
|
598
|
+
},
|
|
451
599
|
{
|
|
452
600
|
"type": "string",
|
|
453
601
|
"named": true
|
|
@@ -527,6 +675,10 @@
|
|
|
527
675
|
"type": "identifier",
|
|
528
676
|
"named": true
|
|
529
677
|
},
|
|
678
|
+
{
|
|
679
|
+
"type": "if",
|
|
680
|
+
"named": true
|
|
681
|
+
},
|
|
530
682
|
{
|
|
531
683
|
"type": "record",
|
|
532
684
|
"named": true
|
|
@@ -575,6 +727,10 @@
|
|
|
575
727
|
"type": "identifier",
|
|
576
728
|
"named": true
|
|
577
729
|
},
|
|
730
|
+
{
|
|
731
|
+
"type": "if",
|
|
732
|
+
"named": true
|
|
733
|
+
},
|
|
578
734
|
{
|
|
579
735
|
"type": "integer",
|
|
580
736
|
"named": true
|
|
@@ -587,6 +743,14 @@
|
|
|
587
743
|
"type": "negation",
|
|
588
744
|
"named": true
|
|
589
745
|
},
|
|
746
|
+
{
|
|
747
|
+
"type": "record",
|
|
748
|
+
"named": true
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
"type": "record_update",
|
|
752
|
+
"named": true
|
|
753
|
+
},
|
|
590
754
|
{
|
|
591
755
|
"type": "string",
|
|
592
756
|
"named": true
|
|
@@ -695,6 +859,10 @@
|
|
|
695
859
|
"type": "identifier",
|
|
696
860
|
"named": true
|
|
697
861
|
},
|
|
862
|
+
{
|
|
863
|
+
"type": "if",
|
|
864
|
+
"named": true
|
|
865
|
+
},
|
|
698
866
|
{
|
|
699
867
|
"type": "integer",
|
|
700
868
|
"named": true
|
|
@@ -707,6 +875,14 @@
|
|
|
707
875
|
"type": "negation",
|
|
708
876
|
"named": true
|
|
709
877
|
},
|
|
878
|
+
{
|
|
879
|
+
"type": "record",
|
|
880
|
+
"named": true
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
"type": "record_update",
|
|
884
|
+
"named": true
|
|
885
|
+
},
|
|
710
886
|
{
|
|
711
887
|
"type": "string",
|
|
712
888
|
"named": true
|
|
@@ -756,6 +932,10 @@
|
|
|
756
932
|
"type": "identifier",
|
|
757
933
|
"named": true
|
|
758
934
|
},
|
|
935
|
+
{
|
|
936
|
+
"type": "if",
|
|
937
|
+
"named": true
|
|
938
|
+
},
|
|
759
939
|
{
|
|
760
940
|
"type": "when",
|
|
761
941
|
"named": true
|
|
@@ -886,6 +1066,73 @@
|
|
|
886
1066
|
"named": true,
|
|
887
1067
|
"fields": {}
|
|
888
1068
|
},
|
|
1069
|
+
{
|
|
1070
|
+
"type": "if",
|
|
1071
|
+
"named": true,
|
|
1072
|
+
"fields": {},
|
|
1073
|
+
"children": {
|
|
1074
|
+
"multiple": true,
|
|
1075
|
+
"required": true,
|
|
1076
|
+
"types": [
|
|
1077
|
+
{
|
|
1078
|
+
"type": "anonymous_function",
|
|
1079
|
+
"named": true
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
"type": "binary_expression",
|
|
1083
|
+
"named": true
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
"type": "expression_group",
|
|
1087
|
+
"named": true
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
"type": "field_access",
|
|
1091
|
+
"named": true
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
"type": "float",
|
|
1095
|
+
"named": true
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
"type": "function_call",
|
|
1099
|
+
"named": true
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
"type": "identifier",
|
|
1103
|
+
"named": true
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
"type": "if",
|
|
1107
|
+
"named": true
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
"type": "integer",
|
|
1111
|
+
"named": true
|
|
1112
|
+
},
|
|
1113
|
+
{
|
|
1114
|
+
"type": "negation",
|
|
1115
|
+
"named": true
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
"type": "record",
|
|
1119
|
+
"named": true
|
|
1120
|
+
},
|
|
1121
|
+
{
|
|
1122
|
+
"type": "record_update",
|
|
1123
|
+
"named": true
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
"type": "string",
|
|
1127
|
+
"named": true
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
"type": "when",
|
|
1131
|
+
"named": true
|
|
1132
|
+
}
|
|
1133
|
+
]
|
|
1134
|
+
}
|
|
1135
|
+
},
|
|
889
1136
|
{
|
|
890
1137
|
"type": "import",
|
|
891
1138
|
"named": true,
|
|
@@ -936,32 +1183,10 @@
|
|
|
936
1183
|
"type": "let",
|
|
937
1184
|
"named": true,
|
|
938
1185
|
"fields": {
|
|
939
|
-
"assign": {
|
|
940
|
-
"multiple": true,
|
|
941
|
-
"required": false,
|
|
942
|
-
"types": [
|
|
943
|
-
{
|
|
944
|
-
"type": "as",
|
|
945
|
-
"named": false
|
|
946
|
-
},
|
|
947
|
-
{
|
|
948
|
-
"type": "identifier",
|
|
949
|
-
"named": true
|
|
950
|
-
}
|
|
951
|
-
]
|
|
952
|
-
},
|
|
953
1186
|
"pattern": {
|
|
954
|
-
"multiple":
|
|
1187
|
+
"multiple": false,
|
|
955
1188
|
"required": true,
|
|
956
1189
|
"types": [
|
|
957
|
-
{
|
|
958
|
-
"type": "as",
|
|
959
|
-
"named": false
|
|
960
|
-
},
|
|
961
|
-
{
|
|
962
|
-
"type": "binary_expression",
|
|
963
|
-
"named": true
|
|
964
|
-
},
|
|
965
1190
|
{
|
|
966
1191
|
"type": "discard",
|
|
967
1192
|
"named": true
|
|
@@ -1038,6 +1263,10 @@
|
|
|
1038
1263
|
"type": "identifier",
|
|
1039
1264
|
"named": true
|
|
1040
1265
|
},
|
|
1266
|
+
{
|
|
1267
|
+
"type": "if",
|
|
1268
|
+
"named": true
|
|
1269
|
+
},
|
|
1041
1270
|
{
|
|
1042
1271
|
"type": "integer",
|
|
1043
1272
|
"named": true
|
|
@@ -1046,6 +1275,14 @@
|
|
|
1046
1275
|
"type": "negation",
|
|
1047
1276
|
"named": true
|
|
1048
1277
|
},
|
|
1278
|
+
{
|
|
1279
|
+
"type": "record",
|
|
1280
|
+
"named": true
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
"type": "record_update",
|
|
1284
|
+
"named": true
|
|
1285
|
+
},
|
|
1049
1286
|
{
|
|
1050
1287
|
"type": "string",
|
|
1051
1288
|
"named": true
|
|
@@ -1111,6 +1348,10 @@
|
|
|
1111
1348
|
"type": "identifier",
|
|
1112
1349
|
"named": true
|
|
1113
1350
|
},
|
|
1351
|
+
{
|
|
1352
|
+
"type": "if",
|
|
1353
|
+
"named": true
|
|
1354
|
+
},
|
|
1114
1355
|
{
|
|
1115
1356
|
"type": "integer",
|
|
1116
1357
|
"named": true
|
|
@@ -1119,6 +1360,14 @@
|
|
|
1119
1360
|
"type": "negation",
|
|
1120
1361
|
"named": true
|
|
1121
1362
|
},
|
|
1363
|
+
{
|
|
1364
|
+
"type": "record",
|
|
1365
|
+
"named": true
|
|
1366
|
+
},
|
|
1367
|
+
{
|
|
1368
|
+
"type": "record_update",
|
|
1369
|
+
"named": true
|
|
1370
|
+
},
|
|
1122
1371
|
{
|
|
1123
1372
|
"type": "string",
|
|
1124
1373
|
"named": true
|
|
@@ -1191,20 +1440,6 @@
|
|
|
1191
1440
|
"type": "record_pattern_argument",
|
|
1192
1441
|
"named": true,
|
|
1193
1442
|
"fields": {
|
|
1194
|
-
"assign": {
|
|
1195
|
-
"multiple": true,
|
|
1196
|
-
"required": false,
|
|
1197
|
-
"types": [
|
|
1198
|
-
{
|
|
1199
|
-
"type": "as",
|
|
1200
|
-
"named": false
|
|
1201
|
-
},
|
|
1202
|
-
{
|
|
1203
|
-
"type": "identifier",
|
|
1204
|
-
"named": true
|
|
1205
|
-
}
|
|
1206
|
-
]
|
|
1207
|
-
},
|
|
1208
1443
|
"label": {
|
|
1209
1444
|
"multiple": false,
|
|
1210
1445
|
"required": false,
|
|
@@ -1216,17 +1451,9 @@
|
|
|
1216
1451
|
]
|
|
1217
1452
|
},
|
|
1218
1453
|
"pattern": {
|
|
1219
|
-
"multiple":
|
|
1454
|
+
"multiple": false,
|
|
1220
1455
|
"required": true,
|
|
1221
1456
|
"types": [
|
|
1222
|
-
{
|
|
1223
|
-
"type": "as",
|
|
1224
|
-
"named": false
|
|
1225
|
-
},
|
|
1226
|
-
{
|
|
1227
|
-
"type": "binary_expression",
|
|
1228
|
-
"named": true
|
|
1229
|
-
},
|
|
1230
1457
|
{
|
|
1231
1458
|
"type": "discard",
|
|
1232
1459
|
"named": true
|
|
@@ -1274,6 +1501,94 @@
|
|
|
1274
1501
|
]
|
|
1275
1502
|
}
|
|
1276
1503
|
},
|
|
1504
|
+
{
|
|
1505
|
+
"type": "record_update",
|
|
1506
|
+
"named": true,
|
|
1507
|
+
"fields": {
|
|
1508
|
+
"arguments": {
|
|
1509
|
+
"multiple": false,
|
|
1510
|
+
"required": true,
|
|
1511
|
+
"types": [
|
|
1512
|
+
{
|
|
1513
|
+
"type": "record_update_arguments",
|
|
1514
|
+
"named": true
|
|
1515
|
+
}
|
|
1516
|
+
]
|
|
1517
|
+
},
|
|
1518
|
+
"constructor": {
|
|
1519
|
+
"multiple": false,
|
|
1520
|
+
"required": true,
|
|
1521
|
+
"types": [
|
|
1522
|
+
{
|
|
1523
|
+
"type": "constructor_name",
|
|
1524
|
+
"named": true
|
|
1525
|
+
}
|
|
1526
|
+
]
|
|
1527
|
+
},
|
|
1528
|
+
"spread": {
|
|
1529
|
+
"multiple": false,
|
|
1530
|
+
"required": true,
|
|
1531
|
+
"types": [
|
|
1532
|
+
{
|
|
1533
|
+
"type": "anonymous_function",
|
|
1534
|
+
"named": true
|
|
1535
|
+
},
|
|
1536
|
+
{
|
|
1537
|
+
"type": "binary_expression",
|
|
1538
|
+
"named": true
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
"type": "expression_group",
|
|
1542
|
+
"named": true
|
|
1543
|
+
},
|
|
1544
|
+
{
|
|
1545
|
+
"type": "field_access",
|
|
1546
|
+
"named": true
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
"type": "float",
|
|
1550
|
+
"named": true
|
|
1551
|
+
},
|
|
1552
|
+
{
|
|
1553
|
+
"type": "function_call",
|
|
1554
|
+
"named": true
|
|
1555
|
+
},
|
|
1556
|
+
{
|
|
1557
|
+
"type": "identifier",
|
|
1558
|
+
"named": true
|
|
1559
|
+
},
|
|
1560
|
+
{
|
|
1561
|
+
"type": "if",
|
|
1562
|
+
"named": true
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
"type": "integer",
|
|
1566
|
+
"named": true
|
|
1567
|
+
},
|
|
1568
|
+
{
|
|
1569
|
+
"type": "negation",
|
|
1570
|
+
"named": true
|
|
1571
|
+
},
|
|
1572
|
+
{
|
|
1573
|
+
"type": "record",
|
|
1574
|
+
"named": true
|
|
1575
|
+
},
|
|
1576
|
+
{
|
|
1577
|
+
"type": "record_update",
|
|
1578
|
+
"named": true
|
|
1579
|
+
},
|
|
1580
|
+
{
|
|
1581
|
+
"type": "string",
|
|
1582
|
+
"named": true
|
|
1583
|
+
},
|
|
1584
|
+
{
|
|
1585
|
+
"type": "when",
|
|
1586
|
+
"named": true
|
|
1587
|
+
}
|
|
1588
|
+
]
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
},
|
|
1277
1592
|
{
|
|
1278
1593
|
"type": "record_update_argument",
|
|
1279
1594
|
"named": true,
|
|
@@ -1320,6 +1635,10 @@
|
|
|
1320
1635
|
"type": "identifier",
|
|
1321
1636
|
"named": true
|
|
1322
1637
|
},
|
|
1638
|
+
{
|
|
1639
|
+
"type": "if",
|
|
1640
|
+
"named": true
|
|
1641
|
+
},
|
|
1323
1642
|
{
|
|
1324
1643
|
"type": "integer",
|
|
1325
1644
|
"named": true
|
|
@@ -1328,6 +1647,14 @@
|
|
|
1328
1647
|
"type": "negation",
|
|
1329
1648
|
"named": true
|
|
1330
1649
|
},
|
|
1650
|
+
{
|
|
1651
|
+
"type": "record",
|
|
1652
|
+
"named": true
|
|
1653
|
+
},
|
|
1654
|
+
{
|
|
1655
|
+
"type": "record_update",
|
|
1656
|
+
"named": true
|
|
1657
|
+
},
|
|
1331
1658
|
{
|
|
1332
1659
|
"type": "string",
|
|
1333
1660
|
"named": true
|
|
@@ -1387,6 +1714,10 @@
|
|
|
1387
1714
|
"multiple": true,
|
|
1388
1715
|
"required": true,
|
|
1389
1716
|
"types": [
|
|
1717
|
+
{
|
|
1718
|
+
"type": "const",
|
|
1719
|
+
"named": true
|
|
1720
|
+
},
|
|
1390
1721
|
{
|
|
1391
1722
|
"type": "enum",
|
|
1392
1723
|
"named": true
|
|
@@ -1637,6 +1968,10 @@
|
|
|
1637
1968
|
"type": "identifier",
|
|
1638
1969
|
"named": true
|
|
1639
1970
|
},
|
|
1971
|
+
{
|
|
1972
|
+
"type": "if",
|
|
1973
|
+
"named": true
|
|
1974
|
+
},
|
|
1640
1975
|
{
|
|
1641
1976
|
"type": "integer",
|
|
1642
1977
|
"named": true
|
|
@@ -1645,6 +1980,14 @@
|
|
|
1645
1980
|
"type": "negation",
|
|
1646
1981
|
"named": true
|
|
1647
1982
|
},
|
|
1983
|
+
{
|
|
1984
|
+
"type": "record",
|
|
1985
|
+
"named": true
|
|
1986
|
+
},
|
|
1987
|
+
{
|
|
1988
|
+
"type": "record_update",
|
|
1989
|
+
"named": true
|
|
1990
|
+
},
|
|
1648
1991
|
{
|
|
1649
1992
|
"type": "string",
|
|
1650
1993
|
"named": true
|
|
@@ -1696,6 +2039,10 @@
|
|
|
1696
2039
|
"type": "identifier",
|
|
1697
2040
|
"named": true
|
|
1698
2041
|
},
|
|
2042
|
+
{
|
|
2043
|
+
"type": "if",
|
|
2044
|
+
"named": true
|
|
2045
|
+
},
|
|
1699
2046
|
{
|
|
1700
2047
|
"type": "integer",
|
|
1701
2048
|
"named": true
|
|
@@ -1704,6 +2051,14 @@
|
|
|
1704
2051
|
"type": "negation",
|
|
1705
2052
|
"named": true
|
|
1706
2053
|
},
|
|
2054
|
+
{
|
|
2055
|
+
"type": "record",
|
|
2056
|
+
"named": true
|
|
2057
|
+
},
|
|
2058
|
+
{
|
|
2059
|
+
"type": "record_update",
|
|
2060
|
+
"named": true
|
|
2061
|
+
},
|
|
1707
2062
|
{
|
|
1708
2063
|
"type": "string",
|
|
1709
2064
|
"named": true
|
|
@@ -1823,6 +2178,14 @@
|
|
|
1823
2178
|
"type": "as",
|
|
1824
2179
|
"named": false
|
|
1825
2180
|
},
|
|
2181
|
+
{
|
|
2182
|
+
"type": "comment",
|
|
2183
|
+
"named": true
|
|
2184
|
+
},
|
|
2185
|
+
{
|
|
2186
|
+
"type": "const",
|
|
2187
|
+
"named": false
|
|
2188
|
+
},
|
|
1826
2189
|
{
|
|
1827
2190
|
"type": "escape_sequence",
|
|
1828
2191
|
"named": true
|
|
@@ -1843,6 +2206,10 @@
|
|
|
1843
2206
|
"type": "identifier",
|
|
1844
2207
|
"named": true
|
|
1845
2208
|
},
|
|
2209
|
+
{
|
|
2210
|
+
"type": "if",
|
|
2211
|
+
"named": false
|
|
2212
|
+
},
|
|
1846
2213
|
{
|
|
1847
2214
|
"type": "import",
|
|
1848
2215
|
"named": false
|
|
@@ -1855,10 +2222,18 @@
|
|
|
1855
2222
|
"type": "module",
|
|
1856
2223
|
"named": false
|
|
1857
2224
|
},
|
|
2225
|
+
{
|
|
2226
|
+
"type": "module_comment",
|
|
2227
|
+
"named": true
|
|
2228
|
+
},
|
|
1858
2229
|
{
|
|
1859
2230
|
"type": "quoted_content",
|
|
1860
2231
|
"named": true
|
|
1861
2232
|
},
|
|
2233
|
+
{
|
|
2234
|
+
"type": "statement_comment",
|
|
2235
|
+
"named": true
|
|
2236
|
+
},
|
|
1862
2237
|
{
|
|
1863
2238
|
"type": "type",
|
|
1864
2239
|
"named": false
|
test/corpus/expressions.txt
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
Pipes
|
|
3
|
+
================================================================================
|
|
4
|
+
|
|
5
|
+
module palm
|
|
6
|
+
|
|
7
|
+
string
|
|
8
|
+
|> iodata.new
|
|
9
|
+
|> iodata.reverse
|
|
10
|
+
|
|
11
|
+
--------------------------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
(source_file
|
|
14
|
+
(module
|
|
15
|
+
(module_name))
|
|
16
|
+
(function
|
|
17
|
+
(visibility_modifier)
|
|
18
|
+
(identifier)
|
|
19
|
+
(let
|
|
20
|
+
(identifier)
|
|
21
|
+
(string
|
|
22
|
+
(quoted_content)))
|
|
23
|
+
(let
|
|
24
|
+
(identifier)
|
|
25
|
+
(integer))
|
|
26
|
+
(let
|
|
27
|
+
(identifier)
|
|
28
|
+
(float))
|
|
29
|
+
(function_call
|
|
30
|
+
(field_access
|
|
31
|
+
(identifier)
|
|
32
|
+
(label))
|
|
33
|
+
(arguments))
|
|
34
|
+
(when
|
|
35
|
+
(identifier)
|
|
36
|
+
(when_entry
|
|
37
|
+
(integer)
|
|
38
|
+
(string
|
|
39
|
+
(quoted_content)))
|
|
40
|
+
(when_entry
|
|
41
|
+
(string
|
|
42
|
+
(quoted_content))))
|
|
43
|
+
(if
|
|
44
|
+
(binary_expression
|
|
45
|
+
(identifier)
|
|
46
|
+
(identifier))
|
|
47
|
+
(function_call
|
|
48
|
+
(field_access
|
|
49
|
+
(identifier)
|
|
50
|
+
(label))
|
|
51
|
+
(arguments
|
|
52
|
+
(argument
|
|
53
|
+
(string
|
|
54
|
+
(quoted_content)))))))
|
|
55
|
+
(function
|
|
56
|
+
(visibility_modifier)
|
|
57
|
+
(identifier)
|
|
58
|
+
(field
|
|
59
|
+
(identifier)
|
|
60
|
+
(type
|
|
61
|
+
(type_identifier)))
|
|
62
|
+
(field
|
|
63
|
+
(identifier)
|
|
64
|
+
(type
|
|
65
|
+
(type_identifier)))
|
|
66
|
+
(return_type
|
|
67
|
+
(type
|
|
68
|
+
(type_identifier)))
|
|
69
|
+
(binary_expression
|
|
70
|
+
(identifier)
|
|
71
|
+
(identifier))))
|
test/corpus/{function.txt → functions.txt}
RENAMED
|
@@ -8,10 +8,14 @@ pub fn main() {
|
|
|
8
8
|
let a = "123"
|
|
9
9
|
let b = 5
|
|
10
10
|
let c = 5.1
|
|
11
|
+
dog.bark()
|
|
11
12
|
when b {
|
|
12
13
|
1 -> "Hello"
|
|
13
14
|
_ -> "World"
|
|
14
15
|
}
|
|
16
|
+
if c > b {
|
|
17
|
+
io.println("Greater")
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
pub fn add(a: Int, b: Int) -> Int {
|
|
@@ -36,6 +40,11 @@ pub fn add(a: Int, b: Int) -> Int {
|
|
|
36
40
|
(let
|
|
37
41
|
(identifier)
|
|
38
42
|
(float))
|
|
43
|
+
(function_call
|
|
44
|
+
(field_access
|
|
45
|
+
(identifier)
|
|
46
|
+
(label))
|
|
47
|
+
(arguments))
|
|
39
48
|
(when
|
|
40
49
|
(identifier)
|
|
41
50
|
(when_entry
|
|
@@ -44,7 +53,19 @@ pub fn add(a: Int, b: Int) -> Int {
|
|
|
44
53
|
(quoted_content)))
|
|
45
54
|
(when_entry
|
|
46
55
|
(string
|
|
47
|
-
(quoted_content))))
|
|
56
|
+
(quoted_content))))
|
|
57
|
+
(if
|
|
58
|
+
(binary_expression
|
|
59
|
+
(identifier)
|
|
60
|
+
(identifier))
|
|
61
|
+
(function_call
|
|
62
|
+
(field_access
|
|
63
|
+
(identifier)
|
|
64
|
+
(label))
|
|
65
|
+
(arguments
|
|
66
|
+
(argument
|
|
67
|
+
(string
|
|
68
|
+
(quoted_content)))))))
|
|
48
69
|
(function
|
|
49
70
|
(visibility_modifier)
|
|
50
71
|
(identifier)
|
|
@@ -61,4 +82,4 @@ pub fn add(a: Int, b: Int) -> Int {
|
|
|
61
82
|
(type_identifier)))
|
|
62
83
|
(binary_expression
|
|
63
84
|
(identifier)
|
|
64
|
-
(identifier))))
|
|
85
|
+
(identifier))))
|
test/corpus/import.txt
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
================================================================================
|
|
2
|
-
Module Statement
|
|
3
|
-
================================================================================
|
|
4
|
-
|
|
5
|
-
module palm
|
|
6
|
-
|
|
7
|
-
--------------------------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
(source_file
|
|
10
|
-
(module
|
|
11
|
-
(module_name)))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
================================================================================
|
|
15
|
-
Import statements
|
|
16
|
-
================================================================================
|
|
17
|
-
|
|
18
|
-
module palm/std
|
|
19
|
-
|
|
20
|
-
import palm/std/list
|
|
21
|
-
import palm/std/list.{List, contains}
|
|
22
|
-
import palm/std/bool as boolean
|
|
23
|
-
|
|
24
|
-
--------------------------------------------------------------------------------
|
|
25
|
-
|
|
26
|
-
(source_file
|
|
27
|
-
(module
|
|
28
|
-
(module_name))
|
|
29
|
-
(import
|
|
30
|
-
(module_name))
|
|
31
|
-
(import
|
|
32
|
-
(module_name)
|
|
33
|
-
(unqualified_imports
|
|
34
|
-
(unqualified_import
|
|
35
|
-
(identifier))
|
|
36
|
-
(unqualified_import
|
|
37
|
-
(identifier))))
|
|
38
|
-
(import
|
|
39
|
-
(module_name)
|
|
40
|
-
(identifier)))
|
test/corpus/statements.txt
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
Module
|
|
3
|
+
================================================================================
|
|
4
|
+
|
|
5
|
+
module palm
|
|
6
|
+
|
|
7
|
+
--------------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
(source_file
|
|
10
|
+
(module
|
|
11
|
+
(module_name)))
|
|
12
|
+
|
|
13
|
+
================================================================================
|
|
14
|
+
Import
|
|
15
|
+
================================================================================
|
|
16
|
+
|
|
17
|
+
module palm/std
|
|
18
|
+
|
|
19
|
+
import palm/std/list
|
|
20
|
+
import palm/std/list.{List, contains}
|
|
21
|
+
import palm/std/bool as boolean
|
|
22
|
+
import a
|
|
23
|
+
import a/b
|
|
24
|
+
import a.{b}
|
|
25
|
+
import a/b.{c, d}
|
|
26
|
+
import a/b.{c as d, e}
|
|
27
|
+
import a/b.{c, D as E}
|
|
28
|
+
import a/b.{c as d} as e
|
|
29
|
+
import animal/cat as kitty
|
|
30
|
+
import animal.{Cat as Kitty} as a
|
|
31
|
+
import animal.{}
|
|
32
|
+
|
|
33
|
+
--------------------------------------------------------------------------------
|
|
34
|
+
|
|
35
|
+
(source_file
|
|
36
|
+
(module
|
|
37
|
+
(module_name))
|
|
38
|
+
(import
|
|
39
|
+
(module_name))
|
|
40
|
+
(import
|
|
41
|
+
(module_name)
|
|
42
|
+
(unqualified_imports
|
|
43
|
+
(unqualified_import
|
|
44
|
+
(identifier))
|
|
45
|
+
(unqualified_import
|
|
46
|
+
(identifier))))
|
|
47
|
+
(import
|
|
48
|
+
(module_name)
|
|
49
|
+
(identifier)))
|
|
50
|
+
|
|
51
|
+
================================================================================
|
|
52
|
+
Const
|
|
53
|
+
================================================================================
|
|
54
|
+
|
|
55
|
+
module palm
|
|
56
|
+
|
|
57
|
+
const name = "John Doe"
|
|
58
|
+
const PI = 3.14
|
|
59
|
+
const data = Some("Json data")
|
|
60
|
+
const sum_of_all = 5 + 5 + 7
|
|
61
|
+
const a: Int = 1234
|
|
62
|
+
const a: Float = 12.34
|
|
63
|
+
// const a = [1, 2]
|
|
64
|
+
const a = list.new(1, 2, 3)
|
|
65
|
+
const a = Node
|
|
66
|
+
const a = Node()
|
|
67
|
+
const a = Cat("Ginny", 1950)
|
|
68
|
+
// const a = Person(name: "Billy", age: 52)
|
|
69
|
+
// const a = uri.Uri(host: "github.com")
|
|
70
|
+
// const a: option.Option(String) = option.Some("Hello, World!")
|
|
71
|
+
|
|
72
|
+
--------------------------------------------------------------------------------
|
|
73
|
+
|
|
74
|
+
(source_file
|
|
75
|
+
(module
|
|
76
|
+
(module_name))
|
|
77
|
+
(const
|
|
78
|
+
(identifier)
|
|
79
|
+
(string
|
|
80
|
+
(quoted_content)))
|
|
81
|
+
(const
|
|
82
|
+
(identifier)
|
|
83
|
+
(float))
|
|
84
|
+
(const
|
|
85
|
+
(identifier)
|
|
86
|
+
(function_call
|
|
87
|
+
(identifier)
|
|
88
|
+
(arguments
|
|
89
|
+
(argument
|
|
90
|
+
(string
|
|
91
|
+
(quoted_content))))))
|
|
92
|
+
(const
|
|
93
|
+
(identifier)
|
|
94
|
+
(binary_expression
|
|
95
|
+
(binary_expression
|
|
96
|
+
(integer)
|
|
97
|
+
(integer))
|
|
98
|
+
(integer)))
|
|
99
|
+
(const
|
|
100
|
+
(identifier)
|
|
101
|
+
(type
|
|
102
|
+
(type_identifier))
|
|
103
|
+
(integer))
|
|
104
|
+
(const
|
|
105
|
+
(identifier)
|
|
106
|
+
(type
|
|
107
|
+
(type_identifier))
|
|
108
|
+
(float))
|
|
109
|
+
(comment)
|
|
110
|
+
(const
|
|
111
|
+
(identifier)
|
|
112
|
+
(function_call
|
|
113
|
+
(field_access
|
|
114
|
+
(identifier)
|
|
115
|
+
(label))
|
|
116
|
+
(arguments
|
|
117
|
+
(argument
|
|
118
|
+
(integer))
|
|
119
|
+
(argument
|
|
120
|
+
(integer))
|
|
121
|
+
(argument
|
|
122
|
+
(integer)))))
|
|
123
|
+
(const
|
|
124
|
+
(identifier)
|
|
125
|
+
(identifier))
|
|
126
|
+
(const
|
|
127
|
+
(identifier)
|
|
128
|
+
(function_call
|
|
129
|
+
(identifier)
|
|
130
|
+
(arguments)))
|
|
131
|
+
(const
|
|
132
|
+
(identifier)
|
|
133
|
+
(function_call
|
|
134
|
+
(identifier)
|
|
135
|
+
(arguments
|
|
136
|
+
(argument
|
|
137
|
+
(string
|
|
138
|
+
(quoted_content)))
|
|
139
|
+
(argument
|
|
140
|
+
(integer)))))
|
|
141
|
+
(comment)
|
|
142
|
+
(comment)
|
|
143
|
+
(comment))
|
|
144
|
+
|
|
145
|
+
================================================================================
|
|
146
|
+
Let
|
|
147
|
+
================================================================================
|
|
148
|
+
|
|
149
|
+
module palm
|
|
150
|
+
|
|
151
|
+
fn main() {
|
|
152
|
+
let name = "John Doe"
|
|
153
|
+
let PI = 3.14
|
|
154
|
+
let data = Some("Json data")
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
--------------------------------------------------------------------------------
|
|
158
|
+
|
|
159
|
+
(source_file
|
|
160
|
+
(module
|
|
161
|
+
(module_name))
|
|
162
|
+
(function
|
|
163
|
+
(identifier)
|
|
164
|
+
(let
|
|
165
|
+
(identifier)
|
|
166
|
+
(string
|
|
167
|
+
(quoted_content)))
|
|
168
|
+
(let
|
|
169
|
+
(identifier)
|
|
170
|
+
(float))
|
|
171
|
+
(let
|
|
172
|
+
(identifier)
|
|
173
|
+
(function_call
|
|
174
|
+
(identifier)
|
|
175
|
+
(arguments
|
|
176
|
+
(argument
|
|
177
|
+
(string
|
|
178
|
+
(quoted_content))))))))
|