Commits (2)
......@@ -124,6 +124,10 @@ The background pattern was downloaded from www.subtlepatterns.com
Changelog
=========
**3.5.5 (04/2021)**
- Fix support for single input/output expressions (with no message name)
- Fix graphical location of errors for undefined states
**3.5.4 (04/2021)**
- Fix code generation when no signals are defined (only exported procedures)
- Add renames clause (aliases) for input/output expressions
......
......@@ -1640,6 +1640,8 @@ def io_expression(root, context):
regular form based on the known structure of events: Observable_Event
type that is generated by kazoo.
'''
errors, warnings = [], []
inputString = get_input_string(root)
event_kind = "{kind}_event"
target_option = " and then event.{kind}_event.{target} = {function}"
......@@ -1658,6 +1660,7 @@ def io_expression(root, context):
string += event_kind.format(kind=kind)
param_name = ""
from_f, to_f = "", ""
for child in root.getChildren():
if child.type == lexer.ID:
......@@ -1687,7 +1690,14 @@ def io_expression(root, context):
func = from_f if direction == "out" else to_f
if msg:
if msg and not func:
# When input or output specify a message there must be a source or destination
if direction == "out":
errors.append(f"FROM clause is missing in output expression '{inputString}'")
else:
errors.append(f"TO clause is missing in input expression '{inputString}'")
elif msg:
string += msg_name.format(kind=kind,
function=func,
direction=direction,
......@@ -1698,7 +1708,9 @@ def io_expression(root, context):
tree = new_root.tree
tree.token_stream = parser.getTokenStream()
expr, errors, warnings = expression(tree, context)
expr, errs, warns = expression(tree, context)
errors.extend(errs)
warnings.extend(warns)
expr.inputString = inputString
# Now address the optional parameter: if set, we will create an implicit
......@@ -3061,14 +3073,17 @@ def composite_state(root, parent=None, context=None):
warnings.extend(warn)
comp.content.states.append(newstate)
# Post-processing: check that all NEXTSTATEs have a corresponding STATE
for ns in [t.inputString.lower() for t in comp.terminators
if t.kind == 'next_state']:
if not ns in [s.lower() for s in
comp.mapping.keys()] + ['-']:
for t in comp.terminators:
if t.kind != "next_state":
continue
ns = t.inputString.lower()
#for ns in [t.inputString.lower() for t in comp.terminators
# if t.kind == 'next_state']:
if not ns in [s.lower() for s in comp.mapping.keys()] + ['-']:
errors.append(['In composite state "{}": missing definition '
'of substate "{}"'
.format(comp.statename, ns.upper()),
[0, 0], []])
[t.pos_x or 0, t.pos_y or 0], []])
for each in chain(errors, warnings):
each[2].insert(0, 'STATE {}'.format(comp.statename))
return comp, errors, warnings
......
......@@ -141,7 +141,7 @@ except ImportError:
__all__ = ['opengeode', 'SDL_Scene', 'SDL_View', 'parse']
__version__ = '3.5.4'
__version__ = '3.5.5'
if hasattr(sys, 'frozen'):
# Detect if we are running on Windows (py2exe-generated)
......@@ -2379,8 +2379,11 @@ clean:
continue
pos = QPoint(*coord)
symbol = self.scene().symbol_near(pos=pos, dist=1)
if symbol is not None:
G_ERRORS.append(symbol)
line.setData(Qt.UserRole + 2, len(G_ERRORS) - 1)
else:
print("No symbol at coord", coord, "in scene", path)
_ = self.go_to_scene_path(current_scene)
......