Commit 8804a625 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fix error reporting in CONNECT branches

parent 87da2c1e
...@@ -2770,8 +2770,7 @@ def input_part(root, parent, context): ...@@ -2770,8 +2770,7 @@ def input_part(root, parent, context):
warnings.append('"PROVIDED" expressions not supported') warnings.append('"PROVIDED" expressions not supported')
i.provided = 'Provided' i.provided = 'Provided'
elif child.type == lexer.TRANSITION: elif child.type == lexer.TRANSITION:
trans, err, warn = transition( trans, err, warn = transition(child, parent=i, context=context)
child, parent=i, context=context)
errors.extend(err) errors.extend(err)
warnings.extend(warn) warnings.extend(warn)
i.transition = trans i.transition = trans
...@@ -2958,22 +2957,21 @@ def connect_part(root, parent, context): ...@@ -2958,22 +2957,21 @@ def connect_part(root, parent, context):
id_token[-1].getTokenStopIndex()) id_token[-1].getTokenStopIndex())
for exitp in conn.connect_list: for exitp in conn.connect_list:
if exitp != '' and not exitp in nested.state_exitpoints: if exitp != '' and not exitp in nested.state_exitpoints:
errors.append('Exit point {ep} not defined in state {st}' errors.append(['Exit point {ep} not defined in state st}'
.format(ep=exitp, st=statename)) .format(ep=exitp, st=statename),
[conn.pos_x or 0, conn.pos_y or 0], []])
terminators = [term for term in nested.terminators terminators = [term for term in nested.terminators
if term.kind == 'return' if term.kind == 'return'
and term.inputString.lower() == exitp] and term.inputString.lower() == exitp]
if not terminators: if not terminators:
errors.append('No {rs} return statement in nested state {st}' errors.append(['No {rs} return statement in nested state {st}'
.format(rs=exitp, st=statename)) .format(rs=exitp, st=statename),
[conn.pos_x or 0, conn.pos_y or 0], []])
for each in terminators: for each in terminators:
# Set next transition, exact id to be found in postprocessing # Set next transition, exact id to be found in postprocessing
each.next_trans = trans each.next_trans = trans
# Set list of terminators # Set list of terminators
conn.terminators = list(context.terminators[terms:]) conn.terminators = list(context.terminators[terms:])
# Report errors with symbol coordinates
errors = [[e, [conn.pos_x or 0, conn.pos_y or 0], []] for e in errors]
warnings = [[w, [conn.pos_x or 0, conn.pos_y or 0], []] for w in warnings]
return conn, errors, warnings return conn, errors, warnings
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment