jaclang 0.8.0__py3-none-any.whl → 0.8.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.
Potentially problematic release.
This version of jaclang might be problematic. Click here for more details.
- jaclang/__init__.py +6 -0
- jaclang/cli/cli.py +23 -50
- jaclang/compiler/codeinfo.py +0 -1
- jaclang/compiler/jac.lark +14 -22
- jaclang/compiler/larkparse/jac_parser.py +2 -2
- jaclang/compiler/parser.py +378 -531
- jaclang/compiler/passes/main/__init__.py +0 -14
- jaclang/compiler/passes/main/annex_pass.py +2 -8
- jaclang/compiler/passes/main/cfg_build_pass.py +39 -13
- jaclang/compiler/passes/main/def_impl_match_pass.py +14 -13
- jaclang/compiler/passes/main/def_use_pass.py +4 -7
- jaclang/compiler/passes/main/import_pass.py +6 -14
- jaclang/compiler/passes/main/inheritance_pass.py +2 -2
- jaclang/compiler/passes/main/pyast_gen_pass.py +428 -799
- jaclang/compiler/passes/main/pyast_load_pass.py +115 -311
- jaclang/compiler/passes/main/pyjac_ast_link_pass.py +8 -7
- jaclang/compiler/passes/main/sym_tab_build_pass.py +3 -3
- jaclang/compiler/passes/main/sym_tab_link_pass.py +6 -9
- jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/action/actions.jac +1 -5
- jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/main.jac +1 -8
- jaclang/compiler/passes/main/tests/test_cfg_build_pass.py +5 -9
- jaclang/compiler/passes/main/tests/test_decl_impl_match_pass.py +7 -8
- jaclang/compiler/passes/main/tests/test_import_pass.py +5 -18
- jaclang/compiler/passes/main/tests/test_pyast_gen_pass.py +2 -6
- jaclang/compiler/passes/main/tests/test_sub_node_pass.py +1 -3
- jaclang/compiler/passes/main/tests/test_sym_tab_link_pass.py +20 -17
- jaclang/compiler/passes/tool/doc_ir_gen_pass.py +425 -216
- jaclang/compiler/passes/tool/jac_formatter_pass.py +2 -0
- jaclang/compiler/passes/tool/tests/fixtures/archetype_frmt.jac +14 -0
- jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/triple_quoted_string.jac +5 -4
- jaclang/compiler/passes/tool/tests/fixtures/import_fmt.jac +6 -0
- jaclang/compiler/passes/tool/tests/fixtures/simple_walk_fmt.jac +3 -3
- jaclang/compiler/passes/tool/tests/fixtures/tagbreak.jac +9 -0
- jaclang/compiler/passes/tool/tests/test_jac_format_pass.py +18 -3
- jaclang/compiler/passes/tool/tests/test_unparse_validate.py +2 -2
- jaclang/compiler/program.py +22 -66
- jaclang/compiler/tests/fixtures/fam.jac +2 -2
- jaclang/compiler/tests/fixtures/pkg_import_lib/__init__.jac +1 -0
- jaclang/compiler/tests/fixtures/pkg_import_lib/sub/__init__.jac +1 -0
- jaclang/compiler/tests/fixtures/pkg_import_lib/sub/helper.jac +3 -0
- jaclang/compiler/tests/fixtures/pkg_import_lib/tools.jac +3 -0
- jaclang/compiler/tests/fixtures/pkg_import_lib_py/__init__.py +5 -0
- jaclang/compiler/tests/fixtures/pkg_import_lib_py/sub/__init__.py +3 -0
- jaclang/compiler/tests/fixtures/pkg_import_lib_py/sub/helper.jac +3 -0
- jaclang/compiler/tests/fixtures/pkg_import_lib_py/tools.jac +3 -0
- jaclang/compiler/tests/fixtures/pkg_import_main.jac +10 -0
- jaclang/compiler/tests/fixtures/pkg_import_main_py.jac +11 -0
- jaclang/compiler/tests/test_importer.py +30 -13
- jaclang/compiler/tests/test_parser.py +1 -0
- jaclang/compiler/unitree.py +488 -320
- jaclang/langserve/__init__.jac +1 -0
- jaclang/langserve/engine.jac +503 -0
- jaclang/langserve/sem_manager.jac +309 -0
- jaclang/langserve/server.jac +201 -0
- jaclang/langserve/tests/server_test/test_lang_serve.py +139 -48
- jaclang/langserve/tests/server_test/utils.py +35 -6
- jaclang/langserve/tests/session.jac +294 -0
- jaclang/langserve/tests/test_sem_tokens.py +2 -2
- jaclang/langserve/tests/test_server.py +8 -7
- jaclang/langserve/utils.jac +51 -30
- jaclang/runtimelib/archetype.py +128 -6
- jaclang/runtimelib/builtin.py +17 -14
- jaclang/runtimelib/importer.py +51 -76
- jaclang/runtimelib/machine.py +469 -305
- jaclang/runtimelib/meta_importer.py +86 -0
- jaclang/runtimelib/tests/fixtures/graph_purger.jac +24 -26
- jaclang/runtimelib/tests/fixtures/other_root_access.jac +25 -16
- jaclang/runtimelib/tests/fixtures/traversing_save.jac +7 -5
- jaclang/runtimelib/tests/test_jaseci.py +3 -1
- jaclang/runtimelib/utils.py +3 -3
- jaclang/tests/fixtures/arch_rel_import_creation.jac +23 -23
- jaclang/tests/fixtures/async_ability.jac +43 -10
- jaclang/tests/fixtures/async_function.jac +18 -0
- jaclang/tests/fixtures/async_walker.jac +17 -12
- jaclang/tests/fixtures/backward_edge_visit.jac +31 -0
- jaclang/tests/fixtures/builtin_printgraph.jac +85 -0
- jaclang/tests/fixtures/builtin_printgraph_json.jac +21 -0
- jaclang/tests/fixtures/builtin_printgraph_mermaid.jac +16 -0
- jaclang/tests/fixtures/chandra_bugs2.jac +20 -13
- jaclang/tests/fixtures/concurrency.jac +1 -1
- jaclang/tests/fixtures/create_dynamic_archetype.jac +25 -28
- jaclang/tests/fixtures/deep/deeper/deep_outer_import.jac +7 -4
- jaclang/tests/fixtures/deep/deeper/snd_lev.jac +2 -2
- jaclang/tests/fixtures/deep/deeper/snd_lev_dup.jac +6 -0
- jaclang/tests/fixtures/deep/one_lev.jac +2 -2
- jaclang/tests/fixtures/deep/one_lev_dup.jac +4 -3
- jaclang/tests/fixtures/dynamic_archetype.jac +19 -12
- jaclang/tests/fixtures/edge_ability.jac +49 -0
- jaclang/tests/fixtures/foo.jac +14 -22
- jaclang/tests/fixtures/guess_game.jac +1 -1
- jaclang/tests/fixtures/here_usage_error.jac +21 -0
- jaclang/tests/fixtures/here_visitor_usage.jac +21 -0
- jaclang/tests/fixtures/jac_from_py.py +1 -1
- jaclang/tests/fixtures/jp_importer.jac +6 -6
- jaclang/tests/fixtures/jp_importer_auto.jac +5 -3
- jaclang/tests/fixtures/node_del.jac +30 -36
- jaclang/tests/fixtures/unicode_strings.jac +24 -0
- jaclang/tests/fixtures/visit_traversal.jac +47 -0
- jaclang/tests/fixtures/walker_update.jac +5 -7
- jaclang/tests/test_cli.py +12 -7
- jaclang/tests/test_language.py +218 -145
- jaclang/tests/test_reference.py +9 -4
- jaclang/tests/test_typecheck.py +13 -26
- jaclang/utils/helpers.py +14 -6
- jaclang/utils/lang_tools.py +9 -8
- jaclang/utils/module_resolver.py +23 -0
- jaclang/utils/tests/test_lang_tools.py +2 -1
- jaclang/utils/treeprinter.py +3 -4
- {jaclang-0.8.0.dist-info → jaclang-0.8.2.dist-info}/METADATA +4 -3
- {jaclang-0.8.0.dist-info → jaclang-0.8.2.dist-info}/RECORD +112 -94
- {jaclang-0.8.0.dist-info → jaclang-0.8.2.dist-info}/WHEEL +1 -1
- jaclang/compiler/passes/main/tests/fixtures/main_err.jac +0 -6
- jaclang/compiler/passes/main/tests/fixtures/second_err.jac +0 -4
- jaclang/compiler/passes/tool/tests/fixtures/corelib.jac +0 -644
- jaclang/compiler/passes/tool/tests/test_doc_ir_gen_pass.py +0 -29
- jaclang/langserve/__init__.py +0 -1
- jaclang/langserve/engine.py +0 -553
- jaclang/langserve/sem_manager.py +0 -383
- jaclang/langserve/server.py +0 -167
- jaclang/langserve/tests/session.py +0 -255
- jaclang/tests/fixtures/builtin_dotgen.jac +0 -42
- jaclang/tests/fixtures/builtin_dotgen_json.jac +0 -21
- jaclang/tests/fixtures/deep/deeper/__init__.jac +0 -1
- {jaclang-0.8.0.dist-info → jaclang-0.8.2.dist-info}/entry_points.txt +0 -0
jaclang/__init__.py
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
"""The Jac Programming Language."""
|
|
2
2
|
|
|
3
|
+
import sys
|
|
4
|
+
|
|
3
5
|
from jaclang.runtimelib.machine import (
|
|
4
6
|
JacMachine,
|
|
5
7
|
JacMachineImpl,
|
|
6
8
|
JacMachineInterface,
|
|
7
9
|
plugin_manager,
|
|
8
10
|
)
|
|
11
|
+
from jaclang.runtimelib.meta_importer import JacMetaImporter
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
plugin_manager.register(JacMachineImpl)
|
|
12
15
|
plugin_manager.load_setuptools_entrypoints("jac")
|
|
13
16
|
|
|
17
|
+
if not any(isinstance(f, JacMetaImporter) for f in sys.meta_path):
|
|
18
|
+
sys.meta_path.insert(0, JacMetaImporter())
|
|
19
|
+
|
|
14
20
|
__all__ = ["JacMachineInterface", "JacMachine"]
|
jaclang/cli/cli.py
CHANGED
|
@@ -12,20 +12,20 @@ from typing import Optional
|
|
|
12
12
|
|
|
13
13
|
import jaclang.compiler.unitree as uni
|
|
14
14
|
from jaclang.cli.cmdreg import CommandShell, cmd_registry
|
|
15
|
-
from jaclang.compiler.passes.main import
|
|
15
|
+
from jaclang.compiler.passes.main import PyastBuildPass
|
|
16
16
|
from jaclang.compiler.program import JacProgram
|
|
17
|
-
from jaclang.runtimelib.builtin import
|
|
17
|
+
from jaclang.runtimelib.builtin import printgraph
|
|
18
18
|
from jaclang.runtimelib.constructs import WalkerArchetype
|
|
19
19
|
from jaclang.runtimelib.machine import (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
ExecutionContext,
|
|
21
|
+
JacMachine as Jac,
|
|
22
|
+
JacMachineInterface as JacInterface,
|
|
23
23
|
)
|
|
24
24
|
from jaclang.utils.helpers import debugger as db
|
|
25
25
|
from jaclang.utils.lang_tools import AstTool
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
JacInterface.create_cmd()
|
|
29
29
|
Jac.setup()
|
|
30
30
|
|
|
31
31
|
|
|
@@ -85,8 +85,8 @@ def format(path: str, outfile: str = "", to_screen: bool = False) -> None:
|
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
def proc_file_sess(
|
|
88
|
-
filename: str, session: str, root: Optional[str] = None
|
|
89
|
-
) -> tuple[str, str,
|
|
88
|
+
filename: str, session: str, root: Optional[str] = None
|
|
89
|
+
) -> tuple[str, str, ExecutionContext]:
|
|
90
90
|
"""Create JacMachine and return the base path, module name, and machine state."""
|
|
91
91
|
if session == "":
|
|
92
92
|
session = (
|
|
@@ -99,7 +99,8 @@ def proc_file_sess(
|
|
|
99
99
|
base, mod = os.path.split(filename)
|
|
100
100
|
base = base if base else "./"
|
|
101
101
|
mod = mod[:-4]
|
|
102
|
-
mach =
|
|
102
|
+
mach = ExecutionContext(session=session, root=root)
|
|
103
|
+
Jac.set_context(mach)
|
|
103
104
|
return base, mod, mach
|
|
104
105
|
|
|
105
106
|
|
|
@@ -109,7 +110,6 @@ def run(
|
|
|
109
110
|
session: str = "",
|
|
110
111
|
main: bool = True,
|
|
111
112
|
cache: bool = True,
|
|
112
|
-
interp: bool = False,
|
|
113
113
|
) -> None:
|
|
114
114
|
"""Run the specified .jac file.
|
|
115
115
|
|
|
@@ -121,7 +121,6 @@ def run(
|
|
|
121
121
|
session: Optional session identifier for persistent state
|
|
122
122
|
main: Treat the module as __main__ (default: True)
|
|
123
123
|
cache: Use cached compilation if available (default: True)
|
|
124
|
-
interp: Run in interpreter mode (default: False)
|
|
125
124
|
|
|
126
125
|
Examples:
|
|
127
126
|
jac run myprogram.jac
|
|
@@ -130,12 +129,12 @@ def run(
|
|
|
130
129
|
"""
|
|
131
130
|
# if no session specified, check if it was defined when starting the command shell
|
|
132
131
|
# otherwise default to jaclang.session
|
|
133
|
-
base, mod, mach = proc_file_sess(filename, session
|
|
132
|
+
base, mod, mach = proc_file_sess(filename, session)
|
|
133
|
+
Jac.set_base_path(base)
|
|
134
134
|
|
|
135
135
|
if filename.endswith(".jac"):
|
|
136
136
|
try:
|
|
137
137
|
Jac.jac_import(
|
|
138
|
-
mach=mach,
|
|
139
138
|
target=mod,
|
|
140
139
|
base_path=base,
|
|
141
140
|
override_name="__main__" if main else None,
|
|
@@ -145,9 +144,8 @@ def run(
|
|
|
145
144
|
elif filename.endswith(".jir"):
|
|
146
145
|
try:
|
|
147
146
|
with open(filename, "rb") as f:
|
|
148
|
-
Jac.attach_program(
|
|
147
|
+
Jac.attach_program(pickle.load(f))
|
|
149
148
|
Jac.jac_import(
|
|
150
|
-
mach=mach,
|
|
151
149
|
target=mod,
|
|
152
150
|
base_path=base,
|
|
153
151
|
override_name="__main__" if main else None,
|
|
@@ -181,19 +179,14 @@ def get_object(filename: str, id: str, session: str = "", main: bool = True) ->
|
|
|
181
179
|
|
|
182
180
|
if filename.endswith(".jac"):
|
|
183
181
|
Jac.jac_import(
|
|
184
|
-
mach=mach,
|
|
185
182
|
target=mod,
|
|
186
183
|
base_path=base,
|
|
187
184
|
override_name="__main__" if main else None,
|
|
188
185
|
)
|
|
189
186
|
elif filename.endswith(".jir"):
|
|
190
187
|
with open(filename, "rb") as f:
|
|
191
|
-
Jac.attach_program(
|
|
192
|
-
mach,
|
|
193
|
-
pickle.load(f),
|
|
194
|
-
)
|
|
188
|
+
Jac.attach_program(pickle.load(f))
|
|
195
189
|
Jac.jac_import(
|
|
196
|
-
mach=mach,
|
|
197
190
|
target=mod,
|
|
198
191
|
base_path=base,
|
|
199
192
|
override_name="__main__" if main else None,
|
|
@@ -203,12 +196,11 @@ def get_object(filename: str, id: str, session: str = "", main: bool = True) ->
|
|
|
203
196
|
raise ValueError("Not a valid file!\nOnly supports `.jac` and `.jir`")
|
|
204
197
|
|
|
205
198
|
data = {}
|
|
206
|
-
obj =
|
|
199
|
+
obj = Jac.get_object(id)
|
|
207
200
|
if obj:
|
|
208
201
|
data = obj.__jac__.__getstate__()
|
|
209
202
|
else:
|
|
210
203
|
print(f"Object with id {id} not found.", file=sys.stderr)
|
|
211
|
-
|
|
212
204
|
mach.close()
|
|
213
205
|
return data
|
|
214
206
|
|
|
@@ -229,10 +221,7 @@ def build(filename: str) -> None:
|
|
|
229
221
|
jac build myprogram.jac --no-typecheck
|
|
230
222
|
"""
|
|
231
223
|
if filename.endswith(".jac"):
|
|
232
|
-
(out := JacProgram()).compile(
|
|
233
|
-
file_path=filename,
|
|
234
|
-
mode=CMode.COMPILE,
|
|
235
|
-
)
|
|
224
|
+
(out := JacProgram()).compile(file_path=filename)
|
|
236
225
|
errs = len(out.errors_had)
|
|
237
226
|
warnings = len(out.warnings_had)
|
|
238
227
|
print(f"Errors: {errs}, Warnings: {warnings}")
|
|
@@ -258,10 +247,7 @@ def check(filename: str, print_errs: bool = True) -> None:
|
|
|
258
247
|
jac check myprogram.jac --no-print_errs
|
|
259
248
|
"""
|
|
260
249
|
if filename.endswith(".jac"):
|
|
261
|
-
(prog := JacProgram()).compile(
|
|
262
|
-
file_path=filename,
|
|
263
|
-
mode=CMode.TYPECHECK,
|
|
264
|
-
)
|
|
250
|
+
(prog := JacProgram()).compile(file_path=filename)
|
|
265
251
|
|
|
266
252
|
errs = len(prog.errors_had)
|
|
267
253
|
warnings = len(prog.warnings_had)
|
|
@@ -324,19 +310,14 @@ def enter(
|
|
|
324
310
|
|
|
325
311
|
if filename.endswith(".jac"):
|
|
326
312
|
ret_module = Jac.jac_import(
|
|
327
|
-
mach=mach,
|
|
328
313
|
target=mod,
|
|
329
314
|
base_path=base,
|
|
330
315
|
override_name="__main__" if main else None,
|
|
331
316
|
)
|
|
332
317
|
elif filename.endswith(".jir"):
|
|
333
318
|
with open(filename, "rb") as f:
|
|
334
|
-
Jac.attach_program(
|
|
335
|
-
mach,
|
|
336
|
-
pickle.load(f),
|
|
337
|
-
)
|
|
319
|
+
Jac.attach_program(pickle.load(f))
|
|
338
320
|
ret_module = Jac.jac_import(
|
|
339
|
-
mach=mach,
|
|
340
321
|
target=mod,
|
|
341
322
|
base_path=base,
|
|
342
323
|
override_name="__main__" if main else None,
|
|
@@ -353,11 +334,10 @@ def enter(
|
|
|
353
334
|
archetype = getattr(loaded_mod, entrypoint)(*args)
|
|
354
335
|
|
|
355
336
|
mach.set_entry_node(node)
|
|
356
|
-
if isinstance(archetype, WalkerArchetype) and
|
|
357
|
-
mach
|
|
337
|
+
if isinstance(archetype, WalkerArchetype) and Jac.check_read_access(
|
|
338
|
+
mach.entry_node
|
|
358
339
|
):
|
|
359
340
|
Jac.spawn(mach.entry_node.archetype, archetype)
|
|
360
|
-
|
|
361
341
|
mach.close()
|
|
362
342
|
|
|
363
343
|
|
|
@@ -395,10 +375,7 @@ def test(
|
|
|
395
375
|
jac test --xit # Stop on first failure
|
|
396
376
|
jac test --verbose # Show detailed output
|
|
397
377
|
"""
|
|
398
|
-
mach = JacMachine()
|
|
399
|
-
|
|
400
378
|
failcount = Jac.run_test(
|
|
401
|
-
mach=mach,
|
|
402
379
|
filepath=filepath,
|
|
403
380
|
func_name=("test_" + test_name) if test_name else None,
|
|
404
381
|
filter=filter,
|
|
@@ -408,8 +385,6 @@ def test(
|
|
|
408
385
|
verbose=verbose,
|
|
409
386
|
)
|
|
410
387
|
|
|
411
|
-
mach.close()
|
|
412
|
-
|
|
413
388
|
if failcount:
|
|
414
389
|
raise SystemExit(f"Tests failed: {failcount}")
|
|
415
390
|
|
|
@@ -526,14 +501,12 @@ def dot(
|
|
|
526
501
|
base, mod, jac_machine = proc_file_sess(filename, session)
|
|
527
502
|
|
|
528
503
|
if filename.endswith(".jac"):
|
|
529
|
-
Jac.jac_import(
|
|
530
|
-
|
|
531
|
-
)
|
|
532
|
-
module = jac_machine.loaded_modules.get("__main__")
|
|
504
|
+
Jac.jac_import(target=mod, base_path=base, override_name="__main__")
|
|
505
|
+
module = Jac.loaded_modules.get("__main__")
|
|
533
506
|
globals().update(vars(module))
|
|
534
507
|
try:
|
|
535
508
|
node = globals().get(initial, eval(initial)) if initial else None
|
|
536
|
-
graph =
|
|
509
|
+
graph = printgraph(
|
|
537
510
|
node=node,
|
|
538
511
|
depth=depth,
|
|
539
512
|
traverse=traverse,
|
jaclang/compiler/codeinfo.py
CHANGED
jaclang/compiler/jac.lark
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
// [Heading]: Base Module structure.
|
|
2
2
|
start: module
|
|
3
3
|
|
|
4
|
-
// TODO:AST: We should allow the very first top level statement to have
|
|
5
|
-
// docstring but not the module to have one. After allowing that
|
|
6
|
-
// the rule for the module would be:
|
|
7
|
-
//
|
|
8
|
-
// module: STRING? toplevel_stmt*
|
|
9
|
-
//
|
|
10
4
|
module: (toplevel_stmt (tl_stmt_with_doc | toplevel_stmt)*)?
|
|
11
5
|
| STRING (tl_stmt_with_doc | toplevel_stmt)*
|
|
12
6
|
|
|
13
|
-
// AST:TODO: Docstring should be part of the definition of the statement
|
|
14
|
-
// and not all toplevel statement have docstring, example: ImportStmt.
|
|
15
|
-
//
|
|
16
|
-
// Statements that are only valid at the toplevel.
|
|
17
7
|
tl_stmt_with_doc: STRING toplevel_stmt
|
|
18
8
|
toplevel_stmt: import_stmt
|
|
19
9
|
| archetype
|
|
@@ -66,13 +56,13 @@ enum: decorators? enum_decl
|
|
|
66
56
|
enum_decl: KW_ENUM access_tag? NAME inherited_archs? (enum_block | SEMI)
|
|
67
57
|
enum_block: LBRACE assignment_list COMMA? (py_code_block | free_code)* RBRACE
|
|
68
58
|
|
|
69
|
-
// [Heading]: Abilities.
|
|
59
|
+
// [Heading]: Functions and Abilities.
|
|
70
60
|
ability: decorators? KW_ASYNC? (ability_decl | function_decl)
|
|
71
61
|
|
|
72
62
|
function_decl: KW_OVERRIDE? KW_STATIC? KW_DEF access_tag? named_ref func_decl? (block_tail | KW_ABSTRACT? SEMI)
|
|
73
63
|
ability_decl: KW_OVERRIDE? KW_STATIC? KW_CAN access_tag? named_ref event_clause (block_tail | KW_ABSTRACT? SEMI)
|
|
74
64
|
block_tail: code_block | KW_BY atomic_call SEMI
|
|
75
|
-
event_clause: KW_WITH expression? (KW_EXIT | KW_ENTRY)
|
|
65
|
+
event_clause: KW_WITH expression? (KW_EXIT | KW_ENTRY)
|
|
76
66
|
|
|
77
67
|
func_decl: (LPAREN func_decl_params? RPAREN) (RETURN_HINT expression)?
|
|
78
68
|
| (RETURN_HINT expression)
|
|
@@ -165,7 +155,7 @@ pattern: literal_pattern
|
|
|
165
155
|
| class_pattern
|
|
166
156
|
|
|
167
157
|
|
|
168
|
-
// [Heading]: Match
|
|
158
|
+
// [Heading]: Match literal patterns.
|
|
169
159
|
literal_pattern: (INT | FLOAT | multistring)
|
|
170
160
|
|
|
171
161
|
// [Heading]: Match singleton patterns.
|
|
@@ -200,7 +190,7 @@ global_ref: GLOBAL_OP name_list
|
|
|
200
190
|
nonlocal_ref: NONLOCAL_OP name_list
|
|
201
191
|
name_list: (named_ref COMMA)* named_ref
|
|
202
192
|
|
|
203
|
-
// [Heading]:
|
|
193
|
+
// [Heading]: Object spatial typed context blocks.
|
|
204
194
|
typed_ctx_block: RETURN_HINT expression code_block
|
|
205
195
|
|
|
206
196
|
// [Heading]: Return statements.
|
|
@@ -227,7 +217,7 @@ report_stmt: KW_REPORT expression
|
|
|
227
217
|
// [Heading]: Control statements.
|
|
228
218
|
ctrl_stmt: KW_SKIP | KW_BREAK | KW_CONTINUE
|
|
229
219
|
|
|
230
|
-
// [Heading]:
|
|
220
|
+
// [Heading]: Object spatial Walker statements.
|
|
231
221
|
spatial_stmt: visit_stmt | ignore_stmt | disenage_stmt
|
|
232
222
|
|
|
233
223
|
// [Heading]: Visit statements.
|
|
@@ -314,10 +304,10 @@ connect: (connect (connect_op | disconnect_op))? atomic_pipe
|
|
|
314
304
|
atomic_pipe: (atomic_pipe A_PIPE_FWD)? atomic_pipe_back
|
|
315
305
|
|
|
316
306
|
// [Heading]: Atomic pipe back expressions.
|
|
317
|
-
atomic_pipe_back: (atomic_pipe_back A_PIPE_BKWD)?
|
|
307
|
+
atomic_pipe_back: (atomic_pipe_back A_PIPE_BKWD)? os_spawn
|
|
318
308
|
|
|
319
|
-
// [Heading]:
|
|
320
|
-
|
|
309
|
+
// [Heading]: Object spatial spawn expressions.
|
|
310
|
+
os_spawn: (os_spawn KW_SPAWN)? unpack
|
|
321
311
|
|
|
322
312
|
// [Heading]: Unpack expressions.
|
|
323
313
|
unpack: STAR_MUL? ref
|
|
@@ -325,7 +315,7 @@ unpack: STAR_MUL? ref
|
|
|
325
315
|
// [Heading]: References (unused).
|
|
326
316
|
ref: BW_AND? pipe_call
|
|
327
317
|
|
|
328
|
-
// [Heading]:
|
|
318
|
+
// [Heading]: Object spatial calls.
|
|
329
319
|
pipe_call: (PIPE_FWD | A_PIPE_FWD | KW_SPAWN | KW_AWAIT)? atomic_chain
|
|
330
320
|
|
|
331
321
|
// [Heading]: Subscripted and dotted expressions.
|
|
@@ -340,7 +330,9 @@ index_slice: LSQUARE
|
|
|
340
330
|
| list_val
|
|
341
331
|
|
|
342
332
|
// [Heading]: Function calls.
|
|
343
|
-
atomic_call: atomic_chain LPAREN param_list?
|
|
333
|
+
atomic_call: atomic_chain LPAREN param_list? by_call? RPAREN by_call?
|
|
334
|
+
|
|
335
|
+
by_call: KW_BY expression
|
|
344
336
|
|
|
345
337
|
param_list: expr_list COMMA kw_expr_list COMMA?
|
|
346
338
|
| kw_expr_list COMMA?
|
|
@@ -408,7 +400,7 @@ tuple_list: expression COMMA expr_list COMMA kw_expr_list COMMA?
|
|
|
408
400
|
kw_expr_list: (kw_expr_list COMMA)? kw_expr
|
|
409
401
|
kw_expr: named_ref EQ expression | STAR_POW expression
|
|
410
402
|
|
|
411
|
-
// [Heading]:
|
|
403
|
+
// [Heading]: Object-Spatial References.
|
|
412
404
|
edge_ref_chain: LSQUARE (KW_NODE| KW_EDGE)? expression? (edge_op_ref (filter_compr | expression)?)+ RSQUARE
|
|
413
405
|
edge_op_ref: edge_any | edge_from | edge_to
|
|
414
406
|
edge_to: ARROW_R | ARROW_R_P1 typed_filter_compare_list ARROW_R_P2
|
|
@@ -599,7 +591,7 @@ KWESC_NAME: /<>[a-zA-Z_][a-zA-Z0-9_]*/
|
|
|
599
591
|
NAME: /[a-zA-Z_][a-zA-Z0-9_]*/
|
|
600
592
|
|
|
601
593
|
|
|
602
|
-
//
|
|
594
|
+
// Object-Spatial Operators -------------------------------------------------- //
|
|
603
595
|
|
|
604
596
|
ARROW_BI: "<-->"
|
|
605
597
|
ARROW_L: "<--"
|