Skip to content

Commit

Permalink
[REFACTOR]: Migrate all process to pluggy
Browse files Browse the repository at this point in the history
  • Loading branch information
amadolid committed Sep 24, 2024
1 parent f703519 commit 3cf26f3
Show file tree
Hide file tree
Showing 15 changed files with 945 additions and 640 deletions.
15 changes: 8 additions & 7 deletions jac/jaclang/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
"""The Jac Programming Language."""

from jaclang.plugin.default import ( # noqa: E402
from jaclang.plugin.default import (
JacBuiltin,
JacCmdDefaults,
JacFeatureDefaults,
JacFeatureImpl,
)
from jaclang.plugin.feature import JacFeature, pm # noqa: E402
from jaclang.plugin.feature import JacFeature, hookmanager

jac_import = JacFeature.jac_import

pm.register(JacFeatureDefaults)
pm.register(JacBuiltin)
pm.register(JacCmdDefaults)
pm.load_setuptools_entrypoints("jac")

hookmanager.register(JacFeatureImpl)
hookmanager.register(JacBuiltin)
hookmanager.register(JacCmdDefaults)
hookmanager.load_setuptools_entrypoints("jac")

__all__ = ["jac_import"]
5 changes: 4 additions & 1 deletion jac/jaclang/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@


Cmd.create_cmd()
Jac.setup()


@cmd_registry.register
Expand Down Expand Up @@ -283,7 +284,9 @@ def enter(

jctx.set_entry_node(node)

if isinstance(architype, WalkerArchitype) and jctx.validate_access():
if isinstance(architype, WalkerArchitype) and Jac.check_read_access(
jctx.entry_node
):
Jac.spawn_call(jctx.entry_node.architype, architype)

jctx.close()
Expand Down
6 changes: 3 additions & 3 deletions jac/jaclang/plugin/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ def dotgen(
dot_file: Optional[str] = None,
) -> str:
"""Print the dot graph."""
from jaclang.plugin.feature import pm
from jaclang.plugin.feature import JacBuiltin as JacB, JacFeature as Jac

root = pm.hook.get_root()
root = Jac.get_root()
node = node if node is not None else root
depth = depth if depth is not None else -1
traverse = traverse if traverse is not None else False
bfs = bfs if bfs is not None else True
edge_limit = edge_limit if edge_limit is not None else 512
node_limit = node_limit if node_limit is not None else 512

return pm.hook.dotgen(
return JacB.dotgen(
edge_type=edge_type,
node=node,
depth=depth,
Expand Down
Loading

0 comments on commit 3cf26f3

Please sign in to comment.