scrall 0.6.2__tar.gz → 0.8.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.

Files changed (26) hide show
  1. {scrall-0.6.2/src/scrall.egg-info → scrall-0.8.0}/PKG-INFO +1 -1
  2. {scrall-0.6.2 → scrall-0.8.0}/pyproject.toml +1 -1
  3. scrall-0.8.0/src/scrall/__init__.py +1 -0
  4. {scrall-0.6.2 → scrall-0.8.0}/src/scrall/parse/scrall.peg +4 -3
  5. {scrall-0.6.2 → scrall-0.8.0}/src/scrall/parse/visitor.py +28 -28
  6. {scrall-0.6.2 → scrall-0.8.0/src/scrall.egg-info}/PKG-INFO +1 -1
  7. {scrall-0.6.2 → scrall-0.8.0}/tests/test_ping_actions.py +6 -6
  8. {scrall-0.6.2 → scrall-0.8.0}/tests/test_selection.py +9 -9
  9. {scrall-0.6.2 → scrall-0.8.0}/tests/test_state_actions.py +1 -1
  10. scrall-0.6.2/src/scrall/__init__.py +0 -1
  11. {scrall-0.6.2 → scrall-0.8.0}/LICENSE +0 -0
  12. {scrall-0.6.2 → scrall-0.8.0}/MANIFEST.in +0 -0
  13. {scrall-0.6.2 → scrall-0.8.0}/README.md +0 -0
  14. {scrall-0.6.2 → scrall-0.8.0}/setup.cfg +0 -0
  15. {scrall-0.6.2 → scrall-0.8.0}/src/scrall/__main__.py +0 -0
  16. {scrall-0.6.2 → scrall-0.8.0}/src/scrall/exceptions.py +0 -0
  17. {scrall-0.6.2 → scrall-0.8.0}/src/scrall/log.conf +0 -0
  18. {scrall-0.6.2 → scrall-0.8.0}/src/scrall/parse/__init__.py +0 -0
  19. {scrall-0.6.2 → scrall-0.8.0}/src/scrall/parse/parser.py +0 -0
  20. {scrall-0.6.2 → scrall-0.8.0}/src/scrall.egg-info/SOURCES.txt +0 -0
  21. {scrall-0.6.2 → scrall-0.8.0}/src/scrall.egg-info/dependency_links.txt +0 -0
  22. {scrall-0.6.2 → scrall-0.8.0}/src/scrall.egg-info/entry_points.txt +0 -0
  23. {scrall-0.6.2 → scrall-0.8.0}/src/scrall.egg-info/requires.txt +0 -0
  24. {scrall-0.6.2 → scrall-0.8.0}/src/scrall.egg-info/top_level.txt +0 -0
  25. {scrall-0.6.2 → scrall-0.8.0}/tests/test_delete.py +0 -0
  26. {scrall-0.6.2 → scrall-0.8.0}/tests/test_signals.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scrall
3
- Version: 0.6.2
3
+ Version: 0.8.0
4
4
  Summary: Starr's Concise Relational Action Language - For Shlaer-Mellor Executable UML
5
5
  Author-email: Leon Starr <leon_starr@modelint.com>
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "scrall"
7
- version = "0.6.2"
7
+ version = "0.8.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.8.0"
@@ -92,10 +92,11 @@ OUTPUT = '=>>'
92
92
 
93
93
  // Instance set
94
94
  instance_set = new_instance / ((operation / name / path) (reflexive_selection / selection / operation / path)*)
95
- selection = '(' SP* select_phrase SP* ')'
96
- select_phrase = (CARD ',' SP* ORDER? scalar_expr) / CARD / ORDER? scalar_expr
95
+ selection = '(' SP* (rank_selection / criteria_selection) SP* ')'
96
+ rank_selection = CARD ', ' SP* RANKR name
97
+ criteria_selection = (CARD ', ' SP* scalar_expr) / CARD / scalar_expr
97
98
  CARD = '1' / '*'
98
- ORDER = '^+' / '^-'
99
+ RANKR = '^+' / '^-'
99
100
  IN = '^'
100
101
  TRUE = 'TRUE'
101
102
  FALSE = 'FALSE'
@@ -16,7 +16,8 @@ Call_a = namedtuple('Call_a', 'call op_chain')
16
16
  Scalar_Call_a = namedtuple('Scalar_Call_a', 'call')
17
17
  """The subject of a call could be an instance set (method) or an external entity (ee operation)"""
18
18
  Attr_Access_a = namedtuple('Attr_Access_a', 'cname its attr')
19
- Selection_a = namedtuple('Selection_a', 'card order criteria')
19
+ Rank_Selection_a = namedtuple('Rank_Selection_a', 'card rankr attr')
20
+ Criteria_Selection_a = namedtuple('Criteria_Selection_a', 'card criteria')
20
21
  Inst_Assignment_a = namedtuple('Inst_Assignment_a', 'lhs card rhs X')
21
22
  EE_Signal_a = namedtuple('EE_Signal_a', 'event supplied_params ee')
22
23
  Signal_a = namedtuple('Signal_a', 'event supplied_params dest')
@@ -69,9 +70,10 @@ Table_Def_a= namedtuple('Table_Def_a', 'name header')
69
70
  Rename_a = namedtuple('Rename_a', 'from_name to_name')
70
71
  Iteration_a = namedtuple('Iteration_a', 'order statement_set')
71
72
  Migration_a = namedtuple('Migration_a','from_inst to_subclass')
73
+ Rank_a = namedtuple('Rank_a', "card extent")
72
74
 
73
75
 
74
- symbol = {'^+': 'ascending', '^-': 'descending'}
76
+ rank_symbol = {'^+': "greatest", '^-': "least"}
75
77
 
76
78
  table_op = {
77
79
  '^': 'INTERSECT',
@@ -440,7 +442,7 @@ class ScrallVisitor(PTNodeVisitor):
440
442
  if type(table).__name__ == 'INST_a':
441
443
  last_comp = table.components[-1]
442
444
 
443
- if last_comp and type(last_comp).__name__ == 'Selection_a':
445
+ if last_comp and type(last_comp).__name__ == 'Criteria_Selection_a':
444
446
  if s:
445
447
  # We have two selection phrases. The first is terminating the instance set and the second is
446
448
  # picked up as 's' above. We will take the first one and ignore the second,
@@ -801,7 +803,7 @@ class ScrallVisitor(PTNodeVisitor):
801
803
 
802
804
  Name is the name of the operation
803
805
  """
804
- _logger.info("operation = ORDER? owner? '.' name supplied_params")
806
+ _logger.info("operation = owner? '.' name supplied_params")
805
807
  _logger.info(f' :: {node.value}')
806
808
 
807
809
  _logger.info(f" < {children}")
@@ -811,7 +813,6 @@ class ScrallVisitor(PTNodeVisitor):
811
813
  owner='implicit' if not owner else owner[0],
812
814
  op_name=children.results['name'][0].name,
813
815
  supplied_params=[] if not p else p[0]
814
- # order=None if not o else symbol[o[0]]
815
816
  )
816
817
  _logger.info(f" > {result}")
817
818
  return result
@@ -916,11 +917,29 @@ class ScrallVisitor(PTNodeVisitor):
916
917
  return result
917
918
 
918
919
  @classmethod
919
- def visit_select_phrase(cls, node, children):
920
+ def visit_rank_selection(cls, node, children):
920
921
  """
921
- (CARD ',' SP* ORDER? scalar_expr) / CARD / ORDER? scalar_expr
922
+ CARD ', ' SP* RANKR name
922
923
  """
923
- _logger.info(f"{node.rule_name} = (CARD ',' SP* scalar_expr) / CARD / scalar_expr")
924
+ _logger.info(f"{node.rule_name} = CARD ', ' SP* RANKR name")
925
+ _logger.info(f">> {[k for k in children.results.keys()]}")
926
+ _logger.info(f' :: {node.value}')
927
+
928
+ _logger.info(f" < {children}")
929
+ card = children.results.get('CARD')[0]
930
+ attr = children.results.get('name')
931
+ rankr = children.results.get('RANKR')
932
+ rankr_parse = rank_symbol[rankr[0]]
933
+ result = Rank_Selection_a(card=card, rankr=rankr_parse, attr=attr)
934
+ _logger.info(f" > {result}")
935
+ return result
936
+
937
+ @classmethod
938
+ def visit_criteria_selection(cls, node, children):
939
+ """
940
+ (CARD ', ' SP* scalar_expr) / CARD / scalar_expr
941
+ """
942
+ _logger.info(f"{node.rule_name} = (CARD ', ' SP* scalar_expr) / CARD / scalar_expr")
924
943
  _logger.info(f">> {[k for k in children.results.keys()]}")
925
944
  _logger.info(f' :: {node.value}')
926
945
 
@@ -928,10 +947,8 @@ class ScrallVisitor(PTNodeVisitor):
928
947
  explicit_card = children.results.get('CARD')
929
948
  card = '*' if not explicit_card else explicit_card[0]
930
949
  criteria = children.results.get('scalar_expr')
931
- o = children.results.get('ORDER')
932
- o = symbol[o[0]] if o else None
933
950
  if criteria:
934
- result = Selection_a(card=card, criteria=criteria[0], order=o)
951
+ result = Criteria_Selection_a(card=card, criteria=criteria[0])
935
952
  else:
936
953
  result = [card]
937
954
  _logger.info(f" > {result}")
@@ -1415,23 +1432,6 @@ class ScrallVisitor(PTNodeVisitor):
1415
1432
  _logger.info(f" > {result}")
1416
1433
  return result
1417
1434
 
1418
- # @classmethod
1419
- # def visit_prefix_name(cls, node, children):
1420
- # """
1421
- # """
1422
- # _logger.info("prefix_name = ORDER? name")
1423
- # _logger.info(f' :: {node.value}')
1424
- #
1425
- # _logger.info(f" < {children}")
1426
- # n = children.results['name'][0]
1427
- # o = children.results.get('ORDER')
1428
- # if o:
1429
- # result = Order_name_a(order=symbol[o[0]], name=n)
1430
- # else:
1431
- # result = n
1432
- # _logger.info(f" > {result}")
1433
- # return result
1434
-
1435
1435
  @classmethod
1436
1436
  def visit_scalar_op(cls, node, children):
1437
1437
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scrall
3
- Version: 0.6.2
3
+ Version: 0.8.0
4
4
  Summary: Starr's Concise Relational Action Language - For Shlaer-Mellor Executable UML
5
5
  Author-email: Leon Starr <leon_starr@modelint.com>
6
6
  License: MIT License
@@ -3,9 +3,9 @@
3
3
  import pytest
4
4
  from scrall.parse.parser import ScrallParser
5
5
  from scrall.parse.visitor import Execution_Unit_a, Signal_a, Signal_Dest_a, N_a, INST_a, PATH_a, R_a,\
6
- Inst_Assignment_a, Flow_Output_a, Selection_a, BOOL_a, Supplied_Parameter_a, Call_a, Op_a, IN_a, \
6
+ Inst_Assignment_a, Flow_Output_a, Criteria_Selection_a, Rank_Selection_a, BOOL_a, Supplied_Parameter_a, Call_a, Op_a, IN_a, \
7
7
  Table_Assignment_a, TEXPR_a, Projection_a, Seq_Statement_Set_a, Scalar_Assignment_a, Scalar_RHS_a, \
8
- Sequence_Token_a, Case_a, Switch_a, Enum_a, Output_Flow_a, INST_PROJ_a, Comp_Statement_Set_a, Order_name_a
8
+ Sequence_Token_a, Case_a, Switch_a, Enum_a, Output_Flow_a, INST_PROJ_a, Comp_Statement_Set_a
9
9
 
10
10
  actions = [
11
11
  ("{\n a = b\n c = d\n}<1>",
@@ -40,7 +40,7 @@ actions = [
40
40
  statement=Table_Assignment_a(type='implicit', assign_tuple=False,
41
41
  lhs='stop here floors',
42
42
  rhs=TEXPR_a(table=INST_a(components=[N_a(name='shaft aslevs')]), hexpr=None,
43
- selection=Selection_a(card='*', criteria=N_a(name='Stop requested')),
43
+ selection=Criteria_Selection_a(card='*', criteria=N_a(name='Stop requested')),
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",
@@ -56,7 +56,7 @@ actions = [
56
56
  Execution_Unit_a(statement_set=Seq_Statement_Set_a(input_tokens=None,
57
57
  statement=Call_a(call=INST_a(components=[Op_a(owner='TRAN', op_name='Go to floor',
58
58
  supplied_params=[Supplied_Parameter_a(pname='Dest floor', sval=IN_a(name='new dest')),
59
- Supplied_Parameter_a(pname='Shaft', sval=N_a(name='Shaft'))], order=None)]
59
+ Supplied_Parameter_a(pname='Shaft', sval=N_a(name='Shaft'))])]
60
60
  ), op_chain=None),
61
61
  block=None), output_token=None)
62
62
  ),
@@ -80,14 +80,14 @@ actions = [
80
80
  Execution_Unit_a(statement_set=Seq_Statement_Set_a(input_tokens=None,
81
81
  statement=Inst_Assignment_a(
82
82
  lhs=Flow_Output_a(name=N_a(name='requested stops'), exp_type=None), card='M',
83
- rhs=INST_a(components=[N_a(name='shaft aslevs'), Selection_a(card='*',
83
+ rhs=INST_a(components=[N_a(name='shaft aslevs'), Criteria_Selection_a(card='*',
84
84
  criteria=BOOL_a(op='==', operands=[N_a(name='Stop requested'), N_a(name='avalue')]))]),
85
85
  X=(0, 58)), block=None), output_token=None)
86
86
  ),
87
87
  ("=>> Accessible Shaft Level( Floor: nearest dest.Floor; Shaft )",
88
88
  Execution_Unit_a(statement_set=Seq_Statement_Set_a(input_tokens=None, statement=Output_Flow_a(
89
89
  output=INST_PROJ_a(iset=INST_a(components=[N_a(name='Accessible Shaft Level'),
90
- Selection_a(card='*', criteria=BOOL_a(op='AND', operands=[
90
+ Criteria_Selection_a(card='*', criteria=BOOL_a(op='AND', operands=[
91
91
  BOOL_a(op='==', operands=[N_a(name='Floor'),
92
92
  INST_PROJ_a(iset=N_a(name='nearest dest'),
93
93
  projection=Projection_a(expand=None, attrs=[N_a(name='Floor')]))]),
@@ -3,14 +3,14 @@
3
3
  import pytest
4
4
  from scrall.parse.parser import ScrallParser
5
5
  from scrall.parse.visitor import Execution_Unit_a, Signal_a, Signal_Dest_a, N_a, INST_a, PATH_a, R_a,\
6
- Inst_Assignment_a, Flow_Output_a, Selection_a, BOOL_a, Op_a, Enum_a, MATH_a, Seq_Statement_Set_a
6
+ Inst_Assignment_a, Flow_Output_a, Rank_Selection_a, Criteria_Selection_a, BOOL_a, Op_a, Enum_a, MATH_a, Seq_Statement_Set_a
7
7
 
8
8
  actions = [
9
9
  ("s ..= Shaft(Inservice; Cleared)",
10
10
  Execution_Unit_a(statement_set=Seq_Statement_Set_a(input_tokens=None,
11
11
  statement=Inst_Assignment_a(
12
12
  lhs=Flow_Output_a(name=N_a(name='s'), exp_type=None), card='M',
13
- rhs=INST_a(components=[N_a(name='Shaft'), Selection_a(card='*',
13
+ rhs=INST_a(components=[N_a(name='Shaft'), Criteria_Selection_a(card='*',
14
14
  criteria=BOOL_a(op='AND', operands=[N_a(name='Inservice'), N_a(name='Cleared')]))]),
15
15
  X=(0, 31)), block=None), output_token=None)
16
16
  ),
@@ -18,7 +18,7 @@ actions = [
18
18
  Execution_Unit_a(statement_set=Seq_Statement_Set_a(input_tokens=None,
19
19
  statement=Inst_Assignment_a(
20
20
  lhs=Flow_Output_a(name=N_a(name='c'), exp_type=None), card='M',
21
- rhs=INST_a(components=[N_a(name='Cabin'), Selection_a(card='*',
21
+ rhs=INST_a(components=[N_a(name='Cabin'), Criteria_Selection_a(card='*',
22
22
  criteria=BOOL_a(op='>', operands=[N_a(name='Speed'),
23
23
  MATH_a(op='+', operands=[N_a(name='slowest'), N_a(name='buffer')])]))]),
24
24
  X=(0, 37)), block=None), output_token=None)
@@ -27,7 +27,7 @@ actions = [
27
27
  Execution_Unit_a(statement_set=Seq_Statement_Set_a(input_tokens=None,
28
28
  statement=Inst_Assignment_a(
29
29
  lhs=Flow_Output_a(name=N_a(name='c'), exp_type=None), card='M',
30
- rhs=INST_a(components=[N_a(name='Cabin'), Selection_a(card='*',
30
+ rhs=INST_a(components=[N_a(name='Cabin'), Criteria_Selection_a(card='*',
31
31
  criteria=BOOL_a(op='>', operands=[N_a(name='Speed'), N_a(name='slowest')]))]),
32
32
  X=(0, 28)), block=None), output_token=None)
33
33
  ),
@@ -35,14 +35,14 @@ actions = [
35
35
  Execution_Unit_a(statement_set=Seq_Statement_Set_a(input_tokens=None,
36
36
  statement=Inst_Assignment_a(
37
37
  lhs=Flow_Output_a(name=N_a(name='s'), exp_type=None), card='M',
38
- rhs=INST_a(components=[N_a(name='Shaft'), Selection_a(card='*',
38
+ rhs=INST_a(components=[N_a(name='Shaft'), Criteria_Selection_a(card='*',
39
39
  criteria=BOOL_a(op='==', operands=[N_a(name='In service'), 'TRUE']))]),
40
40
  X=(0, 29)), block=None), output_token=None)
41
41
  ),
42
42
  ("s ..= Shaft(In service)",
43
43
  Execution_Unit_a(statement_set=Seq_Statement_Set_a(input_tokens=None,
44
44
  statement=Inst_Assignment_a(lhs=Flow_Output_a(name=N_a(name='s'), exp_type=None), card='M',
45
- rhs=INST_a(components=[N_a(name='Shaft'), Selection_a(card='*',
45
+ rhs=INST_a(components=[N_a(name='Shaft'), Criteria_Selection_a(card='*',
46
46
  criteria=N_a(name='In service'))]),
47
47
  X=(0, 23)), block=None), output_token=None)
48
48
  ),
@@ -50,7 +50,7 @@ actions = [
50
50
  Execution_Unit_a(statement_set=Seq_Statement_Set_a(input_tokens=None,
51
51
  statement=Inst_Assignment_a(
52
52
  lhs=Flow_Output_a(name=N_a(name='x'), exp_type=None), card='1',
53
- rhs=INST_a(components=[N_a(name='Bank'), Selection_a(card='*',
53
+ rhs=INST_a(components=[N_a(name='Bank'), Criteria_Selection_a(card='*',
54
54
  criteria=BOOL_a(op='OR', operands=[
55
55
  BOOL_a(op='==', operands=[
56
56
  N_a(name='Max close attempts'),
@@ -62,8 +62,8 @@ actions = [
62
62
  Execution_Unit_a(statement_set=Seq_Statement_Set_a(input_tokens=None,
63
63
  statement=Inst_Assignment_a(
64
64
  lhs=Flow_Output_a(name=N_a(name='x'), exp_type=None), card='M',
65
- rhs=INST_a(components=[Op_a(owner='car', op_name='findsome', supplied_params=[], order=None),
66
- Selection_a(card='*', criteria=BOOL_a(op='==',
65
+ rhs=INST_a(components=[Op_a(owner='car', op_name='findsome', supplied_params=[]),
66
+ Criteria_Selection_a(card='*', criteria=BOOL_a(op='==',
67
67
  operands=[N_a(name='color'), Enum_a(value=N_a(name='red'))]))]),
68
68
  X=(0, 33)), block=None), output_token=None)
69
69
  ),
@@ -3,7 +3,7 @@
3
3
  import pytest
4
4
  from scrall.parse.parser import ScrallParser
5
5
  from scrall.parse.visitor import Execution_Unit_a, Signal_a, Signal_Dest_a, N_a, INST_a, PATH_a, R_a,\
6
- Inst_Assignment_a, Flow_Output_a, Selection_a, BOOL_a, Supplied_Parameter_a, Call_a, Op_a, IN_a, \
6
+ Inst_Assignment_a, Flow_Output_a, Criteria_Selection_a, BOOL_a, Supplied_Parameter_a, Call_a, Op_a, IN_a, \
7
7
  Table_Assignment_a, TEXPR_a, Projection_a, Seq_Statement_Set_a, Scalar_Assignment_a, Scalar_RHS_a, \
8
8
  Sequence_Token_a, Case_a, Switch_a, Enum_a, Output_Flow_a, INST_PROJ_a, Comp_Statement_Set_a, \
9
9
  Decision_a
@@ -1 +0,0 @@
1
- version = "0.6.2"
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