jaseci 1.4.2.6__py3-none-any.whl → 2.0.0__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 jaseci might be problematic. Click here for more details.

Files changed (187) hide show
  1. jaseci/__init__.py +3 -37
  2. jaseci-2.0.0.dist-info/METADATA +65 -0
  3. jaseci-2.0.0.dist-info/RECORD +4 -0
  4. {jaseci-1.4.2.6.dist-info → jaseci-2.0.0.dist-info}/WHEEL +1 -2
  5. jaseci/VERSION +0 -1
  6. jaseci/cli_tools/__init__.py +0 -0
  7. jaseci/cli_tools/book_tools.py +0 -457
  8. jaseci/cli_tools/jsctl.py +0 -500
  9. jaseci/cli_tools/tests/__init__.py +0 -0
  10. jaseci/cli_tools/tests/test_jsctl.py +0 -556
  11. jaseci/extens/__init__.py +0 -0
  12. jaseci/extens/act_lib/__init__.py +0 -0
  13. jaseci/extens/act_lib/date.py +0 -118
  14. jaseci/extens/act_lib/elastic.py +0 -87
  15. jaseci/extens/act_lib/file.py +0 -77
  16. jaseci/extens/act_lib/file_handler.py +0 -190
  17. jaseci/extens/act_lib/internal.py +0 -19
  18. jaseci/extens/act_lib/jaseci.py +0 -62
  19. jaseci/extens/act_lib/mail.py +0 -10
  20. jaseci/extens/act_lib/maths.py +0 -168
  21. jaseci/extens/act_lib/net.py +0 -192
  22. jaseci/extens/act_lib/rand.py +0 -83
  23. jaseci/extens/act_lib/regex.py +0 -85
  24. jaseci/extens/act_lib/request.py +0 -170
  25. jaseci/extens/act_lib/std.py +0 -236
  26. jaseci/extens/act_lib/storage.py +0 -53
  27. jaseci/extens/act_lib/stripe.py +0 -338
  28. jaseci/extens/act_lib/task.py +0 -14
  29. jaseci/extens/act_lib/tests/__init__.py +0 -0
  30. jaseci/extens/act_lib/tests/std_test_code.py +0 -37
  31. jaseci/extens/act_lib/tests/test_date.py +0 -26
  32. jaseci/extens/act_lib/tests/test_elastic.py +0 -159
  33. jaseci/extens/act_lib/tests/test_file.py +0 -116
  34. jaseci/extens/act_lib/tests/test_file_lib.py +0 -40
  35. jaseci/extens/act_lib/tests/test_mail_lib.py +0 -33
  36. jaseci/extens/act_lib/tests/test_maths.py +0 -147
  37. jaseci/extens/act_lib/tests/test_net_lib.py +0 -62
  38. jaseci/extens/act_lib/tests/test_regex.py +0 -61
  39. jaseci/extens/act_lib/tests/test_std.py +0 -51
  40. jaseci/extens/act_lib/tests/test_std_lib.py +0 -36
  41. jaseci/extens/act_lib/tests/test_url.py +0 -32
  42. jaseci/extens/act_lib/tests/test_vector.py +0 -36
  43. jaseci/extens/act_lib/tests/test_webtool.py +0 -44
  44. jaseci/extens/act_lib/tests/test_zlib.py +0 -24
  45. jaseci/extens/act_lib/url.py +0 -80
  46. jaseci/extens/act_lib/vector.py +0 -158
  47. jaseci/extens/act_lib/webtool.py +0 -29
  48. jaseci/extens/act_lib/zip.py +0 -34
  49. jaseci/extens/api/__init__.py +0 -0
  50. jaseci/extens/api/actions_api.py +0 -171
  51. jaseci/extens/api/alias_api.py +0 -140
  52. jaseci/extens/api/architype_api.py +0 -197
  53. jaseci/extens/api/config_api.py +0 -129
  54. jaseci/extens/api/global_api.py +0 -85
  55. jaseci/extens/api/graph_api.py +0 -168
  56. jaseci/extens/api/health_api.py +0 -21
  57. jaseci/extens/api/interface.py +0 -269
  58. jaseci/extens/api/jac_api.py +0 -172
  59. jaseci/extens/api/jsorc_api.py +0 -317
  60. jaseci/extens/api/logger_api.py +0 -90
  61. jaseci/extens/api/master_api.py +0 -134
  62. jaseci/extens/api/object_api.py +0 -102
  63. jaseci/extens/api/prometheus_api.py +0 -75
  64. jaseci/extens/api/queue_api.py +0 -141
  65. jaseci/extens/api/sentinel_api.py +0 -271
  66. jaseci/extens/api/share_api.py +0 -64
  67. jaseci/extens/api/super_api.py +0 -65
  68. jaseci/extens/api/tests/__init__.py +0 -0
  69. jaseci/extens/api/tests/test_architype_api.py +0 -66
  70. jaseci/extens/api/tests/test_global_api.py +0 -179
  71. jaseci/extens/api/tests/test_graph_api.py +0 -64
  72. jaseci/extens/api/tests/test_logger_api.py +0 -43
  73. jaseci/extens/api/tests/test_object_api.py +0 -20
  74. jaseci/extens/api/tests/test_sentinel_api.py +0 -66
  75. jaseci/extens/api/tests/test_uncommon.py +0 -107
  76. jaseci/extens/api/tests/test_user_api.py +0 -32
  77. jaseci/extens/api/tests/test_walker_api.py +0 -316
  78. jaseci/extens/api/user_api.py +0 -166
  79. jaseci/extens/api/walker_api.py +0 -299
  80. jaseci/extens/api/webhook_api.py +0 -77
  81. jaseci/extens/svc/__init__.py +0 -0
  82. jaseci/extens/svc/elastic_svc.py +0 -366
  83. jaseci/extens/svc/kube_svc.py +0 -432
  84. jaseci/extens/svc/mail_svc.py +0 -156
  85. jaseci/extens/svc/prome_svc.py +0 -378
  86. jaseci/extens/svc/redis_svc.py +0 -63
  87. jaseci/extens/svc/storage_svc.py +0 -193
  88. jaseci/extens/svc/stripe_svc.py +0 -51
  89. jaseci/extens/svc/task_svc.py +0 -155
  90. jaseci/extens/svc/tasks.py +0 -302
  91. jaseci/jac/__init__.py +0 -0
  92. jaseci/jac/interpreter/__init__.py +0 -0
  93. jaseci/jac/interpreter/architype_interp.py +0 -219
  94. jaseci/jac/interpreter/interp.py +0 -1784
  95. jaseci/jac/interpreter/sentinel_interp.py +0 -260
  96. jaseci/jac/interpreter/tests/__init__.py +0 -0
  97. jaseci/jac/interpreter/tests/test_interp.py +0 -42
  98. jaseci/jac/interpreter/walker_interp.py +0 -249
  99. jaseci/jac/ir/__init__.py +0 -0
  100. jaseci/jac/ir/ast.py +0 -73
  101. jaseci/jac/ir/ast_builder.py +0 -249
  102. jaseci/jac/ir/jac_code.py +0 -151
  103. jaseci/jac/ir/passes/__init__.py +0 -6
  104. jaseci/jac/ir/passes/ast_prune_pass.py +0 -9
  105. jaseci/jac/ir/passes/codegen_pass.py +0 -244
  106. jaseci/jac/ir/passes/ir_pass.py +0 -29
  107. jaseci/jac/ir/passes/printer_pass.py +0 -23
  108. jaseci/jac/ir/passes/pt_prune_pass.py +0 -29
  109. jaseci/jac/ir/passes/schedule.py +0 -23
  110. jaseci/jac/ir/passes/stats_pass.py +0 -16
  111. jaseci/jac/jac.g4 +0 -450
  112. jaseci/jac/jac_parse/__init__.py +0 -0
  113. jaseci/jac/jac_parse/jacLexer.py +0 -809
  114. jaseci/jac/jac_parse/jacListener.py +0 -853
  115. jaseci/jac/jac_parse/jacParser.py +0 -9192
  116. jaseci/jac/jac_set.py +0 -120
  117. jaseci/jac/jsci_vm/__init__.py +0 -0
  118. jaseci/jac/jsci_vm/disasm.py +0 -94
  119. jaseci/jac/jsci_vm/inst_ptr.py +0 -31
  120. jaseci/jac/jsci_vm/machine.py +0 -188
  121. jaseci/jac/jsci_vm/op_codes.py +0 -82
  122. jaseci/jac/jsci_vm/tests/__init__.py +0 -0
  123. jaseci/jac/jsci_vm/tests/test_codegen.py +0 -31
  124. jaseci/jac/machine/__init__.py +0 -0
  125. jaseci/jac/machine/jac_scope.py +0 -86
  126. jaseci/jac/machine/jac_value.py +0 -227
  127. jaseci/jac/machine/machine_state.py +0 -386
  128. jaseci/jac/tests/__init__.py +0 -0
  129. jaseci/jac/tests/book_code.py +0 -624
  130. jaseci/jac/tests/test_book.py +0 -380
  131. jaseci/jac/tests/test_lang_14.py +0 -49
  132. jaseci/jsorc/__init__.py +0 -7
  133. jaseci/jsorc/jsorc.py +0 -642
  134. jaseci/jsorc/jsorc_settings.py +0 -211
  135. jaseci/jsorc/jsorc_utils.py +0 -298
  136. jaseci/jsorc/live_actions.py +0 -365
  137. jaseci/jsorc/manifests/__init__.py +0 -0
  138. jaseci/jsorc/manifests/database.yaml +0 -109
  139. jaseci/jsorc/manifests/elastic.yaml +0 -6029
  140. jaseci/jsorc/manifests/prometheus.yaml +0 -1383
  141. jaseci/jsorc/manifests/redis.yaml +0 -64
  142. jaseci/jsorc/memory.py +0 -258
  143. jaseci/jsorc/redis.py +0 -140
  144. jaseci/jsorc/remote_actions.py +0 -158
  145. jaseci/jsorc/tests/__init__.py +0 -0
  146. jaseci/jsorc/tests/test_actions.py +0 -542
  147. jaseci/jsorc/tests/test_jsorc.py +0 -112
  148. jaseci/prim/__init__.py +0 -0
  149. jaseci/prim/ability.py +0 -94
  150. jaseci/prim/architype.py +0 -90
  151. jaseci/prim/edge.py +0 -173
  152. jaseci/prim/element.py +0 -233
  153. jaseci/prim/graph.py +0 -27
  154. jaseci/prim/master.py +0 -67
  155. jaseci/prim/node.py +0 -533
  156. jaseci/prim/obj_mixins.py +0 -238
  157. jaseci/prim/sentinel.py +0 -282
  158. jaseci/prim/super_master.py +0 -31
  159. jaseci/prim/walker.py +0 -261
  160. jaseci/svc/__init__.py +0 -0
  161. jaseci/tests/__init__.py +0 -0
  162. jaseci/tests/infer.py +0 -39
  163. jaseci/tests/jac_test_code.py +0 -1293
  164. jaseci/tests/jac_test_progs.py +0 -774
  165. jaseci/tests/test_core.py +0 -153
  166. jaseci/tests/test_jac.py +0 -824
  167. jaseci/tests/test_node.py +0 -89
  168. jaseci/tests/test_progs.py +0 -702
  169. jaseci/tests/test_stack.py +0 -220
  170. jaseci/tests/test_stripe.py +0 -225
  171. jaseci/utils/__init__.py +0 -0
  172. jaseci/utils/actions/__init__.py +0 -0
  173. jaseci/utils/actions/actions_manager.py +0 -254
  174. jaseci/utils/actions/actions_optimizer.py +0 -517
  175. jaseci/utils/actions/actions_state.py +0 -95
  176. jaseci/utils/file_handler.py +0 -171
  177. jaseci/utils/gprof2dot.py +0 -3786
  178. jaseci/utils/id_list.py +0 -169
  179. jaseci/utils/json_handler.py +0 -70
  180. jaseci/utils/log_utils.py +0 -57
  181. jaseci/utils/test_core.py +0 -62
  182. jaseci/utils/utils.py +0 -387
  183. jaseci-1.4.2.6.dist-info/LICENSE +0 -21
  184. jaseci-1.4.2.6.dist-info/METADATA +0 -39
  185. jaseci-1.4.2.6.dist-info/RECORD +0 -185
  186. jaseci-1.4.2.6.dist-info/entry_points.txt +0 -3
  187. jaseci-1.4.2.6.dist-info/top_level.txt +0 -1
@@ -1,23 +0,0 @@
1
- from jaseci.jac.ir.passes.ir_pass import IrPass
2
- from jaseci.jac.jsci_vm.disasm import DisAsm
3
-
4
-
5
- class PrinterPass(IrPass):
6
- def __init__(self, to_screen=True, with_exit=False, **kwargs):
7
- super().__init__(**kwargs)
8
- self.to_screen = to_screen
9
- self.with_exit = with_exit
10
- self.output = []
11
-
12
- def enter_node(self, node):
13
- out = "Entering " if self.with_exit else "Encountering " + str(node)
14
- print(out) if self.to_screen else None
15
- self.output.append(out)
16
- if hasattr(node, "bytecode"):
17
- self.output += DisAsm().disassemble(node.bytecode, to_screen=self.to_screen)
18
-
19
- def exit_node(self, node):
20
- if self.with_exit:
21
- out = "Exiting " + str(node)
22
- print(out) if self.to_screen else None
23
- self.output.append(out)
@@ -1,29 +0,0 @@
1
- from jaseci.jac.ir.passes.ir_pass import IrPass
2
-
3
-
4
- class ParseTreePrunePass(IrPass):
5
- prune_able = [
6
- "connect",
7
- "logical",
8
- "compare",
9
- "arithmetic",
10
- "term",
11
- "factor",
12
- "power",
13
- ]
14
-
15
- cull_able = ["ErrorChar"]
16
-
17
- def enter_node(self, node):
18
- cull_list = []
19
- for i in range(len(node.kid)):
20
- if node.kid[i].name in self.cull_able:
21
- cull_list.append(node.kid[i])
22
- continue
23
- peak = node.kid[i]
24
- while peak.name in self.prune_able and len(peak.kid) == 1:
25
- # print("PRUNING:", peak, "from", node.kid, "replacing", peak.kid[0])
26
- node.kid[i] = peak.kid[0]
27
- peak = peak.kid[0]
28
- for i in cull_list:
29
- node.kid.remove(i)
@@ -1,23 +0,0 @@
1
- from jaseci.jac.ir.passes import (
2
- ParseTreePrunePass,
3
- PrinterPass,
4
- StatsPass,
5
- CodeGenPass,
6
- AstPrunePass,
7
- )
8
- from jaseci.jac.ir.ast import Ast
9
-
10
-
11
- def multi_pass_optimizer(jac_ast: Ast, opt_level: int):
12
- ParseTreePrunePass(ir=jac_ast).run() if opt_level > 0 else None
13
- CodeGenPass(ir=jac_ast).run() if opt_level > 2 else None
14
- AstPrunePass(ir=jac_ast).run() if opt_level > 2 else None
15
-
16
-
17
- def debug_pass(
18
- jac_ast: Ast,
19
- print_walk: bool = False,
20
- stats_out: bool = False,
21
- ):
22
- PrinterPass(jac_ast).run() if print_walk else None
23
- StatsPass(jac_ast).run() if stats_out else None
@@ -1,16 +0,0 @@
1
- from jaseci.jac.ir.passes.ir_pass import IrPass
2
- import sys
3
-
4
-
5
- class StatsPass(IrPass):
6
- def __init__(self, *args):
7
- super().__init__(*args)
8
- self.stats = {"node_count": 0, "ir_size_kb": 0}
9
-
10
- def enter_node(self, node):
11
- self.stats["node_count"] += 1
12
- self.stats["ir_size_kb"] += sys.getsizeof(node) / 1024
13
-
14
- def after_pass(self):
15
- self.stats["ir_size_kb"] = round(self.stats["ir_size_kb"], 2)
16
- print(self.stats, "\n")
jaseci/jac/jac.g4 DELETED
@@ -1,450 +0,0 @@
1
- grammar jac;
2
-
3
- start: ver_label? import_module* element* EOF;
4
-
5
- ver_label: 'version' COLON STRING SEMI?;
6
-
7
- import_module:
8
- KW_IMPORT LBRACE (import_items | STAR_MUL) RBRACE KW_WITH STRING SEMI;
9
-
10
- import_items:
11
- WALKER_DBL_COLON (STAR_MUL | import_names) (
12
- COMMA import_items
13
- )?
14
- | NODE_DBL_COLON (STAR_MUL | import_names) (
15
- COMMA import_items
16
- )?
17
- | EDGE_DBL_COLON (STAR_MUL | import_names) (
18
- COMMA import_items
19
- )?
20
- | GRAPH_DBL_COLON (STAR_MUL | import_names) (
21
- COMMA import_items
22
- )?
23
- | KW_GLOBAL DBL_COLON (STAR_MUL | import_names) (
24
- COMMA import_items
25
- )?
26
- | TYPE_DBL_COLON (STAR_MUL | import_names) (
27
- COMMA import_items
28
- )?;
29
-
30
- import_names: NAME | LBRACE name_list RBRACE;
31
-
32
- element: global_var | architype | test;
33
-
34
- global_var:
35
- KW_GLOBAL NAME EQ expression (COMMA NAME EQ expression)* SEMI;
36
-
37
- architype:
38
- KW_NODE NAME (COLON NAME)* attr_block
39
- | KW_EDGE NAME (COLON NAME)* attr_block
40
- | KW_TYPE NAME struct_block
41
- | KW_GRAPH NAME graph_block
42
- | KW_ASYNC? KW_WALKER NAME namespaces? walker_block;
43
-
44
- walker_block:
45
- LBRACE attr_stmt* walk_entry_block? (
46
- statement
47
- | walk_activity_block
48
- )* walk_exit_block? RBRACE;
49
-
50
- test:
51
- KW_TEST NAME? multistring KW_WITH (
52
- graph_ref
53
- | KW_GRAPH graph_block
54
- ) KW_BY (
55
- (walker_ref spawn_ctx? (code_block | SEMI))
56
- | KW_WALKER walker_block
57
- );
58
-
59
- namespaces: COLON name_list;
60
-
61
- walk_entry_block: KW_WITH KW_ENTRY code_block;
62
-
63
- walk_exit_block: KW_WITH KW_EXIT code_block;
64
-
65
- walk_activity_block: KW_WITH KW_ACTIVITY code_block;
66
-
67
- attr_block: LBRACE (attr_stmt)* RBRACE | COLON attr_stmt | SEMI;
68
-
69
- attr_stmt: has_stmt | can_stmt;
70
-
71
- struct_block: LBRACE (has_stmt)* RBRACE | COLON has_stmt | SEMI;
72
-
73
- can_block: (can_stmt)*;
74
-
75
- graph_block:
76
- LBRACE has_root can_block KW_SPAWN code_block RBRACE
77
- | COLON has_root can_block KW_SPAWN code_block SEMI;
78
-
79
- has_root: KW_HAS KW_ANCHOR NAME SEMI;
80
-
81
- has_stmt: KW_HAS has_assign (COMMA has_assign)* SEMI;
82
-
83
- has_assign: KW_PRIVATE? KW_ANCHOR? (NAME | NAME EQ expression);
84
-
85
- can_stmt:
86
- KW_CAN dotted_name (preset_in_out event_clause)? (
87
- COMMA dotted_name (preset_in_out event_clause)?
88
- )* SEMI
89
- | KW_CAN NAME event_clause? code_block;
90
-
91
- event_clause:
92
- KW_WITH name_list? (KW_ENTRY | KW_EXIT | KW_ACTIVITY);
93
-
94
- preset_in_out:
95
- DBL_COLON param_list? (DBL_COLON | COLON_OUT expression);
96
-
97
- dotted_name: NAME DOT NAME;
98
-
99
- name_list: NAME (COMMA NAME)*;
100
-
101
- param_list:
102
- expr_list
103
- | kw_expr_list
104
- | expr_list COMMA kw_expr_list;
105
-
106
- expr_list: connect (COMMA connect)*;
107
-
108
- kw_expr_list: NAME EQ connect (COMMA NAME EQ connect)*;
109
-
110
- code_block: LBRACE statement* RBRACE | COLON statement;
111
-
112
- node_ctx_block: name_list code_block;
113
-
114
- statement:
115
- code_block
116
- | node_ctx_block
117
- | expression SEMI
118
- | if_stmt
119
- | try_stmt
120
- | for_stmt
121
- | while_stmt
122
- | assert_stmt SEMI
123
- | ctrl_stmt SEMI
124
- | destroy_action
125
- | report_action
126
- | walker_action;
127
-
128
- if_stmt: KW_IF expression code_block elif_stmt* else_stmt?;
129
-
130
- try_stmt: KW_TRY code_block else_from_try?;
131
-
132
- else_from_try:
133
- KW_ELSE (LPAREN NAME RPAREN)? code_block
134
- | KW_ELSE (KW_WITH NAME)? code_block;
135
-
136
- elif_stmt: KW_ELIF expression code_block;
137
-
138
- else_stmt: KW_ELSE code_block;
139
-
140
- for_stmt:
141
- KW_FOR expression KW_TO expression KW_BY expression code_block
142
- | KW_FOR NAME (COMMA NAME)? KW_IN expression code_block;
143
-
144
- while_stmt: KW_WHILE expression code_block;
145
-
146
- ctrl_stmt: KW_CONTINUE | KW_BREAK | KW_SKIP;
147
-
148
- assert_stmt: KW_ASSERT expression;
149
-
150
- destroy_action: KW_DESTROY expression SEMI;
151
-
152
- report_action:
153
- KW_REPORT expression SEMI
154
- | KW_REPORT COLON NAME EQ expression SEMI;
155
-
156
- walker_action:
157
- ignore_action
158
- | take_action
159
- | disengage_action
160
- | yield_action;
161
-
162
- ignore_action: KW_IGNORE expression SEMI;
163
-
164
- take_action:
165
- KW_TAKE (COLON NAME)? expression (SEMI | else_stmt);
166
-
167
- disengage_action: KW_DISENGAGE (report_action | SEMI);
168
-
169
- yield_action:
170
- KW_YIELD (
171
- report_action
172
- | disengage_action
173
- | take_action
174
- | SEMI
175
- );
176
-
177
- expression: connect (assignment | copy_assign | inc_assign)?;
178
-
179
- assignment: EQ expression;
180
-
181
- copy_assign: CPY_EQ expression;
182
-
183
- inc_assign: (PEQ | MEQ | TEQ | DEQ) expression;
184
-
185
- connect: logical ( (NOT edge_ref | connect_op) expression)?;
186
-
187
- logical: compare ((KW_AND | KW_OR) compare)*;
188
-
189
- compare: NOT compare | arithmetic (cmp_op arithmetic)*;
190
-
191
- cmp_op: EE | LT | GT | LTE | GTE | NE | KW_IN | nin;
192
-
193
- nin: NOT KW_IN;
194
-
195
- arithmetic: term ((PLUS | MINUS) term)*;
196
-
197
- term: factor ((STAR_MUL | DIV | MOD) factor)*;
198
-
199
- factor: (PLUS | MINUS) factor | power;
200
-
201
- power: atom (POW factor)*;
202
-
203
- global_ref: KW_GLOBAL DOT (obj_built_in | NAME);
204
-
205
- atom:
206
- INT
207
- | FLOAT
208
- | multistring
209
- | BOOL
210
- | NULL
211
- | NAME
212
- | global_ref
213
- | node_edge_ref
214
- | list_val
215
- | dict_val
216
- | LPAREN expression RPAREN
217
- | ability_op NAME spawn_ctx?
218
- | atom atom_trailer
219
- | KW_SYNC atom
220
- | spawn
221
- | ref
222
- | deref
223
- | any_type;
224
-
225
- atom_trailer:
226
- DOT built_in
227
- | DOT NAME
228
- | index_slice
229
- | ability_call;
230
-
231
- ability_call:
232
- LPAREN param_list? RPAREN
233
- | ability_op NAME spawn_ctx?;
234
-
235
- ability_op: DBL_COLON | DBL_COLON NAME COLON;
236
-
237
- ref: KW_REF atom;
238
-
239
- deref: STAR_MUL atom;
240
-
241
- built_in:
242
- | string_built_in
243
- | dict_built_in
244
- | list_built_in
245
- | obj_built_in
246
- | cast_built_in;
247
-
248
- cast_built_in: any_type;
249
-
250
- obj_built_in: KW_CONTEXT | KW_INFO | KW_DETAILS;
251
-
252
- dict_built_in:
253
- KW_KEYS
254
- | LBRACE name_list RBRACE
255
- | (TYP_DICT DBL_COLON | DICT_DBL_COLON) (NAME | KW_KEYS) (
256
- LPAREN expr_list RPAREN
257
- )?;
258
-
259
- list_built_in:
260
- KW_LENGTH
261
- | (TYP_LIST DBL_COLON | LIST_DBL_COLON) NAME (
262
- LPAREN expr_list RPAREN
263
- )?;
264
-
265
- string_built_in:
266
- (TYP_STRING DBL_COLON | STR_DBL_COLON) NAME (
267
- LPAREN expr_list RPAREN
268
- )?;
269
-
270
- node_edge_ref:
271
- node_ref filter_ctx? node_edge_ref?
272
- | edge_ref node_edge_ref?;
273
-
274
- node_ref: NODE_DBL_COLON NAME;
275
-
276
- walker_ref: WALKER_DBL_COLON NAME;
277
-
278
- graph_ref: GRAPH_DBL_COLON NAME;
279
-
280
- type_ref: TYPE_DBL_COLON NAME;
281
-
282
- edge_ref: edge_to | edge_from | edge_any;
283
-
284
- edge_to: '-->' | '-' ('[' NAME filter_ctx? ']')? '->';
285
-
286
- edge_from: '<--' | '<-' ('[' NAME filter_ctx? ']')? '-';
287
-
288
- edge_any: '<-->' | '<-' ('[' NAME filter_ctx? ']')? '->';
289
-
290
- connect_op: connect_to | connect_from | connect_any;
291
-
292
- connect_to: '++>' | '+' ('[' NAME spawn_ctx? ']')? '+>';
293
-
294
- connect_from: '<++' | '<+' ('[' NAME spawn_ctx? ']')? '+';
295
-
296
- connect_any: '<++>' | '<+' ('[' NAME spawn_ctx? ']')? '+>';
297
-
298
- list_val: LSQUARE expr_list? RSQUARE;
299
-
300
- index_slice:
301
- LSQUARE expression RSQUARE
302
- | LSQUARE expression COLON expression RSQUARE;
303
-
304
- dict_val: LBRACE (kv_pair (COMMA kv_pair)*)? RBRACE;
305
-
306
- kv_pair: expression COLON expression;
307
-
308
- spawn: KW_SPAWN spawn_object;
309
-
310
- spawn_object:
311
- node_spawn
312
- | walker_spawn
313
- | graph_spawn
314
- | type_spawn;
315
-
316
- spawn_edge: expression connect_op;
317
-
318
- node_spawn: spawn_edge? node_ref spawn_ctx?;
319
-
320
- graph_spawn: spawn_edge? graph_ref;
321
-
322
- walker_spawn: expression KW_SYNC? walker_ref spawn_ctx?;
323
-
324
- type_spawn: type_ref spawn_ctx?;
325
-
326
- spawn_ctx: LPAREN (spawn_assign (COMMA spawn_assign)*)? RPAREN;
327
-
328
- filter_ctx:
329
- LPAREN (filter_compare (COMMA filter_compare)*)? RPAREN;
330
-
331
- spawn_assign: NAME EQ expression;
332
-
333
- filter_compare: NAME cmp_op expression;
334
-
335
- any_type:
336
- TYP_STRING
337
- | TYP_INT
338
- | TYP_FLOAT
339
- | TYP_LIST
340
- | TYP_DICT
341
- | TYP_BOOL
342
- | KW_NODE
343
- | KW_EDGE
344
- | KW_TYPE;
345
-
346
- multistring: STRING+;
347
-
348
- /* Lexer rules */
349
- TYP_STRING: 'str';
350
- TYP_INT: 'int';
351
- TYP_FLOAT: 'float';
352
- TYP_LIST: 'list';
353
- TYP_DICT: 'dict';
354
- TYP_BOOL: 'bool';
355
- KW_TYPE: 'type';
356
- KW_GRAPH: 'graph';
357
- KW_NODE: 'node';
358
- KW_IGNORE: 'ignore';
359
- KW_TAKE: 'take';
360
- KW_SPAWN: 'spawn';
361
- KW_WITH: 'with';
362
- KW_ENTRY: 'entry';
363
- KW_EXIT: 'exit';
364
- KW_LENGTH: 'length';
365
- KW_KEYS: 'keys';
366
- KW_CONTEXT: 'context';
367
- KW_INFO: 'info';
368
- KW_DETAILS: 'details';
369
- KW_ACTIVITY: 'activity';
370
- KW_IMPORT: 'import';
371
- COLON: ':';
372
- DBL_COLON: '::';
373
- STR_DBL_COLON: 's::';
374
- LIST_DBL_COLON: 'l::';
375
- DICT_DBL_COLON: 'd::';
376
- NODE_DBL_COLON: 'n::' | KW_NODE DBL_COLON;
377
- EDGE_DBL_COLON: 'e::' | KW_EDGE DBL_COLON;
378
- WALKER_DBL_COLON: 'w::' | KW_WALKER DBL_COLON;
379
- GRAPH_DBL_COLON: 'g::' | KW_GRAPH DBL_COLON;
380
- TYPE_DBL_COLON: 't::' | KW_TYPE DBL_COLON;
381
- COLON_OUT: '::>';
382
- LBRACE: '{';
383
- RBRACE: '}';
384
- KW_EDGE: 'edge';
385
- KW_WALKER: 'walker';
386
- KW_ASYNC: 'async';
387
- KW_SYNC: 'sync';
388
- KW_TEST: 'test';
389
- KW_ASSERT: 'assert';
390
- SEMI: ';';
391
- EQ: '=';
392
- PEQ: '+=';
393
- MEQ: '-=';
394
- TEQ: '*=';
395
- DEQ: '/=';
396
- CPY_EQ: ':=';
397
- KW_AND: 'and' | '&&';
398
- KW_OR: 'or' | '||';
399
- KW_IF: 'if';
400
- KW_ELIF: 'elif';
401
- KW_ELSE: 'else';
402
- KW_FOR: 'for';
403
- KW_TO: 'to';
404
- KW_BY: 'by';
405
- KW_WHILE: 'while';
406
- KW_CONTINUE: 'continue';
407
- KW_BREAK: 'break';
408
- KW_DISENGAGE: 'disengage';
409
- KW_YIELD: 'yield';
410
- KW_SKIP: 'skip';
411
- KW_REPORT: 'report';
412
- KW_DESTROY: 'destroy';
413
- KW_TRY: 'try';
414
- KW_REF: '&';
415
- DOT: '.';
416
- NOT: '!' | 'not';
417
- EE: '==';
418
- LT: '<';
419
- GT: '>';
420
- LTE: '<=';
421
- GTE: '>=';
422
- NE: '!=';
423
- KW_IN: 'in';
424
- KW_ANCHOR: 'anchor';
425
- KW_HAS: 'has';
426
- KW_GLOBAL: 'global';
427
- KW_PRIVATE: 'private';
428
- COMMA: ',';
429
- KW_CAN: 'can';
430
- PLUS: '+';
431
- MINUS: '-';
432
- STAR_MUL: '*';
433
- DIV: '/';
434
- MOD: '%';
435
- POW: '^';
436
- LPAREN: '(';
437
- RPAREN: ')';
438
- LSQUARE: '[';
439
- RSQUARE: ']';
440
- FLOAT: ([0-9]+)? '.' [0-9]+;
441
- STRING: '"' ~ ["\r\n]* '"' | '\'' ~ ['\r\n]* '\'';
442
- BOOL: 'true' | 'false';
443
- INT: [0-9]+;
444
- NULL: 'null';
445
- NAME: [a-zA-Z_] [a-zA-Z0-9_]*;
446
- COMMENT: '/*' .*? '*/' -> skip;
447
- LINE_COMMENT: '//' ~[\r\n]* -> skip;
448
- PY_COMMENT: '#' ~[\r\n]* -> skip;
449
- WS: [ \t\r\n] -> skip;
450
- ErrorChar: .;
File without changes