jaclang 0.7.22__py3-none-any.whl → 0.7.24__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 (33) hide show
  1. jaclang/__init__.py +5 -10
  2. jaclang/cli/cli.py +4 -1
  3. jaclang/compiler/absyntree.py +6 -4
  4. jaclang/compiler/parser.py +4 -2
  5. jaclang/compiler/passes/main/tests/fixtures/fstrings.jac +2 -0
  6. jaclang/compiler/passes/main/type_check_pass.py +8 -6
  7. jaclang/plugin/builtin.py +3 -3
  8. jaclang/plugin/default.py +588 -206
  9. jaclang/plugin/feature.py +274 -99
  10. jaclang/plugin/plugin.md +471 -0
  11. jaclang/plugin/spec.py +231 -86
  12. jaclang/plugin/tests/fixtures/other_root_access.jac +9 -9
  13. jaclang/plugin/tests/test_features.py +2 -2
  14. jaclang/runtimelib/architype.py +1 -370
  15. jaclang/runtimelib/constructs.py +2 -0
  16. jaclang/runtimelib/context.py +2 -4
  17. jaclang/runtimelib/machine.py +57 -0
  18. jaclang/runtimelib/memory.py +2 -4
  19. jaclang/settings.py +3 -0
  20. jaclang/tests/fixtures/arch_create_util.jac +7 -0
  21. jaclang/tests/fixtures/arch_rel_import_creation.jac +30 -0
  22. jaclang/tests/fixtures/builtin_dotgen.jac +6 -6
  23. jaclang/tests/fixtures/create_dynamic_architype.jac +35 -0
  24. jaclang/tests/fixtures/edge_node_walk.jac +1 -1
  25. jaclang/tests/fixtures/edges_walk.jac +1 -1
  26. jaclang/tests/fixtures/enum_inside_archtype.jac +16 -11
  27. jaclang/tests/fixtures/gendot_bubble_sort.jac +1 -1
  28. jaclang/tests/fixtures/visit_order.jac +20 -0
  29. jaclang/tests/test_language.py +55 -1
  30. {jaclang-0.7.22.dist-info → jaclang-0.7.24.dist-info}/METADATA +2 -1
  31. {jaclang-0.7.22.dist-info → jaclang-0.7.24.dist-info}/RECORD +33 -28
  32. {jaclang-0.7.22.dist-info → jaclang-0.7.24.dist-info}/WHEEL +1 -1
  33. {jaclang-0.7.22.dist-info → jaclang-0.7.24.dist-info}/entry_points.txt +0 -0
jaclang/__init__.py CHANGED
@@ -1,17 +1,12 @@
1
1
  """The Jac Programming Language."""
2
2
 
3
- from jaclang.plugin.default import ( # noqa: E402
4
- JacBuiltin,
5
- JacCmdDefaults,
6
- JacFeatureDefaults,
7
- )
8
- from jaclang.plugin.feature import JacFeature, pm # noqa: E402
3
+ from jaclang.plugin.default import JacFeatureImpl
4
+ from jaclang.plugin.feature import JacFeature, plugin_manager
9
5
 
10
6
  jac_import = JacFeature.jac_import
11
7
 
12
- pm.register(JacFeatureDefaults)
13
- pm.register(JacBuiltin)
14
- pm.register(JacCmdDefaults)
15
- pm.load_setuptools_entrypoints("jac")
8
+
9
+ plugin_manager.register(JacFeatureImpl)
10
+ plugin_manager.load_setuptools_entrypoints("jac")
16
11
 
17
12
  __all__ = ["jac_import"]
jaclang/cli/cli.py CHANGED
@@ -28,6 +28,7 @@ from jaclang.utils.lang_tools import AstTool
28
28
 
29
29
 
30
30
  Cmd.create_cmd()
31
+ Jac.setup()
31
32
 
32
33
 
33
34
  @cmd_registry.register
@@ -283,7 +284,9 @@ def enter(
283
284
 
284
285
  jctx.set_entry_node(node)
285
286
 
286
- if isinstance(architype, WalkerArchitype) and jctx.validate_access():
287
+ if isinstance(architype, WalkerArchitype) and Jac.check_read_access(
288
+ jctx.entry_node
289
+ ):
287
290
  Jac.spawn_call(jctx.entry_node.architype, architype)
288
291
 
289
292
  jctx.close()
@@ -1261,6 +1261,9 @@ class Enum(ArchSpec, AstAccessNode, AstImplNeedingNode, ArchBlockStmt):
1261
1261
  res = res and self.semstr.normalize(deep) if self.semstr else res
1262
1262
  res = res and self.decorators.normalize(deep) if self.decorators else res
1263
1263
  new_kid: list[AstNode] = []
1264
+ if self.decorators:
1265
+ new_kid.append(self.gen_token(Tok.DECOR_OP))
1266
+ new_kid.append(self.decorators)
1264
1267
  if self.doc:
1265
1268
  new_kid.append(self.doc)
1266
1269
  new_kid.append(self.gen_token(Tok.KW_ENUM))
@@ -4278,10 +4281,9 @@ class String(Literal):
4278
4281
  elif self.value.startswith(("'", '"')):
4279
4282
  repr_str = self.value.encode().decode("unicode_escape")
4280
4283
  if (
4281
- self.value.startswith('"""')
4282
- and self.value.endswith('"""')
4283
- and not self.find_parent_of_type(FString)
4284
- ):
4284
+ (self.value.startswith('"""') and self.value.endswith('"""'))
4285
+ or (self.value.startswith("'''") and self.value.endswith("'''"))
4286
+ ) and not self.find_parent_of_type(FString):
4285
4287
  return repr_str[3:-3]
4286
4288
  if (not self.find_parent_of_type(FString)) or (
4287
4289
  not (
@@ -706,10 +706,12 @@ class JacParser(Pass):
706
706
  | NAME (COLON STRING)?
707
707
  | py_code_block
708
708
  | free_code
709
+ | abstract_ability
710
+ | ability
709
711
  """
710
- if isinstance(kid[0], ast.PyInlineCode):
712
+ if isinstance(kid[0], (ast.PyInlineCode, ast.Ability)):
711
713
  return self.nu(kid[0])
712
- if isinstance(kid[0], (ast.Name)):
714
+ elif isinstance(kid[0], (ast.Name)):
713
715
  if (
714
716
  len(kid) >= 3
715
717
  and isinstance(kid[-1], ast.Expr)
@@ -42,6 +42,8 @@ with entry {
42
42
  len(f_s1), len(f_s2)
43
43
  ) ;
44
44
  """sdfsdf\nsdfsdfsdfsd dffgdfgd.""" ;
45
+ c1 = '''hello klkl"""''';
46
+ print(c1) ;
45
47
  }
46
48
  can func() {;
47
49
  }
@@ -50,12 +50,6 @@ class JacTypeCheckPass(Pass):
50
50
  options = myab.myb.Options()
51
51
  options.ignore_missing_imports = True
52
52
  options.cache_dir = Con.JAC_MYPY_CACHE
53
- options.mypy_path = [
54
- # str( # TODO: Remove me, this was the wrong way to point to stubs
55
- # pathlib.Path(os.path.dirname(__file__)).parent.parent.parent.parent
56
- # / "stubs"
57
- # )
58
- ]
59
53
  if top_module_path != "":
60
54
  options.mypy_path.append(top_module_path)
61
55
 
@@ -116,6 +110,14 @@ class JacTypeCheckPass(Pass):
116
110
  old_graph=mypy_graph,
117
111
  new_modules=new_modules, # To parse the dependancies of modules
118
112
  )
113
+ mypy_graph = {
114
+ k: v
115
+ for k, v in mypy_graph.items()
116
+ if (
117
+ k.startswith("jaclang.plugin")
118
+ or not (k.startswith("jaclang.") or k.startswith("mypy."))
119
+ )
120
+ }
119
121
  for i in mypy_graph:
120
122
  self.ir.py_mod_dep_map[i] = mypy_graph[i].xpath
121
123
  for j in mypy_graph[i].dependencies:
jaclang/plugin/builtin.py CHANGED
@@ -19,9 +19,9 @@ def dotgen(
19
19
  dot_file: Optional[str] = None,
20
20
  ) -> str:
21
21
  """Print the dot graph."""
22
- from jaclang.plugin.feature import pm
22
+ from jaclang.plugin.feature import JacFeature as Jac
23
23
 
24
- root = pm.hook.get_root()
24
+ root = Jac.get_root()
25
25
  node = node if node is not None else root
26
26
  depth = depth if depth is not None else -1
27
27
  traverse = traverse if traverse is not None else False
@@ -29,7 +29,7 @@ def dotgen(
29
29
  edge_limit = edge_limit if edge_limit is not None else 512
30
30
  node_limit = node_limit if node_limit is not None else 512
31
31
 
32
- return pm.hook.dotgen(
32
+ return Jac.dotgen(
33
33
  edge_type=edge_type,
34
34
  node=node,
35
35
  depth=depth,