Commit f2030c3c authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Parse properly instance/via clauses

parent 18db5dda
......@@ -123,8 +123,8 @@ The background pattern was downloaded from www.subtlepatterns.com
Changelog
=========
**3.1.3 (07/2020)**
- Fix issue finding ASN.1 files when model loaded from another folder
**3.2.0 (07/2020)**
- Add basic support for state type/instance
**3.1.2 (07/2020)**
- Reinforce syntax error checking and reporting
......
This diff is collapsed.
......@@ -3857,6 +3857,7 @@ def state(root, parent, context):
state_def.charPositionInLine = child.getCharPositionInLine()
state_def.statelist = [state_def.inputString]
inst_stop = child.getTokenStopIndex()
via_stop = inst_stop # in case there is also a via clause
elif child.type == lexer.TYPE_INSTANCE:
# Extract the complete string "state: instance"
start = inst_stop
......@@ -3926,8 +3927,8 @@ def state(root, parent, context):
.format(each, statename.lower()))
# then update the mapping state-input
context.mapping[statename.lower()].append(inp)
except KeyError:
stwarn.append('State definition missing')
except KeyError as err:
stwarn.append(f'State definition missing - {str(err)}')
state_def.inputs.append(inp)
if inp.inputString.strip() == '*':
if asterisk_input:
......
......@@ -140,7 +140,7 @@ except ImportError:
__all__ = ['opengeode', 'SDL_Scene', 'SDL_View', 'parse']
__version__ = '3.1.3'
__version__ = '3.2.0'
if hasattr(sys, 'frozen'):
# Detect if we are running on Windows (py2exe-generated)
......
This diff is collapsed.
This diff is collapsed.
......@@ -478,28 +478,30 @@ floating_label
-> ^(FLOATING_LABEL cif? hyperlink? connector_name transition?)
;
// state is either a full state definition, or a declaration of an instance
// state is either a full state definition, or a state instance
state
: state_definition
| state_instance
;
// the "via" part is needed to allow the graphical merge with a nextstate
state_definition
: cif?
hyperlink?
STATE statelist (e=end | SEMI) // "via" part may be in NEXTSTATE
STATE statelist via? (e=end | SEMI)
(state_part)*
ENDSTATE statename? f=end
-> ^(STATE cif? hyperlink? $e? statelist state_part*)
-> ^(STATE cif? hyperlink? $e? statelist via? state_part*)
;
state_instance
: cif?
hyperlink?
STATE statename ':' type_inst e=end
STATE statename ':' type_inst via? (e=end | SEMI)
(state_part)*
ENDSTATE statename? f=end
-> ^(STATE cif? hyperlink? $e? statename type_inst)
-> ^(STATE cif? hyperlink? $e? statename via? type_inst state_part*)
;
......
Markdown is supported
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