Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
ccfeb420
Commit
ccfeb420
authored
Mar 16, 2015
by
Maxime Perrotin
Browse files
Parse simple stop conditions
parent
f63eb47a
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
opengeode/icons.py
View file @
ccfeb420
...
...
@@ -2,7 +2,7 @@
# Resource object code
#
# Created:
Fri Jan 23 17:47:05
2015
# Created:
Mon Mar 9 21:42:24
2015
# by: The Resource Compiler for PySide (Qt v4.8.6)
#
# WARNING! All changes made in this file will be lost!
opengeode/ogParser.py
View file @
ccfeb420
...
...
@@ -3908,6 +3908,19 @@ def label(root, parent, context=None):
return
lab
,
errors
,
warnings
def
stop_if
(
root
,
parent
,
context
=
None
):
''' Parse a STOP IF expression - Return an expression
Can be used in simulators to cut off paths
** This is an extension of the SDL grammar **
'''
expr
=
root
.
getChild
(
0
)
expr
,
errors
,
warnings
=
expression
(
expr
,
context
)
expr
.
exprType
=
BOOLEAN
errors
=
[[
e
,
[
0
,
0
],
[]]
for
e
in
errors
]
warnings
=
[[
w
,
[
0
,
0
],
[]]
for
w
in
warnings
]
return
expr
,
errors
,
warnings
def
pr_file
(
root
):
''' Complete PR model - can be made up from several files/strings '''
errors
=
[]
...
...
@@ -4065,7 +4078,7 @@ def parse_pr(files=None, string=None):
return
og_ast
,
warnings
,
errors
def
parseSingleElement
(
elem
=
''
,
string
=
''
):
def
parseSingleElement
(
elem
=
''
,
string
=
''
,
context
=
None
):
'''
Parse any symbol and return syntax error and AST entry
Used for on-the-fly checks when user edits text
...
...
@@ -4075,7 +4088,7 @@ def parseSingleElement(elem='', string=''):
'terminator_statement'
,
'label'
,
'task'
,
'procedure_call'
,
'end'
,
'text_area'
,
'state'
,
'start'
,
'procedure'
,
'floating_label'
,
'connect_part'
,
'process_definition'
,
'proc_start'
,
'state_start'
,
'signalroute'
))
'signalroute'
,
'stop_if'
))
# Create a dummy context, needed to place context data
if
elem
==
'proc_start'
:
elem
=
'start'
...
...
@@ -4084,7 +4097,7 @@ def parseSingleElement(elem='', string=''):
elem
=
'start'
context
=
ogAST
.
CompositeState
()
else
:
context
=
ogAST
.
Process
()
context
=
context
or
ogAST
.
Process
()
LOG
.
debug
(
'Parsing string: '
+
string
+
' with elem '
+
elem
)
parser
=
parser_init
(
string
=
string
)
parser_ptr
=
getattr
(
parser
,
elem
)
...
...
opengeode/sdl92Lexer.py
View file @
ccfeb420
This diff is collapsed.
Click to expand it.
opengeode/sdl92Parser.py
View file @
ccfeb420
This diff is collapsed.
Click to expand it.
sdl92.g
View file @
ccfeb420
...
...
@@ -106,6 +106,7 @@ tokens {
STATELIST;
STIMULUS;
STOP;
STOPIF;
STRING;
STRUCT;
SYNONYM;
...
...
@@ -1073,6 +1074,12 @@ use_asn1
-> ^(ASN1 STRING);
/* OpenGEODE specific: Boolean condition that can be used in simulators
*/
stop_if
: STOP IF expression
-> ^(STOPIF expression);
symbolname
: START
| INPUT
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment