viv-compiler 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl
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.
- viv_compiler/{utils/_version.py → _version.py} +1 -1
- viv_compiler/cli.py +14 -12
- viv_compiler/config/config.py +17 -18
- viv_compiler/core/__init__.py +3 -3
- viv_compiler/core/core.py +7 -7
- viv_compiler/core/{importer.py → includes.py} +5 -5
- viv_compiler/core/metadata.py +71 -0
- viv_compiler/core/{postprocessor.py → postprocessing.py} +6 -32
- viv_compiler/core/{validator.py → validation.py} +203 -88
- viv_compiler/core/visitor.py +184 -139
- viv_compiler/grammar/viv.peg +450 -218
- viv_compiler/types/content_public_schemas.py +59 -31
- viv_compiler/types/dsl_public_schemas.py +84 -82
- viv_compiler/utils/utils.py +93 -33
- {viv_compiler-0.1.0.dist-info → viv_compiler-0.1.2.dist-info}/METADATA +120 -82
- viv_compiler-0.1.2.dist-info/RECORD +33 -0
- viv_compiler-0.1.0.dist-info/RECORD +0 -32
- {viv_compiler-0.1.0.dist-info → viv_compiler-0.1.2.dist-info}/WHEEL +0 -0
- {viv_compiler-0.1.0.dist-info → viv_compiler-0.1.2.dist-info}/entry_points.txt +0 -0
- {viv_compiler-0.1.0.dist-info → viv_compiler-0.1.2.dist-info}/licenses/LICENSE +0 -0
- {viv_compiler-0.1.0.dist-info → viv_compiler-0.1.2.dist-info}/top_level.txt +0 -0
viv_compiler/grammar/viv.peg
CHANGED
@@ -1,228 +1,460 @@
|
|
1
|
-
// This is a specification of the syntax of the Viv action language, declared in a variant
|
2
|
-
// form (EBNF) that is associated with the parsing expression grammar
|
3
|
-
// the format expected by the Arpeggio Python
|
4
|
-
|
5
|
-
|
6
|
-
//
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
//
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
1
|
+
// This is a specification of the syntax of the Viv action language, declared in a variant
|
2
|
+
// of extended Backus--Naur form (EBNF) that is associated with the parsing expression grammar
|
3
|
+
// (PEG) formalism. More specifically, it is in the format expected by the Arpeggio Python
|
4
|
+
// library (version `2.0.0`).
|
5
|
+
|
6
|
+
// // //
|
7
|
+
// Grammar root: includes, tropes, actions (in any order)
|
8
|
+
// // //
|
9
|
+
|
10
|
+
file =
|
11
|
+
(include / trope / action)* EOF
|
12
|
+
|
13
|
+
|
14
|
+
// // //
|
15
|
+
// Include declarations
|
16
|
+
// // //
|
17
|
+
|
18
|
+
include =
|
19
|
+
"include" filename
|
20
|
+
filename =
|
21
|
+
'"' (!'"' ((r'(\w+)' / r'.')))* '"' /
|
22
|
+
"'" (!"'" ((r'(\w+)' / r'.')))* "'"
|
23
|
+
|
24
|
+
|
25
|
+
// // //
|
26
|
+
// Trope headers
|
27
|
+
// // //
|
28
|
+
|
29
|
+
trope =
|
30
|
+
"trope" name trope_params? ":" statements
|
31
|
+
trope_params =
|
32
|
+
"with" trope_param ("," trope_param)*
|
33
|
+
trope_param = binding_type name
|
34
|
+
|
35
|
+
|
36
|
+
// // //
|
37
|
+
// Action headers
|
38
|
+
// // //
|
39
|
+
|
40
|
+
action =
|
41
|
+
action_header action_body
|
42
|
+
action_header =
|
43
|
+
special_action_tag? "action" name parent_action_declaration? ":"
|
44
|
+
special_action_tag =
|
45
|
+
"special"
|
46
|
+
parent_action_declaration =
|
47
|
+
"from" name
|
48
|
+
action_body =
|
49
|
+
(
|
50
|
+
(&"gloss" gloss)? /
|
51
|
+
(&"report" report)? /
|
52
|
+
(&"saliences" saliences)? /
|
53
|
+
(&"associations" associations)? /
|
54
|
+
(&"embargoes" embargoes)? /
|
55
|
+
(&"tags" tags_field / &"join" tags_field)? /
|
56
|
+
(&"roles" roles / &"join" roles)? /
|
57
|
+
(&"preconditions" preconditions / &"join" preconditions)? /
|
58
|
+
(&"scratch" scratch / &"join" scratch)? /
|
59
|
+
(&"effects" effects / &"join" effects)? /
|
60
|
+
(&"reactions" reactions / &"join" reactions)?
|
61
|
+
)#
|
62
|
+
child_join_operator =
|
63
|
+
"join"
|
64
|
+
|
65
|
+
|
66
|
+
// // //
|
67
|
+
// Glosses, reports, tags
|
68
|
+
// // //
|
69
|
+
|
70
|
+
gloss =
|
71
|
+
"gloss" ":" string
|
72
|
+
report =
|
73
|
+
"report" ":" templated_text
|
74
|
+
tags_field =
|
75
|
+
child_join_operator? "tags" ":" tags
|
76
|
+
tags =
|
77
|
+
tag ("," tag)*
|
78
|
+
tag =
|
79
|
+
!reserved r"[A-Za-z_][A-Za-z0-9\-_]*"
|
80
|
+
|
81
|
+
|
82
|
+
// // //
|
83
|
+
// Roles
|
84
|
+
// // //
|
85
|
+
|
86
|
+
roles =
|
87
|
+
child_join_operator? "roles" ":" role+
|
88
|
+
role =
|
89
|
+
role_renaming /
|
90
|
+
number_range? binding_rate_directive? binding_type role_name binding_pool_directive? ":" role_labels
|
91
|
+
binding_type =
|
92
|
+
entity_sigil / symbol_sigil
|
93
|
+
role_renaming =
|
94
|
+
role_name "<<" role_name
|
95
|
+
number_range =
|
96
|
+
number ("-" number)?
|
97
|
+
role_name =
|
98
|
+
name ''
|
99
|
+
binding_pool_directive =
|
100
|
+
binding_pool_from_directive / binding_pool_is_directive
|
101
|
+
binding_pool_from_directive =
|
102
|
+
"from" expression
|
103
|
+
binding_pool_is_directive =
|
104
|
+
"is" expression
|
105
|
+
role_labels =
|
106
|
+
role_label ("," role_label)*
|
107
|
+
role_label =
|
108
|
+
"initiator" / "partner" / "recipient" / "bystander" / "location" /
|
109
|
+
"symbol" / "absent" / "action" / "item" / "precast" / build_directive
|
110
|
+
build_directive =
|
111
|
+
"build" "(" build_directive_entity_recipe ")"
|
112
|
+
build_directive_entity_recipe =
|
113
|
+
object
|
114
|
+
binding_rate_directive =
|
115
|
+
chance_directive / mean_directive
|
116
|
+
chance_directive =
|
117
|
+
"[" "-"? r"[0-9]+(\.[0-9]+)?" "%" "]"
|
118
|
+
mean_directive =
|
119
|
+
"[" "~" "-"? r"[0-9]+(\.[0-9]+)?" "]"
|
120
|
+
preconditions =
|
121
|
+
child_join_operator? "preconditions" ":" statements
|
122
|
+
|
123
|
+
|
124
|
+
// // //
|
125
|
+
// Scratch and effects
|
126
|
+
// // //
|
127
|
+
|
128
|
+
scratch =
|
129
|
+
child_join_operator? "scratch" ":" statements
|
130
|
+
effects =
|
131
|
+
child_join_operator? "effects" ":" statements
|
132
|
+
|
133
|
+
|
134
|
+
// // //
|
135
|
+
// Reactions
|
136
|
+
// // //
|
137
|
+
|
138
|
+
reactions =
|
139
|
+
child_join_operator? "reactions" ":" (conditional / loop / reaction)+
|
140
|
+
reaction =
|
141
|
+
"queue" reaction_action_name ":" reaction_options
|
142
|
+
reaction_action_name =
|
143
|
+
name ''
|
144
|
+
reaction_options =
|
145
|
+
(bindings / urgent? / priority? / kill_code? / when? / where? / abandonment_conditions?)#
|
146
|
+
bindings =
|
147
|
+
"bindings" ":" binding+
|
148
|
+
binding =
|
149
|
+
(binding_type name ":" reference)
|
150
|
+
urgent =
|
151
|
+
"urgent" ":" expression
|
152
|
+
priority =
|
153
|
+
"priority" ":" expression
|
154
|
+
kill_code =
|
155
|
+
"kill_code" ":" expression
|
156
|
+
where =
|
157
|
+
"where" ":" expression
|
158
|
+
when =
|
159
|
+
"when" (when_action_timestamp_anchor / when_hearing_timestamp_anchor) ":" time_expression
|
160
|
+
when_action_timestamp_anchor =
|
161
|
+
"from action"
|
162
|
+
when_hearing_timestamp_anchor =
|
163
|
+
"from hearing"
|
164
|
+
time_expression =
|
165
|
+
time_statement ("," time_statement)?
|
166
|
+
time_statement =
|
167
|
+
before_time_statement / after_time_statement / between_time_statement
|
168
|
+
before_time_statement =
|
169
|
+
"before" (time_period / time)
|
170
|
+
after_time_statement =
|
171
|
+
"after" (time_period / time)
|
172
|
+
between_time_statement =
|
173
|
+
"between" time_period "and" time_period / "between" time "and" time
|
174
|
+
time_period =
|
175
|
+
(number / number_word) (
|
176
|
+
"minutes" / "hours" / "days" / "weeks" / "months" / "years" /
|
177
|
+
"minute" / "hour" / "day" / "week" / "month" / "year"
|
178
|
+
)
|
179
|
+
number_word =
|
180
|
+
"one" / "two" / "three" / "four" / "five" / "six" /
|
181
|
+
"seven" / "eight" / "nine" / "ten" / "eleven" / "twelve"
|
182
|
+
time =
|
183
|
+
hh (":" mm)? ("pm" / "am" / "PM" / "AM")?
|
184
|
+
hh =
|
185
|
+
r"[0-9]{1,2}"
|
186
|
+
mm =
|
187
|
+
r"[0-9]{2}"
|
188
|
+
abandonment_conditions =
|
189
|
+
"abandon" ":" statements
|
190
|
+
|
191
|
+
|
192
|
+
// // //
|
193
|
+
// Saliences
|
194
|
+
// // //
|
195
|
+
|
196
|
+
saliences =
|
197
|
+
child_join_operator? "saliences" saliences_default_value /
|
198
|
+
child_join_operator? "saliences" "for" local_variable saliences_default_value saliences_body?
|
199
|
+
saliences_default_value =
|
200
|
+
"default" (enum / number)
|
201
|
+
saliences_body =
|
202
|
+
":" statement+
|
203
|
+
|
204
|
+
|
205
|
+
// // //
|
206
|
+
// Associations
|
207
|
+
// // //
|
208
|
+
|
209
|
+
associations =
|
210
|
+
child_join_operator? "associations" associations_default_value /
|
211
|
+
child_join_operator? "associations" "for" local_variable associations_default_value associations_body?
|
212
|
+
associations_default_value =
|
213
|
+
"default" tags
|
214
|
+
associations_body =
|
215
|
+
":" associations_statements
|
216
|
+
associations_statements =
|
217
|
+
associations_statement+
|
218
|
+
associations_statement =
|
219
|
+
associations_conditional / associations_loop / tags
|
106
220
|
associations_conditional =
|
107
|
-
|
108
|
-
|
109
|
-
("
|
110
|
-
|
111
|
-
|
112
|
-
|
221
|
+
associations_conditional_branches ("else:" associations_conditional_alternative)? "end"
|
222
|
+
associations_conditional_branches =
|
223
|
+
"if" associations_conditional_branch ("elif" associations_conditional_branch)*
|
224
|
+
associations_conditional_branch =
|
225
|
+
condition ":" associations_conditional_consequent
|
226
|
+
associations_conditional_consequent =
|
227
|
+
associations_scoped_statements ''
|
228
|
+
associations_conditional_alternative =
|
229
|
+
associations_scoped_statements ''
|
113
230
|
associations_loop =
|
114
|
-
"loop" unary_expression "as"
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
231
|
+
"loop" unary_expression "as" local_variable ":" associations_scoped_statements "end"
|
232
|
+
associations_scoped_statements =
|
233
|
+
(!"end" !"else:" associations_statement)+
|
234
|
+
|
235
|
+
|
236
|
+
// // //
|
237
|
+
// Embargoes
|
238
|
+
// // //
|
239
|
+
|
240
|
+
embargoes =
|
241
|
+
child_join_operator? "embargoes" ":" embargo+
|
242
|
+
embargo =
|
243
|
+
embargo_roles? embargo_time_period embargo_location?
|
244
|
+
embargo_roles =
|
245
|
+
!embargo_time_period role_name ("," role_name)*
|
246
|
+
embargo_time_period =
|
247
|
+
("for" time_period) / "forever"
|
248
|
+
embargo_location =
|
249
|
+
"here"
|
250
|
+
|
251
|
+
|
252
|
+
// // //
|
253
|
+
// Trope-fit expressions
|
254
|
+
// // //
|
255
|
+
|
256
|
+
trope_fit_expression =
|
257
|
+
trope_fit_expression_args &"fits" "fits" name
|
258
|
+
trope_fit_expression_args =
|
259
|
+
reference ("," reference)*
|
132
260
|
|
133
261
|
|
262
|
+
// // //
|
134
263
|
// High-level language features
|
264
|
+
// // //
|
135
265
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
condition =
|
151
|
-
|
152
|
-
|
153
|
-
scoped_statements
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
assignment_lvalue assignment_operator expression
|
162
|
-
assignment_lvalue = role_anchored_reference / local_variable_anchored_reference
|
163
|
-
assignment_lvalue_start = role_reference_sigil / local_variable_sigil / global_variable_sigil
|
164
|
-
arithmetic_expression = "{" unary_expression arithmetic_operator expression "}" /
|
165
|
-
unary_expression arithmetic_operator expression
|
166
|
-
logical_expression = disjunction ''
|
167
|
-
disjunction = conjunction ("||" conjunction)* /
|
168
|
-
negation? "{" conjunction ("||" conjunction)+ "}" !"&&"
|
169
|
-
conjunction = ("{" expression "}" / relational_expression) ("&&" logical_expression)* /
|
170
|
-
negation? "{" ("{" expression "}" / relational_expression) ("&&" logical_expression)+ "}"
|
171
|
-
relational_expression = negation? "{" unary_expression relational_operator unary_expression "}" /
|
172
|
-
unary_expression relational_operator unary_expression /
|
173
|
-
unary_expression
|
174
|
-
unary_expression = negation? "{" simple_unary_expression "}" / negation? simple_unary_expression
|
175
|
-
simple_unary_expression = object / chance_expression / trope_fit_expression / adapter_function_call /
|
176
|
-
list / role_anchored_reference / local_variable_anchored_reference /
|
177
|
-
role_unpacking / literal
|
178
|
-
chance_expression = "-"? r"[0-9]+(\.[0-9]+)?" "%"
|
179
|
-
negation = "!"
|
180
|
-
assignment_operator = "+=" / "-=" / "*=" / "/=" / "=" / "append" / "remove"
|
181
|
-
relational_operator = "==" / "!=" / "<=" / ">=" / "<" / ">" / "in"
|
182
|
-
arithmetic_operator = "+" / "-" !">" / "*" / "/"
|
183
|
-
literal = enum / string / number / boolean / null_type
|
266
|
+
adapter_function_call =
|
267
|
+
"~" name "(" args? ")" eval_fail_safe_marker?
|
268
|
+
args =
|
269
|
+
expression ("," expression)*
|
270
|
+
statements =
|
271
|
+
statement+
|
272
|
+
statement =
|
273
|
+
conditional / loop / reaction / expression / literal
|
274
|
+
conditional =
|
275
|
+
conditional_branches ("else:" alternative)? "end"
|
276
|
+
conditional_branches =
|
277
|
+
"if" conditional_branch ("elif" conditional_branch)*
|
278
|
+
conditional_branch =
|
279
|
+
condition ":" consequent
|
280
|
+
condition =
|
281
|
+
expression ''
|
282
|
+
consequent =
|
283
|
+
scoped_statements ''
|
284
|
+
alternative =
|
285
|
+
scoped_statements ''
|
286
|
+
scoped_statements =
|
287
|
+
(!"end" !"else:" statement)+
|
288
|
+
loop =
|
289
|
+
"loop" unary_expression "as" local_variable ":" scoped_statements "end"
|
290
|
+
local_variable = local_variable_sigil binding_type name
|
184
291
|
|
185
292
|
|
293
|
+
// // //
|
294
|
+
// Expressions
|
295
|
+
// // //
|
296
|
+
|
297
|
+
expression =
|
298
|
+
assignment_expression / arithmetic_expression / logical_expression / unary_expression
|
299
|
+
assignment_expression =
|
300
|
+
&"{" &assignment_lvalue_start "{" assignment_lvalue assignment_operator expression "}" /
|
301
|
+
assignment_lvalue assignment_operator expression
|
302
|
+
assignment_lvalue =
|
303
|
+
reference ''
|
304
|
+
assignment_lvalue_start =
|
305
|
+
entity_sigil / symbol_sigil / scratch_variable_sigil / local_variable_sigil
|
306
|
+
arithmetic_expression =
|
307
|
+
"{" unary_expression arithmetic_operator expression "}" /
|
308
|
+
unary_expression arithmetic_operator expression
|
309
|
+
logical_expression =
|
310
|
+
disjunction ''
|
311
|
+
disjunction =
|
312
|
+
conjunction ("||" conjunction)* /
|
313
|
+
negation? "{" conjunction ("||" conjunction)+ "}" !"&&"
|
314
|
+
conjunction =
|
315
|
+
("{" expression "}" / relational_expression) ("&&" logical_expression)* /
|
316
|
+
negation? "{" ("{" expression "}" / relational_expression) ("&&" logical_expression)+ "}"
|
317
|
+
relational_expression =
|
318
|
+
negation? "{" unary_expression relational_operator unary_expression "}" /
|
319
|
+
unary_expression relational_operator unary_expression /
|
320
|
+
unary_expression
|
321
|
+
unary_expression =
|
322
|
+
negation? "{" simple_unary_expression "}" / negation? simple_unary_expression
|
323
|
+
simple_unary_expression =
|
324
|
+
object / chance_expression / trope_fit_expression / adapter_function_call /
|
325
|
+
list / reference / role_unpacking / literal
|
326
|
+
chance_expression =
|
327
|
+
"-"? r"[0-9]+(\.[0-9]+)?" "%"
|
328
|
+
negation =
|
329
|
+
"!"
|
330
|
+
assignment_operator =
|
331
|
+
"+=" / "-=" / "*=" / "/=" / "=" / "append" / "remove"
|
332
|
+
relational_operator =
|
333
|
+
"==" / "!=" / "<=" / ">=" / "<" / ">" / "in"
|
334
|
+
arithmetic_operator =
|
335
|
+
"+" / "-" !">" / "*" / "/"
|
336
|
+
literal =
|
337
|
+
enum / string / number / boolean / null_type
|
338
|
+
|
339
|
+
|
340
|
+
// // //
|
341
|
+
// Sigils
|
342
|
+
// // //
|
343
|
+
|
344
|
+
entity_sigil =
|
345
|
+
"@"
|
346
|
+
symbol_sigil =
|
347
|
+
"&"
|
348
|
+
scratch_variable_sigil =
|
349
|
+
"$"
|
350
|
+
local_variable_sigil =
|
351
|
+
"_"
|
352
|
+
role_unpacking_sigil =
|
353
|
+
"*"
|
354
|
+
|
355
|
+
|
356
|
+
// // //
|
186
357
|
// References
|
358
|
+
// // //
|
359
|
+
|
360
|
+
reference =
|
361
|
+
(scratch_variable_sigil / local_variable_sigil)? entity_sigil name reference_path? /
|
362
|
+
(scratch_variable_sigil / local_variable_sigil)? symbol_sigil name reference_path?
|
363
|
+
reference_path =
|
364
|
+
(reference_path_property_name / reference_path_pointer / reference_path_lookup)+
|
365
|
+
reference_path_property_name =
|
366
|
+
"." property_name eval_fail_safe_marker?
|
367
|
+
reference_path_pointer =
|
368
|
+
"->" property_name eval_fail_safe_marker?
|
369
|
+
reference_path_lookup =
|
370
|
+
"[" expression "]" eval_fail_safe_marker?
|
371
|
+
property_name =
|
372
|
+
r"[a-zA-Z0-9_]+"
|
373
|
+
eval_fail_safe_marker =
|
374
|
+
"?"
|
375
|
+
role_unpacking =
|
376
|
+
role_unpacking_sigil name
|
377
|
+
|
378
|
+
|
379
|
+
// // //
|
380
|
+
// Templated text
|
381
|
+
// // //
|
382
|
+
|
383
|
+
templated_text =
|
384
|
+
'"' (!'"' template_gap / template_frame_component_double_quote)+ '"' /
|
385
|
+
"'" (!"'" template_gap / template_frame_component_single_quote)+ "'"
|
386
|
+
template_frame_component_double_quote =
|
387
|
+
r'[^"{]+'
|
388
|
+
template_frame_component_single_quote =
|
389
|
+
r"[^'{]+"
|
390
|
+
template_gap =
|
391
|
+
"{" (reference / role_unpacking) "}"
|
392
|
+
|
393
|
+
|
394
|
+
// // //
|
395
|
+
// Enums
|
396
|
+
// // //
|
397
|
+
|
398
|
+
enum =
|
399
|
+
('-' / '+')? enum_token
|
400
|
+
enum_token =
|
401
|
+
r'(##|#)[A-Za-z_][A-Za-z0-9\-_]*'
|
402
|
+
|
403
|
+
|
404
|
+
// // //
|
405
|
+
// Objects
|
406
|
+
// // //
|
407
|
+
|
408
|
+
object =
|
409
|
+
&"{" &object_key_start "{" (key_value_pair ("," key_value_pair)*)? "}"
|
410
|
+
object_key_start =
|
411
|
+
'"' / "'" / r"[A-Za-z_]"
|
412
|
+
key_value_pair =
|
413
|
+
key ":" value
|
414
|
+
key =
|
415
|
+
string / bare_key
|
416
|
+
bare_key =
|
417
|
+
r"[A-Za-z_][A-Za-z0-9_\-]*"
|
418
|
+
value =
|
419
|
+
expression ''
|
420
|
+
|
421
|
+
|
422
|
+
// // //
|
423
|
+
// Other literals
|
424
|
+
// // //
|
425
|
+
|
426
|
+
list =
|
427
|
+
"[" (expression ("," expression)*)? "]"
|
428
|
+
number =
|
429
|
+
sign? r"[0-9]*" point r"[0-9]+" / sign? r"[0-9]+" point?
|
430
|
+
sign =
|
431
|
+
'-' / '+'
|
432
|
+
point =
|
433
|
+
"." / "." // There must be multiple rules to get the point itself to surface
|
434
|
+
string =
|
435
|
+
'"' (!'"' (reference / space / character))* '"' /
|
436
|
+
"'" (!"'" (reference / space / character))* "'"
|
437
|
+
character =
|
438
|
+
r'[^"\'{@*$]+'
|
439
|
+
space =
|
440
|
+
r"[ \t]+"
|
441
|
+
boolean =
|
442
|
+
"true" / "false"
|
443
|
+
null_type =
|
444
|
+
"null"
|
445
|
+
|
446
|
+
|
447
|
+
// // //
|
448
|
+
// Miscellaneous
|
449
|
+
// // //
|
187
450
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
// Data structures
|
200
|
-
|
201
|
-
list = "[" (expression ("," expression)*)? "]"
|
202
|
-
object = &"{" &object_key_start "{" (key_value_pair ("," key_value_pair)*)? "}"
|
203
|
-
object_key_start = '"' / "'" / r"[A-Za-z_]"
|
204
|
-
key_value_pair = key ":" value
|
205
|
-
key = string / bare_key
|
206
|
-
bare_key = r"[A-Za-z_][A-Za-z0-9_\-]*"
|
207
|
-
value = expression ''
|
208
|
-
|
209
|
-
|
210
|
-
// Literals
|
211
|
-
|
212
|
-
number = sign? r"[0-9]*" point r"[0-9]+" / sign? r"[0-9]+" point?
|
213
|
-
sign = '-' / '+'
|
214
|
-
point = "." / "." // There must be multiple rules to get the point itself to surface
|
215
|
-
string = '"' (!'"' (reference / space / character))* '"' /
|
216
|
-
"'" (!"'" (reference / space / character))* "'"
|
217
|
-
character = r'[^"\'{@*$]+'
|
218
|
-
space = r"[ \t]+"
|
219
|
-
token = !reserved r"[A-Za-z_][A-Za-z0-9\-_]*"
|
220
|
-
boolean = "true" / "false"
|
221
|
-
null_type = "null"
|
222
|
-
enum = ('-' / '+')? enum_token
|
223
|
-
enum_token = r'(##|#)[A-Za-z_][A-Za-z0-9\-_]*'
|
224
|
-
templated_text = '"' (!'"' template_gap / template_frame_component_double_quote)+ '"' /
|
225
|
-
"'" (!"'" template_gap / template_frame_component_single_quote)+ "'"
|
226
|
-
template_frame_component_double_quote = r'[^"{]+'
|
227
|
-
template_frame_component_single_quote = r"[^'{]+"
|
228
|
-
template_gap = "{" (reference / role_unpacking) "}"
|
451
|
+
name =
|
452
|
+
(!reserved r"[A-Za-z_][A-Za-z0-9\-_]*")
|
453
|
+
reserved =
|
454
|
+
"loop" / "gloss" / "roles" / "preconditions" / "effects" / "reactions" / "saliences" /
|
455
|
+
"priority" / "kill_code" / "abandon" / "if" / "else" / "end" / "action" / "when" /
|
456
|
+
"where" / "associations" / "special" / "default" / "urgent" / "type" / "__causes__" /
|
457
|
+
"__groups__" / "__action__" / "join" / "tags" / "embargoes" / "here" / "include" /
|
458
|
+
"report" / "trope" / "fits" / "with" / "scratch"
|
459
|
+
comment =
|
460
|
+
r"\/\/[^\n]*"
|