@apple/tree-sitter-pkl 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.adoc +40 -0
- package/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/Package.swift +24 -0
- package/README.md +42 -0
- package/bindings/c/tree-sitter-pkl.h +16 -0
- package/bindings/swift/TreeSitterPkl/pkl.h +16 -0
- package/grammar.js +147 -63
- package/package.json +3 -4
- package/queries/highlights.scm +3 -8
- package/queries/injections.scm +3 -3
- package/src/grammar.json +750 -353
- package/src/node-types.json +1768 -1043
- package/src/parser.c +45772 -50670
- package/src/scanner.c +60 -28
- package/src/tree_sitter/alloc.h +54 -0
- package/src/tree_sitter/array.h +290 -0
- package/src/tree_sitter/parser.h +54 -13
- package/test/corpus/basic/annotation.txt +243 -0
- package/test/corpus/basic/comments.txt +41 -0
- package/test/corpus/basic/shebangComment.txt +15 -0
- package/test/corpus/basic/types.txt +232 -0
- package/test/corpus/class/constModifier.txt +24 -0
- package/test/corpus/class/fixedModifier.txt +24 -0
- package/test/corpus/expr/binary.txt +109 -0
- package/test/corpus/expr/functionLiteral.txt +23 -0
- package/test/corpus/expr/if.txt +15 -0
- package/test/corpus/expr/import.txt +20 -0
- package/test/corpus/expr/let.txt +17 -0
- package/test/corpus/expr/new.txt +36 -0
- package/test/corpus/expr/qualifiedAccess.txt +95 -0
- package/test/corpus/expr/read.txt +29 -0
- package/test/corpus/expr/throw.txt +14 -0
- package/test/corpus/expr/trace.txt +14 -0
- package/test/corpus/module/moduleHeader1.txt +23 -0
- package/test/corpus/module/moduleHeader2.txt +29 -0
- package/test/corpus/module/moduleHeader3.error.txt +23 -0
- package/test/corpus/module/moduleHeader4.txt +34 -0
- package/test/corpus/module/moduleHeader5.txt +16 -0
- package/test/corpus/module/moduleHeader6.txt +17 -0
- package/test/corpus/number/underscores.txt +99 -0
- package/test/corpus/object/objectAmendChain.txt +38 -0
- package/test/corpus/object/objectElementsWithParens.txt +51 -0
- package/test/corpus/object/objectGenerator.txt +53 -0
- package/test/corpus/object/objectMember.txt +129 -0
- package/test/corpus/object/objectMemberPredicate.txt +41 -0
- package/test/corpus/object/objectSpread.txt +51 -0
- package/test/corpus/object/objectWhenGenerator.txt +71 -0
- package/test/corpus/string/customStringDelimiters.txt +397 -0
- package/test/corpus/string/missingDelimiter.txt +28 -0
- package/test/corpus/string/multiline.txt +39 -0
- package/test/corpus/string/multilineInterpolation.txt +102 -0
- package/test/corpus/string/simple.txt +13 -0
- package/test/corpus/string/singleLineEscapes.txt +64 -0
- package/test/corpus/string/singleLineInterpolation.txt +94 -0
- package/test/corpus/string/stringWithTwoSlashes.txt +20 -0
- package/README.adoc +0 -61
- package/src/synctests.ts +0 -44
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
================
|
|
2
|
+
annotation
|
|
3
|
+
================
|
|
4
|
+
|
|
5
|
+
/// doc comment
|
|
6
|
+
/// doc comment
|
|
7
|
+
@Ann
|
|
8
|
+
@Ann2 { x = "foo" }
|
|
9
|
+
@Ann3 {
|
|
10
|
+
x = "foo"
|
|
11
|
+
y = 1
|
|
12
|
+
}
|
|
13
|
+
module some.mod
|
|
14
|
+
|
|
15
|
+
/// doc comment
|
|
16
|
+
/// doc comment
|
|
17
|
+
@Ann
|
|
18
|
+
@Ann2 { x = "foo" }
|
|
19
|
+
@Ann3 {
|
|
20
|
+
x = "foo"
|
|
21
|
+
y = 1
|
|
22
|
+
}
|
|
23
|
+
class SomeClass {
|
|
24
|
+
/// doc comment
|
|
25
|
+
/// doc comment
|
|
26
|
+
@Ann
|
|
27
|
+
@Ann2 { x = "foo" }
|
|
28
|
+
@Ann3 {
|
|
29
|
+
x = "foo"
|
|
30
|
+
y = 1
|
|
31
|
+
}
|
|
32
|
+
function someMethod() = "hi"
|
|
33
|
+
|
|
34
|
+
/// doc comment
|
|
35
|
+
/// doc comment
|
|
36
|
+
@Ann
|
|
37
|
+
@Ann2 { x = "foo" }
|
|
38
|
+
@Ann3 {
|
|
39
|
+
x = "foo"
|
|
40
|
+
y = 1
|
|
41
|
+
}
|
|
42
|
+
someProperty: String = "hi"
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/// doc comment
|
|
46
|
+
/// doc comment
|
|
47
|
+
@Ann
|
|
48
|
+
@Ann2 { x = "foo" }
|
|
49
|
+
@Ann3 {
|
|
50
|
+
x = "foo"
|
|
51
|
+
y = 1
|
|
52
|
+
}
|
|
53
|
+
function someMethod() = "hi"
|
|
54
|
+
|
|
55
|
+
/// doc comment
|
|
56
|
+
/// doc comment
|
|
57
|
+
@Ann
|
|
58
|
+
@Ann2 { x = "foo" }
|
|
59
|
+
@Ann3 {
|
|
60
|
+
x = "foo"
|
|
61
|
+
y = 1
|
|
62
|
+
}
|
|
63
|
+
someProperty: String = "hi"
|
|
64
|
+
|
|
65
|
+
----------------
|
|
66
|
+
|
|
67
|
+
(module
|
|
68
|
+
(moduleHeader
|
|
69
|
+
(docComment)
|
|
70
|
+
(annotation
|
|
71
|
+
(qualifiedIdentifier
|
|
72
|
+
(identifier)))
|
|
73
|
+
(annotation
|
|
74
|
+
(qualifiedIdentifier
|
|
75
|
+
(identifier))
|
|
76
|
+
(objectBody
|
|
77
|
+
(objectProperty
|
|
78
|
+
(identifier)
|
|
79
|
+
(slStringLiteral
|
|
80
|
+
(slStringLiteralPart)))))
|
|
81
|
+
(annotation
|
|
82
|
+
(qualifiedIdentifier
|
|
83
|
+
(identifier))
|
|
84
|
+
(objectBody
|
|
85
|
+
(objectProperty
|
|
86
|
+
(identifier)
|
|
87
|
+
(slStringLiteral
|
|
88
|
+
(slStringLiteralPart)))
|
|
89
|
+
(objectProperty
|
|
90
|
+
(identifier)
|
|
91
|
+
(intLiteral))))
|
|
92
|
+
(moduleClause
|
|
93
|
+
(qualifiedIdentifier
|
|
94
|
+
(identifier)
|
|
95
|
+
(identifier))))
|
|
96
|
+
(clazz
|
|
97
|
+
(docComment)
|
|
98
|
+
(annotation
|
|
99
|
+
(qualifiedIdentifier
|
|
100
|
+
(identifier)))
|
|
101
|
+
(annotation
|
|
102
|
+
(qualifiedIdentifier
|
|
103
|
+
(identifier))
|
|
104
|
+
(objectBody
|
|
105
|
+
(objectProperty
|
|
106
|
+
(identifier)
|
|
107
|
+
(slStringLiteral
|
|
108
|
+
(slStringLiteralPart)))))
|
|
109
|
+
(annotation
|
|
110
|
+
(qualifiedIdentifier
|
|
111
|
+
(identifier))
|
|
112
|
+
(objectBody
|
|
113
|
+
(objectProperty
|
|
114
|
+
(identifier)
|
|
115
|
+
(slStringLiteral
|
|
116
|
+
(slStringLiteralPart)))
|
|
117
|
+
(objectProperty
|
|
118
|
+
(identifier)
|
|
119
|
+
(intLiteral))))
|
|
120
|
+
(identifier)
|
|
121
|
+
(classBody
|
|
122
|
+
(classMethod
|
|
123
|
+
(docComment)
|
|
124
|
+
(annotation
|
|
125
|
+
(qualifiedIdentifier
|
|
126
|
+
(identifier)))
|
|
127
|
+
(annotation
|
|
128
|
+
(qualifiedIdentifier
|
|
129
|
+
(identifier))
|
|
130
|
+
(objectBody
|
|
131
|
+
(objectProperty
|
|
132
|
+
(identifier)
|
|
133
|
+
(slStringLiteral
|
|
134
|
+
(slStringLiteralPart)))))
|
|
135
|
+
(annotation
|
|
136
|
+
(qualifiedIdentifier
|
|
137
|
+
(identifier))
|
|
138
|
+
(objectBody
|
|
139
|
+
(objectProperty
|
|
140
|
+
(identifier)
|
|
141
|
+
(slStringLiteral
|
|
142
|
+
(slStringLiteralPart)))
|
|
143
|
+
(objectProperty
|
|
144
|
+
(identifier)
|
|
145
|
+
(intLiteral))))
|
|
146
|
+
(methodHeader
|
|
147
|
+
(identifier)
|
|
148
|
+
(parameterList))
|
|
149
|
+
(slStringLiteral
|
|
150
|
+
(slStringLiteralPart)))
|
|
151
|
+
(classProperty
|
|
152
|
+
(docComment)
|
|
153
|
+
(annotation
|
|
154
|
+
(qualifiedIdentifier
|
|
155
|
+
(identifier)))
|
|
156
|
+
(annotation
|
|
157
|
+
(qualifiedIdentifier
|
|
158
|
+
(identifier))
|
|
159
|
+
(objectBody
|
|
160
|
+
(objectProperty
|
|
161
|
+
(identifier)
|
|
162
|
+
(slStringLiteral
|
|
163
|
+
(slStringLiteralPart)))))
|
|
164
|
+
(annotation
|
|
165
|
+
(qualifiedIdentifier
|
|
166
|
+
(identifier))
|
|
167
|
+
(objectBody
|
|
168
|
+
(objectProperty
|
|
169
|
+
(identifier)
|
|
170
|
+
(slStringLiteral
|
|
171
|
+
(slStringLiteralPart)))
|
|
172
|
+
(objectProperty
|
|
173
|
+
(identifier)
|
|
174
|
+
(intLiteral))))
|
|
175
|
+
(identifier)
|
|
176
|
+
(typeAnnotation
|
|
177
|
+
(type
|
|
178
|
+
(declaredType
|
|
179
|
+
(qualifiedIdentifier
|
|
180
|
+
(identifier)))))
|
|
181
|
+
(slStringLiteral
|
|
182
|
+
(slStringLiteralPart)))))
|
|
183
|
+
(classMethod
|
|
184
|
+
(docComment)
|
|
185
|
+
(annotation
|
|
186
|
+
(qualifiedIdentifier
|
|
187
|
+
(identifier)))
|
|
188
|
+
(annotation
|
|
189
|
+
(qualifiedIdentifier
|
|
190
|
+
(identifier))
|
|
191
|
+
(objectBody
|
|
192
|
+
(objectProperty
|
|
193
|
+
(identifier)
|
|
194
|
+
(slStringLiteral
|
|
195
|
+
(slStringLiteralPart)))))
|
|
196
|
+
(annotation
|
|
197
|
+
(qualifiedIdentifier
|
|
198
|
+
(identifier))
|
|
199
|
+
(objectBody
|
|
200
|
+
(objectProperty
|
|
201
|
+
(identifier)
|
|
202
|
+
(slStringLiteral
|
|
203
|
+
(slStringLiteralPart)))
|
|
204
|
+
(objectProperty
|
|
205
|
+
(identifier)
|
|
206
|
+
(intLiteral))))
|
|
207
|
+
(methodHeader
|
|
208
|
+
(identifier)
|
|
209
|
+
(parameterList))
|
|
210
|
+
(slStringLiteral
|
|
211
|
+
(slStringLiteralPart)))
|
|
212
|
+
(classProperty
|
|
213
|
+
(docComment)
|
|
214
|
+
(annotation
|
|
215
|
+
(qualifiedIdentifier
|
|
216
|
+
(identifier)))
|
|
217
|
+
(annotation
|
|
218
|
+
(qualifiedIdentifier
|
|
219
|
+
(identifier))
|
|
220
|
+
(objectBody
|
|
221
|
+
(objectProperty
|
|
222
|
+
(identifier)
|
|
223
|
+
(slStringLiteral
|
|
224
|
+
(slStringLiteralPart)))))
|
|
225
|
+
(annotation
|
|
226
|
+
(qualifiedIdentifier
|
|
227
|
+
(identifier))
|
|
228
|
+
(objectBody
|
|
229
|
+
(objectProperty
|
|
230
|
+
(identifier)
|
|
231
|
+
(slStringLiteral
|
|
232
|
+
(slStringLiteralPart)))
|
|
233
|
+
(objectProperty
|
|
234
|
+
(identifier)
|
|
235
|
+
(intLiteral))))
|
|
236
|
+
(identifier)
|
|
237
|
+
(typeAnnotation
|
|
238
|
+
(type
|
|
239
|
+
(declaredType
|
|
240
|
+
(qualifiedIdentifier
|
|
241
|
+
(identifier)))))
|
|
242
|
+
(slStringLiteral
|
|
243
|
+
(slStringLiteralPart))))
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
========
|
|
2
|
+
comments
|
|
3
|
+
========
|
|
4
|
+
|
|
5
|
+
x = 10 // end-of-line comment
|
|
6
|
+
|
|
7
|
+
y = 20 /*
|
|
8
|
+
multi
|
|
9
|
+
line
|
|
10
|
+
comment
|
|
11
|
+
*/ z = 30
|
|
12
|
+
|
|
13
|
+
/// documentation comment
|
|
14
|
+
function myFun() = 0
|
|
15
|
+
|
|
16
|
+
a = 20 // single-line comment running until EOF rather than newline
|
|
17
|
+
|
|
18
|
+
--------
|
|
19
|
+
|
|
20
|
+
(module
|
|
21
|
+
(classProperty
|
|
22
|
+
(identifier)
|
|
23
|
+
(intLiteral))
|
|
24
|
+
(lineComment)
|
|
25
|
+
(classProperty
|
|
26
|
+
(identifier)
|
|
27
|
+
(intLiteral))
|
|
28
|
+
(blockComment)
|
|
29
|
+
(classProperty
|
|
30
|
+
(identifier)
|
|
31
|
+
(intLiteral))
|
|
32
|
+
(classMethod
|
|
33
|
+
(docComment)
|
|
34
|
+
(methodHeader
|
|
35
|
+
(identifier)
|
|
36
|
+
(parameterList))
|
|
37
|
+
(intLiteral))
|
|
38
|
+
(classProperty
|
|
39
|
+
(identifier)
|
|
40
|
+
(intLiteral))
|
|
41
|
+
(lineComment))
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
===
|
|
2
|
+
types
|
|
3
|
+
===
|
|
4
|
+
|
|
5
|
+
res1: String
|
|
6
|
+
|
|
7
|
+
res2: String?
|
|
8
|
+
|
|
9
|
+
res3: String|Int
|
|
10
|
+
|
|
11
|
+
res4: *String|Int
|
|
12
|
+
|
|
13
|
+
res5: String?
|
|
14
|
+
|
|
15
|
+
res6: String?(this == null)
|
|
16
|
+
|
|
17
|
+
res7: String(this == null)?
|
|
18
|
+
|
|
19
|
+
res8: String(this == null)?(!isEmpty)
|
|
20
|
+
|
|
21
|
+
res9: module
|
|
22
|
+
|
|
23
|
+
res10: module?
|
|
24
|
+
|
|
25
|
+
res11: nothing
|
|
26
|
+
|
|
27
|
+
res12: nothing?
|
|
28
|
+
|
|
29
|
+
res13: unknown
|
|
30
|
+
|
|
31
|
+
res14: unknown?
|
|
32
|
+
|
|
33
|
+
res15: "string literal type"
|
|
34
|
+
|
|
35
|
+
res16: (Int) -> Boolean
|
|
36
|
+
|
|
37
|
+
res17: (module)
|
|
38
|
+
|
|
39
|
+
res18: (String|Boolean)|(Int) -> Boolean
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
(module
|
|
43
|
+
(classProperty
|
|
44
|
+
(identifier)
|
|
45
|
+
(typeAnnotation
|
|
46
|
+
(type
|
|
47
|
+
(declaredType
|
|
48
|
+
(qualifiedIdentifier
|
|
49
|
+
(identifier))))))
|
|
50
|
+
(classProperty
|
|
51
|
+
(identifier)
|
|
52
|
+
(typeAnnotation
|
|
53
|
+
(type
|
|
54
|
+
(nullableType
|
|
55
|
+
(type
|
|
56
|
+
(declaredType
|
|
57
|
+
(qualifiedIdentifier
|
|
58
|
+
(identifier))))))))
|
|
59
|
+
(classProperty
|
|
60
|
+
(identifier)
|
|
61
|
+
(typeAnnotation
|
|
62
|
+
(type
|
|
63
|
+
(unionType
|
|
64
|
+
(type
|
|
65
|
+
(declaredType
|
|
66
|
+
(qualifiedIdentifier
|
|
67
|
+
(identifier))))
|
|
68
|
+
(type
|
|
69
|
+
(declaredType
|
|
70
|
+
(qualifiedIdentifier
|
|
71
|
+
(identifier))))))))
|
|
72
|
+
(classProperty
|
|
73
|
+
(identifier)
|
|
74
|
+
(typeAnnotation
|
|
75
|
+
(type
|
|
76
|
+
(unionType
|
|
77
|
+
(type
|
|
78
|
+
(unionDefaultType
|
|
79
|
+
(type
|
|
80
|
+
(declaredType
|
|
81
|
+
(qualifiedIdentifier
|
|
82
|
+
(identifier))))))
|
|
83
|
+
(type
|
|
84
|
+
(declaredType
|
|
85
|
+
(qualifiedIdentifier
|
|
86
|
+
(identifier))))))))
|
|
87
|
+
(classProperty
|
|
88
|
+
(identifier)
|
|
89
|
+
(typeAnnotation
|
|
90
|
+
(type
|
|
91
|
+
(nullableType
|
|
92
|
+
(type
|
|
93
|
+
(declaredType
|
|
94
|
+
(qualifiedIdentifier
|
|
95
|
+
(identifier))))))))
|
|
96
|
+
(classProperty
|
|
97
|
+
(identifier)
|
|
98
|
+
(typeAnnotation
|
|
99
|
+
(type
|
|
100
|
+
(constrainedType
|
|
101
|
+
(type
|
|
102
|
+
(nullableType
|
|
103
|
+
(type
|
|
104
|
+
(declaredType
|
|
105
|
+
(qualifiedIdentifier
|
|
106
|
+
(identifier))))))
|
|
107
|
+
(binaryExpr
|
|
108
|
+
(thisExpr)
|
|
109
|
+
(nullLiteral))))))
|
|
110
|
+
(classProperty
|
|
111
|
+
(identifier)
|
|
112
|
+
(typeAnnotation
|
|
113
|
+
(type
|
|
114
|
+
(nullableType
|
|
115
|
+
(type
|
|
116
|
+
(constrainedType
|
|
117
|
+
(type
|
|
118
|
+
(declaredType
|
|
119
|
+
(qualifiedIdentifier
|
|
120
|
+
(identifier))))
|
|
121
|
+
(binaryExpr
|
|
122
|
+
(thisExpr)
|
|
123
|
+
(nullLiteral))))))))
|
|
124
|
+
(classProperty
|
|
125
|
+
(identifier)
|
|
126
|
+
(typeAnnotation
|
|
127
|
+
(type
|
|
128
|
+
(constrainedType
|
|
129
|
+
(type
|
|
130
|
+
(nullableType
|
|
131
|
+
(type
|
|
132
|
+
(constrainedType
|
|
133
|
+
(type
|
|
134
|
+
(declaredType
|
|
135
|
+
(qualifiedIdentifier
|
|
136
|
+
(identifier))))
|
|
137
|
+
(binaryExpr
|
|
138
|
+
(thisExpr)
|
|
139
|
+
(nullLiteral))))))
|
|
140
|
+
(unaryExpr
|
|
141
|
+
(variableExpr
|
|
142
|
+
(identifier)))))))
|
|
143
|
+
(classProperty
|
|
144
|
+
(identifier)
|
|
145
|
+
(typeAnnotation
|
|
146
|
+
(type
|
|
147
|
+
(moduleType))))
|
|
148
|
+
(classProperty
|
|
149
|
+
(identifier)
|
|
150
|
+
(typeAnnotation
|
|
151
|
+
(type
|
|
152
|
+
(nullableType
|
|
153
|
+
(type
|
|
154
|
+
(moduleType))))))
|
|
155
|
+
(classProperty
|
|
156
|
+
(identifier)
|
|
157
|
+
(typeAnnotation
|
|
158
|
+
(type
|
|
159
|
+
(nothingType))))
|
|
160
|
+
(classProperty
|
|
161
|
+
(identifier)
|
|
162
|
+
(typeAnnotation
|
|
163
|
+
(type
|
|
164
|
+
(nullableType
|
|
165
|
+
(type
|
|
166
|
+
(nothingType))))))
|
|
167
|
+
(classProperty
|
|
168
|
+
(identifier)
|
|
169
|
+
(typeAnnotation
|
|
170
|
+
(type
|
|
171
|
+
(unknownType))))
|
|
172
|
+
(classProperty
|
|
173
|
+
(identifier)
|
|
174
|
+
(typeAnnotation
|
|
175
|
+
(type
|
|
176
|
+
(nullableType
|
|
177
|
+
(type
|
|
178
|
+
(unknownType))))))
|
|
179
|
+
(classProperty
|
|
180
|
+
(identifier)
|
|
181
|
+
(typeAnnotation
|
|
182
|
+
(type
|
|
183
|
+
(stringLiteralType
|
|
184
|
+
(stringConstant
|
|
185
|
+
(slStringLiteralPart))))))
|
|
186
|
+
(classProperty
|
|
187
|
+
(identifier)
|
|
188
|
+
(typeAnnotation
|
|
189
|
+
(type
|
|
190
|
+
(functionLiteralType
|
|
191
|
+
(type
|
|
192
|
+
(declaredType
|
|
193
|
+
(qualifiedIdentifier
|
|
194
|
+
(identifier))))
|
|
195
|
+
(type
|
|
196
|
+
(declaredType
|
|
197
|
+
(qualifiedIdentifier
|
|
198
|
+
(identifier))))))))
|
|
199
|
+
(classProperty
|
|
200
|
+
(identifier)
|
|
201
|
+
(typeAnnotation
|
|
202
|
+
(type
|
|
203
|
+
(parenthesizedType
|
|
204
|
+
(type
|
|
205
|
+
(moduleType))))))
|
|
206
|
+
(classProperty
|
|
207
|
+
(identifier)
|
|
208
|
+
(typeAnnotation
|
|
209
|
+
(type
|
|
210
|
+
(unionType
|
|
211
|
+
(type
|
|
212
|
+
(parenthesizedType
|
|
213
|
+
(type
|
|
214
|
+
(unionType
|
|
215
|
+
(type
|
|
216
|
+
(declaredType
|
|
217
|
+
(qualifiedIdentifier
|
|
218
|
+
(identifier))))
|
|
219
|
+
(type
|
|
220
|
+
(declaredType
|
|
221
|
+
(qualifiedIdentifier
|
|
222
|
+
(identifier))))))))
|
|
223
|
+
(type
|
|
224
|
+
(functionLiteralType
|
|
225
|
+
(type
|
|
226
|
+
(declaredType
|
|
227
|
+
(qualifiedIdentifier
|
|
228
|
+
(identifier))))
|
|
229
|
+
(type
|
|
230
|
+
(declaredType
|
|
231
|
+
(qualifiedIdentifier
|
|
232
|
+
(identifier)))))))))))
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
constModifier
|
|
3
|
+
================================================================================
|
|
4
|
+
|
|
5
|
+
class MyClass {
|
|
6
|
+
const myProp: String = "hello"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
--------------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
(module
|
|
12
|
+
(clazz
|
|
13
|
+
(identifier)
|
|
14
|
+
(classBody
|
|
15
|
+
(classProperty
|
|
16
|
+
(modifier)
|
|
17
|
+
(identifier)
|
|
18
|
+
(typeAnnotation
|
|
19
|
+
(type
|
|
20
|
+
(declaredType
|
|
21
|
+
(qualifiedIdentifier
|
|
22
|
+
(identifier)))))
|
|
23
|
+
(slStringLiteral
|
|
24
|
+
(slStringLiteralPart))))))
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
fixedModifier
|
|
3
|
+
================================================================================
|
|
4
|
+
|
|
5
|
+
class MyClass {
|
|
6
|
+
fixed myProp: String = "hello"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
--------------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
(module
|
|
12
|
+
(clazz
|
|
13
|
+
(identifier)
|
|
14
|
+
(classBody
|
|
15
|
+
(classProperty
|
|
16
|
+
(modifier)
|
|
17
|
+
(identifier)
|
|
18
|
+
(typeAnnotation
|
|
19
|
+
(type
|
|
20
|
+
(declaredType
|
|
21
|
+
(qualifiedIdentifier
|
|
22
|
+
(identifier)))))
|
|
23
|
+
(slStringLiteral
|
|
24
|
+
(slStringLiteralPart))))))
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
===
|
|
2
|
+
binary
|
|
3
|
+
===
|
|
4
|
+
|
|
5
|
+
exprs {
|
|
6
|
+
1 as Int
|
|
7
|
+
1 is Int
|
|
8
|
+
1 == 1
|
|
9
|
+
1 != 1
|
|
10
|
+
1 && 1
|
|
11
|
+
1 || 1
|
|
12
|
+
1 |> 1
|
|
13
|
+
1 >= 2
|
|
14
|
+
1 <= 2
|
|
15
|
+
1 > 2
|
|
16
|
+
1 < 2
|
|
17
|
+
1 * 2
|
|
18
|
+
1 / 2
|
|
19
|
+
1 ~/ 2
|
|
20
|
+
1 ** 2
|
|
21
|
+
1 % 2
|
|
22
|
+
1 + 2
|
|
23
|
+
1 - 2
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
(module
|
|
29
|
+
(classProperty
|
|
30
|
+
(identifier)
|
|
31
|
+
(objectBody
|
|
32
|
+
(objectElement
|
|
33
|
+
(asExpr
|
|
34
|
+
(intLiteral)
|
|
35
|
+
(type
|
|
36
|
+
(declaredType
|
|
37
|
+
(qualifiedIdentifier
|
|
38
|
+
(identifier))))))
|
|
39
|
+
(objectElement
|
|
40
|
+
(isExpr
|
|
41
|
+
(intLiteral)
|
|
42
|
+
(type
|
|
43
|
+
(declaredType
|
|
44
|
+
(qualifiedIdentifier
|
|
45
|
+
(identifier))))))
|
|
46
|
+
(objectElement
|
|
47
|
+
(binaryExpr
|
|
48
|
+
(intLiteral)
|
|
49
|
+
(intLiteral)))
|
|
50
|
+
(objectElement
|
|
51
|
+
(binaryExpr
|
|
52
|
+
(intLiteral)
|
|
53
|
+
(intLiteral)))
|
|
54
|
+
(objectElement
|
|
55
|
+
(binaryExpr
|
|
56
|
+
(intLiteral)
|
|
57
|
+
(intLiteral)))
|
|
58
|
+
(objectElement
|
|
59
|
+
(binaryExpr
|
|
60
|
+
(intLiteral)
|
|
61
|
+
(intLiteral)))
|
|
62
|
+
(objectElement
|
|
63
|
+
(binaryExpr
|
|
64
|
+
(intLiteral)
|
|
65
|
+
(intLiteral)))
|
|
66
|
+
(objectElement
|
|
67
|
+
(binaryExpr
|
|
68
|
+
(intLiteral)
|
|
69
|
+
(intLiteral)))
|
|
70
|
+
(objectElement
|
|
71
|
+
(binaryExpr
|
|
72
|
+
(intLiteral)
|
|
73
|
+
(intLiteral)))
|
|
74
|
+
(objectElement
|
|
75
|
+
(binaryExpr
|
|
76
|
+
(intLiteral)
|
|
77
|
+
(intLiteral)))
|
|
78
|
+
(objectElement
|
|
79
|
+
(binaryExpr
|
|
80
|
+
(intLiteral)
|
|
81
|
+
(intLiteral)))
|
|
82
|
+
(objectElement
|
|
83
|
+
(binaryExpr
|
|
84
|
+
(intLiteral)
|
|
85
|
+
(intLiteral)))
|
|
86
|
+
(objectElement
|
|
87
|
+
(binaryExpr
|
|
88
|
+
(intLiteral)
|
|
89
|
+
(intLiteral)))
|
|
90
|
+
(objectElement
|
|
91
|
+
(binaryExpr
|
|
92
|
+
(intLiteral)
|
|
93
|
+
(intLiteral)))
|
|
94
|
+
(objectElement
|
|
95
|
+
(binaryExprRightAssoc
|
|
96
|
+
(intLiteral)
|
|
97
|
+
(intLiteral)))
|
|
98
|
+
(objectElement
|
|
99
|
+
(binaryExpr
|
|
100
|
+
(intLiteral)
|
|
101
|
+
(intLiteral)))
|
|
102
|
+
(objectElement
|
|
103
|
+
(binaryExpr
|
|
104
|
+
(intLiteral)
|
|
105
|
+
(intLiteral)))
|
|
106
|
+
(objectElement
|
|
107
|
+
(binaryExpr
|
|
108
|
+
(intLiteral)
|
|
109
|
+
(intLiteral))))))
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
===
|
|
2
|
+
functionLiteral
|
|
3
|
+
===
|
|
4
|
+
|
|
5
|
+
res1 = (bar: Int) -> bar + 5
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
(module
|
|
9
|
+
(classProperty
|
|
10
|
+
(identifier)
|
|
11
|
+
(functionLiteral
|
|
12
|
+
(parameterList
|
|
13
|
+
(typedIdentifier
|
|
14
|
+
(identifier)
|
|
15
|
+
(typeAnnotation
|
|
16
|
+
(type
|
|
17
|
+
(declaredType
|
|
18
|
+
(qualifiedIdentifier
|
|
19
|
+
(identifier)))))))
|
|
20
|
+
(binaryExpr
|
|
21
|
+
(variableExpr
|
|
22
|
+
(identifier))
|
|
23
|
+
(intLiteral)))))
|