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

Detect informal expressions and ignore them

parent e7191b88
...@@ -1423,6 +1423,11 @@ def _decision(dec): ...@@ -1423,6 +1423,11 @@ def _decision(dec):
LOG.warning('Ada backend does not support the "ANY" statement') LOG.warning('Ada backend does not support the "ANY" statement')
code.append('-- "DECISION ANY" statement was ignored') code.append('-- "DECISION ANY" statement was ignored')
return code, local_decl return code, local_decl
elif dec.kind == 'informal_text':
LOG.warning('Informal decision ignored')
code.append('-- Informal decision was ignored: {}'
.format(dec.inputString))
return code, local_decl
question_type = dec.question.exprType question_type = dec.question.exprType
actual_type = type_name(question_type) actual_type = type_name(question_type)
basic = find_basic_type(question_type).kind in ('IntegerType', basic = find_basic_type(question_type).kind in ('IntegerType',
......
...@@ -3220,6 +3220,8 @@ def decision(root, parent, context): ...@@ -3220,6 +3220,8 @@ def decision(root, parent, context):
need_else = False need_else = False
is_enum = False is_enum = False
for ans in dec.answers: for ans in dec.answers:
if dec.kind in ('informal_text', 'any'):
break
ans_x, ans_y = ans.pos_x, ans.pos_y ans_x, ans_y = ans.pos_x, ans.pos_y
if ans.kind in ('constant', 'open_range'): if ans.kind in ('constant', 'open_range'):
expr = ans.openRangeOp() expr = ans.openRangeOp()
...@@ -3365,7 +3367,8 @@ def decision(root, parent, context): ...@@ -3365,7 +3367,8 @@ def decision(root, parent, context):
# (4) if an answer uses a non-ground expression an ELSE is there # (4) if an answer uses a non-ground expression an ELSE is there
# (5) present() operator and enumerated question are fully covered # (5) present() operator and enumerated question are fully covered
q_ranges = [(qmin, qmax)] if is_numeric(dec.question.exprType) else [] q_ranges = [(qmin, qmax)] if dec.question \
and is_numeric(dec.question.exprType) else []
for each in combinations(covered_ranges.viewitems(), 2): for each in combinations(covered_ranges.viewitems(), 2):
if not q_ranges: if not q_ranges:
continue continue
......
...@@ -660,10 +660,9 @@ else_part ...@@ -660,10 +660,9 @@ else_part
question question
: expression : informal_text
| expression
-> ^(QUESTION expression) -> ^(QUESTION expression)
| informal_text
-> informal_text
| ANY | ANY
-> ^(ANY); -> ^(ANY);
......
# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2014-10-26 11:45:13 # $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2014-11-11 10:36:42
import sys import sys
from antlr3 import * from antlr3 import *
...@@ -449,8 +449,8 @@ class sdl92Lexer(Lexer): ...@@ -449,8 +449,8 @@ class sdl92Lexer(Lexer):
_type = ASSIG_OP _type = ASSIG_OP
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1153:17: ( ':=' ) # sdl92.g:1152:17: ( ':=' )
# sdl92.g:1153:25: ':=' # sdl92.g:1152:25: ':='
pass pass
self.match(":=") self.match(":=")
...@@ -474,8 +474,8 @@ class sdl92Lexer(Lexer): ...@@ -474,8 +474,8 @@ class sdl92Lexer(Lexer):
_type = L_BRACKET _type = L_BRACKET
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1154:17: ( '{' ) # sdl92.g:1153:17: ( '{' )
# sdl92.g:1154:25: '{' # sdl92.g:1153:25: '{'
pass pass
self.match(123) self.match(123)
...@@ -499,8 +499,8 @@ class sdl92Lexer(Lexer): ...@@ -499,8 +499,8 @@ class sdl92Lexer(Lexer):
_type = R_BRACKET _type = R_BRACKET
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1155:17: ( '}' ) # sdl92.g:1154:17: ( '}' )
# sdl92.g:1155:25: '}' # sdl92.g:1154:25: '}'
pass pass
self.match(125) self.match(125)
...@@ -524,8 +524,8 @@ class sdl92Lexer(Lexer): ...@@ -524,8 +524,8 @@ class sdl92Lexer(Lexer):
_type = L_PAREN _type = L_PAREN
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1156:17: ( '(' ) # sdl92.g:1155:17: ( '(' )
# sdl92.g:1156:25: '(' # sdl92.g:1155:25: '('
pass pass
self.match(40) self.match(40)
...@@ -549,8 +549,8 @@ class sdl92Lexer(Lexer): ...@@ -549,8 +549,8 @@ class sdl92Lexer(Lexer):
_type = R_PAREN _type = R_PAREN
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1157:17: ( ')' ) # sdl92.g:1156:17: ( ')' )
# sdl92.g:1157:25: ')' # sdl92.g:1156:25: ')'
pass pass
self.match(41) self.match(41)
...@@ -574,8 +574,8 @@ class sdl92Lexer(Lexer): ...@@ -574,8 +574,8 @@ class sdl92Lexer(Lexer):
_type = COMMA _type = COMMA
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1158:17: ( ',' ) # sdl92.g:1157:17: ( ',' )
# sdl92.g:1158:25: ',' # sdl92.g:1157:25: ','
pass pass
self.match(44) self.match(44)
...@@ -599,8 +599,8 @@ class sdl92Lexer(Lexer): ...@@ -599,8 +599,8 @@ class sdl92Lexer(Lexer):
_type = SEMI _type = SEMI
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1159:17: ( ';' ) # sdl92.g:1158:17: ( ';' )
# sdl92.g:1159:25: ';' # sdl92.g:1158:25: ';'
pass pass
self.match(59) self.match(59)
...@@ -624,8 +624,8 @@ class sdl92Lexer(Lexer): ...@@ -624,8 +624,8 @@ class sdl92Lexer(Lexer):
_type = DASH _type = DASH
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1160:17: ( '-' ) # sdl92.g:1159:17: ( '-' )
# sdl92.g:1160:25: '-' # sdl92.g:1159:25: '-'
pass pass
self.match(45) self.match(45)
...@@ -649,8 +649,8 @@ class sdl92Lexer(Lexer): ...@@ -649,8 +649,8 @@ class sdl92Lexer(Lexer):
_type = ANY _type = ANY
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1161:17: ( A N Y ) # sdl92.g:1160:17: ( A N Y )
# sdl92.g:1161:25: A N Y # sdl92.g:1160:25: A N Y
pass pass
self.mA() self.mA()
self.mN() self.mN()
...@@ -676,8 +676,8 @@ class sdl92Lexer(Lexer): ...@@ -676,8 +676,8 @@ class sdl92Lexer(Lexer):
_type = ASTERISK _type = ASTERISK
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1162:17: ( '*' ) # sdl92.g:1161:17: ( '*' )
# sdl92.g:1162:25: '*' # sdl92.g:1161:25: '*'
pass pass
self.match(42) self.match(42)
...@@ -701,8 +701,8 @@ class sdl92Lexer(Lexer): ...@@ -701,8 +701,8 @@ class sdl92Lexer(Lexer):
_type = DCL _type = DCL
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1163:17: ( D C L ) # sdl92.g:1162:17: ( D C L )
# sdl92.g:1163:25: D C L # sdl92.g:1162:25: D C L
pass pass
self.mD() self.mD()
self.mC() self.mC()
...@@ -728,8 +728,8 @@ class sdl92Lexer(Lexer): ...@@ -728,8 +728,8 @@ class sdl92Lexer(Lexer):
_type = END _type = END
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1164:17: ( E N D ) # sdl92.g:1163:17: ( E N D )
# sdl92.g:1164:25: E N D # sdl92.g:1163:25: E N D
pass pass
self.mE() self.mE()
self.mN() self.mN()
...@@ -755,8 +755,8 @@ class sdl92Lexer(Lexer): ...@@ -755,8 +755,8 @@ class sdl92Lexer(Lexer):
_type = KEEP _type = KEEP
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1165:17: ( K E E P ) # sdl92.g:1164:17: ( K E E P )
# sdl92.g:1165:25: K E E P # sdl92.g:1164:25: K E E P
pass pass
self.mK() self.mK()
self.mE() self.mE()
...@@ -783,8 +783,8 @@ class sdl92Lexer(Lexer): ...@@ -783,8 +783,8 @@ class sdl92Lexer(Lexer):
_type = PARAMNAMES _type = PARAMNAMES
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1166:17: ( P A R A M N A M E S ) # sdl92.g:1165:17: ( P A R A M N A M E S )
# sdl92.g:1166:25: P A R A M N A M E S # sdl92.g:1165:25: P A R A M N A M E S
pass pass
self.mP() self.mP()
self.mA() self.mA()
...@@ -817,8 +817,8 @@ class sdl92Lexer(Lexer): ...@@ -817,8 +817,8 @@ class sdl92Lexer(Lexer):
_type = SPECIFIC _type = SPECIFIC
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1167:17: ( S P E C I F I C ) # sdl92.g:1166:17: ( S P E C I F I C )
# sdl92.g:1167:25: S P E C I F I C # sdl92.g:1166:25: S P E C I F I C
pass pass
self.mS() self.mS()
self.mP() self.mP()
...@@ -849,8 +849,8 @@ class sdl92Lexer(Lexer): ...@@ -849,8 +849,8 @@ class sdl92Lexer(Lexer):
_type = GEODE _type = GEODE
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1168:17: ( G E O D E ) # sdl92.g:1167:17: ( G E O D E )
# sdl92.g:1168:25: G E O D E # sdl92.g:1167:25: G E O D E
pass pass
self.mG() self.mG()
self.mE() self.mE()
...@@ -878,8 +878,8 @@ class sdl92Lexer(Lexer): ...@@ -878,8 +878,8 @@ class sdl92Lexer(Lexer):
_type = HYPERLINK _type = HYPERLINK
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1169:17: ( H Y P E R L I N K ) # sdl92.g:1168:17: ( H Y P E R L I N K )
# sdl92.g:1169:25: H Y P E R L I N K # sdl92.g:1168:25: H Y P E R L I N K
pass pass
self.mH() self.mH()
self.mY() self.mY()
...@@ -911,8 +911,8 @@ class sdl92Lexer(Lexer): ...@@ -911,8 +911,8 @@ class sdl92Lexer(Lexer):
_type = ENDTEXT _type = ENDTEXT
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1170:17: ( E N D T E X T ) # sdl92.g:1169:17: ( E N D T E X T )
# sdl92.g:1170:25: E N D T E X T # sdl92.g:1169:25: E N D T E X T
pass pass
self.mE() self.mE()
self.mN() self.mN()
...@@ -942,8 +942,8 @@ class sdl92Lexer(Lexer): ...@@ -942,8 +942,8 @@ class sdl92Lexer(Lexer):
_type = RETURN _type = RETURN
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1171:17: ( R E T U R N ) # sdl92.g:1170:17: ( R E T U R N )
# sdl92.g:1171:25: R E T U R N # sdl92.g:1170:25: R E T U R N
pass pass
self.mR() self.mR()
self.mE() self.mE()
...@@ -972,8 +972,8 @@ class sdl92Lexer(Lexer): ...@@ -972,8 +972,8 @@ class sdl92Lexer(Lexer):
_type = TIMER _type = TIMER
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1172:17: ( T I M E R ) # sdl92.g:1171:17: ( T I M E R )
# sdl92.g:1172:25: T I M E R # sdl92.g:1171:25: T I M E R
pass pass
self.mT() self.mT()
self.mI() self.mI()
...@@ -1001,8 +1001,8 @@ class sdl92Lexer(Lexer): ...@@ -1001,8 +1001,8 @@ class sdl92Lexer(Lexer):
_type = PROCESS _type = PROCESS
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1173:17: ( P R O C E S S ) # sdl92.g:1172:17: ( P R O C E S S )
# sdl92.g:1173:25: P R O C E S S # sdl92.g:1172:25: P R O C E S S
pass pass
self.mP() self.mP()
self.mR() self.mR()
...@@ -1032,8 +1032,8 @@ class sdl92Lexer(Lexer): ...@@ -1032,8 +1032,8 @@ class sdl92Lexer(Lexer):
_type = ENDPROCESS _type = ENDPROCESS
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1174:17: ( E N D P R O C E S S ) # sdl92.g:1173:17: ( E N D P R O C E S S )
# sdl92.g:1174:25: E N D P R O C E S S # sdl92.g:1173:25: E N D P R O C E S S
pass pass
self.mE() self.mE()
self.mN() self.mN()
...@@ -1066,8 +1066,8 @@ class sdl92Lexer(Lexer): ...@@ -1066,8 +1066,8 @@ class sdl92Lexer(Lexer):
_type = START _type = START
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1175:17: ( S T A R T ) # sdl92.g:1174:17: ( S T A R T )
# sdl92.g:1175:25: S T A R T # sdl92.g:1174:25: S T A R T
pass pass
self.mS() self.mS()
self.mT() self.mT()
...@@ -1095,8 +1095,8 @@ class sdl92Lexer(Lexer): ...@@ -1095,8 +1095,8 @@ class sdl92Lexer(Lexer):
_type = STATE _type = STATE
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1176:17: ( S T A T E ) # sdl92.g:1175:17: ( S T A T E )
# sdl92.g:1176:25: S T A T E # sdl92.g:1175:25: S T A T E
pass pass
self.mS() self.mS()
self.mT() self.mT()
...@@ -1124,8 +1124,8 @@ class sdl92Lexer(Lexer): ...@@ -1124,8 +1124,8 @@ class sdl92Lexer(Lexer):
_type = TEXT _type = TEXT
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1177:17: ( T E X T ) # sdl92.g:1176:17: ( T E X T )
# sdl92.g:1177:25: T E X T # sdl92.g:1176:25: T E X T
pass pass
self.mT() self.mT()
self.mE() self.mE()
...@@ -1152,8 +1152,8 @@ class sdl92Lexer(Lexer): ...@@ -1152,8 +1152,8 @@ class sdl92Lexer(Lexer):
_type = PROCEDURE _type = PROCEDURE
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1178:17: ( P R O C E D U R E ) # sdl92.g:1177:17: ( P R O C E D U R E )
# sdl92.g:1178:25: P R O C E D U R E # sdl92.g:1177:25: P R O C E D U R E
pass pass
self.mP() self.mP()
self.mR() self.mR()
...@@ -1185,8 +1185,8 @@ class sdl92Lexer(Lexer): ...@@ -1185,8 +1185,8 @@ class sdl92Lexer(Lexer):
_type = ENDPROCEDURE _type = ENDPROCEDURE
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1179:17: ( E N D P R O C E D U R E ) # sdl92.g:1178:17: ( E N D P R O C E D U R E )
# sdl92.g:1179:25: E N D P R O C E D U R E # sdl92.g:1178:25: E N D P R O C E D U R E
pass pass
self.mE() self.mE()
self.mN() self.mN()
...@@ -1221,8 +1221,8 @@ class sdl92Lexer(Lexer): ...@@ -1221,8 +1221,8 @@ class sdl92Lexer(Lexer):
_type = PROCEDURE_CALL _type = PROCEDURE_CALL
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1180:17: ( P R O C E D U R E C A L L ) # sdl92.g:1179:17: ( P R O C E D U R E C A L L )
# sdl92.g:1180:25: P R O C E D U R E C A L L # sdl92.g:1179:25: P R O C E D U R E C A L L
pass pass
self.mP() self.mP()
self.mR() self.mR()
...@@ -1258,8 +1258,8 @@ class sdl92Lexer(Lexer): ...@@ -1258,8 +1258,8 @@ class sdl92Lexer(Lexer):
_type = ENDSTATE _type = ENDSTATE
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1181:17: ( E N D S T A T E ) # sdl92.g:1180:17: ( E N D S T A T E )
# sdl92.g:1181:25: E N D S T A T E # sdl92.g:1180:25: E N D S T A T E
pass pass
self.mE() self.mE()
self.mN() self.mN()
...@@ -1290,8 +1290,8 @@ class sdl92Lexer(Lexer): ...@@ -1290,8 +1290,8 @@ class sdl92Lexer(Lexer):
_type = INPUT _type = INPUT
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1182:17: ( I N P U T ) # sdl92.g:1181:17: ( I N P U T )
# sdl92.g:1182:25: I N P U T # sdl92.g:1181:25: I N P U T
pass pass
self.mI() self.mI()
self.mN() self.mN()
...@@ -1319,8 +1319,8 @@ class sdl92Lexer(Lexer): ...@@ -1319,8 +1319,8 @@ class sdl92Lexer(Lexer):
_type = PROVIDED _type = PROVIDED
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1183:17: ( P R O V I D E D ) # sdl92.g:1182:17: ( P R O V I D E D )
# sdl92.g:1183:25: P R O V I D E D # sdl92.g:1182:25: P R O V I D E D
pass pass
self.mP() self.mP()
self.mR() self.mR()
...@@ -1351,8 +1351,8 @@ class sdl92Lexer(Lexer): ...@@ -1351,8 +1351,8 @@ class sdl92Lexer(Lexer):
_type = PRIORITY _type = PRIORITY
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1184:17: ( P R I O R I T Y ) # sdl92.g:1183:17: ( P R I O R I T Y )
# sdl92.g:1184:25: P R I O R I T Y # sdl92.g:1183:25: P R I O R I T Y
pass pass
self.mP() self.mP()
self.mR() self.mR()
...@@ -1383,8 +1383,8 @@ class sdl92Lexer(Lexer): ...@@ -1383,8 +1383,8 @@ class sdl92Lexer(Lexer):
_type = SAVE _type = SAVE
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1185:17: ( S A V E ) # sdl92.g:1184:17: ( S A V E )
# sdl92.g:1185:25: S A V E # sdl92.g:1184:25: S A V E
pass pass
self.mS() self.mS()
self.mA() self.mA()
...@@ -1411,8 +1411,8 @@ class sdl92Lexer(Lexer): ...@@ -1411,8 +1411,8 @@ class sdl92Lexer(Lexer):
_type = NONE _type = NONE
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1186:17: ( N O N E ) # sdl92.g:1185:17: ( N O N E )
# sdl92.g:1186:25: N O N E # sdl92.g:1185:25: N O N E
pass pass
self.mN() self.mN()
self.mO() self.mO()
...@@ -1439,8 +1439,8 @@ class sdl92Lexer(Lexer): ...@@ -1439,8 +1439,8 @@ class sdl92Lexer(Lexer):
_type = FOR _type = FOR
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1193:17: ( F O R ) # sdl92.g:1192:17: ( F O R )
# sdl92.g:1193:25: F O R # sdl92.g:1192:25: F O R
pass pass
self.mF() self.mF()
self.mO() self.mO()
...@@ -1466,8 +1466,8 @@ class sdl92Lexer(Lexer): ...@@ -1466,8 +1466,8 @@ class sdl92Lexer(Lexer):
_type = ENDFOR _type = ENDFOR
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1194:17: ( E N D F O R ) # sdl92.g:1193:17: ( E N D F O R )
# sdl92.g:1194:25: E N D F O R # sdl92.g:1193:25: E N D F O R
pass pass
self.mE() self.mE()
self.mN() self.mN()
...@@ -1496,8 +1496,8 @@ class sdl92Lexer(Lexer): ...@@ -1496,8 +1496,8 @@ class sdl92Lexer(Lexer):
_type = RANGE _type = RANGE
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1195:17: ( R A N G E ) # sdl92.g:1194:17: ( R A N G E )
# sdl92.g:1195:25: R A N G E # sdl92.g:1194:25: R A N G E
pass pass
self.mR() self.mR()
self.mA() self.mA()
...@@ -1525,8 +1525,8 @@ class sdl92Lexer(Lexer): ...@@ -1525,8 +1525,8 @@ class sdl92Lexer(Lexer):
_type = NEXTSTATE _type = NEXTSTATE
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1196:17: ( N E X T S T A T E ) # sdl92.g:1195:17: ( N E X T S T A T E )
# sdl92.g:1196:25: N E X T S T A T E # sdl92.g:1195:25: N E X T S T A T E
pass pass
self.mN() self.mN()
self.mE() self.mE()
...@@ -1558,8 +1558,8 @@ class sdl92Lexer(Lexer): ...@@ -1558,8 +1558,8 @@ class sdl92Lexer(Lexer):
_type = ANSWER _type = ANSWER
_channel = DEFAULT_CHANNEL _channel = DEFAULT_CHANNEL
# sdl92.g:1197:17: ( A N S W E R ) # sdl92.g:1196:17: ( A N S W