jaclang 0.7.1__py3-none-any.whl → 0.7.5__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/cli/cli.py +2 -2
- jaclang/compiler/absyntree.py +378 -277
- jaclang/compiler/codeloc.py +2 -2
- jaclang/compiler/constant.py +2 -0
- jaclang/compiler/jac.lark +25 -19
- jaclang/compiler/parser.py +115 -92
- jaclang/compiler/passes/main/access_modifier_pass.py +15 -9
- jaclang/compiler/passes/main/def_impl_match_pass.py +29 -11
- jaclang/compiler/passes/main/def_use_pass.py +48 -17
- jaclang/compiler/passes/main/fuse_typeinfo_pass.py +49 -30
- jaclang/compiler/passes/main/import_pass.py +12 -7
- jaclang/compiler/passes/main/pyast_gen_pass.py +110 -47
- jaclang/compiler/passes/main/pyast_load_pass.py +49 -13
- jaclang/compiler/passes/main/pyjac_ast_link_pass.py +25 -11
- jaclang/compiler/passes/main/pyout_pass.py +3 -1
- jaclang/compiler/passes/main/registry_pass.py +6 -6
- jaclang/compiler/passes/main/sym_tab_build_pass.py +30 -72
- jaclang/compiler/passes/main/tests/test_decl_def_match_pass.py +21 -4
- jaclang/compiler/passes/main/tests/test_def_use_pass.py +5 -10
- jaclang/compiler/passes/main/tests/test_import_pass.py +8 -0
- jaclang/compiler/passes/main/tests/test_type_check_pass.py +1 -1
- jaclang/compiler/passes/main/type_check_pass.py +2 -1
- jaclang/compiler/passes/tool/jac_formatter_pass.py +44 -11
- jaclang/compiler/passes/tool/tests/fixtures/corelib.jac +16 -0
- jaclang/compiler/passes/tool/tests/fixtures/corelib_fmt.jac +16 -0
- jaclang/compiler/passes/tool/tests/fixtures/doc_string.jac +15 -0
- jaclang/compiler/passes/tool/tests/test_jac_format_pass.py +7 -5
- jaclang/compiler/passes/tool/tests/test_unparse_validate.py +1 -2
- jaclang/compiler/passes/transform.py +2 -4
- jaclang/{core/registry.py → compiler/semtable.py} +1 -3
- jaclang/compiler/symtable.py +39 -31
- jaclang/compiler/tests/test_parser.py +2 -2
- jaclang/core/aott.py +112 -16
- jaclang/core/{construct.py → architype.py} +44 -93
- jaclang/core/constructs.py +44 -0
- jaclang/core/context.py +157 -0
- jaclang/core/importer.py +18 -9
- jaclang/core/llms/anthropic.py +31 -2
- jaclang/core/llms/base.py +3 -3
- jaclang/core/llms/groq.py +4 -1
- jaclang/core/llms/huggingface.py +4 -1
- jaclang/core/llms/ollama.py +4 -1
- jaclang/core/llms/openai.py +6 -2
- jaclang/core/llms/togetherai.py +4 -1
- jaclang/core/memory.py +53 -2
- jaclang/core/test.py +90 -0
- jaclang/core/utils.py +2 -2
- jaclang/langserve/engine.py +119 -122
- jaclang/langserve/server.py +27 -5
- jaclang/langserve/tests/fixtures/circle.jac +16 -12
- jaclang/langserve/tests/fixtures/circle_err.jac +3 -3
- jaclang/langserve/tests/fixtures/circle_pure.impl.jac +8 -4
- jaclang/langserve/tests/fixtures/circle_pure.jac +2 -2
- jaclang/langserve/tests/test_server.py +114 -0
- jaclang/langserve/utils.py +104 -10
- jaclang/plugin/builtin.py +1 -1
- jaclang/plugin/default.py +46 -90
- jaclang/plugin/feature.py +32 -16
- jaclang/plugin/spec.py +17 -19
- jaclang/plugin/tests/test_features.py +0 -33
- jaclang/settings.py +4 -0
- jaclang/tests/fixtures/abc.jac +16 -12
- jaclang/tests/fixtures/byllmissue.jac +12 -0
- jaclang/tests/fixtures/edgetypetest.jac +16 -0
- jaclang/tests/fixtures/hash_init_check.jac +17 -0
- jaclang/tests/fixtures/impl_match_confused.impl.jac +1 -0
- jaclang/tests/fixtures/impl_match_confused.jac +5 -0
- jaclang/tests/fixtures/math_question.jpg +0 -0
- jaclang/tests/fixtures/maxfail_run_test.jac +17 -5
- jaclang/tests/fixtures/nosigself.jac +19 -0
- jaclang/tests/fixtures/run_test.jac +17 -5
- jaclang/tests/fixtures/walker_override.jac +21 -0
- jaclang/tests/fixtures/with_llm_vision.jac +25 -0
- jaclang/tests/test_bugs.py +19 -0
- jaclang/tests/test_cli.py +1 -1
- jaclang/tests/test_language.py +116 -11
- jaclang/tests/test_reference.py +1 -1
- jaclang/utils/lang_tools.py +5 -4
- jaclang/utils/test.py +2 -1
- jaclang/utils/treeprinter.py +35 -4
- {jaclang-0.7.1.dist-info → jaclang-0.7.5.dist-info}/METADATA +3 -2
- {jaclang-0.7.1.dist-info → jaclang-0.7.5.dist-info}/RECORD +84 -71
- jaclang/core/shelve_storage.py +0 -55
- {jaclang-0.7.1.dist-info → jaclang-0.7.5.dist-info}/WHEEL +0 -0
- {jaclang-0.7.1.dist-info → jaclang-0.7.5.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:walker:gen_outline:can:get_highlights {}
|
|
Binary file
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
glob x = 5,y=2;
|
|
2
|
-
|
|
3
|
-
test
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
glob x = 5, y = 2;
|
|
2
|
+
|
|
3
|
+
test a {
|
|
4
|
+
check assertAlmostEqual(5, x);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
test b {
|
|
8
|
+
check assertIn("l", "llm");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
test c {
|
|
12
|
+
check assertEqual(x - y, 3);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
test d {
|
|
16
|
+
check assertEqual(1, 2);
|
|
17
|
+
}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
glob a = 5,b=2;
|
|
2
|
-
|
|
3
|
-
test
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
glob a = 5, b = 2;
|
|
2
|
+
|
|
3
|
+
test t1 {
|
|
4
|
+
check assertAlmostEqual(a, 6);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
test t2 {
|
|
8
|
+
check assertTrue(a != b);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
test t3 {
|
|
12
|
+
check assertIn("d", "abc");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
test t4 {
|
|
16
|
+
check assertEqual(a - b, 3);
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
walker a {
|
|
2
|
+
can foo with `root entry {
|
|
3
|
+
print("foo");
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
walker b :a: {
|
|
8
|
+
can bar with `root entry {
|
|
9
|
+
print("bar");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
walker c :b: {
|
|
14
|
+
override can foo with `root entry {
|
|
15
|
+
print("baz");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
with entry {
|
|
20
|
+
root spawn c();
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import:py from jaclang.core.llms, BaseLLM;
|
|
2
|
+
import:py from PIL, Image;
|
|
3
|
+
import:py os;
|
|
4
|
+
|
|
5
|
+
obj model:BaseLLM: {
|
|
6
|
+
can init {
|
|
7
|
+
self.verbose = False;
|
|
8
|
+
self.max_tries = 1;
|
|
9
|
+
}
|
|
10
|
+
can __infer__(meaning_in: str, **kwargs: dict) {
|
|
11
|
+
print(kwargs);
|
|
12
|
+
print(meaning_in);
|
|
13
|
+
return "[Output] Something";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
glob llm = model();
|
|
17
|
+
|
|
18
|
+
can 'Solve the Given Math Question'
|
|
19
|
+
solve_math_question(question_img: 'Image of the Question': Image) -> 'Answer to the Question': str
|
|
20
|
+
by llm(method="Chain-of-Thoughts");
|
|
21
|
+
|
|
22
|
+
with entry {
|
|
23
|
+
question_img = Image.open(os.path.join(os.path.dirname(__file__), 'math_question.jpg'));
|
|
24
|
+
print(solve_math_question(question_img));
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Test Jac language generally."""
|
|
2
|
+
|
|
3
|
+
from jaclang.compiler.compile import jac_file_to_pass
|
|
4
|
+
from jaclang.utils.test import TestCase
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class JacBugTests(TestCase):
|
|
8
|
+
"""Test pass module."""
|
|
9
|
+
|
|
10
|
+
def setUp(self) -> None:
|
|
11
|
+
"""Set up test."""
|
|
12
|
+
return super().setUp()
|
|
13
|
+
|
|
14
|
+
def test_impl_match_confusion_issue(self) -> None:
|
|
15
|
+
"""Basic test for symtable support for inheritance."""
|
|
16
|
+
mypass = jac_file_to_pass(
|
|
17
|
+
self.fixture_abs_path("impl_match_confused.jac"),
|
|
18
|
+
)
|
|
19
|
+
self.assertEqual(len(mypass.errors_had), 1)
|
jaclang/tests/test_cli.py
CHANGED
|
@@ -112,7 +112,7 @@ class JacCliTests(TestCase):
|
|
|
112
112
|
cli.tool("ir", ["ast", f"{self.fixture_abs_path('type_info.jac')}"])
|
|
113
113
|
sys.stdout = sys.__stdout__
|
|
114
114
|
stdout_value = captured_output.getvalue()
|
|
115
|
-
self.assertEqual(stdout_value.count("type_info.ServerWrapper"),
|
|
115
|
+
self.assertEqual(stdout_value.count("type_info.ServerWrapper"), 7)
|
|
116
116
|
self.assertEqual(stdout_value.count("builtins.int"), 2)
|
|
117
117
|
self.assertEqual(stdout_value.count("builtins.str"), 7)
|
|
118
118
|
|
jaclang/tests/test_language.py
CHANGED
|
@@ -6,9 +6,12 @@ import pickle
|
|
|
6
6
|
import sys
|
|
7
7
|
import sysconfig
|
|
8
8
|
|
|
9
|
+
|
|
10
|
+
import jaclang.compiler.passes.main as passes
|
|
9
11
|
from jaclang import jac_import
|
|
10
12
|
from jaclang.cli import cli
|
|
11
13
|
from jaclang.compiler.compile import jac_file_to_pass, jac_pass_to_pass, jac_str_to_pass
|
|
14
|
+
from jaclang.compiler.passes.main.schedules import py_code_gen_typed
|
|
12
15
|
from jaclang.plugin.feature import JacFeature as Jac
|
|
13
16
|
from jaclang.settings import settings
|
|
14
17
|
from jaclang.utils.test import TestCase
|
|
@@ -119,16 +122,10 @@ class JacLanguageTests(TestCase):
|
|
|
119
122
|
self.assertIn("{'temperature': 0.7}", stdout_value)
|
|
120
123
|
self.assertIn("Emoji Representation (str)", stdout_value)
|
|
121
124
|
self.assertIn('Text Input (input) (str) = "Lets move to paris"', stdout_value)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
stdout_value,
|
|
127
|
-
)
|
|
128
|
-
except AssertionError:
|
|
129
|
-
self.skipTest(
|
|
130
|
-
"This error only happens in certain enviornments, check later."
|
|
131
|
-
)
|
|
125
|
+
self.assertIn(
|
|
126
|
+
' = [{"input": "I love tp drink pina coladas"',
|
|
127
|
+
stdout_value,
|
|
128
|
+
)
|
|
132
129
|
|
|
133
130
|
def test_with_llm_method(self) -> None:
|
|
134
131
|
"""Parse micro jac file."""
|
|
@@ -187,7 +184,7 @@ class JacLanguageTests(TestCase):
|
|
|
187
184
|
self.assertIn("14/03/1879", stdout_value)
|
|
188
185
|
self.assertNotIn(
|
|
189
186
|
'University (University) (obj) = type(__module__="with_llm_type", __doc__=None, '
|
|
190
|
-
"_jac_entry_funcs_
|
|
187
|
+
"_jac_entry_funcs_`=[`], _jac_exit_funcs_=[], __init__=function(__wrapped__=function()))",
|
|
191
188
|
stdout_value,
|
|
192
189
|
)
|
|
193
190
|
desired_output_count = stdout_value.count(
|
|
@@ -195,6 +192,25 @@ class JacLanguageTests(TestCase):
|
|
|
195
192
|
)
|
|
196
193
|
self.assertEqual(desired_output_count, 2)
|
|
197
194
|
|
|
195
|
+
def test_with_llm_vision(self) -> None:
|
|
196
|
+
"""Test MTLLLM Vision Implementation."""
|
|
197
|
+
try:
|
|
198
|
+
captured_output = io.StringIO()
|
|
199
|
+
sys.stdout = captured_output
|
|
200
|
+
jac_import("with_llm_vision", base_path=self.fixture_abs_path("./"))
|
|
201
|
+
sys.stdout = sys.__stdout__
|
|
202
|
+
stdout_value = captured_output.getvalue()
|
|
203
|
+
self.assertIn(
|
|
204
|
+
"{'type': 'text', 'text': '\\n[System Prompt]\\n", stdout_value[:500]
|
|
205
|
+
)
|
|
206
|
+
self.assertNotIn(
|
|
207
|
+
" {'type': 'text', 'text': 'Image of the Question (question_img) (Image) = '}, "
|
|
208
|
+
"{'type': 'image_url', 'image_url': {'url': 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQAB",
|
|
209
|
+
stdout_value[:500],
|
|
210
|
+
)
|
|
211
|
+
except Exception:
|
|
212
|
+
self.skipTest("This test requires Pillow to be installed.")
|
|
213
|
+
|
|
198
214
|
def test_ignore(self) -> None:
|
|
199
215
|
"""Parse micro jac file."""
|
|
200
216
|
Jac.get_root()._jac_.edges.clear()
|
|
@@ -829,3 +845,92 @@ class JacLanguageTests(TestCase):
|
|
|
829
845
|
stdout_value = captured_output.getvalue()
|
|
830
846
|
self.assertIn("Deep convo is imported", stdout_value)
|
|
831
847
|
settings.py_raise = settings.py_raise_deep = False
|
|
848
|
+
|
|
849
|
+
def test_override_walker_inherit(self) -> None:
|
|
850
|
+
"""Test py ast to Jac ast conversion output."""
|
|
851
|
+
captured_output = io.StringIO()
|
|
852
|
+
sys.stdout = captured_output
|
|
853
|
+
jac_import("walker_override", base_path=self.fixture_abs_path("./"))
|
|
854
|
+
sys.stdout = sys.__stdout__
|
|
855
|
+
stdout_value = captured_output.getvalue()
|
|
856
|
+
self.assertEqual("baz\nbar\n", stdout_value)
|
|
857
|
+
|
|
858
|
+
def test_ds_type_check_pass(self) -> None:
|
|
859
|
+
"""Test conn assign on edges."""
|
|
860
|
+
Jac.get_root()._jac_.edges.clear()
|
|
861
|
+
mypass = jac_file_to_pass(
|
|
862
|
+
self.fixture_abs_path("../../../examples/micro/simple_walk.jac"),
|
|
863
|
+
schedule=py_code_gen_typed,
|
|
864
|
+
)
|
|
865
|
+
self.assertEqual(len(mypass.errors_had), 0)
|
|
866
|
+
self.assertEqual(len(mypass.warnings_had), 0)
|
|
867
|
+
|
|
868
|
+
def test_ds_type_check_pass2(self) -> None:
|
|
869
|
+
"""Test conn assign on edges."""
|
|
870
|
+
Jac.get_root()._jac_.edges.clear()
|
|
871
|
+
mypass = jac_file_to_pass(
|
|
872
|
+
self.fixture_abs_path("../../../examples/guess_game/guess_game5.jac"),
|
|
873
|
+
schedule=py_code_gen_typed,
|
|
874
|
+
)
|
|
875
|
+
self.assertEqual(len(mypass.errors_had), 0)
|
|
876
|
+
self.assertEqual(len(mypass.warnings_had), 0)
|
|
877
|
+
|
|
878
|
+
def test_self_with_no_sig(self) -> None: # we can get rid of this, isn't?
|
|
879
|
+
"""Test py ast to Jac ast conversion output."""
|
|
880
|
+
captured_output = io.StringIO()
|
|
881
|
+
sys.stdout = captured_output
|
|
882
|
+
jac_import("nosigself", base_path=self.fixture_abs_path("./"))
|
|
883
|
+
sys.stdout = sys.__stdout__
|
|
884
|
+
stdout_value = captured_output.getvalue()
|
|
885
|
+
self.assertEqual(stdout_value.count("5"), 2)
|
|
886
|
+
|
|
887
|
+
def test_hash_init_check(self) -> None: # we can get rid of this, isn't?
|
|
888
|
+
"""Test py ast to Jac ast conversion output."""
|
|
889
|
+
captured_output = io.StringIO()
|
|
890
|
+
sys.stdout = captured_output
|
|
891
|
+
jac_import("hash_init_check", base_path=self.fixture_abs_path("./"))
|
|
892
|
+
sys.stdout = sys.__stdout__
|
|
893
|
+
stdout_value = captured_output.getvalue()
|
|
894
|
+
self.assertIn("Test Passed", stdout_value)
|
|
895
|
+
|
|
896
|
+
def test_multiline_single_tok(self) -> None:
|
|
897
|
+
"""Test conn assign on edges."""
|
|
898
|
+
Jac.get_root()._jac_.edges.clear()
|
|
899
|
+
mypass = jac_file_to_pass(self.fixture_abs_path("byllmissue.jac"))
|
|
900
|
+
self.assertIn("2:5 - 4:8", mypass.ir.pp())
|
|
901
|
+
|
|
902
|
+
def test_single_impl_annex(self) -> None:
|
|
903
|
+
"""Basic test for pass."""
|
|
904
|
+
mypass = jac_file_to_pass(
|
|
905
|
+
self.fixture_abs_path("../../../examples/manual_code/circle_pure.jac"),
|
|
906
|
+
target=passes.JacImportPass,
|
|
907
|
+
)
|
|
908
|
+
|
|
909
|
+
self.assertEqual(mypass.ir.pp().count("AbilityDef - (o)Circle.(c)area"), 1)
|
|
910
|
+
self.assertIsNone(mypass.ir.sym_tab)
|
|
911
|
+
mypass = jac_file_to_pass(
|
|
912
|
+
self.fixture_abs_path("../../../examples/manual_code/circle_pure.jac"),
|
|
913
|
+
target=passes.SymTabBuildPass,
|
|
914
|
+
)
|
|
915
|
+
self.assertEqual(
|
|
916
|
+
len([i for i in mypass.ir.sym_tab.kid if i.name == "circle_pure.impl"]),
|
|
917
|
+
1,
|
|
918
|
+
)
|
|
919
|
+
|
|
920
|
+
def test_inherit_baseclass_sym(self) -> None:
|
|
921
|
+
"""Basic test for symtable support for inheritance."""
|
|
922
|
+
mypass = jac_file_to_pass(
|
|
923
|
+
self.fixture_abs_path("../../../examples/guess_game/guess_game4.jac"),
|
|
924
|
+
target=passes.DefUsePass,
|
|
925
|
+
)
|
|
926
|
+
table = None
|
|
927
|
+
for i in mypass.ir.sym_tab.kid:
|
|
928
|
+
print(i.name)
|
|
929
|
+
if i.name == "GuessTheNumberGame":
|
|
930
|
+
for j in i.kid:
|
|
931
|
+
if j.name == "play":
|
|
932
|
+
table = j
|
|
933
|
+
break
|
|
934
|
+
break
|
|
935
|
+
self.assertIsNotNone(table)
|
|
936
|
+
self.assertIsNotNone(table.lookup("attempts"))
|
jaclang/tests/test_reference.py
CHANGED
jaclang/utils/lang_tools.py
CHANGED
|
@@ -9,6 +9,7 @@ from typing import List, Optional, Type
|
|
|
9
9
|
import jaclang.compiler.absyntree as ast
|
|
10
10
|
from jaclang.compiler.compile import jac_file_to_pass
|
|
11
11
|
from jaclang.compiler.passes.main.pyast_load_pass import PyastBuildPass
|
|
12
|
+
from jaclang.compiler.passes.main.schedules import py_code_gen, type_checker_sched
|
|
12
13
|
from jaclang.compiler.passes.main.schedules import py_code_gen_typed
|
|
13
14
|
from jaclang.compiler.symtable import SymbolTable
|
|
14
15
|
from jaclang.utils.helpers import auto_generate_refs, pascal_to_snake
|
|
@@ -81,8 +82,8 @@ class AstTool:
|
|
|
81
82
|
"JacSource",
|
|
82
83
|
"EmptyToken",
|
|
83
84
|
"AstSymbolNode",
|
|
85
|
+
"AstSymbolStubNode",
|
|
84
86
|
"AstAccessNode",
|
|
85
|
-
"TokenSymbol",
|
|
86
87
|
"Literal",
|
|
87
88
|
"AstDocNode",
|
|
88
89
|
"AstSemStrNode",
|
|
@@ -97,7 +98,7 @@ class AstTool:
|
|
|
97
98
|
"ArchBlockStmt",
|
|
98
99
|
"EnumBlockStmt",
|
|
99
100
|
"CodeBlockStmt",
|
|
100
|
-
"
|
|
101
|
+
"NameAtom",
|
|
101
102
|
"ArchSpec",
|
|
102
103
|
"MatchPattern",
|
|
103
104
|
]
|
|
@@ -234,8 +235,8 @@ class AstTool:
|
|
|
234
235
|
return f"Error While Jac to Py AST conversion: {e}"
|
|
235
236
|
else:
|
|
236
237
|
ir = jac_file_to_pass(
|
|
237
|
-
file_name, schedule=
|
|
238
|
-
).ir
|
|
238
|
+
file_name, schedule=[*(py_code_gen[:-1]), *type_checker_sched]
|
|
239
|
+
).ir
|
|
239
240
|
|
|
240
241
|
match output:
|
|
241
242
|
case "sym":
|
jaclang/utils/test.py
CHANGED
|
@@ -107,6 +107,7 @@ class AstSyncTestMixin:
|
|
|
107
107
|
"jac_source",
|
|
108
108
|
"empty_token",
|
|
109
109
|
"ast_symbol_node",
|
|
110
|
+
"ast_symbol_stub_node",
|
|
110
111
|
"ast_impl_needing_node",
|
|
111
112
|
"ast_access_node",
|
|
112
113
|
"token_symbol",
|
|
@@ -124,7 +125,7 @@ class AstSyncTestMixin:
|
|
|
124
125
|
"arch_block_stmt",
|
|
125
126
|
"enum_block_stmt",
|
|
126
127
|
"code_block_stmt",
|
|
127
|
-
"
|
|
128
|
+
"name_atom",
|
|
128
129
|
"arch_spec",
|
|
129
130
|
"match_pattern",
|
|
130
131
|
]
|
jaclang/utils/treeprinter.py
CHANGED
|
@@ -96,16 +96,39 @@ def print_ast_tree(
|
|
|
96
96
|
else ""
|
|
97
97
|
)
|
|
98
98
|
sym_table_link = (
|
|
99
|
-
f"SymbolTable: {node.
|
|
100
|
-
if isinstance(node, AstSymbolNode) and node.
|
|
99
|
+
f"SymbolTable: {node.type_sym_tab.name}"
|
|
100
|
+
if isinstance(node, AstSymbolNode) and node.type_sym_tab
|
|
101
101
|
else "SymbolTable: None" if isinstance(node, AstSymbolNode) else ""
|
|
102
102
|
)
|
|
103
|
+
|
|
103
104
|
if isinstance(node, Token) and isinstance(node, AstSymbolNode):
|
|
104
|
-
|
|
105
|
+
out = (
|
|
106
|
+
f"{node.__class__.__name__} - {node.value} - "
|
|
107
|
+
f"Type: {node.sym_type}, {access} {sym_table_link}"
|
|
108
|
+
)
|
|
109
|
+
if settings.ast_symbol_info_detailed:
|
|
110
|
+
symbol = (
|
|
111
|
+
node.sym.sym_dotted_name
|
|
112
|
+
if node.sym
|
|
113
|
+
else "<No Symbol is associated with this node>"
|
|
114
|
+
)
|
|
115
|
+
out += f" SymbolPath: {symbol}"
|
|
116
|
+
return out
|
|
105
117
|
elif isinstance(node, Token):
|
|
106
118
|
return f"{node.__class__.__name__} - {node.value}, {access}"
|
|
107
119
|
elif isinstance(node, AstSymbolNode):
|
|
108
|
-
|
|
120
|
+
out = (
|
|
121
|
+
f"{node.__class__.__name__} - {node.sym_name} - "
|
|
122
|
+
f"Type: {node.sym_type}, {access} {sym_table_link}"
|
|
123
|
+
)
|
|
124
|
+
if settings.ast_symbol_info_detailed:
|
|
125
|
+
symbol = (
|
|
126
|
+
node.sym.sym_dotted_name
|
|
127
|
+
if node.sym
|
|
128
|
+
else "<No Symbol is associated with this node>"
|
|
129
|
+
)
|
|
130
|
+
out += f" SymbolPath: {symbol}"
|
|
131
|
+
return out
|
|
109
132
|
else:
|
|
110
133
|
return f"{node.__class__.__name__}, {access}"
|
|
111
134
|
|
|
@@ -242,6 +265,14 @@ def _build_symbol_tree_common(
|
|
|
242
265
|
)
|
|
243
266
|
for n in sym.defn
|
|
244
267
|
]
|
|
268
|
+
uses = SymbolTree(node_name="uses", parent=symbol_node)
|
|
269
|
+
[
|
|
270
|
+
SymbolTree(
|
|
271
|
+
node_name=f"line {n.loc.first_line}, col {n.loc.col_start}",
|
|
272
|
+
parent=uses,
|
|
273
|
+
)
|
|
274
|
+
for n in sym.uses
|
|
275
|
+
]
|
|
245
276
|
|
|
246
277
|
for k in node.kid:
|
|
247
278
|
_build_symbol_tree_common(k, children)
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jaclang
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.5
|
|
4
4
|
Summary: Jac is a unique and powerful programming language that runs on top of Python, offering an unprecedented level of intelligence and intuitive understanding.
|
|
5
5
|
Home-page: https://jaseci.org
|
|
6
6
|
License: MIT
|
|
7
7
|
Keywords: jac,jaclang,programming-language,machine-learning,artificial-intelligence
|
|
8
8
|
Author: Jason Mars
|
|
9
9
|
Author-email: jason@jaseci.org
|
|
10
|
-
Requires-Python: >=3.
|
|
10
|
+
Requires-Python: >=3.11.0,<4.0.0
|
|
11
11
|
Classifier: License :: OSI Approved :: MIT License
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
15
|
Provides-Extra: llm
|
|
15
16
|
Project-URL: Documentation, https://jac-lang.org
|