scrall 0.9.1__tar.gz → 0.9.3__tar.gz
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 scrall might be problematic. Click here for more details.
- {scrall-0.9.1/src/scrall.egg-info → scrall-0.9.3}/PKG-INFO +1 -1
- {scrall-0.9.1 → scrall-0.9.3}/pyproject.toml +1 -1
- scrall-0.9.3/src/scrall/__init__.py +1 -0
- {scrall-0.9.1 → scrall-0.9.3}/src/scrall/parse/scrall.peg +2 -2
- {scrall-0.9.1 → scrall-0.9.3}/src/scrall/parse/visitor.py +5 -8
- {scrall-0.9.1 → scrall-0.9.3/src/scrall.egg-info}/PKG-INFO +1 -1
- {scrall-0.9.1 → scrall-0.9.3}/src/scrall.egg-info/SOURCES.txt +2 -0
- {scrall-0.9.1 → scrall-0.9.3}/tests/test_calls.py +1 -1
- scrall-0.9.3/tests/test_decision_scalar_expr.py +65 -0
- {scrall-0.9.1 → scrall-0.9.3}/tests/test_decision_wrap.py +1 -1
- scrall-0.9.3/tests/test_operation.py +30 -0
- scrall-0.9.1/src/scrall/__init__.py +0 -1
- {scrall-0.9.1 → scrall-0.9.3}/LICENSE +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/MANIFEST.in +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/README.md +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/setup.cfg +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/src/scrall/__main__.py +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/src/scrall/exceptions.py +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/src/scrall/log.conf +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/src/scrall/parse/__init__.py +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/src/scrall/parse/parser.py +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/src/scrall.egg-info/dependency_links.txt +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/src/scrall.egg-info/entry_points.txt +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/src/scrall.egg-info/requires.txt +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/src/scrall.egg-info/top_level.txt +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/tests/test_decision_wrap_false.py +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/tests/test_delete.py +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/tests/test_ping_actions.py +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/tests/test_selection.py +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/tests/test_signals.py +0 -0
- {scrall-0.9.1 → scrall-0.9.3}/tests/test_state_actions.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "scrall"
|
|
7
|
-
version = "0.9.
|
|
7
|
+
version = "0.9.3"
|
|
8
8
|
description = "Starr's Concise Relational Action Language - For Shlaer-Mellor Executable UML"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "Leon Starr", email = "leon_starr@modelint.com" }]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version = "0.9.3"
|
|
@@ -44,8 +44,8 @@ RENAME = '>>'
|
|
|
44
44
|
|
|
45
45
|
// Decision action
|
|
46
46
|
decision = scalar_expr true_result false_result?
|
|
47
|
-
true_result = DECISION_OP LINEWRAP? SP? component_statement_set
|
|
48
|
-
false_result =
|
|
47
|
+
true_result = DECISION_OP LINEWRAP? SP? component_statement_set SP*
|
|
48
|
+
false_result = FALSE_RESULT_OP LINEWRAP? SP? component_statement_set // Else
|
|
49
49
|
FALSE_RESULT_OP = ':'
|
|
50
50
|
|
|
51
51
|
// Switch action
|
|
@@ -635,14 +635,6 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
635
635
|
_logger.info(f" > {result}")
|
|
636
636
|
return result
|
|
637
637
|
|
|
638
|
-
# # Asynch service
|
|
639
|
-
# @classmethod
|
|
640
|
-
# def visit_asynch_service(cls, node, children):
|
|
641
|
-
# """
|
|
642
|
-
# name '.' signal_spec ASYNCH ee
|
|
643
|
-
# """
|
|
644
|
-
# result = Asynch_a(*children)
|
|
645
|
-
|
|
646
638
|
@classmethod
|
|
647
639
|
def visit_signal_action(cls, node, children):
|
|
648
640
|
"""
|
|
@@ -847,6 +839,11 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
847
839
|
_logger.info(f" > {result}")
|
|
848
840
|
return result
|
|
849
841
|
|
|
842
|
+
@classmethod
|
|
843
|
+
def visit_owner(cls, node, children):
|
|
844
|
+
result = ''.join(children)
|
|
845
|
+
return result
|
|
846
|
+
|
|
850
847
|
@classmethod
|
|
851
848
|
def visit_supplied_params(cls, node, children):
|
|
852
849
|
"""
|
|
@@ -17,9 +17,11 @@ src/scrall/parse/parser.py
|
|
|
17
17
|
src/scrall/parse/scrall.peg
|
|
18
18
|
src/scrall/parse/visitor.py
|
|
19
19
|
tests/test_calls.py
|
|
20
|
+
tests/test_decision_scalar_expr.py
|
|
20
21
|
tests/test_decision_wrap.py
|
|
21
22
|
tests/test_decision_wrap_false.py
|
|
22
23
|
tests/test_delete.py
|
|
24
|
+
tests/test_operation.py
|
|
23
25
|
tests/test_ping_actions.py
|
|
24
26
|
tests/test_selection.py
|
|
25
27
|
tests/test_signals.py
|
|
@@ -33,7 +33,7 @@ actions = [
|
|
|
33
33
|
]
|
|
34
34
|
|
|
35
35
|
@pytest.mark.parametrize("text, expected", actions)
|
|
36
|
-
def
|
|
36
|
+
def test_call_action(text, expected):
|
|
37
37
|
parse = ScrallParser.parse_text(scrall_text=text, debug=False)[0]
|
|
38
38
|
print(parse)
|
|
39
39
|
assert parse[0] == expected
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
""" test_decision_scalar_expr.py -- Ensure scalar expression works as true result in a decision"""
|
|
2
|
+
|
|
3
|
+
# This verifies that we don't have a regression on a bug fix where scalar_expr true results were eating the colon
|
|
4
|
+
# and failing the parse
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
from scrall.parse.parser import ScrallParser
|
|
8
|
+
from scrall.parse.visitor import *
|
|
9
|
+
|
|
10
|
+
actions = [
|
|
11
|
+
("fwd dest? =>> fwd dest : {\n"
|
|
12
|
+
" rev dest .= Ping( dir: Travel direction.opposite )\n"
|
|
13
|
+
" !rev dest? Travel direction.toggle : =>> rev dest\n"
|
|
14
|
+
"}",
|
|
15
|
+
Execution_Unit_a(
|
|
16
|
+
statement_set=Seq_Statement_Set_a(
|
|
17
|
+
input_tokens=[],
|
|
18
|
+
statement=Decision_a(
|
|
19
|
+
input=N_a(name='fwd dest'),
|
|
20
|
+
true_result=Comp_Statement_Set_a(
|
|
21
|
+
statement=Output_Flow_a(output=N_a(name='fwd dest')), block=None),
|
|
22
|
+
false_result=Comp_Statement_Set_a(
|
|
23
|
+
statement=None, block=[
|
|
24
|
+
Execution_Unit_a(
|
|
25
|
+
statement_set=Seq_Statement_Set_a(
|
|
26
|
+
input_tokens=[],
|
|
27
|
+
statement=Inst_Assignment_a(
|
|
28
|
+
lhs=Flow_Output_a(name=N_a(name='rev dest'), exp_type=None), card='1',
|
|
29
|
+
rhs=INST_a(components=
|
|
30
|
+
[N_a(name='Ping'),
|
|
31
|
+
Criteria_Selection_a(
|
|
32
|
+
card='ALL',
|
|
33
|
+
criteria=BOOL_a(op='==',
|
|
34
|
+
operands=[N_a(name='dir'),
|
|
35
|
+
INST_PROJ_a(
|
|
36
|
+
iset=N_a(name='Travel direction'),
|
|
37
|
+
projection=Projection_a(
|
|
38
|
+
expand=None,
|
|
39
|
+
attrs=[N_a(name='opposite')]))]))]), X=(31, 81)), block=None),
|
|
40
|
+
output_token=None),
|
|
41
|
+
Execution_Unit_a(
|
|
42
|
+
statement_set=Seq_Statement_Set_a(
|
|
43
|
+
input_tokens=[],
|
|
44
|
+
statement=Decision_a(
|
|
45
|
+
input=BOOL_a(op='NOT', operands=N_a(name='rev dest')),
|
|
46
|
+
true_result=Comp_Statement_Set_a(
|
|
47
|
+
statement=Call_a(
|
|
48
|
+
call=N_a(name='Travel direction'),
|
|
49
|
+
op_chain=Op_chain_a(components=[N_a(name='toggle')])), block=None),
|
|
50
|
+
false_result=Comp_Statement_Set_a(
|
|
51
|
+
statement=Output_Flow_a(
|
|
52
|
+
output=N_a(name='rev dest')), block=None)), block=None),
|
|
53
|
+
output_token=None)
|
|
54
|
+
]
|
|
55
|
+
)
|
|
56
|
+
), block=None
|
|
57
|
+
), output_token=None),
|
|
58
|
+
)
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
@pytest.mark.parametrize("text, expected", actions)
|
|
62
|
+
def test_decision_scalar_true_result(text, expected):
|
|
63
|
+
parse = ScrallParser.parse_text(scrall_text=text, debug=False)[0]
|
|
64
|
+
print(parse)
|
|
65
|
+
assert parse[0] == expected
|
|
@@ -33,7 +33,7 @@ expected_parse = Execution_Unit_a(
|
|
|
33
33
|
"choice? {\n *cat\n}",
|
|
34
34
|
"choice?\n { *cat }",
|
|
35
35
|
])
|
|
36
|
-
def
|
|
36
|
+
def test_decision_wrap(text):
|
|
37
37
|
parse = ScrallParser.parse_text(scrall_text=text, debug=False)[0]
|
|
38
38
|
print(parse)
|
|
39
39
|
assert parse[0] == expected_parse
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
""" test_operation.py - Test the invocation of an operation"""
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from scrall.parse.parser import ScrallParser
|
|
5
|
+
from scrall.parse.visitor import *
|
|
6
|
+
|
|
7
|
+
actions = [
|
|
8
|
+
("dest aslev .= cabin in shaft.Ping both ways()",
|
|
9
|
+
Execution_Unit_a(statement_set=Seq_Statement_Set_a(
|
|
10
|
+
input_tokens=[],
|
|
11
|
+
statement=Inst_Assignment_a(
|
|
12
|
+
lhs=Flow_Output_a(name=N_a(name='dest aslev'), exp_type=None), card='1',
|
|
13
|
+
rhs=INST_a(
|
|
14
|
+
components=[
|
|
15
|
+
Op_a(
|
|
16
|
+
owner='cabin in shaft',
|
|
17
|
+
op_name='Ping both ways',
|
|
18
|
+
supplied_params=[])]
|
|
19
|
+
), X=(0, 45)
|
|
20
|
+
),
|
|
21
|
+
block=None), output_token=None)
|
|
22
|
+
),
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@pytest.mark.parametrize("text, expected", actions)
|
|
27
|
+
def test_operation(text, expected):
|
|
28
|
+
parse = ScrallParser.parse_text(scrall_text=text, debug=False)[0]
|
|
29
|
+
print(parse)
|
|
30
|
+
assert parse[0] == expected
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
version = "0.9.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|