scrall 0.9.2__tar.gz → 0.9.4__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.2/src/scrall.egg-info → scrall-0.9.4}/PKG-INFO +1 -1
- {scrall-0.9.2 → scrall-0.9.4}/pyproject.toml +1 -1
- scrall-0.9.4/src/scrall/__init__.py +1 -0
- {scrall-0.9.2 → scrall-0.9.4}/src/scrall/parse/scrall.peg +2 -2
- {scrall-0.9.2 → scrall-0.9.4}/src/scrall/parse/visitor.py +17 -17
- {scrall-0.9.2 → scrall-0.9.4/src/scrall.egg-info}/PKG-INFO +1 -1
- {scrall-0.9.2 → scrall-0.9.4}/src/scrall.egg-info/SOURCES.txt +1 -0
- scrall-0.9.4/tests/test_calls.py +64 -0
- scrall-0.9.4/tests/test_decision_scalar_expr.py +65 -0
- {scrall-0.9.2 → scrall-0.9.4}/tests/test_decision_wrap.py +1 -1
- {scrall-0.9.2 → scrall-0.9.4}/tests/test_operation.py +1 -1
- scrall-0.9.2/src/scrall/__init__.py +0 -1
- scrall-0.9.2/tests/test_calls.py +0 -39
- {scrall-0.9.2 → scrall-0.9.4}/LICENSE +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/MANIFEST.in +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/README.md +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/setup.cfg +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/src/scrall/__main__.py +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/src/scrall/exceptions.py +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/src/scrall/log.conf +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/src/scrall/parse/__init__.py +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/src/scrall/parse/parser.py +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/src/scrall.egg-info/dependency_links.txt +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/src/scrall.egg-info/entry_points.txt +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/src/scrall.egg-info/requires.txt +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/src/scrall.egg-info/top_level.txt +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/tests/test_decision_wrap_false.py +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/tests/test_delete.py +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/tests/test_ping_actions.py +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/tests/test_selection.py +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/tests/test_signals.py +0 -0
- {scrall-0.9.2 → scrall-0.9.4}/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.4"
|
|
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.4"
|
|
@@ -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
|
|
@@ -157,7 +157,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
157
157
|
_logger.info(f' :: {node.value}')
|
|
158
158
|
|
|
159
159
|
_logger.info(f"< {children}")
|
|
160
|
-
result = [
|
|
160
|
+
result = children[:]
|
|
161
161
|
_logger.info(f" -> {result}")
|
|
162
162
|
return result
|
|
163
163
|
|
|
@@ -239,7 +239,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
239
239
|
|
|
240
240
|
_logger.info(f" < {children}")
|
|
241
241
|
_logger.info(f" > pass")
|
|
242
|
-
return children
|
|
242
|
+
return children[:] # Removes the result component
|
|
243
243
|
|
|
244
244
|
@classmethod
|
|
245
245
|
def visit_statement(cls, node, children):
|
|
@@ -333,7 +333,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
333
333
|
|
|
334
334
|
_logger.info(f" < {children}")
|
|
335
335
|
_logger.info(" > pass")
|
|
336
|
-
return children
|
|
336
|
+
return children[:]
|
|
337
337
|
|
|
338
338
|
@classmethod
|
|
339
339
|
def visit_attr_type_def(cls, node, children):
|
|
@@ -354,7 +354,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
354
354
|
|
|
355
355
|
_logger.info(f" < {children}")
|
|
356
356
|
_logger.info(f" > pass")
|
|
357
|
-
return children
|
|
357
|
+
return children[:]
|
|
358
358
|
|
|
359
359
|
@classmethod
|
|
360
360
|
def visit_row(cls, node, children):
|
|
@@ -376,7 +376,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
376
376
|
|
|
377
377
|
_logger.info(f" < {children}")
|
|
378
378
|
_logger.info(f" > pass")
|
|
379
|
-
return children
|
|
379
|
+
return children[:]
|
|
380
380
|
|
|
381
381
|
# Implicit table assignment
|
|
382
382
|
@classmethod
|
|
@@ -483,7 +483,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
483
483
|
|
|
484
484
|
_logger.info(f" < {children}")
|
|
485
485
|
_logger.info(f" > pass")
|
|
486
|
-
return children
|
|
486
|
+
return children[:]
|
|
487
487
|
|
|
488
488
|
@classmethod
|
|
489
489
|
def visit_column_op(cls, node, children):
|
|
@@ -592,7 +592,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
592
592
|
_logger.info(f' :: {node.value}')
|
|
593
593
|
|
|
594
594
|
_logger.info(f" < {children}")
|
|
595
|
-
result = children
|
|
595
|
+
result = children[:]
|
|
596
596
|
_logger.info(f" > {result}")
|
|
597
597
|
return result
|
|
598
598
|
|
|
@@ -781,7 +781,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
781
781
|
_logger.info(f' :: {node.value}')
|
|
782
782
|
|
|
783
783
|
_logger.info(f" < {children}")
|
|
784
|
-
result = children
|
|
784
|
+
result = children[:]
|
|
785
785
|
_logger.info(f" > {result}")
|
|
786
786
|
return result
|
|
787
787
|
|
|
@@ -853,7 +853,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
853
853
|
_logger.info(f' :: {node.value}')
|
|
854
854
|
|
|
855
855
|
_logger.info(f" < {children}")
|
|
856
|
-
result = children
|
|
856
|
+
result = children[:]
|
|
857
857
|
_logger.info(f" > {result}")
|
|
858
858
|
return result
|
|
859
859
|
|
|
@@ -903,7 +903,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
903
903
|
_logger.info(f' :: {node.value}')
|
|
904
904
|
|
|
905
905
|
_logger.info(f" < {children}")
|
|
906
|
-
result = Iteration_a(*children)
|
|
906
|
+
result = Iteration_a(*children) # TODO: Check this for inclusion of results member
|
|
907
907
|
_logger.info(f" > {result}")
|
|
908
908
|
return result
|
|
909
909
|
|
|
@@ -944,7 +944,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
944
944
|
# Just like above case, but returning an IN_a (parameter name)
|
|
945
945
|
result = p[0]
|
|
946
946
|
else:
|
|
947
|
-
result = INST_a(children)
|
|
947
|
+
result = INST_a(children[:])
|
|
948
948
|
_logger.info(f" > {result}")
|
|
949
949
|
return result
|
|
950
950
|
|
|
@@ -1012,7 +1012,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
1012
1012
|
_logger.info(f' :: {node.value}')
|
|
1013
1013
|
|
|
1014
1014
|
_logger.info(f" < {children}")
|
|
1015
|
-
result = New_lineage_a(children)
|
|
1015
|
+
result = New_lineage_a(children[:])
|
|
1016
1016
|
_logger.info(f" > {result}")
|
|
1017
1017
|
return result
|
|
1018
1018
|
|
|
@@ -1109,7 +1109,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
1109
1109
|
_logger.info(f' :: {node.value}')
|
|
1110
1110
|
|
|
1111
1111
|
_logger.info(f" < {children}")
|
|
1112
|
-
result = Scalar_Call_a(children)
|
|
1112
|
+
result = Scalar_Call_a(children[:])
|
|
1113
1113
|
_logger.info(f" > {result}")
|
|
1114
1114
|
return result
|
|
1115
1115
|
|
|
@@ -1146,7 +1146,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
1146
1146
|
_logger.info(f' :: {node.value}')
|
|
1147
1147
|
|
|
1148
1148
|
_logger.info(f" < {children}")
|
|
1149
|
-
result = children
|
|
1149
|
+
result = children[:]
|
|
1150
1150
|
_logger.info(f" > {result}")
|
|
1151
1151
|
return result
|
|
1152
1152
|
|
|
@@ -1428,7 +1428,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
1428
1428
|
return result
|
|
1429
1429
|
# TODO: include opchain if supplied
|
|
1430
1430
|
|
|
1431
|
-
result = children
|
|
1431
|
+
result = children[:]
|
|
1432
1432
|
_logger.info(f" > {result}")
|
|
1433
1433
|
return result
|
|
1434
1434
|
|
|
@@ -1459,7 +1459,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
1459
1459
|
_logger.info(f' :: {node.value}')
|
|
1460
1460
|
|
|
1461
1461
|
_logger.info(f" < {children}")
|
|
1462
|
-
result = Op_chain_a(children)
|
|
1462
|
+
result = Op_chain_a(children[:])
|
|
1463
1463
|
_logger.info(f" > {result}")
|
|
1464
1464
|
return result
|
|
1465
1465
|
|
|
@@ -1568,7 +1568,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
1568
1568
|
_logger.info(f' :: {node.value}')
|
|
1569
1569
|
|
|
1570
1570
|
_logger.info(f" < {children}")
|
|
1571
|
-
result = PATH_a(children)
|
|
1571
|
+
result = PATH_a(children[:])
|
|
1572
1572
|
_logger.info(f" > {result}")
|
|
1573
1573
|
return result
|
|
1574
1574
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
""" test_calls.py - Test method calls and calls to an external service """
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from scrall.parse.parser import ScrallParser
|
|
5
|
+
from scrall.parse.visitor import *
|
|
6
|
+
|
|
7
|
+
actions = [
|
|
8
|
+
("~.Goto floor( Dest floor: ^new dest )",
|
|
9
|
+
Execution_Unit_a(
|
|
10
|
+
statement_set=Seq_Statement_Set_a(
|
|
11
|
+
input_tokens=[],
|
|
12
|
+
statement=Call_a(
|
|
13
|
+
call=None,
|
|
14
|
+
op_chain=Op_chain_a(
|
|
15
|
+
components=[
|
|
16
|
+
Scalar_op_a(
|
|
17
|
+
name=N_a(name='Goto floor'),
|
|
18
|
+
supplied_params=[
|
|
19
|
+
Supplied_Parameter_a(
|
|
20
|
+
pname='Dest floor',
|
|
21
|
+
sval=IN_a(name='new dest')
|
|
22
|
+
)
|
|
23
|
+
]
|
|
24
|
+
)
|
|
25
|
+
]
|
|
26
|
+
)
|
|
27
|
+
), block=None),
|
|
28
|
+
output_token=None)
|
|
29
|
+
),
|
|
30
|
+
(".Ping( dir: Travel direction.opposite )",
|
|
31
|
+
Execution_Unit_a(
|
|
32
|
+
statement_set=Seq_Statement_Set_a(
|
|
33
|
+
input_tokens=[],
|
|
34
|
+
statement=Call_a(
|
|
35
|
+
call=INST_a(
|
|
36
|
+
components=[
|
|
37
|
+
Op_a(
|
|
38
|
+
owner='implicit',
|
|
39
|
+
op_name='Ping',
|
|
40
|
+
supplied_params=[
|
|
41
|
+
Supplied_Parameter_a(
|
|
42
|
+
pname='dir',
|
|
43
|
+
sval=INST_PROJ_a(
|
|
44
|
+
iset=N_a(name='Travel direction'),
|
|
45
|
+
projection=Projection_a(
|
|
46
|
+
expand=None, attrs=[N_a(name='opposite')]
|
|
47
|
+
)
|
|
48
|
+
)
|
|
49
|
+
)
|
|
50
|
+
]
|
|
51
|
+
)
|
|
52
|
+
]
|
|
53
|
+
),
|
|
54
|
+
op_chain=None),
|
|
55
|
+
block=None),
|
|
56
|
+
output_token=None)
|
|
57
|
+
),
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
@pytest.mark.parametrize("text, expected", actions)
|
|
61
|
+
def test_call_action(text, expected):
|
|
62
|
+
parse = ScrallParser.parse_text(scrall_text=text, debug=False)[0]
|
|
63
|
+
print(parse)
|
|
64
|
+
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
|
|
@@ -24,7 +24,7 @@ actions = [
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
@pytest.mark.parametrize("text, expected", actions)
|
|
27
|
-
def
|
|
27
|
+
def test_operation(text, expected):
|
|
28
28
|
parse = ScrallParser.parse_text(scrall_text=text, debug=False)[0]
|
|
29
29
|
print(parse)
|
|
30
30
|
assert parse[0] == expected
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
version = "0.9.2"
|
scrall-0.9.2/tests/test_calls.py
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
""" test_calls.py - Test method calls and calls to an external service """
|
|
2
|
-
|
|
3
|
-
import pytest
|
|
4
|
-
from scrall.parse.parser import ScrallParser
|
|
5
|
-
from scrall.parse.visitor import (
|
|
6
|
-
Execution_Unit_a, Seq_Statement_Set_a, Call_a, Op_chain_a, Scalar_op_a,
|
|
7
|
-
Supplied_Parameter_a, N_a, IN_a,
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
actions = [
|
|
11
|
-
("~.Goto floor( Dest floor: ^new dest )",
|
|
12
|
-
Execution_Unit_a(
|
|
13
|
-
statement_set=Seq_Statement_Set_a(
|
|
14
|
-
input_tokens=[],
|
|
15
|
-
statement=Call_a(
|
|
16
|
-
call=None,
|
|
17
|
-
op_chain=Op_chain_a(
|
|
18
|
-
components=[
|
|
19
|
-
Scalar_op_a(
|
|
20
|
-
name=N_a(name='Goto floor'),
|
|
21
|
-
supplied_params=[
|
|
22
|
-
Supplied_Parameter_a(
|
|
23
|
-
pname='Dest floor',
|
|
24
|
-
sval=IN_a(name='new dest')
|
|
25
|
-
)
|
|
26
|
-
]
|
|
27
|
-
)
|
|
28
|
-
]
|
|
29
|
-
)
|
|
30
|
-
), block=None),
|
|
31
|
-
output_token=None)
|
|
32
|
-
),
|
|
33
|
-
]
|
|
34
|
-
|
|
35
|
-
@pytest.mark.parametrize("text, expected", actions)
|
|
36
|
-
def test_signal_action(text, expected):
|
|
37
|
-
parse = ScrallParser.parse_text(scrall_text=text, debug=False)[0]
|
|
38
|
-
print(parse)
|
|
39
|
-
assert parse[0] == expected
|
|
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
|