Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
linting fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
kugesan1105 committed Jan 28, 2024
1 parent bf222f4 commit ab52996
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 34 deletions.
2 changes: 1 addition & 1 deletion examples/reference/arithmetic_expressions.jac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
with entry{
with entry{
p = print;

p("Multiply:", 7 * 2);
Expand Down
4 changes: 2 additions & 2 deletions examples/reference/arithmetic_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
p("Division:", 15 / 3)
p("Floor:", 15 // 3)
p("Modulo:", 17 % 5)
p("Expon:", 2 ** 3)
p("combo:", (9+ 2) * 9 - 2)
p("Expon:", 2**3)
p("combo:", (9 + 2) * 9 - 2)
2 changes: 1 addition & 1 deletion examples/reference/assignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
a <<= 2
print(a)
c //= 4
print(c)
print(c)
2 changes: 1 addition & 1 deletion examples/reference/bitwise_expressions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
p=print
p = print
p("&:", 5 & 3)
p("|:", 5 | 3)
p("^:", 5 ^ 3)
Expand Down
23 changes: 15 additions & 8 deletions examples/reference/disengage_statements.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
from __future__ import annotations
from jaclang.plugin.feature import JacFeature as jac

@jac.make_architype('walker', on_entry=[jac.DSFunc('func2', jac.RootType)], on_exit=[])
class walker_1:

@jac.make_architype("walker", on_entry=[jac.DSFunc("func2", jac.RootType)], on_exit=[])
class walker_1:
def func2(self, _jac_here_: jac.RootType) -> None:
end = _jac_here_
i = 0
while i < 5:
jac.connect(end, (end := node_1(val=i + 1)), jac.build_edge(jac.EdgeDir.OUT, None, None))
jac.connect(
end,
(end := node_1(val=i + 1)),
jac.build_edge(jac.EdgeDir.OUT, None, None),
)
i += 1
if jac.visit_node(self, jac.edge_ref(_jac_here_, jac.EdgeDir.OUT, None, None)):
pass

@jac.make_architype('node', on_entry=[jac.DSFunc('func_1', walker_1)], on_exit=[])

@jac.make_architype("node", on_entry=[jac.DSFunc("func_1", walker_1)], on_exit=[])
class node_1:
val: int

def func_1(self, _jac_here_: walker_1) -> None:
print('visiting ', self)
print("visiting ", self)
if self.val == 3:
print('Disengaging traversal in node with value 3.')
print("Disengaging traversal in node with value 3.")
jac.disengage(_jac_here_)
return
if jac.visit_node(_jac_here_, jac.edge_ref(self, jac.EdgeDir.OUT, None, None)):
pass
else:
print('finished visitng all nodes ....\n')
jac.spawn_call(jac.get_root(), walker_1())
print("finished visitng all nodes ....\n")


jac.spawn_call(jac.get_root(), walker_1())
4 changes: 2 additions & 2 deletions examples/reference/elvis_expressions.jac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
with entry{

user_language = None;
preferred_language = user_language ?: 'english';

print(preferred_language);
}
5 changes: 3 additions & 2 deletions examples/reference/elvis_expressions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from jaclang.plugin.feature import JacFeature as jac

user_language = None
preferred_language = jac.elvis(user_language, 'english')
print(preferred_language)
preferred_language = jac.elvis(user_language, "english")
print(preferred_language)
15 changes: 10 additions & 5 deletions examples/reference/global_and_nonlocal_statements.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
from __future__ import annotations
x = 'Jaclang '

x = "Jaclang "


def foo() -> None:
global x
x = 'Jaclang is '
y = 'Awesome'
x = "Jaclang is "
y = "Awesome"

def foo2() -> tuple[str, str]:
nonlocal y
y = 'Fantastic'
y = "Fantastic"
return (x, y)

print(x, y)
print(foo2())
foo()


foo()
16 changes: 10 additions & 6 deletions examples/reference/ignore_statements.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from __future__ import annotations
from jaclang.plugin.feature import JacFeature as jac

@jac.make_architype('walker', on_entry=[jac.DSFunc('start_game', jac.RootType)], on_exit=[])
class GuessGame:

@jac.make_architype(
"walker", on_entry=[jac.DSFunc("start_game", jac.RootType)], on_exit=[]
)
class GuessGame:
def start_game(self, _jac_here_: jac.RootType) -> None:
i = 0
while i < 10:
Expand All @@ -16,9 +18,11 @@ def start_game(self, _jac_here_: jac.RootType) -> None:
if jac.visit_node(self, jac.edge_ref(_jac_here_, jac.EdgeDir.OUT, None, None)):
pass

@jac.make_architype('node', on_entry=[jac.DSFunc('check', GuessGame)], on_exit=[])
class turn:

@jac.make_architype("node", on_entry=[jac.DSFunc("check", GuessGame)], on_exit=[])
class turn:
def check(self, _jac_here_: GuessGame) -> None:
print('here', end=', ')
jac.spawn_call(jac.get_root(), GuessGame())
print("here", end=", ")


jac.spawn_call(jac.get_root(), GuessGame())
12 changes: 6 additions & 6 deletions examples/reference/visit_statements.jac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#version1
#version1
walker creator{
can create with `<root> entry;
}
Expand All @@ -20,7 +20,7 @@ node item{
};
}
:walker:creator:can:create{
end = <here>;
end = <here>;
for i=0 to i<5 by i+=1 {
end ++> end := item(val=i+1);
}
Expand All @@ -34,7 +34,7 @@ with entry{
<root> spawn creator();
<r> spawn Travellor();
}

# #version2
# #1
# walker creator{
Expand All @@ -45,7 +45,7 @@ with entry{
# can func_1 with creator entry;
# }
# :walker:creator:can:create{
# end = <here>;
# end = <here>;
# for i=0 to i<5 by i+=1 {
# end ++> end := item(val=i+1);
# }
Expand All @@ -68,13 +68,13 @@ with entry{
# }
# :node:item:can:func_1{
# print("visiting ",<s>);

# visit-->else{
# print("finished visitng all nodes ....\n");
# };
# }
# :walker:creator:can:create{
# end = <here>;
# end = <here>;
# for i=0 to i<5 by i+=1 {
# end ++> end := item(val=i+1);
# }
Expand Down

0 comments on commit ab52996

Please sign in to comment.