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

Parse "state" as a valid primary expression

In stop conditions, it is valid to write "stop if state=wait"; until now
"state" was a reserved keyword so the parser would not accept it in an
expression. Now it does.
parent ccfeb420
......@@ -2,7 +2,7 @@
 
# Resource object code
#
# Created: Mon Mar 9 21:42:24 2015
# Created: Mon Mar 16 20:49:26 2015
# by: The Resource Compiler for PySide (Qt v4.8.6)
#
# WARNING! All changes made in this file will be lost!
......@@ -3909,16 +3909,20 @@ def label(root, parent, context=None):
def stop_if(root, parent, context=None):
''' Parse a STOP IF expression - Return an expression
''' Parse a set of stop conditions - Return an list of expressions
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
expressions, errors, warnings = [], [], []
for each in root.getChildren():
expr, err, warn = expression(each, context)
expr.exprType = BOOLEAN
expressions.append(expr)
errors.extend(err)
warnings.extend(warn)
errors = [[e, [0, 0], []] for e in errors]
warnings = [[w, [0, 0], []] for w in warnings]
return expr, errors, warnings
return expressions, errors, warnings
def pr_file(root):
......
This diff is collapsed.
This diff is collapsed.
......@@ -869,6 +869,7 @@ primary
| '{'
primary (COMMA primary)*
'}' -> ^(SEQOF primary+)
| STATE^
;
......@@ -1077,8 +1078,8 @@ use_asn1
/* OpenGEODE specific: Boolean condition that can be used in simulators
*/
stop_if
: STOP IF expression
-> ^(STOPIF expression);
: (STOP IF expression end)+
-> ^(STOPIF expression+);
symbolname
: START
......
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