jaclang 0.5.11__py3-none-any.whl → 0.5.15__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.

Potentially problematic release.


This version of jaclang might be problematic. Click here for more details.

Files changed (43) hide show
  1. jaclang/cli/cli.py +20 -0
  2. jaclang/compiler/__init__.py +35 -19
  3. jaclang/compiler/absyntree.py +103 -95
  4. jaclang/compiler/generated/jac_parser.py +4069 -0
  5. jaclang/compiler/jac.lark +655 -0
  6. jaclang/compiler/parser.py +44 -31
  7. jaclang/compiler/passes/main/fuse_typeinfo_pass.py +92 -37
  8. jaclang/compiler/passes/main/import_pass.py +8 -5
  9. jaclang/compiler/passes/main/pyast_gen_pass.py +512 -352
  10. jaclang/compiler/passes/main/pyast_load_pass.py +271 -64
  11. jaclang/compiler/passes/main/registry_pass.py +3 -7
  12. jaclang/compiler/passes/main/tests/test_pyast_gen_pass.py +2 -0
  13. jaclang/compiler/passes/main/type_check_pass.py +4 -1
  14. jaclang/compiler/passes/tool/jac_formatter_pass.py +7 -0
  15. jaclang/compiler/passes/tool/tests/test_unparse_validate.py +16 -0
  16. jaclang/compiler/passes/utils/mypy_ast_build.py +93 -0
  17. jaclang/compiler/tests/test_importer.py +15 -0
  18. jaclang/core/aott.py +4 -3
  19. jaclang/core/construct.py +1 -1
  20. jaclang/core/importer.py +109 -51
  21. jaclang/core/llms.py +29 -0
  22. jaclang/core/registry.py +22 -0
  23. jaclang/core/utils.py +72 -0
  24. jaclang/plugin/default.py +118 -6
  25. jaclang/plugin/feature.py +29 -2
  26. jaclang/plugin/spec.py +25 -2
  27. jaclang/utils/helpers.py +7 -9
  28. jaclang/utils/lang_tools.py +37 -13
  29. jaclang/utils/test.py +1 -3
  30. jaclang/utils/tests/test_lang_tools.py +6 -0
  31. jaclang/vendor/lark/grammars/common.lark +59 -0
  32. jaclang/vendor/lark/grammars/lark.lark +62 -0
  33. jaclang/vendor/lark/grammars/python.lark +302 -0
  34. jaclang/vendor/lark/grammars/unicode.lark +7 -0
  35. {jaclang-0.5.11.dist-info → jaclang-0.5.15.dist-info}/METADATA +1 -1
  36. {jaclang-0.5.11.dist-info → jaclang-0.5.15.dist-info}/RECORD +40 -36
  37. jaclang/compiler/__jac_gen__/jac_parser.py +0 -4069
  38. jaclang/compiler/tests/fixtures/__jac_gen__/__init__.py +0 -0
  39. jaclang/compiler/tests/fixtures/__jac_gen__/hello_world.py +0 -5
  40. /jaclang/compiler/{__jac_gen__ → generated}/__init__.py +0 -0
  41. {jaclang-0.5.11.dist-info → jaclang-0.5.15.dist-info}/WHEEL +0 -0
  42. {jaclang-0.5.11.dist-info → jaclang-0.5.15.dist-info}/entry_points.txt +0 -0
  43. {jaclang-0.5.11.dist-info → jaclang-0.5.15.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,655 @@
1
+ // Base Module structure
2
+ start: module
3
+
4
+ module: (doc_tag? element (element_with_doc | element)*)?
5
+ | doc_tag (element_with_doc (element_with_doc | element)*)?
6
+
7
+ doc_tag: STRING | DOC_STRING
8
+ element_with_doc: doc_tag element
9
+
10
+ element: import_stmt
11
+ | architype
12
+ | ability
13
+ | global_var
14
+ | free_code
15
+ | py_code_block
16
+ | test
17
+
18
+ // Import/Include Statements
19
+ import_stmt: KW_IMPORT sub_name KW_FROM from_path COMMA import_items SEMI
20
+ | KW_IMPORT sub_name import_path (COMMA import_path)* SEMI
21
+ | include_stmt
22
+
23
+ from_path: (DOT | ELLIPSIS)* import_path
24
+ | (DOT | ELLIPSIS)+
25
+
26
+ import_path: named_ref (DOT named_ref)* (KW_AS NAME)?
27
+ import_items: (import_item COMMA)* import_item
28
+ import_item: named_ref (KW_AS NAME)?
29
+ sub_name: COLON NAME
30
+ include_stmt: KW_INCLUDE sub_name import_path SEMI
31
+
32
+ // Architypes
33
+ architype: decorators? (enum | architype_def | architype_decl)
34
+ architype_decl: arch_type access_tag? STRING? NAME inherited_archs? (member_block | SEMI)
35
+ architype_def: abil_to_arch_chain member_block
36
+ decorators: (DECOR_OP atomic_chain)+
37
+ access_tag: COLON ( KW_PROT | KW_PUB | KW_PRIV )
38
+
39
+ inherited_archs: LT (atomic_chain COMMA)* atomic_chain GT
40
+ | COLON (atomic_chain COMMA)* atomic_chain COLON
41
+
42
+ arch_type: KW_WALKER
43
+ | KW_OBJECT
44
+ | KW_EDGE
45
+ | KW_NODE
46
+ | KW_CLASS
47
+
48
+ // Architype bodies
49
+ member_block: LBRACE member_stmt* RBRACE
50
+ member_stmt: doc_tag? (py_code_block | abstract_ability | ability | architype | has_stmt | free_code)
51
+ has_stmt: KW_STATIC? (KW_LET | KW_HAS) access_tag? has_assign_list SEMI
52
+ has_assign_list: (has_assign_list COMMA)? typed_has_clause
53
+ typed_has_clause: named_ref (COLON STRING)? type_tag (EQ expression | KW_BY KW_POST_INIT)?
54
+ type_tag: COLON expression
55
+
56
+ // Enumerations
57
+ enum: enum_def
58
+ | enum_decl
59
+
60
+ enum_decl: KW_ENUM access_tag? STRING? NAME inherited_archs? (enum_block | SEMI)
61
+ enum_def: arch_to_enum_chain enum_block
62
+ enum_block: LBRACE ((enum_stmt COMMA)* enum_stmt)? RBRACE
63
+
64
+ enum_stmt: NAME (COLON STRING)? EQ expression
65
+ | NAME (COLON STRING)?
66
+ | py_code_block
67
+
68
+ // Abilities
69
+ ability: decorators? ability_def
70
+ | decorators? KW_ASYNC? ability_decl
71
+ | decorators? genai_ability
72
+
73
+ ability_decl: KW_OVERRIDE? KW_STATIC? KW_CAN access_tag? STRING? any_ref (func_decl | event_clause) (code_block | SEMI)
74
+ ability_def: arch_to_abil_chain (func_decl | event_clause) code_block
75
+ abstract_ability: KW_OVERRIDE? KW_STATIC? KW_CAN access_tag? STRING? any_ref (func_decl | event_clause) KW_ABSTRACT SEMI
76
+ genai_ability: KW_OVERRIDE? KW_STATIC? KW_CAN access_tag? STRING? any_ref (func_decl) KW_BY atomic_call SEMI
77
+ event_clause: KW_WITH expression? (KW_EXIT | KW_ENTRY) (STRING? RETURN_HINT expression)?
78
+ func_decl: (LPAREN func_decl_params? RPAREN)? (RETURN_HINT (STRING COLON)? expression)?
79
+ func_decl_params: (param_var COMMA)* param_var
80
+ param_var: (STAR_POW | STAR_MUL)? NAME (COLON STRING)? type_tag (EQ expression)?
81
+
82
+ // Global variables
83
+ global_var: (KW_LET | KW_GLOBAL) access_tag? assignment_list SEMI
84
+ assignment_list: (assignment_list COMMA)? assignment
85
+
86
+ // Free code
87
+ free_code: KW_WITH KW_ENTRY sub_name? code_block
88
+
89
+ // Inline python
90
+ py_code_block: PYNLINE
91
+
92
+ // Tests
93
+ test: KW_TEST NAME? code_block
94
+
95
+ // Implementations
96
+ arch_or_ability_chain: arch_or_ability_chain? (ability_ref | arch_ref)
97
+ abil_to_arch_chain: arch_or_ability_chain? arch_ref
98
+ arch_to_abil_chain: arch_or_ability_chain? ability_ref
99
+ arch_to_enum_chain: arch_or_ability_chain? enum_ref
100
+
101
+ arch_ref: class_ref
102
+ | object_ref
103
+ | walker_ref
104
+ | edge_ref
105
+ | node_ref
106
+
107
+ node_ref: NODE_OP named_ref
108
+ edge_ref: EDGE_OP named_ref
109
+ walker_ref: WALKER_OP named_ref
110
+ class_ref: CLASS_OP named_ref
111
+ object_ref: OBJECT_OP named_ref
112
+ enum_ref: ENUM_OP named_ref
113
+ ability_ref: ABILITY_OP named_ref
114
+
115
+ // Codeblocks and Statements
116
+ code_block: LBRACE statement* RBRACE
117
+
118
+ statement: import_stmt
119
+ | ability
120
+ | architype
121
+ | if_stmt
122
+ | while_stmt
123
+ | for_stmt
124
+ | try_stmt
125
+ | match_stmt
126
+ | with_stmt
127
+ | global_ref SEMI
128
+ | nonlocal_ref SEMI
129
+ | typed_ctx_block
130
+ | return_stmt SEMI
131
+ | yield_expr SEMI
132
+ | raise_stmt SEMI
133
+ | assert_stmt SEMI
134
+ | assignment SEMI
135
+ | delete_stmt SEMI
136
+ | report_stmt SEMI
137
+ | expression SEMI
138
+ | ctrl_stmt SEMI
139
+ | py_code_block
140
+ | walker_stmt
141
+ | SEMI
142
+
143
+
144
+ // If statements
145
+ if_stmt: KW_IF expression code_block (elif_stmt | else_stmt)?
146
+ elif_stmt: KW_ELIF expression code_block (elif_stmt | else_stmt)?
147
+ else_stmt: KW_ELSE code_block
148
+
149
+ // While statements
150
+ while_stmt: KW_WHILE expression code_block
151
+
152
+ // For statements
153
+ for_stmt: KW_ASYNC? KW_FOR assignment KW_TO expression KW_BY assignment code_block else_stmt?
154
+ | KW_ASYNC? KW_FOR atomic_chain KW_IN expression code_block else_stmt?
155
+
156
+ // Try statements
157
+ try_stmt: KW_TRY code_block except_list? else_stmt? finally_stmt?
158
+ except_list: except_def+
159
+ except_def: KW_EXCEPT expression (KW_AS NAME)? code_block
160
+ finally_stmt: KW_FINALLY code_block
161
+
162
+ // Match statements
163
+ match_stmt: KW_MATCH expression LBRACE match_case_block+ RBRACE
164
+ match_case_block: KW_CASE pattern_seq (KW_IF expression)? COLON statement+
165
+
166
+ // Match patterns
167
+ pattern_seq: (or_pattern | as_pattern)
168
+ or_pattern: (pattern BW_OR)* pattern
169
+ as_pattern: or_pattern KW_AS NAME
170
+
171
+ pattern: literal_pattern
172
+ | singleton_pattern
173
+ | capture_pattern
174
+ | sequence_pattern
175
+ | mapping_pattern
176
+ | class_pattern
177
+
178
+
179
+ // Match litteral patterns
180
+ literal_pattern: (INT | FLOAT | multistring)
181
+
182
+ // Match singleton patterns
183
+ singleton_pattern: (NULL | BOOL)
184
+
185
+ // Match capture patterns
186
+ capture_pattern: NAME
187
+
188
+ // Match sequence patterns
189
+ sequence_pattern: LSQUARE list_inner_pattern (COMMA list_inner_pattern)* RSQUARE
190
+ | LPAREN list_inner_pattern (COMMA list_inner_pattern)* RPAREN
191
+
192
+ // Match mapping patterns
193
+ mapping_pattern: LBRACE (dict_inner_pattern (COMMA dict_inner_pattern)*)? RBRACE
194
+ list_inner_pattern: (pattern_seq | STAR_MUL NAME)
195
+ dict_inner_pattern: (literal_pattern COLON pattern_seq | STAR_POW NAME)
196
+
197
+ // Match class patterns
198
+ class_pattern: NAME LPAREN kw_pattern_list? RPAREN
199
+ | NAME LPAREN pattern_list (COMMA kw_pattern_list)? RPAREN
200
+
201
+ pattern_list: (pattern_list COMMA)? pattern_seq
202
+ kw_pattern_list: (kw_pattern_list COMMA)? named_ref EQ pattern_seq
203
+
204
+ // Context managers
205
+ with_stmt: KW_ASYNC? KW_WITH expr_as_list code_block
206
+ expr_as_list: (expr_as COMMA)* expr_as
207
+ expr_as: expression (KW_AS expression)?
208
+
209
+ // Global and nonlocal statements
210
+ global_ref: GLOBAL_OP name_list
211
+ nonlocal_ref: NONLOCAL_OP name_list
212
+ name_list: (named_ref COMMA)* named_ref
213
+
214
+ // Data spatial typed context blocks
215
+ typed_ctx_block: RETURN_HINT expression code_block
216
+
217
+ // Return statements
218
+ return_stmt: KW_RETURN expression?
219
+
220
+ // Yield statements
221
+ yield_expr: KW_YIELD KW_FROM? expression
222
+
223
+ // Raise statements
224
+ raise_stmt: KW_RAISE (expression (KW_FROM expression)?)?
225
+
226
+ // Assert statements
227
+ assert_stmt: KW_ASSERT expression (COMMA expression)?
228
+
229
+ // Delete statements
230
+ delete_stmt: KW_DELETE expression
231
+
232
+ // Report statements
233
+ report_stmt: KW_REPORT expression
234
+
235
+ // Control statements
236
+ ctrl_stmt: KW_SKIP | KW_BREAK | KW_CONTINUE
237
+
238
+ // Data spatial Walker statements
239
+ walker_stmt: visit_stmt
240
+ | revisit_stmt
241
+ | disengage_stmt
242
+ | ignore_stmt
243
+
244
+ // Visit statements
245
+ visit_stmt: KW_VISIT (inherited_archs)? expression (else_stmt | SEMI)
246
+
247
+ // Revisit statements
248
+ revisit_stmt: KW_REVISIT expression? (else_stmt | SEMI)
249
+
250
+ // Disengage statements
251
+ disengage_stmt: KW_DISENGAGE SEMI
252
+
253
+ // Ignore statements
254
+ ignore_stmt: KW_IGNORE expression SEMI
255
+
256
+ // Assignments
257
+ assignment: KW_LET? (atomic_chain EQ)+ (yield_expr | expression)
258
+ | atomic_chain (COLON STRING)? type_tag (EQ (yield_expr | expression))?
259
+ | atomic_chain aug_op (yield_expr | expression)
260
+
261
+ aug_op: RSHIFT_EQ
262
+ | LSHIFT_EQ
263
+ | BW_NOT_EQ
264
+ | BW_XOR_EQ
265
+ | BW_OR_EQ
266
+ | BW_AND_EQ
267
+ | MOD_EQ
268
+ | DIV_EQ
269
+ | FLOOR_DIV_EQ
270
+ | MUL_EQ
271
+ | SUB_EQ
272
+ | ADD_EQ
273
+ | MATMUL_EQ
274
+ | STAR_POW_EQ
275
+
276
+ // Expressions
277
+ expression: walrus_assign (KW_IF expression KW_ELSE expression)?
278
+ | lambda_expr
279
+
280
+ // Walrus assignments
281
+ walrus_assign: (any_ref WALRUS_EQ)? pipe
282
+
283
+ // Lambda expressions
284
+ lambda_expr: KW_WITH func_decl_params? (RETURN_HINT expression)? KW_CAN expression
285
+
286
+ // Pipe expressions
287
+ pipe: (pipe PIPE_FWD)? pipe_back
288
+
289
+ // Pipe back expressions
290
+ pipe_back: (pipe_back PIPE_BKWD)? elvis_check
291
+
292
+ // Elvis expressions
293
+ elvis_check: (elvis_check ELVIS_OP)? bitwise_or
294
+
295
+ // Bitwise expressions
296
+ bitwise_or: (bitwise_or BW_OR)? bitwise_xor
297
+ bitwise_xor: (bitwise_xor BW_XOR)? bitwise_and
298
+ bitwise_and: (bitwise_and BW_AND)? shift
299
+ shift: (shift (RSHIFT | LSHIFT))? logical_or
300
+
301
+ // Logical and compare expressions
302
+ logical_or: logical_and (KW_OR logical_and)*
303
+ logical_and: logical_not (KW_AND logical_not)*
304
+ logical_not: NOT logical_not | compare
305
+ compare: (arithmetic cmp_op)* arithmetic
306
+
307
+ cmp_op: KW_ISN
308
+ | KW_IS
309
+ | KW_NIN
310
+ | KW_IN
311
+ | NE
312
+ | GTE
313
+ | LTE
314
+ | GT
315
+ | LT
316
+ | EE
317
+
318
+ // Arithmetic expressions
319
+ arithmetic: (arithmetic (MINUS | PLUS))? term
320
+ term: (term (MOD | DIV | FLOOR_DIV | STAR_MUL | DECOR_OP))? factor
321
+ factor: (BW_NOT | MINUS | PLUS) factor | power
322
+ power: (power STAR_POW)? connect
323
+
324
+ // Connect expressions
325
+ connect: (connect (connect_op | disconnect_op))? atomic_pipe
326
+
327
+ // Atomic expressions
328
+ atomic_pipe: (atomic_pipe A_PIPE_FWD)? atomic_pipe_back
329
+
330
+ // Atomic pipe back expressions
331
+ atomic_pipe_back: (atomic_pipe_back A_PIPE_BKWD)? ds_spawn
332
+
333
+ // Data spatial spawn expressions
334
+ ds_spawn: (ds_spawn KW_SPAWN)? unpack
335
+
336
+ // Unpack expressions
337
+ unpack: STAR_MUL? ref
338
+
339
+ // References (unused)
340
+ ref: BW_AND? pipe_call
341
+
342
+ // Data spatial calls
343
+ pipe_call: (PIPE_FWD | A_PIPE_FWD | KW_SPAWN | KW_AWAIT)? atomic_chain
344
+
345
+ // Subscripted and dotted expressions
346
+ atomic_chain: atomic_chain NULL_OK? (filter_compr | assign_compr | index_slice)
347
+ | atomic_chain NULL_OK? (DOT_BKWD | DOT_FWD | DOT) any_ref
348
+ | (atomic_call | atom | edge_ref_chain)
349
+
350
+ index_slice: LSQUARE expression? COLON expression? (COLON expression?)? RSQUARE
351
+ | list_val
352
+
353
+ // Function calls
354
+ atomic_call: atomic_chain LPAREN param_list? (KW_BY atomic_call)? RPAREN
355
+
356
+ param_list: expr_list COMMA kw_expr_list
357
+ | kw_expr_list
358
+ | expr_list
359
+
360
+ // Atom
361
+ atom: any_ref
362
+ | LPAREN (expression | yield_expr) RPAREN
363
+ | atom_collection
364
+ | atom_literal
365
+
366
+ atom_literal: builtin_type
367
+ | NULL
368
+ | BOOL
369
+ | multistring
370
+ | ELLIPSIS
371
+ | FLOAT
372
+ | OCT
373
+ | BIN
374
+ | HEX
375
+ | INT
376
+
377
+ multistring: (fstring | STRING | DOC_STRING)+
378
+
379
+ fstring: FSTR_START fstr_parts FSTR_END
380
+ | FSTR_SQ_START fstr_sq_parts FSTR_SQ_END
381
+
382
+ fstr_parts: (FSTR_PIECE | FSTR_BESC | LBRACE expression RBRACE )*
383
+ fstr_sq_parts: (FSTR_SQ_PIECE | FSTR_BESC | LBRACE expression RBRACE )*
384
+
385
+ // Collection values
386
+ atom_collection: dict_compr
387
+ | set_compr
388
+ | gen_compr
389
+ | list_compr
390
+ | dict_val
391
+ | set_val
392
+ | tuple_val
393
+ | list_val
394
+
395
+ list_compr: LSQUARE expression inner_compr+ RSQUARE
396
+ gen_compr: LPAREN expression inner_compr+ RPAREN
397
+ set_compr: LBRACE expression inner_compr+ RBRACE
398
+ dict_compr: LBRACE kv_pair inner_compr+ RBRACE
399
+ inner_compr: KW_ASYNC? KW_FOR atomic_chain KW_IN pipe_call (KW_IF walrus_assign)*
400
+
401
+ dict_val: LBRACE ((kv_pair COMMA)* kv_pair)? RBRACE
402
+ list_val: LSQUARE expr_list? RSQUARE
403
+ tuple_val: LPAREN tuple_list? RPAREN
404
+ set_val: LBRACE expr_list RBRACE
405
+
406
+ kv_pair: expression COLON expression | STAR_POW expression
407
+ expr_list: (expr_list COMMA)? expression
408
+
409
+ // Tuples and Jac Tuples
410
+ tuple_list: expression COMMA expr_list COMMA kw_expr_list
411
+ | expression COMMA kw_expr_list
412
+ | expression COMMA expr_list
413
+ | expression COMMA
414
+ | kw_expr_list
415
+
416
+ kw_expr_list: (kw_expr_list COMMA)? kw_expr
417
+ kw_expr: any_ref EQ expression | STAR_POW expression
418
+
419
+ // Data Spatial References
420
+ edge_ref_chain: (EDGE_OP|NODE_OP)? LSQUARE expression? (edge_op_ref (filter_compr | expression)?)+ RSQUARE
421
+ edge_op_ref: edge_any | edge_from | edge_to
422
+ edge_to: ARROW_R | ARROW_R_P1 typed_filter_compare_list ARROW_R_P2
423
+ edge_from: ARROW_L | ARROW_L_P1 typed_filter_compare_list ARROW_L_P2
424
+ edge_any: ARROW_BI | ARROW_L_P1 typed_filter_compare_list ARROW_R_P2
425
+ connect_op: connect_from | connect_to | connect_any
426
+ disconnect_op: KW_DELETE edge_op_ref
427
+ connect_to: CARROW_R | CARROW_R_P1 expression (COLON kw_expr_list)? CARROW_R_P2
428
+ connect_from: CARROW_L | CARROW_L_P1 expression (COLON kw_expr_list)? CARROW_L_P2
429
+ connect_any: CARROW_BI | CARROW_L_P1 expression (COLON kw_expr_list)? CARROW_R_P2
430
+
431
+ // Special Comprehensions
432
+ filter_compr: LPAREN NULL_OK filter_compare_list RPAREN
433
+ | LPAREN TYPE_OP NULL_OK typed_filter_compare_list RPAREN
434
+ assign_compr: LPAREN EQ kw_expr_list RPAREN
435
+ filter_compare_list: (filter_compare_list COMMA)? filter_compare_item
436
+ typed_filter_compare_list: expression (COLON filter_compare_list)?
437
+ filter_compare_item: named_ref cmp_op expression
438
+
439
+ // Names and references
440
+ any_ref: named_ref
441
+ | type_ref
442
+
443
+ named_ref: special_ref
444
+ | KWESC_NAME
445
+ | NAME
446
+
447
+ type_ref: TYPE_OP (named_ref | builtin_type)
448
+
449
+ special_ref: KW_INIT
450
+ | KW_POST_INIT
451
+ | KW_ROOT
452
+ | KW_SUPER
453
+ | KW_SELF
454
+ | KW_HERE
455
+
456
+ // Builtin types
457
+ builtin_type: TYP_TYPE
458
+ | TYP_ANY
459
+ | TYP_BOOL
460
+ | TYP_DICT
461
+ | TYP_SET
462
+ | TYP_TUPLE
463
+ | TYP_LIST
464
+ | TYP_FLOAT
465
+ | TYP_INT
466
+ | TYP_BYTES
467
+ | TYP_STRING
468
+
469
+ // Lexer Tokens
470
+ TYP_STRING: "str"
471
+ TYP_INT: "int"
472
+ TYP_FLOAT: "float"
473
+ TYP_LIST: "list"
474
+ TYP_TUPLE: "tuple"
475
+ TYP_SET: "set"
476
+ TYP_DICT: "dict"
477
+ TYP_BOOL: "bool"
478
+ TYP_BYTES: "bytes"
479
+ TYP_ANY: "any"
480
+ TYP_TYPE: "type"
481
+ KW_LET: "let"
482
+ KW_ABSTRACT: "abs"
483
+ KW_CLASS: "class"
484
+ KW_OBJECT: "obj"
485
+ KW_ENUM: "enum"
486
+ KW_NODE: "node"
487
+ KW_IGNORE: "ignore"
488
+ KW_VISIT: "visit"
489
+ KW_REVISIT: "revisit"
490
+ KW_SPAWN: "spawn"
491
+ KW_WITH: "with"
492
+ KW_ENTRY: "entry"
493
+ KW_EXIT: "exit"
494
+ KW_IMPORT: "import"
495
+ KW_INCLUDE: "include"
496
+ KW_FROM: "from"
497
+ KW_AS: "as"
498
+ KW_EDGE: "edge"
499
+ KW_WALKER: "walker"
500
+ KW_ASYNC: "async"
501
+ KW_AWAIT: "await"
502
+ KW_TEST: "test"
503
+ KW_ASSERT: "assert"
504
+ KW_IF: "if"
505
+ KW_ELIF: "elif"
506
+ KW_ELSE: "else"
507
+ KW_FOR: "for"
508
+ KW_TO: "to"
509
+ KW_BY: "by"
510
+ KW_WHILE: "while"
511
+ KW_CONTINUE: "continue"
512
+ KW_BREAK: "break"
513
+ KW_DISENGAGE: "disengage"
514
+ KW_YIELD: "yield"
515
+ KW_SKIP: "skip"
516
+ KW_REPORT: "report"
517
+ KW_RETURN: "return"
518
+ KW_DELETE: "del"
519
+ KW_TRY: "try"
520
+ KW_EXCEPT: "except"
521
+ KW_FINALLY: "finally"
522
+ KW_RAISE: "raise"
523
+ KW_IN: "in"
524
+ KW_IS: "is"
525
+ KW_PRIV: "priv"
526
+ KW_PUB: "pub"
527
+ KW_PROT: "protect"
528
+ KW_HAS: "has"
529
+ KW_GLOBAL: "glob"
530
+ KW_CAN: "can"
531
+ KW_STATIC: "static"
532
+ KW_OVERRIDE: "override"
533
+ KW_MATCH: "match"
534
+ KW_CASE: "case"
535
+ KW_HERE: "here"
536
+ KW_SELF: "self"
537
+ KW_INIT: "init"
538
+ KW_POST_INIT: "postinit"
539
+ KW_SUPER: "super"
540
+ KW_ROOT: "root"
541
+
542
+ FLOAT: /(\d+(\.\d*)|\.\d+)([eE][+-]?\d+)?/
543
+ DOC_STRING.1: /"""(.|\n|\r)*?"""|'''(.|\n|\r)*?'''/
544
+ PYNLINE: /::py::(.|\n|\r)*?::py::/
545
+ STRING: /(r?b?|b?r?)"[^"\r\n]*"|(r?b?|b?r?)'[^'\r\n]*'/
546
+ BOOL.1: /True|False/
547
+ KW_NIN.1: /\bnot\s+in\b/
548
+ KW_ISN.1: /\bis\s+not\b/
549
+ HEX: /0[xX][0-9a-fA-F_]+/
550
+ BIN: /0[bB][01_]+/
551
+ OCT: /0[oO][0-7_]+/
552
+ INT: /[0-9][0-9_]*/
553
+ NULL.1: /None/
554
+ KWESC_NAME: /<>[a-zA-Z_][a-zA-Z0-9_]*/
555
+ NAME: /[a-zA-Z_][a-zA-Z0-9_]*/
556
+
557
+ ARROW_BI: /<-->/
558
+ ARROW_L: /<--/
559
+ ARROW_R: /-->/
560
+ ARROW_L_P1: /<-\:/
561
+ ARROW_R_P2: /:->/
562
+ ARROW_L_P2: /:-/
563
+ ARROW_R_P1: /-\:/
564
+ CARROW_BI: /<\+\+>/
565
+ CARROW_L: /<\+\+/
566
+ CARROW_R: /\+\+>/
567
+ CARROW_L_P1: /<\+\:/
568
+ CARROW_R_P2: /:\+>/
569
+ CARROW_L_P2: /:\+/
570
+ CARROW_R_P1: /\+\:/
571
+
572
+ GLOBAL_OP: /:g:|:global:/
573
+ NONLOCAL_OP: /:nl:|:nonlocal:/
574
+ WALKER_OP: /:w:|:walker:/
575
+ NODE_OP: /:n:|:node:/
576
+ EDGE_OP: /:e:|:edge:/
577
+ CLASS_OP: /:cls:|:class:/
578
+ OBJECT_OP: /:o:|:obj:/
579
+ TYPE_OP: /`|:t:|:type:/
580
+ ENUM_OP: /:enum:/
581
+ ABILITY_OP: /:c:|:can:/
582
+ A_PIPE_FWD: /:>/
583
+ A_PIPE_BKWD: /<:/
584
+ PIPE_FWD: /\|>/
585
+ PIPE_BKWD: /<\|/
586
+ DOT_FWD: /\.>/
587
+ DOT_BKWD: /<\./
588
+ RETURN_HINT: /->/
589
+ ELVIS_OP: /\?:/
590
+ NULL_OK: /\?/
591
+ MATMUL_EQ: /@=/
592
+ DECOR_OP: /@/
593
+
594
+ KW_AND.1: /&&|and/
595
+ KW_OR.1: /\|\||or/
596
+ ADD_EQ: /\+=/
597
+ SUB_EQ: /-=/
598
+ STAR_POW_EQ: /\*\*\=/
599
+ MUL_EQ: /\*=/
600
+ FLOOR_DIV_EQ: /\/\/=/
601
+ DIV_EQ: /\/=/
602
+ MOD_EQ: /%=/
603
+ BW_AND_EQ: /&=/
604
+ BW_OR_EQ: /\|=/
605
+ BW_XOR_EQ: /\^=/
606
+ BW_NOT_EQ: /~=/
607
+ LSHIFT_EQ: /<<=/
608
+ RSHIFT_EQ: />>=/
609
+ LSHIFT: /<</
610
+ RSHIFT: />>/
611
+ LTE: /<=/
612
+ GTE: />=/
613
+ NE: /!=/
614
+ NOT: "not"
615
+ WALRUS_EQ: /:=/
616
+ COLON: /:/
617
+ LBRACE: /{/
618
+ RBRACE: /}/
619
+ SEMI: /;/
620
+ EE: /==/
621
+ EQ: /=/
622
+ ELLIPSIS: /\.\.\./
623
+ DOT: /\./
624
+ LT: /</
625
+ GT: />/
626
+ COMMA: /,/
627
+ PLUS: /\+/
628
+ MINUS: /-/
629
+ STAR_POW: /\*\*/
630
+ STAR_MUL: /\*/
631
+ FLOOR_DIV: /\/\//
632
+ DIV: /\//
633
+ MOD: /%/
634
+ BW_AND: /&/
635
+ BW_OR: /\|/
636
+ BW_XOR: /\^/
637
+ BW_NOT: /~/
638
+ LPAREN: /\(/
639
+ RPAREN: /\)/
640
+ LSQUARE: /\[/
641
+ RSQUARE: /\]/
642
+
643
+ // f-string tokens
644
+ FSTR_START.1: "f\""
645
+ FSTR_END: "\""
646
+ FSTR_SQ_START.1: "f'"
647
+ FSTR_SQ_END: "'"
648
+ FSTR_PIECE.-1: /[^\{\}\"]+/
649
+ FSTR_SQ_PIECE.-1: /[^\{\}\']+/
650
+ FSTR_BESC.1: /{{|}}/
651
+
652
+ COMMENT: /#\*(.|\n|\r)*?\*#|#.*/
653
+ WS.-2: /[ \t\f\r\n]/+
654
+ %ignore COMMENT
655
+ %ignore WS