scrall 0.8.10__tar.gz → 0.9.0__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.8.10/src/scrall.egg-info → scrall-0.9.0}/PKG-INFO +1 -1
- {scrall-0.8.10 → scrall-0.9.0}/pyproject.toml +1 -1
- scrall-0.9.0/src/scrall/__init__.py +1 -0
- {scrall-0.8.10 → scrall-0.9.0}/src/scrall/parse/scrall.peg +4 -5
- {scrall-0.8.10 → scrall-0.9.0}/src/scrall/parse/visitor.py +15 -15
- {scrall-0.8.10 → scrall-0.9.0/src/scrall.egg-info}/PKG-INFO +1 -1
- {scrall-0.8.10 → scrall-0.9.0}/src/scrall.egg-info/SOURCES.txt +1 -0
- scrall-0.9.0/tests/test_calls.py +39 -0
- {scrall-0.8.10 → scrall-0.9.0}/tests/test_ping_actions.py +24 -15
- scrall-0.9.0/tests/test_signals.py +63 -0
- {scrall-0.8.10 → scrall-0.9.0}/tests/test_state_actions.py +2 -2
- scrall-0.8.10/src/scrall/__init__.py +0 -1
- scrall-0.8.10/tests/test_signals.py +0 -31
- {scrall-0.8.10 → scrall-0.9.0}/LICENSE +0 -0
- {scrall-0.8.10 → scrall-0.9.0}/MANIFEST.in +0 -0
- {scrall-0.8.10 → scrall-0.9.0}/README.md +0 -0
- {scrall-0.8.10 → scrall-0.9.0}/setup.cfg +0 -0
- {scrall-0.8.10 → scrall-0.9.0}/src/scrall/__main__.py +0 -0
- {scrall-0.8.10 → scrall-0.9.0}/src/scrall/exceptions.py +0 -0
- {scrall-0.8.10 → scrall-0.9.0}/src/scrall/log.conf +0 -0
- {scrall-0.8.10 → scrall-0.9.0}/src/scrall/parse/__init__.py +0 -0
- {scrall-0.8.10 → scrall-0.9.0}/src/scrall/parse/parser.py +0 -0
- {scrall-0.8.10 → scrall-0.9.0}/src/scrall.egg-info/dependency_links.txt +0 -0
- {scrall-0.8.10 → scrall-0.9.0}/src/scrall.egg-info/entry_points.txt +0 -0
- {scrall-0.8.10 → scrall-0.9.0}/src/scrall.egg-info/requires.txt +0 -0
- {scrall-0.8.10 → scrall-0.9.0}/src/scrall.egg-info/top_level.txt +0 -0
- {scrall-0.8.10 → scrall-0.9.0}/tests/test_delete.py +0 -0
- {scrall-0.8.10 → scrall-0.9.0}/tests/test_selection.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "scrall"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.9.0"
|
|
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.0"
|
|
@@ -58,24 +58,23 @@ enum_value = '_' name // Scalar switch has enum value cases
|
|
|
58
58
|
DECISION_OP = '?'
|
|
59
59
|
|
|
60
60
|
// Signal action
|
|
61
|
-
signal_action = signal_spec SP+ (signal_dest /
|
|
61
|
+
signal_action = signal_spec SP+ (signal_dest / external_dest / SIGNAL_OP)
|
|
62
62
|
// SIGNAL_OP only destination means: copy dest from false result of decision action
|
|
63
63
|
signal_spec = name supplied_params?
|
|
64
|
-
signal_dest = SIGNAL_OP LINEWRAP? SP? (assigner / instance_set) (SP+ delay)?
|
|
64
|
+
signal_dest = SIGNAL_OP '*'? LINEWRAP? SP? (assigner / instance_set) (SP+ delay)?
|
|
65
65
|
assigner = rnum assigner_partition?
|
|
66
|
-
|
|
66
|
+
external_dest = SIGNAL_OP LINEWRAP? SP? '~'
|
|
67
67
|
delay = DELAY_OP SP* scalar_expr
|
|
68
68
|
assigner_partition = '( ' instance_set ' )'
|
|
69
69
|
DELAY_OP = '@'
|
|
70
70
|
SIGNAL_OP = '->'
|
|
71
|
-
ASYNCH = '=>'
|
|
72
71
|
|
|
73
72
|
// Instance assignment action
|
|
74
73
|
inst_assignment = flow_output SP+ INST_ASSIGN SP+ instance_set
|
|
75
74
|
INST_ASSIGN = '.=' / '..='
|
|
76
75
|
|
|
77
76
|
// Synchronous call action (method or ee operation or type operation)
|
|
78
|
-
call = instance_set op_chain? // Post-parse verify that last element is an operation, otherwise invalid call
|
|
77
|
+
call = ('~' / instance_set) op_chain? // Post-parse verify that last element is an operation, otherwise invalid call
|
|
79
78
|
operation = owner? '.' name supplied_params
|
|
80
79
|
owner = name
|
|
81
80
|
supplied_params = '(' SP* (param (',' SP+ param)*)? SP* ')'
|
|
@@ -19,11 +19,11 @@ Attr_Access_a = namedtuple('Attr_Access_a', 'cname its attr')
|
|
|
19
19
|
Rank_Selection_a = namedtuple('Rank_Selection_a', 'card rankr attr')
|
|
20
20
|
Criteria_Selection_a = namedtuple('Criteria_Selection_a', 'card criteria')
|
|
21
21
|
Inst_Assignment_a = namedtuple('Inst_Assignment_a', 'lhs card rhs X')
|
|
22
|
-
|
|
22
|
+
External_Signal_a = namedtuple('External_Signal_a', 'event supplied_params')
|
|
23
23
|
Signal_a = namedtuple('Signal_a', 'event supplied_params dest')
|
|
24
24
|
"""Signal sent to trigger event at destination with optional supplied parameters"""
|
|
25
25
|
Signal_Action_a = namedtuple('Signal_Action_a', 'event supplied_params dest delay')
|
|
26
|
-
Signal_Dest_a = namedtuple('Signal_Dest_a', 'target_iset assigner_dest delay')
|
|
26
|
+
Signal_Dest_a = namedtuple('Signal_Dest_a', 'target_iset assigner_dest delay cancel')
|
|
27
27
|
Assigner_Dest_a = namedtuple('Assigner_Dest_a', 'rnum partition')
|
|
28
28
|
Signal_Choice_a = namedtuple('Signal_Choice_a', 'decision true_signal false_signal')
|
|
29
29
|
Sequence_Token_a = namedtuple('Sequence_Token_a', 'name')
|
|
@@ -647,13 +647,13 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
647
647
|
def visit_signal_action(cls, node, children):
|
|
648
648
|
"""
|
|
649
649
|
"""
|
|
650
|
-
_logger.info("signal_action = signal_spec SP+ (signal_dest /
|
|
650
|
+
_logger.info("signal_action = signal_spec SP+ (signal_dest / external_dest / SIGNAL_OP)")
|
|
651
651
|
_logger.info(f' :: {node.value}')
|
|
652
652
|
|
|
653
653
|
_logger.info(f" < {children}")
|
|
654
654
|
sdest = children.results.get('signal_dest')
|
|
655
|
-
|
|
656
|
-
if not sdest and not
|
|
655
|
+
external_dest = bool(children.results.get('external_dest'))
|
|
656
|
+
if not sdest and not external_dest:
|
|
657
657
|
# Dest should be supplied by false result in decision
|
|
658
658
|
result = Signal_a(
|
|
659
659
|
event=children[0]['name'],
|
|
@@ -668,11 +668,10 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
668
668
|
dest=children[1]
|
|
669
669
|
)
|
|
670
670
|
else:
|
|
671
|
-
# Otherwise it must be an
|
|
672
|
-
result =
|
|
671
|
+
# Otherwise it must be an external destination
|
|
672
|
+
result = External_Signal_a(
|
|
673
673
|
event=children[0]['name'],
|
|
674
674
|
supplied_params=children[0]['params'],
|
|
675
|
-
ee=children[1]
|
|
676
675
|
)
|
|
677
676
|
|
|
678
677
|
_logger.info(f" > {result}")
|
|
@@ -692,14 +691,14 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
692
691
|
return result
|
|
693
692
|
|
|
694
693
|
@classmethod
|
|
695
|
-
def
|
|
694
|
+
def visit_external_dest(cls, node, children):
|
|
696
695
|
"""
|
|
697
696
|
"""
|
|
698
|
-
_logger.info("
|
|
697
|
+
_logger.info("external_dest = SIGNAL_OP LINEWRAP? SP? '~'")
|
|
699
698
|
_logger.info(f' :: {node.value}')
|
|
700
699
|
|
|
701
700
|
_logger.info(f" < {children}")
|
|
702
|
-
result =
|
|
701
|
+
result = '~'
|
|
703
702
|
_logger.info(f" > {result}")
|
|
704
703
|
return result
|
|
705
704
|
|
|
@@ -709,6 +708,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
709
708
|
"""
|
|
710
709
|
_logger.info("signal_dest = SIGNAL_OP LINEWRAP? SP? (assigner / instance_set) (SP+ delay)?")
|
|
711
710
|
_logger.info(f' :: {node.value}')
|
|
711
|
+
cancel = bool(children[0] == '*')
|
|
712
712
|
|
|
713
713
|
_logger.info(f" < {children}")
|
|
714
714
|
iset = children.results.get('instance_set')
|
|
@@ -717,7 +717,7 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
717
717
|
assigner = assigner[0] if assigner else None
|
|
718
718
|
delay = children.results.get('delay')
|
|
719
719
|
delay = 0 if not delay else delay[0]
|
|
720
|
-
result = Signal_Dest_a(target_iset=iset, assigner_dest=assigner, delay=delay)
|
|
720
|
+
result = Signal_Dest_a(target_iset=iset, assigner_dest=assigner, delay=delay, cancel=cancel)
|
|
721
721
|
_logger.info(f" > {result}")
|
|
722
722
|
return result
|
|
723
723
|
|
|
@@ -808,14 +808,14 @@ class ScrallVisitor(PTNodeVisitor):
|
|
|
808
808
|
"""
|
|
809
809
|
Post-parse verify that last element is an operation, otherwise invalid call
|
|
810
810
|
"""
|
|
811
|
-
_logger.info("call = instance_set op_chain?")
|
|
811
|
+
_logger.info("call = ('~' / instance_set) op_chain?")
|
|
812
812
|
_logger.info(f' :: {node.value}')
|
|
813
813
|
|
|
814
814
|
_logger.info(f" < {children}")
|
|
815
|
-
iset = children.results
|
|
815
|
+
iset = children.results.get('instance_set')
|
|
816
816
|
opc = children.results.get('op_chain')
|
|
817
817
|
result = Call_a(
|
|
818
|
-
call=iset,
|
|
818
|
+
call=iset[0] if iset else None, # None means that we are calling a service mapped to a service domain
|
|
819
819
|
op_chain=None if not opc else opc[0]
|
|
820
820
|
)
|
|
821
821
|
_logger.info(f" > {result}")
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
""" test_pint_actions.py - Example statements from the Elevator ping method """
|
|
2
2
|
|
|
3
3
|
import pytest
|
|
4
4
|
from scrall.parse.parser import ScrallParser
|
|
@@ -44,14 +44,18 @@ actions = [
|
|
|
44
44
|
projection=Projection_a(expand=None, attrs=[N_a(name='Floor')])),
|
|
45
45
|
X=(0, 56)), block=None), output_token=None)),
|
|
46
46
|
("Try redirect( ^new dest ) -> /R53/Cabin",
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
Execution_Unit_a(
|
|
48
|
+
statement_set=Seq_Statement_Set_a(
|
|
49
|
+
input_tokens=[],
|
|
50
|
+
statement=Signal_a(
|
|
51
|
+
event='Try redirect', supplied_params=[
|
|
52
|
+
[Supplied_Parameter_a(pname='new dest', sval=IN_a(name='new dest'))]],
|
|
53
|
+
dest=Signal_Dest_a(
|
|
54
|
+
target_iset=INST_a(
|
|
55
|
+
components=[PATH_a(hops=[R_a(rnum='R53'), N_a(name='Cabin')])]),
|
|
56
|
+
assigner_dest=None, delay=0, cancel=False)), block=None),
|
|
57
|
+
output_token=None)
|
|
58
|
+
),
|
|
55
59
|
("TRAN.Go to floor( Dest floor: ^new dest, Shaft )",
|
|
56
60
|
Execution_Unit_a(statement_set=Seq_Statement_Set_a(input_tokens=[],
|
|
57
61
|
statement=Call_a(call=INST_a(components=[Op_a(owner='TRAN', op_name='Go to floor',
|
|
@@ -60,12 +64,17 @@ actions = [
|
|
|
60
64
|
), op_chain=None),
|
|
61
65
|
block=None), output_token=None)
|
|
62
66
|
),
|
|
63
|
-
("Change requested ->
|
|
64
|
-
Execution_Unit_a(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
("Change requested -> me",
|
|
68
|
+
Execution_Unit_a(
|
|
69
|
+
statement_set=Seq_Statement_Set_a(
|
|
70
|
+
input_tokens=[],
|
|
71
|
+
statement=Signal_a(
|
|
72
|
+
event='Change requested', supplied_params=[],
|
|
73
|
+
dest=Signal_Dest_a(
|
|
74
|
+
target_iset=N_a(name='me'), assigner_dest=None, delay=0, cancel=False
|
|
75
|
+
)
|
|
76
|
+
), block=None),
|
|
77
|
+
output_token=None)
|
|
69
78
|
),
|
|
70
79
|
("shaft aslevs ..= /R2/R28/Shaft Level/R3/Accessible Shaft Level",
|
|
71
80
|
Execution_Unit_a(statement_set=Seq_Statement_Set_a(input_tokens=[],
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# simple tests
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from scrall.parse.parser import ScrallParser
|
|
5
|
+
from scrall.parse.visitor import Execution_Unit_a, Signal_a, Signal_Dest_a, N_a, INST_a, PATH_a, R_a, \
|
|
6
|
+
Seq_Statement_Set_a, Supplied_Parameter_a, External_Signal_a
|
|
7
|
+
|
|
8
|
+
actions = [
|
|
9
|
+
("Time to close ->* me",
|
|
10
|
+
Execution_Unit_a(
|
|
11
|
+
statement_set=Seq_Statement_Set_a(
|
|
12
|
+
input_tokens=[],
|
|
13
|
+
statement=Signal_a(
|
|
14
|
+
event='Time to close',
|
|
15
|
+
supplied_params=[],
|
|
16
|
+
dest=Signal_Dest_a(target_iset=N_a(name='me'), assigner_dest=None, delay=0, cancel=True)),
|
|
17
|
+
block=None),
|
|
18
|
+
output_token=None)
|
|
19
|
+
),
|
|
20
|
+
("Goto floor( Dest floor: my level) -> ~",
|
|
21
|
+
Execution_Unit_a(
|
|
22
|
+
statement_set=Seq_Statement_Set_a(
|
|
23
|
+
input_tokens=[],
|
|
24
|
+
statement=External_Signal_a(
|
|
25
|
+
event='Goto floor',
|
|
26
|
+
supplied_params=[
|
|
27
|
+
[Supplied_Parameter_a(pname='Dest floor', sval=N_a(name='my level'))]
|
|
28
|
+
]), block=None),
|
|
29
|
+
output_token=None)
|
|
30
|
+
),
|
|
31
|
+
("Change requested -> me",
|
|
32
|
+
Execution_Unit_a(
|
|
33
|
+
statement_set=Seq_Statement_Set_a(
|
|
34
|
+
input_tokens=[],
|
|
35
|
+
statement=Signal_a(
|
|
36
|
+
event='Change requested',
|
|
37
|
+
supplied_params=[],
|
|
38
|
+
dest=Signal_Dest_a(target_iset=N_a(name='me'), assigner_dest=None, delay=0, cancel=False)),
|
|
39
|
+
block=None),
|
|
40
|
+
output_token=None)
|
|
41
|
+
),
|
|
42
|
+
("Ready to go -> /R53/Transfer",
|
|
43
|
+
Execution_Unit_a(
|
|
44
|
+
statement_set=Seq_Statement_Set_a(
|
|
45
|
+
input_tokens=[],
|
|
46
|
+
statement=Signal_a(
|
|
47
|
+
event='Ready to go',
|
|
48
|
+
supplied_params=[],
|
|
49
|
+
dest=Signal_Dest_a(target_iset=INST_a(
|
|
50
|
+
components=[PATH_a(hops=[R_a(rnum='R53'), N_a(name='Transfer')])]
|
|
51
|
+
), assigner_dest=None, delay=0, cancel=False)
|
|
52
|
+
),
|
|
53
|
+
block=None),
|
|
54
|
+
output_token=None)
|
|
55
|
+
),
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@pytest.mark.parametrize("text, expected", actions)
|
|
60
|
+
def test_signal_action(text, expected):
|
|
61
|
+
parse = ScrallParser.parse_text(scrall_text=text, debug=False)[0]
|
|
62
|
+
print(parse)
|
|
63
|
+
assert parse[0] == expected
|
|
@@ -23,7 +23,7 @@ actions = [
|
|
|
23
23
|
true_result=Comp_Statement_Set_a(statement=
|
|
24
24
|
Signal_a(event='Take out of service', supplied_params=[],
|
|
25
25
|
dest=Signal_Dest_a(target_iset=N_a(name='ME'),
|
|
26
|
-
assigner_dest=None, delay=0)), block=None),
|
|
26
|
+
assigner_dest=None, delay=0, cancel=False)), block=None),
|
|
27
27
|
false_result=None),
|
|
28
28
|
block=None), output_token=None)
|
|
29
29
|
),
|
|
@@ -36,7 +36,7 @@ actions = [
|
|
|
36
36
|
true_result=Comp_Statement_Set_a(statement=
|
|
37
37
|
Signal_a(event='Take out of service', supplied_params=[],
|
|
38
38
|
dest=Signal_Dest_a(target_iset=N_a(name='ME'),
|
|
39
|
-
assigner_dest=None, delay=0)), block=None),
|
|
39
|
+
assigner_dest=None, delay=0, cancel=False)), block=None),
|
|
40
40
|
false_result=None),
|
|
41
41
|
block=None), output_token=None))]
|
|
42
42
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
version = "0.8.10"
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# simple tests
|
|
2
|
-
|
|
3
|
-
import pytest
|
|
4
|
-
from scrall.parse.parser import ScrallParser
|
|
5
|
-
from scrall.parse.visitor import Execution_Unit_a, Signal_a, Signal_Dest_a, N_a, INST_a, PATH_a, R_a, \
|
|
6
|
-
Seq_Statement_Set_a
|
|
7
|
-
|
|
8
|
-
actions = [
|
|
9
|
-
("Change requested -> ME",
|
|
10
|
-
Execution_Unit_a(statement_set=Seq_Statement_Set_a(input_tokens=[],
|
|
11
|
-
statement=Signal_a(event='Change requested', supplied_params=[],
|
|
12
|
-
dest=Signal_Dest_a(target_iset=N_a(name='ME'),
|
|
13
|
-
assigner_dest=None, delay=0)),
|
|
14
|
-
block=None), output_token=None)
|
|
15
|
-
),
|
|
16
|
-
("Ready to go -> /R53/Transfer",
|
|
17
|
-
Execution_Unit_a(statement_set=Seq_Statement_Set_a(input_tokens=[],
|
|
18
|
-
statement=Signal_a(event='Ready to go', supplied_params=[], dest=Signal_Dest_a(
|
|
19
|
-
target_iset=INST_a(
|
|
20
|
-
components=[PATH_a(hops=[R_a(rnum='R53'), N_a(name='Transfer')])]),
|
|
21
|
-
assigner_dest=None, delay=0)),
|
|
22
|
-
block=None), output_token=None)
|
|
23
|
-
),
|
|
24
|
-
]
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@pytest.mark.parametrize("text, expected", actions)
|
|
28
|
-
def test_signal_action(text, expected):
|
|
29
|
-
parse = ScrallParser.parse_text(scrall_text=text, debug=False)[0]
|
|
30
|
-
print(parse)
|
|
31
|
-
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
|