scrall 0.2.14__tar.gz → 0.2.16__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.
Files changed (24) hide show
  1. {scrall-0.2.14/src/scrall.egg-info → scrall-0.2.16}/PKG-INFO +1 -1
  2. {scrall-0.2.14 → scrall-0.2.16}/pyproject.toml +1 -1
  3. scrall-0.2.16/src/scrall/__init__.py +1 -0
  4. {scrall-0.2.14 → scrall-0.2.16}/src/scrall/parse/parser.py +6 -6
  5. {scrall-0.2.14 → scrall-0.2.16}/src/scrall/parse/visitor.py +3 -2
  6. {scrall-0.2.14 → scrall-0.2.16/src/scrall.egg-info}/PKG-INFO +1 -1
  7. {scrall-0.2.14 → scrall-0.2.16}/tests/test_ping_actions.py +5 -3
  8. {scrall-0.2.14 → scrall-0.2.16}/tests/test_selection.py +8 -8
  9. {scrall-0.2.14 → scrall-0.2.16}/tests/test_signals.py +1 -1
  10. scrall-0.2.14/src/scrall/__init__.py +0 -1
  11. {scrall-0.2.14 → scrall-0.2.16}/LICENSE +0 -0
  12. {scrall-0.2.14 → scrall-0.2.16}/MANIFEST.in +0 -0
  13. {scrall-0.2.14 → scrall-0.2.16}/README.md +0 -0
  14. {scrall-0.2.14 → scrall-0.2.16}/setup.cfg +0 -0
  15. {scrall-0.2.14 → scrall-0.2.16}/src/scrall/__main__.py +0 -0
  16. {scrall-0.2.14 → scrall-0.2.16}/src/scrall/exceptions.py +0 -0
  17. {scrall-0.2.14 → scrall-0.2.16}/src/scrall/log.conf +0 -0
  18. {scrall-0.2.14 → scrall-0.2.16}/src/scrall/parse/__init__.py +0 -0
  19. {scrall-0.2.14 → scrall-0.2.16}/src/scrall/parse/scrall.peg +0 -0
  20. {scrall-0.2.14 → scrall-0.2.16}/src/scrall.egg-info/SOURCES.txt +0 -0
  21. {scrall-0.2.14 → scrall-0.2.16}/src/scrall.egg-info/dependency_links.txt +0 -0
  22. {scrall-0.2.14 → scrall-0.2.16}/src/scrall.egg-info/entry_points.txt +0 -0
  23. {scrall-0.2.14 → scrall-0.2.16}/src/scrall.egg-info/requires.txt +0 -0
  24. {scrall-0.2.14 → scrall-0.2.16}/src/scrall.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scrall
3
- Version: 0.2.14
3
+ Version: 0.2.16
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.2.14"
7
+ version = "0.2.16"
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.2.16"
@@ -1,7 +1,7 @@
1
1
  """ parser.py """
2
2
 
3
3
  from scrall.exceptions import ScrallGrammarFileOpen, ScrallParseError, ScrallInputFileEmpty, ScrallInputFileOpen
4
- from scrall.parse.visitor import ScrallVisitor
4
+ from scrall.parse.visitor import ScrallVisitor, Execution_Unit_a, Output_Flow_a
5
5
  from arpeggio import visit_parse_tree, NoMatch
6
6
  from arpeggio.cleanpeg import ParserPEG
7
7
  import os # For issuing system commands to generate diagnostic files
@@ -44,7 +44,7 @@ class ScrallParser:
44
44
  pg_model_pdf = diagnostics_path / "peggrammar_parser_model.pdf"
45
45
 
46
46
  @classmethod
47
- def parse_file(cls, file_input: Path, debug=False) -> List:
47
+ def parse_file(cls, file_input: Path, debug=False) -> (List[Execution_Unit_a | Output_Flow_a], str):
48
48
  """
49
49
  Read and save the file contents and options and then call the parser
50
50
 
@@ -74,7 +74,7 @@ class ScrallParser:
74
74
  return cls.parse()
75
75
 
76
76
  @classmethod
77
- def parse_text(cls, scrall_text: str, debug=False) -> List:
77
+ def parse_text(cls, scrall_text: str, debug=False) -> (List[Execution_Unit_a | Output_Flow_a], str):
78
78
  """
79
79
  Save options and call the parser
80
80
 
@@ -90,11 +90,11 @@ class ScrallParser:
90
90
  return cls.parse()
91
91
 
92
92
  @classmethod
93
- def parse(cls) -> List:
93
+ def parse(cls) -> (List[Execution_Unit_a | Output_Flow_a], str):
94
94
  """
95
95
  Parse a Scrall activity
96
96
 
97
- :return: A list of parsed Scrall statements
97
+ :return: A list of parsed execution units and the input scrall text
98
98
  """
99
99
  # Read the grammar file
100
100
  try:
@@ -130,4 +130,4 @@ class ScrallParser:
130
130
  # Comment this part out if you want to retain the dot files
131
131
  cls.parse_tree_dot.unlink(True)
132
132
 
133
- return result
133
+ return result, cls.scrall_text
@@ -17,7 +17,7 @@ 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
19
  Selection_a = namedtuple('Selection_a', 'card criteria')
20
- Inst_Assignment_a = namedtuple('Inst_Assignment_a', 'lhs card rhs')
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')
23
23
  """Signal sent to trigger event at destination with optional supplied parameters"""
@@ -538,7 +538,8 @@ class ScrallVisitor(PTNodeVisitor):
538
538
  return Inst_Assignment_a(
539
539
  lhs=children.results['flow_output'][0],
540
540
  card='1' if children.results['INST_ASSIGN'][0] == '.=' else 'M',
541
- rhs=children.results['instance_set'][0]
541
+ rhs=children.results['instance_set'][0],
542
+ X=(node.position, node.position_end)
542
543
  )
543
544
 
544
545
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scrall
3
- Version: 0.2.14
3
+ Version: 0.2.16
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
@@ -39,7 +39,8 @@ actions = [
39
39
  R_a(rnum='R28'),
40
40
  N_a(name='Shaft Level'),
41
41
  R_a(rnum='R3'),
42
- N_a(name='Accessible Shaft Level')])])))
42
+ N_a(name='Accessible Shaft Level')])]),
43
+ X=(0, 62)))
43
44
  ),
44
45
  ("requested stops ..= shaft aslevs( Stop requested: avalue )\n",
45
46
  Execution_Unit_a(input_tokens=None, output_tokens=None,
@@ -50,7 +51,8 @@ actions = [
50
51
  criteria=BOOL_a(op=['=='],
51
52
  operands=[
52
53
  N_a(name='Stop requested'),
53
- N_a(name='avalue')]))])))
54
+ N_a(name='avalue')]))]),
55
+ X=(0, 58)))
54
56
  ),
55
57
  ]
56
58
 
@@ -59,4 +61,4 @@ actions = [
59
61
  def test_signal_action(text, expected):
60
62
  parse = ScrallParser.parse_text(scrall_text=text, debug=False)[0]
61
63
  print(parse)
62
- assert parse == expected
64
+ assert parse[0] == expected
@@ -9,29 +9,29 @@ actions = [
9
9
  ("s ..= Shaft(Inservice; Cleared)", Execution_Unit_a(input_tokens=None, output_tokens=None,
10
10
  action_group=Inst_Assignment_a(lhs=Flow_Output_a(name=N_a(name='s'), exp_type=None), card='M',
11
11
  rhs=INST_a(components=[N_a(name='Shaft'), Selection_a(card='*',
12
- criteria=BOOL_a(op='AND', operands=[N_a(name='Inservice'), N_a(name='Cleared')]))])))
12
+ criteria=BOOL_a(op='AND', operands=[N_a(name='Inservice'), N_a(name='Cleared')]))]), X=(0,31)))
13
13
  ),
14
14
  ("c ..= Cabin(Speed > slowest + buffer)", Execution_Unit_a(input_tokens=None, output_tokens=None,
15
15
  action_group=Inst_Assignment_a(lhs=Flow_Output_a(name=N_a(name='c'), exp_type=None), card='M',
16
16
  rhs=INST_a(components=[N_a(name='Cabin'), Selection_a(card='*',
17
17
  criteria=BOOL_a(op='>', operands=[N_a(name='Speed'),
18
18
  MATH_a(op='+', operands=[
19
- N_a(name='slowest'), N_a(name='buffer')])]))])))
19
+ N_a(name='slowest'), N_a(name='buffer')])]))]), X=(0,37)))
20
20
  ),
21
21
  ("c ..= Cabin(Speed > slowest)", Execution_Unit_a(input_tokens=None, output_tokens=None,
22
22
  action_group=Inst_Assignment_a(lhs=Flow_Output_a(name=N_a(name='c'), exp_type=None), card='M',
23
23
  rhs=INST_a(components=[N_a(name='Cabin'), Selection_a(card='*',
24
- criteria=BOOL_a(op='>', operands=[N_a(name='Speed'), N_a(name='slowest')]))])))
24
+ criteria=BOOL_a(op='>', operands=[N_a(name='Speed'), N_a(name='slowest')]))]), X=(0,28)))
25
25
  ),
26
26
  ("s ..= Shaft(In service: True)", Execution_Unit_a(input_tokens=None, output_tokens=None,
27
27
  action_group=Inst_Assignment_a(lhs=Flow_Output_a(name=N_a(name='s'), exp_type=None), card='M',
28
28
  rhs=INST_a(components=[N_a(name='Shaft'), Selection_a(card='*',
29
- criteria=BOOL_a(op=['=='], operands=[N_a(name='In service'), 'true']))])))
29
+ criteria=BOOL_a(op=['=='], operands=[N_a(name='In service'), 'true']))]), X=(0,29)))
30
30
  ),
31
31
  ("s ..= Shaft(In service)", Execution_Unit_a(input_tokens=None, output_tokens=None,
32
32
  action_group=Inst_Assignment_a(lhs=Flow_Output_a(name=N_a(name='s'), exp_type=None), card='M',
33
33
  rhs=INST_a(components=[N_a(name='Shaft'), Selection_a(card='*',
34
- criteria=N_a(name='In service'))])))
34
+ criteria=N_a(name='In service'))]), X=(0,23)))
35
35
  ),
36
36
  ("x .= Bank(Max close attempts: (v or x) or Average cabin speed > mspeed)",
37
37
  Execution_Unit_a(input_tokens=None, output_tokens=None,
@@ -44,7 +44,7 @@ actions = [
44
44
  BOOL_a(op='OR', operands=[N_a(name='v'), N_a(name='x')])]),
45
45
  BOOL_a(op='>', operands=[
46
46
  N_a(name='Average cabin speed'),
47
- N_a(name='mspeed')])]))])))
47
+ N_a(name='mspeed')])]))]), X=(0,71)))
48
48
  ),
49
49
  ("x ..= car.findsome()(color: _red)",
50
50
  Execution_Unit_a(input_tokens=None, output_tokens=None,
@@ -54,7 +54,7 @@ actions = [
54
54
  order=None),
55
55
  Selection_a(card='*', criteria=BOOL_a(op=['=='], operands=[
56
56
  N_a(name='color'), Enum_a(value=N_a(name='red'))]))])
57
- ))
57
+ , X=(0,33)))
58
58
  ),
59
59
  ]
60
60
 
@@ -63,4 +63,4 @@ actions = [
63
63
  def test_signal_action(text, expected):
64
64
  parse = ScrallParser.parse_text(scrall_text=text + '\n', debug=False)[0]
65
65
  print(parse)
66
- assert parse == expected
66
+ assert parse[0] == expected
@@ -24,4 +24,4 @@ actions = [
24
24
  def test_signal_action(text, expected):
25
25
  parse = ScrallParser.parse_text(scrall_text=text, debug=False)[0]
26
26
  print(parse)
27
- assert parse == expected
27
+ assert parse[0] == expected
@@ -1 +0,0 @@
1
- version = "0.2.14"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes