scrall 0.6.0__tar.gz → 0.6.2__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.0/src/scrall.egg-info → scrall-0.6.2}/PKG-INFO +3 -2
  2. {scrall-0.6.0 → scrall-0.6.2}/pyproject.toml +1 -1
  3. scrall-0.6.2/src/scrall/__init__.py +1 -0
  4. {scrall-0.6.0 → scrall-0.6.2}/src/scrall/__main__.py +4 -1
  5. {scrall-0.6.0 → scrall-0.6.2}/src/scrall/parse/scrall.peg +4 -5
  6. {scrall-0.6.0 → scrall-0.6.2}/src/scrall/parse/visitor.py +30 -37
  7. {scrall-0.6.0 → scrall-0.6.2/src/scrall.egg-info}/PKG-INFO +3 -2
  8. {scrall-0.6.0 → scrall-0.6.2}/src/scrall.egg-info/SOURCES.txt +1 -0
  9. scrall-0.6.2/tests/test_delete.py +22 -0
  10. scrall-0.6.0/src/scrall/__init__.py +0 -1
  11. {scrall-0.6.0 → scrall-0.6.2}/LICENSE +0 -0
  12. {scrall-0.6.0 → scrall-0.6.2}/MANIFEST.in +0 -0
  13. {scrall-0.6.0 → scrall-0.6.2}/README.md +0 -0
  14. {scrall-0.6.0 → scrall-0.6.2}/setup.cfg +0 -0
  15. {scrall-0.6.0 → scrall-0.6.2}/src/scrall/exceptions.py +0 -0
  16. {scrall-0.6.0 → scrall-0.6.2}/src/scrall/log.conf +0 -0
  17. {scrall-0.6.0 → scrall-0.6.2}/src/scrall/parse/__init__.py +0 -0
  18. {scrall-0.6.0 → scrall-0.6.2}/src/scrall/parse/parser.py +0 -0
  19. {scrall-0.6.0 → scrall-0.6.2}/src/scrall.egg-info/dependency_links.txt +0 -0
  20. {scrall-0.6.0 → scrall-0.6.2}/src/scrall.egg-info/entry_points.txt +0 -0
  21. {scrall-0.6.0 → scrall-0.6.2}/src/scrall.egg-info/requires.txt +0 -0
  22. {scrall-0.6.0 → scrall-0.6.2}/src/scrall.egg-info/top_level.txt +0 -0
  23. {scrall-0.6.0 → scrall-0.6.2}/tests/test_ping_actions.py +0 -0
  24. {scrall-0.6.0 → scrall-0.6.2}/tests/test_selection.py +0 -0
  25. {scrall-0.6.0 → scrall-0.6.2}/tests/test_signals.py +0 -0
  26. {scrall-0.6.0 → scrall-0.6.2}/tests/test_state_actions.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: scrall
3
- Version: 0.6.0
3
+ Version: 0.6.2
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
@@ -42,6 +42,7 @@ Requires-Dist: twine; extra == "build"
42
42
  Provides-Extra: dev
43
43
  Requires-Dist: bump2version; extra == "dev"
44
44
  Requires-Dist: pytest; extra == "dev"
45
+ Dynamic: license-file
45
46
 
46
47
  # Scrall Action Language
47
48
  Scrall = Starr's Concise Relational Action Language
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "scrall"
7
- version = "0.6.0"
7
+ version = "0.6.2"
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.6.2"
@@ -4,11 +4,14 @@ __main__.py
4
4
  Scrall Parser
5
5
  """
6
6
 
7
+ # System
7
8
  import logging
8
9
  import logging.config
9
10
  import sys
10
11
  import argparse
11
12
  from pathlib import Path
13
+
14
+ # Scrall
12
15
  from scrall import version
13
16
  from scrall.parse.parser import ScrallParser
14
17
 
@@ -66,7 +69,7 @@ def main():
66
69
  d = args.debug
67
70
  result = ScrallParser.parse_file(file_input=fpath, debug=d)
68
71
 
69
- logger.info("No problemo") # We didn't die on an exception, basically
72
+ # logger.info("No problemo") # We didn't die on an exception, basically
70
73
  print("\nNo problemo")
71
74
 
72
75
 
@@ -75,7 +75,7 @@ INST_ASSIGN = '.=' / '..='
75
75
 
76
76
  // Synchronous call action (method or ee operation)
77
77
  call = instance_set op_chain? // Post-parse verify that last element is an operation, otherwise invalid call
78
- operation = ORDER? owner? '.' name supplied_params
78
+ operation = owner? '.' name supplied_params
79
79
  owner = name
80
80
  supplied_params = '(' SP* (param (',' SP+ param)*)? SP* ')'
81
81
  param = (name SP* ':' SP*)? scalar_expr // Comma above keeps scalar_expr from grabbing next param
@@ -91,9 +91,9 @@ output_flow = OUTPUT SP+ scalar_expr
91
91
  OUTPUT = '=>>'
92
92
 
93
93
  // Instance set
94
- instance_set = new_instance / ((operation / prefix_name / path) (reflexive_selection / selection / operation / path)*)
94
+ instance_set = new_instance / ((operation / name / path) (reflexive_selection / selection / operation / path)*)
95
95
  selection = '(' SP* select_phrase SP* ')'
96
- select_phrase = (CARD ',' SP* scalar_expr) / CARD / scalar_expr
96
+ select_phrase = (CARD ',' SP* ORDER? scalar_expr) / CARD / ORDER? scalar_expr
97
97
  CARD = '1' / '*'
98
98
  ORDER = '^+' / '^-'
99
99
  IN = '^'
@@ -109,7 +109,7 @@ attr_init = '(' SP* (attr_value_init (',' SP+ attr_value_init)* SP*)? ')' // all
109
109
  attr_value_init = (name SP? ':' SP+ scalar_expr )*
110
110
  update_ref = (instance_set SP+)? to_ref // relate or unrelated to me or explicit instance_set
111
111
  to_ref = '&' rnum SP+ instance_set (',' SP+ instance_set)? // non-associative or associative reference
112
- delete = '!*' SP* instance_set
112
+ delete = '!*' SP* instance_set (',' SP+ instance_set) // supports multi-delete transaction
113
113
 
114
114
  // Scalar call
115
115
  //scalar_call = scalar_expr
@@ -136,7 +136,6 @@ scalar_chain = (ITS op_chain) / ((scalar_source / instance_set projection?) op_c
136
136
  scalar_source = type_selector / input_param
137
137
  op_chain = ('.' (scalar_op / name))*
138
138
  value = TRUE / FALSE / enum_value
139
- prefix_name = ORDER? name
140
139
  scalar_op = name supplied_params
141
140
 
142
141
  // name of type and name of value selected
@@ -10,13 +10,13 @@ _logger = logging.getLogger(__name__)
10
10
  # and return in the visit result.
11
11
  Supplied_Parameter_a = namedtuple('Supplied_Parameter_a', 'pname sval')
12
12
  """Parameter name and flow name pair for a set of supplied parameters"""
13
- Op_a = namedtuple('Op_a', 'owner op_name supplied_params order')
13
+ Op_a = namedtuple('Op_a', 'owner op_name supplied_params')
14
14
  Scalar_op_a = namedtuple('Scalar_op_a', 'name supplied_params')
15
15
  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 criteria')
19
+ Selection_a = namedtuple('Selection_a', 'card order criteria')
20
20
  Inst_Assignment_a = namedtuple('Inst_Assignment_a', 'lhs card rhs X')
21
21
  EE_Signal_a = namedtuple('EE_Signal_a', 'event supplied_params ee')
22
22
  Signal_a = namedtuple('Signal_a', 'event supplied_params dest')
@@ -29,7 +29,7 @@ Execution_Unit_a = namedtuple('Execution_Unit_a', 'statement_set output_token')
29
29
  Seq_Statement_Set_a = namedtuple('Seq_Statement_Set_a', 'input_tokens statement block')
30
30
  Comp_Statement_Set_a = namedtuple('Comp_Statement_Set_a', 'statement block')
31
31
  Decision_a = namedtuple('Decision_a', 'input true_result false_result')
32
- Delete_Action_a = namedtuple('Delete_Action_a', 'instance_set')
32
+ Delete_Action_a = namedtuple('Delete_Action_a', 'instance_sets')
33
33
  Case_a = namedtuple('Case_a', 'enums comp_statement_set')
34
34
  Switch_a = namedtuple('Switch_a', 'input_flow cases')
35
35
  MATH_a = namedtuple('MATH_a', 'op operands')
@@ -792,6 +792,8 @@ class ScrallVisitor(PTNodeVisitor):
792
792
  @classmethod
793
793
  def visit_operation(cls, node, children):
794
794
  """
795
+ owner? '.' name supplied_params
796
+
795
797
  The results of an operation can be ordered ascending, descending
796
798
  The operation is invoked on the owner which may or may not be explicitly named
797
799
  If the owner is implicit, it could be 'ME' (the executing instance) or an operation on a type
@@ -804,13 +806,12 @@ class ScrallVisitor(PTNodeVisitor):
804
806
 
805
807
  _logger.info(f" < {children}")
806
808
  owner = children.results.get('owner')
807
- o = children.results.get('ORDER')
808
809
  p = children.results.get('supplied_params')
809
810
  result = Op_a(
810
811
  owner='implicit' if not owner else owner[0],
811
812
  op_name=children.results['name'][0].name,
812
- supplied_params=[] if not p else p[0],
813
- order=None if not o else symbol[o[0]]
813
+ supplied_params=[] if not p else p[0]
814
+ # order=None if not o else symbol[o[0]]
814
815
  )
815
816
  _logger.info(f" > {result}")
816
817
  return result
@@ -914,21 +915,10 @@ class ScrallVisitor(PTNodeVisitor):
914
915
  _logger.info(f" > {result}")
915
916
  return result
916
917
 
917
- @classmethod
918
- def visit_selection(cls, node, children):
919
- """
920
- """
921
- _logger.info("selection = '(' select_phrase ')'")
922
- _logger.info(f' :: {node.value}')
923
-
924
- _logger.info(f" < {children}")
925
- result = Selection_a(card=children[0][0], criteria=None if len(children[0]) < 2 else children[0][1])
926
- _logger.info(f" > {result}")
927
- return result
928
-
929
918
  @classmethod
930
919
  def visit_select_phrase(cls, node, children):
931
920
  """
921
+ (CARD ',' SP* ORDER? scalar_expr) / CARD / ORDER? scalar_expr
932
922
  """
933
923
  _logger.info(f"{node.rule_name} = (CARD ',' SP* scalar_expr) / CARD / scalar_expr")
934
924
  _logger.info(f">> {[k for k in children.results.keys()]}")
@@ -938,8 +928,10 @@ class ScrallVisitor(PTNodeVisitor):
938
928
  explicit_card = children.results.get('CARD')
939
929
  card = '*' if not explicit_card else explicit_card[0]
940
930
  criteria = children.results.get('scalar_expr')
931
+ o = children.results.get('ORDER')
932
+ o = symbol[o[0]] if o else None
941
933
  if criteria:
942
- result = [card, criteria[0]]
934
+ result = Selection_a(card=card, criteria=criteria[0], order=o)
943
935
  else:
944
936
  result = [card]
945
937
  _logger.info(f" > {result}")
@@ -1045,13 +1037,14 @@ class ScrallVisitor(PTNodeVisitor):
1045
1037
  @classmethod
1046
1038
  def visit_delete(cls, node, children):
1047
1039
  """
1040
+ '!*' SP* instance_set (',' SP+ instance_set)
1048
1041
  """
1049
- _logger.info("delete = '!*' instance_set")
1042
+ _logger.info("delete = '!*' SP* instance_set (',' SP+ instance_set)")
1050
1043
  _logger.info(f' :: {node.value}')
1051
1044
 
1052
1045
  _logger.info(f" < {children}")
1053
1046
  iset = children.results.get('instance_set')
1054
- result = Delete_Action_a(instance_set=iset)
1047
+ result = Delete_Action_a(instance_sets=iset)
1055
1048
  _logger.info(f" > {result}")
1056
1049
  return result
1057
1050
 
@@ -1422,22 +1415,22 @@ class ScrallVisitor(PTNodeVisitor):
1422
1415
  _logger.info(f" > {result}")
1423
1416
  return result
1424
1417
 
1425
- @classmethod
1426
- def visit_prefix_name(cls, node, children):
1427
- """
1428
- """
1429
- _logger.info("prefix_name = ORDER? name")
1430
- _logger.info(f' :: {node.value}')
1431
-
1432
- _logger.info(f" < {children}")
1433
- n = children.results['name'][0]
1434
- o = children.results.get('ORDER')
1435
- if o:
1436
- result = Order_name_a(order=symbol[o[0]], name=n)
1437
- else:
1438
- result = n
1439
- _logger.info(f" > {result}")
1440
- return result
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
1441
1434
 
1442
1435
  @classmethod
1443
1436
  def visit_scalar_op(cls, node, children):
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: scrall
3
- Version: 0.6.0
3
+ Version: 0.6.2
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
@@ -42,6 +42,7 @@ Requires-Dist: twine; extra == "build"
42
42
  Provides-Extra: dev
43
43
  Requires-Dist: bump2version; extra == "dev"
44
44
  Requires-Dist: pytest; extra == "dev"
45
+ Dynamic: license-file
45
46
 
46
47
  # Scrall Action Language
47
48
  Scrall = Starr's Concise Relational Action Language
@@ -16,6 +16,7 @@ src/scrall/parse/__init__.py
16
16
  src/scrall/parse/parser.py
17
17
  src/scrall/parse/scrall.peg
18
18
  src/scrall/parse/visitor.py
19
+ tests/test_delete.py
19
20
  tests/test_ping_actions.py
20
21
  tests/test_selection.py
21
22
  tests/test_signals.py
@@ -0,0 +1,22 @@
1
+ # test delete action
2
+
3
+ import pytest
4
+ from scrall.parse.parser import ScrallParser
5
+ from scrall.parse.visitor import Execution_Unit_a, N_a, INST_a, PATH_a, R_a, Seq_Statement_Set_a, Delete_Action_a
6
+
7
+ actions = [
8
+ ("!* siamese, /R1/Cat",
9
+ Execution_Unit_a(statement_set=Seq_Statement_Set_a(
10
+ input_tokens=None, statement=Delete_Action_a(
11
+ instance_sets=[N_a(name='siamese'),
12
+ INST_a(components=[PATH_a(hops=[R_a(rnum='R1'),
13
+ N_a(name='Cat')])])]), block=None), output_token=None)
14
+ ),
15
+ ]
16
+
17
+
18
+ @pytest.mark.parametrize("text, expected", actions)
19
+ def test_delete_action(text, expected):
20
+ parse = ScrallParser.parse_text(scrall_text=text, debug=False)[0]
21
+ print(parse)
22
+ assert parse[0] == expected
@@ -1 +0,0 @@
1
- version = "0.6.0"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes