jaclang 0.5.8__py3-none-any.whl → 0.5.9__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/utils/helpers.py CHANGED
@@ -7,9 +7,6 @@ import pdb
7
7
  import re
8
8
 
9
9
 
10
- import jaclang.compiler.absyntree as ast
11
-
12
-
13
10
  def pascal_to_snake(pascal_string: str) -> str:
14
11
  """Convert pascal case to snake case."""
15
12
  snake_string = re.sub(r"(?<!^)(?=[A-Z])", "_", pascal_string).lower()
@@ -46,6 +43,7 @@ def get_ast_nodes_as_snake_case() -> list[str]:
46
43
  """Get all AST nodes as snake case."""
47
44
  import inspect
48
45
  import sys
46
+ import jaclang.compiler.absyntree as ast
49
47
 
50
48
  module_name = ast.__name__
51
49
  module = sys.modules[module_name]
@@ -88,6 +86,46 @@ def extract_headings(file_path: str) -> dict[str, tuple[int, int]]:
88
86
  return headings
89
87
 
90
88
 
89
+ def auto_generate_refs() -> None:
90
+ """Auto generate lang reference for docs."""
91
+ file_path = os.path.join(
92
+ os.path.split(os.path.dirname(__file__))[0], "../jaclang/compiler/jac.lark"
93
+ )
94
+ result = extract_headings(file_path)
95
+ created_file_path = os.path.join(
96
+ os.path.split(os.path.dirname(__file__))[0],
97
+ "../support/jac-lang.org/docs/learn/jac_ref.md",
98
+ )
99
+ destination_folder = os.path.join(
100
+ os.path.split(os.path.dirname(__file__))[0], "../examples/reference/"
101
+ )
102
+ with open(created_file_path, "w") as md_file:
103
+ md_file.write(
104
+ '# Jac Language Reference\n\n--8<-- "examples/reference/introduction.md"\n\n'
105
+ )
106
+ for heading, lines in result.items():
107
+ heading = heading.strip()
108
+ heading_snakecase = heading_to_snake(heading)
109
+ content = (
110
+ f'## {heading}\n**Grammar Snippet**\n```yaml linenums="{lines[0]}"\n--8<-- '
111
+ f'"jaclang/compiler/jac.lark:{lines[0]}:{lines[1]}"\n```\n'
112
+ f'**Code Example**\n=== "Jac"\n ```jac linenums="1"\n --8<-- "examples/reference/'
113
+ f'{heading_snakecase}.jac"\n'
114
+ f' ```\n=== "Python"\n ```python linenums="1"\n --8<-- "examples/reference/'
115
+ f'{heading_snakecase}.py"\n ```\n'
116
+ "**Description**\n\n--8<-- "
117
+ f'"examples/reference/'
118
+ f'{heading_snakecase}.md"\n'
119
+ )
120
+ with open(created_file_path, "a") as md_file:
121
+ md_file.write(f"{content}\n")
122
+ md_file_name = f"{heading_snakecase}.md"
123
+ md_file_path = os.path.join(destination_folder, md_file_name)
124
+ if not os.path.exists(md_file_path):
125
+ with open(md_file_path, "w") as md_file:
126
+ md_file.write("")
127
+
128
+
91
129
  def import_target_to_relative_path(
92
130
  import_target: str, base_path: str | None = None, file_extension: str = ".jac"
93
131
  ) -> str:
@@ -10,7 +10,7 @@ import jaclang.compiler.absyntree as ast
10
10
  from jaclang.compiler.compile import jac_file_to_pass
11
11
  from jaclang.compiler.passes.main.schedules import py_code_gen_typed
12
12
  from jaclang.compiler.symtable import SymbolTable
13
- from jaclang.utils.helpers import extract_headings, heading_to_snake, pascal_to_snake
13
+ from jaclang.utils.helpers import auto_generate_refs, pascal_to_snake
14
14
 
15
15
 
16
16
  class AstKidInfo:
@@ -258,40 +258,5 @@ class AstTool:
258
258
 
259
259
  def automate_ref(self) -> str:
260
260
  """Automate the reference guide generation."""
261
- file_path = os.path.join(
262
- os.path.split(os.path.dirname(__file__))[0], "../jaclang/compiler/jac.lark"
263
- )
264
- result = extract_headings(file_path)
265
- created_file_path = os.path.join(
266
- os.path.split(os.path.dirname(__file__))[0],
267
- "../support/jac-lang.org/docs/learn/jac_ref.md",
268
- )
269
- destination_folder = os.path.join(
270
- os.path.split(os.path.dirname(__file__))[0], "../examples/reference/"
271
- )
272
- with open(created_file_path, "w") as md_file:
273
- md_file.write(
274
- '# Jac Language Reference\n\n--8<-- "examples/reference/introduction.md"\n\n'
275
- )
276
- for heading, lines in result.items():
277
- heading = heading.strip()
278
- heading_snakecase = heading_to_snake(heading)
279
- content = (
280
- f'## {heading}\n**Grammar Snippet**\n```yaml linenums="{lines[0]}"\n--8<-- '
281
- f'"jaclang/compiler/jac.lark:{lines[0]}:{lines[1]}"\n```\n'
282
- f'**Code Example**\n=== "Jac"\n ```jac linenums="1"\n --8<-- "examples/reference/'
283
- f'{heading_snakecase}.jac"\n'
284
- f' ```\n=== "Python"\n ```python linenums="1"\n --8<-- "examples/reference/'
285
- f'{heading_snakecase}.py"\n ```\n'
286
- "**Description**\n\n--8<-- "
287
- f'"examples/reference/'
288
- f'{heading_snakecase}.md"\n'
289
- )
290
- with open(created_file_path, "a") as md_file:
291
- md_file.write(f"{content}\n")
292
- md_file_name = f"{heading_snakecase}.md"
293
- md_file_path = os.path.join(destination_folder, md_file_name)
294
- if not os.path.exists(md_file_path):
295
- with open(md_file_path, "w") as md_file:
296
- md_file.write("")
261
+ auto_generate_refs()
297
262
  return "References generated."
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jaclang
3
- Version: 0.5.8
3
+ Version: 0.5.9
4
4
  Home-page: https://github.com/Jaseci-Labs/jaclang
5
5
  Author: Jason Mars
6
6
  Author-email: jason@jaseci.org
@@ -1,30 +1,29 @@
1
1
  jaclang/__init__.py,sha256=8y03wUXOs-_OI-SQfXzmQBUPHkwKyEM2zGDQvnWMS_k,693
2
2
  jaclang/cli/__init__.py,sha256=7aaPgYddIAHBvkdv36ngbfwsimMnfGaTDcaHYMg_vf4,23
3
- jaclang/cli/cli.py,sha256=kE7ZR0ZgKuhlFGfszMcNu239uhSO6rt7PIP6UtsHyko,7822
3
+ jaclang/cli/cli.py,sha256=8q125ai5V6NuJ1LPNLHD25xFxYEx2qHjqBB5vXY1fIY,10039
4
4
  jaclang/cli/cmdreg.py,sha256=bn2UdOkNbE-4zfbomO2j8rTtkXhsltH4jE5rKqA5HbY,7862
5
- jaclang/compiler/__init__.py,sha256=Ulx-OBWcdr6Uh9m7vmDUNjA2zy-rx9uKJ59kb63tFGY,955
6
- jaclang/compiler/absyntree.py,sha256=K58UU0VO3oAjmza6gbyYnm4J1U_YFQ7Nh4J9p4XW_rk,124652
5
+ jaclang/compiler/__init__.py,sha256=4k5DVYSk89mQbk5gVlLgXUtvIPJthUajiHTcY4Uk1mU,2266
6
+ jaclang/compiler/absyntree.py,sha256=4tj4vTv9IXWNLG3oWWv1ODN7A_Y1e-ehFvuGiVGm_Og,127314
7
7
  jaclang/compiler/codeloc.py,sha256=KMwf5OMQu3_uDjIdH7ta2piacUtXNPgUV1t8OuLjpzE,2828
8
8
  jaclang/compiler/compile.py,sha256=fS6Uvor93EavESKrwadqp7bstcpMRRACvBkqbr4En04,2682
9
9
  jaclang/compiler/constant.py,sha256=C8nOgWLAg-fRg8Qax_jRcYp6jGyWSSA1gwzk9Zdy7HE,6534
10
- jaclang/compiler/parser.py,sha256=nARBmZhrtBNN140pY1e8z0773GGtK7C95dShjOXJ484,135292
10
+ jaclang/compiler/parser.py,sha256=xUwxCSKA70JPivejOHbhdyFiCNDaNMmuT6QaLYAjHG8,135461
11
11
  jaclang/compiler/symtable.py,sha256=SRYSwZtLHXLIOkE9CfdWDkkwx0vDLXvMeYiFfh6-wP4,5769
12
12
  jaclang/compiler/workspace.py,sha256=auTT5VDJzwz1w8_WYlt65U6wAYxGtTl1u1v0lofOfo4,7521
13
- jaclang/compiler/__jac_gen__/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- jaclang/compiler/__jac_gen__/jac_parser.py,sha256=jP8ZLmt-q4X-MTzDGX4IDKmVsDCfnY7KTIcFByhuwmU,334046
15
13
  jaclang/compiler/passes/__init__.py,sha256=0Tw0d130ZjzA05jVcny9cf5NfLjlaM70PKqFnY4zqn4,69
16
- jaclang/compiler/passes/ir_pass.py,sha256=ZCcERZZfcOxRurJjOlW5UFj-C1mlp44qpDMsUCH2dUQ,4893
14
+ jaclang/compiler/passes/ir_pass.py,sha256=Gwcuh3vkSpzozgQdh78GgH7tjkIouuGLmmi2Klyoctk,5490
17
15
  jaclang/compiler/passes/transform.py,sha256=6t-bbX_s615i7_naOIBjT4wvAkvLFM4niRHYyF4my8A,2086
18
- jaclang/compiler/passes/main/__init__.py,sha256=93aNqSyI2GyRBrzIkxVc7N8JENKPdwtVWpR3XmZ6wG8,831
16
+ jaclang/compiler/passes/main/__init__.py,sha256=jT0AZ3-Cp4VIoJUdUAfwEdjgB0mtMRaqMIw4cjlrLvs,905
19
17
  jaclang/compiler/passes/main/def_impl_match_pass.py,sha256=_KgAVVzMAatigKDp1vAnhyY2GcWf0rRoD8MkfYg-POU,3297
20
18
  jaclang/compiler/passes/main/def_use_pass.py,sha256=d2REmfme2HjUj8avDcXUuPbv3yKfvYHqpL49sxniLhQ,8576
21
19
  jaclang/compiler/passes/main/fuse_typeinfo_pass.py,sha256=QY-0Cxpb3rYDU4JlO4_WILo9ppsv9GJLlR65YqG32sw,13809
22
20
  jaclang/compiler/passes/main/import_pass.py,sha256=d2vguYz7z-aNtVnJUfBoSmbYVdGeKmZbnSnrRnE4cg4,6198
23
- jaclang/compiler/passes/main/pyast_gen_pass.py,sha256=MqDl2QrO3ECjKSjM-l6nNerm2qo9oweEG87p7mcL9Zo,124064
21
+ jaclang/compiler/passes/main/pyast_gen_pass.py,sha256=rfxj5BYMRJwi2OADjgXMQy4NEWiMwwJ7-KMikJKZQFU,135708
24
22
  jaclang/compiler/passes/main/pyast_load_pass.py,sha256=S2U2rjHGbVIP6oYezW1YCUBvxNGC0c_5OdTpfUpuXZ0,79234
25
23
  jaclang/compiler/passes/main/pybc_gen_pass.py,sha256=CjA9AqyMO3Pv_b5Hh0YI6JmCqIru2ASonO6rhrkau-M,1336
26
24
  jaclang/compiler/passes/main/pyout_pass.py,sha256=jw-ApCvVyAqynBFCArPQ20wq2ou0s7lTCGqcUyxrJWI,3018
27
- jaclang/compiler/passes/main/schedules.py,sha256=H8KIzdTq1Iwj7vkk3J2ek6Sd5fgLzmwPwNu0BJkM-l0,976
25
+ jaclang/compiler/passes/main/registry_pass.py,sha256=HeE7IyS4_9iWuBWLmQturxVoE5RjxHd4fl2xk192Alk,4483
26
+ jaclang/compiler/passes/main/schedules.py,sha256=Tn_jr6Lunm3t5tAluxvE493qfa4lF2kgIQPN0J42TEE,1048
28
27
  jaclang/compiler/passes/main/sub_node_tab_pass.py,sha256=fGgK0CBWsuD6BS4BsLwXPl1b5UC2N2YEOGa6jNMu8N8,1332
29
28
  jaclang/compiler/passes/main/sym_tab_build_pass.py,sha256=_NPfmSnDioQb80rVmOJWO_38KCtE238jnImFNlhuYsA,40986
30
29
  jaclang/compiler/passes/main/type_check_pass.py,sha256=BT5gUxlBEPYACLyZyoMNPjh4WJY8-wDKRmOIxMRRoMo,3231
@@ -35,6 +34,7 @@ jaclang/compiler/passes/main/tests/test_import_pass.py,sha256=KDTIhUnAVyp0iQ64lC
35
34
  jaclang/compiler/passes/main/tests/test_pyast_build_pass.py,sha256=LIT4TP-nhtftRtY5rNySRQlim-dWMSlkfUvkhZTk4pc,1383
36
35
  jaclang/compiler/passes/main/tests/test_pyast_gen_pass.py,sha256=QAw3kPE58pQYjVmuqwsd-G-fzlksbiiqvFWrhbaXkdM,4607
37
36
  jaclang/compiler/passes/main/tests/test_pybc_gen_pass.py,sha256=If8PE4exN5g9o1NRElNC0XdfIwJAp7M7f69rzmYRYUQ,655
37
+ jaclang/compiler/passes/main/tests/test_registry_pass.py,sha256=Eed94qPmO38GFVV4DARx6G0xaawAoncWfgSHja1wPeQ,1162
38
38
  jaclang/compiler/passes/main/tests/test_sub_node_pass.py,sha256=I8m2SM2Z-OJkRG3CfpzhZkxh4lrKNtFmcu6UuYzZpY0,877
39
39
  jaclang/compiler/passes/main/tests/test_sym_tab_build_pass.py,sha256=85mUM6mYYLCrQ9AivBIbreG7CgdsJH2zrNOqdcpnwBo,730
40
40
  jaclang/compiler/passes/main/tests/test_type_check_pass.py,sha256=bzrVcsBZra2HkQH2_qLdX0CY9wbx9gVxs-mSIeWGvqc,1553
@@ -46,7 +46,7 @@ jaclang/compiler/passes/tool/schedules.py,sha256=kmbsCazAMizGAdQuZpFky5BPlYlMXqN
46
46
  jaclang/compiler/passes/tool/tests/__init__.py,sha256=AeOaZjA1rf6VAr0JqIit6jlcmOzW7pxGr4U1fOwgK_Y,24
47
47
  jaclang/compiler/passes/tool/tests/test_fuse_comments_pass.py,sha256=ZeWHsm7VIyyS8KKpoB2SdlHM4jF22fMfSrfTfxt2MQw,398
48
48
  jaclang/compiler/passes/tool/tests/test_jac_format_pass.py,sha256=5RrRgd8WFB_5qk9mBlEgWD0GdoQu8DsG2rgRCsfoObw,4829
49
- jaclang/compiler/passes/tool/tests/test_unparse_validate.py,sha256=vKcI3jMSDphBt9Arr8THe7CdDVNZZ6hsHl6XwCIR_Rk,1546
49
+ jaclang/compiler/passes/tool/tests/test_unparse_validate.py,sha256=gZ7BRDznLihoctlqDWuNIFlo6xtFh9d8qJidksP4EZ0,2252
50
50
  jaclang/compiler/passes/utils/__init__.py,sha256=UsI5rUopTUiStAzup4kbPwIwrnC5ofCrqWBCBbM2-k4,35
51
51
  jaclang/compiler/passes/utils/mypy_ast_build.py,sha256=qY_QO7rxMOCoPppph0OrCXJD-RJlPQekkDYYfGgfox0,22659
52
52
  jaclang/compiler/tests/__init__.py,sha256=qiXa5UNRBanGOcplFKTT9a_9GEyiv7goq1OzuCjDCFE,27
@@ -56,20 +56,21 @@ jaclang/compiler/tests/test_workspace.py,sha256=SEBcvz_daTbonrLHK9FbjiH86TUbOtVG
56
56
  jaclang/compiler/tests/fixtures/__init__.py,sha256=udQ0T6rajpW_nMiYKJNckqP8izZ-pH3P4PNTJEln2NU,36
57
57
  jaclang/compiler/tests/fixtures/activity.py,sha256=fSvxYDKufsPeQIrbuh031zHw_hdbRv5iK9mS7dD8E54,263
58
58
  jaclang/core/__init__.py,sha256=jDDYBCV82qPhmcDVk3NIvHbhng0ebSrXD3xrojg0-eo,34
59
- jaclang/core/aott.py,sha256=DYk_jFdcTY5AMXpHePeHONquaPcq9UgIGk_sUrtwsbQ,1741
60
- jaclang/core/construct.py,sha256=jZLere0irH-z2hjfc3Enuq9FmvWSiMjmDpDc5x4WkV0,13436
59
+ jaclang/core/aott.py,sha256=m40f0Aeh75pVCJOjZiD72cXzZ0F561NjYPyAdPbvKsk,7738
60
+ jaclang/core/construct.py,sha256=_37LPojurHhzeZRQ5L_e4WWLIikpVLI_eR0ZfuCnrmY,13644
61
61
  jaclang/core/importer.py,sha256=_ahfUAg8egcLkBxkh-2xzOPEa4gz1a0-6zrxeQDxkRg,3370
62
- jaclang/core/utils.py,sha256=n400FVGmps2mLvXXoyhN5Ovr78YMD7a8f5yrSwSO4cY,3173
62
+ jaclang/core/registry.py,sha256=7W3Fty7ff8CwlahtRsBtFUaEnZKpHY4uwrStUaelZ8c,3485
63
+ jaclang/core/utils.py,sha256=jUNHRdMKw-cvm48qyLBkZ0Zek_FHPCgqzBGGsw9zrFo,3990
63
64
  jaclang/plugin/__init__.py,sha256=qLbQ2KjwyTvlV50Q7JTIznyIzuGDPjuwM_ZJjdk-avo,182
64
65
  jaclang/plugin/builtin.py,sha256=D1R4GGNHX96P-wZnGm9OI4dMeCJvuXuHkCw2Cl5vaAU,1201
65
- jaclang/plugin/default.py,sha256=Nl_yxjr7g5jZ1atblCfDs6oWZBFF99dZCzzsdTBXvAk,17573
66
- jaclang/plugin/feature.py,sha256=p7kVaoX7JZvxde5Ms9tSiRWCZ8nOBANPZ_NwwN5uWas,7643
67
- jaclang/plugin/spec.py,sha256=0oL0eJP-gWHyvGI4zpRz5OhK-wMq9kWyYAsV-okgJxk,6949
66
+ jaclang/plugin/default.py,sha256=1PkL9L9acLcjXxklhvtdu3lNimOiHGRc-rFFX2Ce2iY,18806
67
+ jaclang/plugin/feature.py,sha256=-TT25Z3gJThOh_FdgSeeTt1XZFm0yGH2DgO_IIQISDo,7774
68
+ jaclang/plugin/spec.py,sha256=ZGbYFC_s2l7HEjvTMvraDBzfsPcnU9rDI_mmfZSlFZM,7024
68
69
  jaclang/plugin/tests/__init__.py,sha256=rn_tNG8jCHWwBc_rx4yFkGc4N1GISb7aPuTFVRTvrTk,38
69
70
  jaclang/plugin/tests/test_features.py,sha256=uNQ52HHc0GiOGg5xUZk-ddafdtud0IHN4H_EUAs4er4,3547
70
71
  jaclang/utils/__init__.py,sha256=86LQ_LDyWV-JFkYBpeVHpLaVxkqwFDP60XpWXOFZIQk,46
71
- jaclang/utils/helpers.py,sha256=V4mMBGP6cVp5lN9Dq99HQTZLMLyg8EVxuMR1I0ABV5I,4093
72
- jaclang/utils/lang_tools.py,sha256=4GAeTTITQhzR2nUzSt16WXRjctMM0BEpW93JBvGXOaU,10905
72
+ jaclang/utils/helpers.py,sha256=gf9Z74Gfs28JT0qkIWXItYz_EWZijUaf3WnmOJc8fhs,5868
73
+ jaclang/utils/lang_tools.py,sha256=ZkHfokISsBf_V-yDwYZLlzyb1s-mdG44tAi8N-1J2f8,9086
73
74
  jaclang/utils/log.py,sha256=G8Y_DnETgTh9xzvlW5gh9zqJ1ap4YY_MDTwIMu5Uc0Y,262
74
75
  jaclang/utils/test.py,sha256=LQKtY_DnWXUBbGVnpp05oMeGn24bTxawqrz5ZqZK0dQ,5444
75
76
  jaclang/utils/treeprinter.py,sha256=RV7mmnlUdla_dYxIrwxsV2F32ncgEnB9PdA3ZnKLxPE,10934
@@ -400,8 +401,8 @@ jaclang/vendor/pluggy/_manager.py,sha256=fcYU7VER0CplRym4jAJ7RCFYl6cfDSeVM589YHH
400
401
  jaclang/vendor/pluggy/_result.py,sha256=wXDoVy68bOaOrBzQ0bWFb3HTbpqhvdQMgYwaZvfzxfA,3239
401
402
  jaclang/vendor/pluggy/_tracing.py,sha256=kSBr25F_rNklV2QhLD6h1jx6Z1kcKDRbuYvF5jv35pU,2089
402
403
  jaclang/vendor/pluggy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
403
- jaclang-0.5.8.dist-info/METADATA,sha256=UTKjkxxbfs09CnrqWJw5acY-YqYIzV8YnhVgTgthcwQ,152
404
- jaclang-0.5.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
405
- jaclang-0.5.8.dist-info/entry_points.txt,sha256=Z-snS3MDBdV1Z4znXDZTenyyndovaNjqRkDW1t2kYSs,50
406
- jaclang-0.5.8.dist-info/top_level.txt,sha256=ZOAoLpE67ozkUJd-v3C59wBNXiteRD8IWPbsYB3M08g,8
407
- jaclang-0.5.8.dist-info/RECORD,,
404
+ jaclang-0.5.9.dist-info/METADATA,sha256=SK82yF6fwkoRztupFnof7gvPiptsFOo10-Xx3vFXIes,152
405
+ jaclang-0.5.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
406
+ jaclang-0.5.9.dist-info/entry_points.txt,sha256=Z-snS3MDBdV1Z4znXDZTenyyndovaNjqRkDW1t2kYSs,50
407
+ jaclang-0.5.9.dist-info/top_level.txt,sha256=ZOAoLpE67ozkUJd-v3C59wBNXiteRD8IWPbsYB3M08g,8
408
+ jaclang-0.5.9.dist-info/RECORD,,
File without changes