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):
LOG.warning('Ada backend does not support the "ANY" statement')
code.append('-- "DECISION ANY" statement was ignored')
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
actual_type = type_name(question_type)
basic = find_basic_type(question_type).kind in ('IntegerType',
......
......@@ -3220,6 +3220,8 @@ def decision(root, parent, context):
need_else = False
is_enum = False
for ans in dec.answers:
if dec.kind in ('informal_text', 'any'):
break
ans_x, ans_y = ans.pos_x, ans.pos_y
if ans.kind in ('constant', 'open_range'):
expr = ans.openRangeOp()
......@@ -3365,7 +3367,8 @@ def decision(root, parent, context):
# (4) if an answer uses a non-ground expression an ELSE is there
# (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):
if not q_ranges:
continue
......
......@@ -660,10 +660,9 @@ else_part
question
: expression
: informal_text
| expression
-> ^(QUESTION expression)
| informal_text
-> informal_text
| 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
from antlr3 import *
......@@ -449,8 +449,8 @@ class sdl92Lexer(Lexer):
_type = ASSIG_OP
_channel = DEFAULT_CHANNEL
# sdl92.g:1153:17: ( ':=' )
# sdl92.g:1153:25: ':='
# sdl92.g:1152:17: ( ':=' )
# sdl92.g:1152:25: ':='
pass
self.match(":=")
......@@ -474,8 +474,8 @@ class sdl92Lexer(Lexer):
_type = L_BRACKET
_channel = DEFAULT_CHANNEL
# sdl92.g:1154:17: ( '{' )
# sdl92.g:1154:25: '{'
# sdl92.g:1153:17: ( '{' )
# sdl92.g:1153:25: '{'
pass
self.match(123)
......@@ -499,8 +499,8 @@ class sdl92Lexer(Lexer):
_type = R_BRACKET
_channel = DEFAULT_CHANNEL
# sdl92.g:1155:17: ( '}' )
# sdl92.g:1155:25: '}'
# sdl92.g:1154:17: ( '}' )
# sdl92.g:1154:25: '}'
pass
self.match(125)
......@@ -524,8 +524,8 @@ class sdl92Lexer(Lexer):
_type = L_PAREN
_channel = DEFAULT_CHANNEL
# sdl92.g:1156:17: ( '(' )
# sdl92.g:1156:25: '('
# sdl92.g:1155:17: ( '(' )
# sdl92.g:1155:25: '('
pass
self.match(40)
......@@ -549,8 +549,8 @@ class sdl92Lexer(Lexer):
_type = R_PAREN
_channel = DEFAULT_CHANNEL
# sdl92.g:1157:17: ( ')' )
# sdl92.g:1157:25: ')'
# sdl92.g:1156:17: ( ')' )
# sdl92.g:1156:25: ')'
pass
self.match(41)
......@@ -574,8 +574,8 @@ class sdl92Lexer(Lexer):
_type = COMMA
_channel = DEFAULT_CHANNEL
# sdl92.g:1158:17: ( ',' )
# sdl92.g:1158:25: ','
# sdl92.g:1157:17: ( ',' )
# sdl92.g:1157:25: ','
pass
self.match(44)
......@@ -599,8 +599,8 @@ class sdl92Lexer(Lexer):
_type = SEMI
_channel = DEFAULT_CHANNEL
# sdl92.g:1159:17: ( ';' )
# sdl92.g:1159:25: ';'
# sdl92.g:1158:17: ( ';' )
# sdl92.g:1158:25: ';'
pass
self.match(59)
......@@ -624,8 +624,8 @@ class sdl92Lexer(Lexer):
_type = DASH
_channel = DEFAULT_CHANNEL
# sdl92.g:1160:17: ( '-' )
# sdl92.g:1160:25: '-'
# sdl92.g:1159:17: ( '-' )
# sdl92.g:1159:25: '-'
pass
self.match(45)
......@@ -649,8 +649,8 @@ class sdl92Lexer(Lexer):
_type = ANY
_channel = DEFAULT_CHANNEL
# sdl92.g:1161:17: ( A N Y )
# sdl92.g:1161:25: A N Y
# sdl92.g:1160:17: ( A N Y )
# sdl92.g:1160:25: A N Y
pass
self.mA()
self.mN()
......@@ -676,8 +676,8 @@ class sdl92Lexer(Lexer):
_type = ASTERISK
_channel = DEFAULT_CHANNEL
# sdl92.g:1162:17: ( '*' )
# sdl92.g:1162:25: '*'
# sdl92.g:1161:17: ( '*' )
# sdl92.g:1161:25: '*'
pass
self.match(42)
......@@ -701,8 +701,8 @@ class sdl92Lexer(Lexer):
_type = DCL
_channel = DEFAULT_CHANNEL
# sdl92.g:1163:17: ( D C L )
# sdl92.g:1163:25: D C L
# sdl92.g:1162:17: ( D C L )
# sdl92.g:1162:25: D C L
pass
self.mD()
self.mC()
......@@ -728,8 +728,8 @@ class sdl92Lexer(Lexer):
_type = END
_channel = DEFAULT_CHANNEL
# sdl92.g:1164:17: ( E N D )
# sdl92.g:1164:25: E N D
# sdl92.g:1163:17: ( E N D )
# sdl92.g:1163:25: E N D
pass
self.mE()
self.mN()
......@@ -755,8 +755,8 @@ class sdl92Lexer(Lexer):
_type = KEEP
_channel = DEFAULT_CHANNEL
# sdl92.g:1165:17: ( K E E P )
# sdl92.g:1165:25: K E E P
# sdl92.g:1164:17: ( K E E P )
# sdl92.g:1164:25: K E E P
pass
self.mK()
self.mE()
......@@ -783,8 +783,8 @@ class sdl92Lexer(Lexer):
_type = PARAMNAMES
_channel = DEFAULT_CHANNEL
# sdl92.g:1166: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:17: ( 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
self.mP()
self.mA()
......@@ -817,8 +817,8 @@ class sdl92Lexer(Lexer):
_type = SPECIFIC
_channel = DEFAULT_CHANNEL
# sdl92.g:1167:17: ( S P E C I F I C )
# sdl92.g:1167:25: S P E C I F I C
# sdl92.g:1166:17: ( S P E C I F I C )
# sdl92.g:1166:25: S P E C I F I C
pass
self.mS()
self.mP()
......@@ -849,8 +849,8 @@ class sdl92Lexer(Lexer):
_type = GEODE
_channel = DEFAULT_CHANNEL
# sdl92.g:1168:17: ( G E O D E )
# sdl92.g:1168:25: G E O D E
# sdl92.g:1167:17: ( G E O D E )
# sdl92.g:1167:25: G E O D E
pass
self.mG()
self.mE()
......@@ -878,8 +878,8 @@ class sdl92Lexer(Lexer):
_type = HYPERLINK
_channel = DEFAULT_CHANNEL
# sdl92.g:1169: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:17: ( H Y P E R L I N K )
# sdl92.g:1168:25: H Y P E R L I N K
pass
self.mH()
self.mY()
......@@ -911,8 +911,8 @@ class sdl92Lexer(Lexer):
_type = ENDTEXT
_channel = DEFAULT_CHANNEL
# sdl92.g:1170:17: ( E N D T E X T )
# sdl92.g:1170:25: E N D T E X T
# sdl92.g:1169:17: ( E N D T E X T )
# sdl92.g:1169:25: E N D T E X T
pass
self.mE()
self.mN()
......@@ -942,8 +942,8 @@ class sdl92Lexer(Lexer):
_type = RETURN
_channel = DEFAULT_CHANNEL
# sdl92.g:1171:17: ( R E T U R N )
# sdl92.g:1171:25: R E T U R N
# sdl92.g:1170:17: ( R E T U R N )
# sdl92.g:1170:25: R E T U R N
pass
self.mR()
self.mE()
......@@ -972,8 +972,8 @@ class sdl92Lexer(Lexer):
_type = TIMER
_channel = DEFAULT_CHANNEL
# sdl92.g:1172:17: ( T I M E R )
# sdl92.g:1172:25: T I M E R
# sdl92.g:1171:17: ( T I M E R )
# sdl92.g:1171:25: T I M E R
pass
self.mT()
self.mI()
......@@ -1001,8 +1001,8 @@ class sdl92Lexer(Lexer):
_type = PROCESS
_channel = DEFAULT_CHANNEL
# sdl92.g:1173:17: ( P R O C E S S )
# sdl92.g:1173:25: P R O C E S S
# sdl92.g:1172:17: ( P R O C E S S )
# sdl92.g:1172:25: P R O C E S S
pass
self.mP()
self.mR()
......@@ -1032,8 +1032,8 @@ class sdl92Lexer(Lexer):
_type = ENDPROCESS
_channel = DEFAULT_CHANNEL
# sdl92.g:1174: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:17: ( 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
self.mE()
self.mN()
......@@ -1066,8 +1066,8 @@ class sdl92Lexer(Lexer):
_type = START
_channel = DEFAULT_CHANNEL
# sdl92.g:1175:17: ( S T A R T )
# sdl92.g:1175:25: S T A R T
# sdl92.g:1174:17: ( S T A R T )
# sdl92.g:1174:25: S T A R T
pass
self.mS()
self.mT()
......@@ -1095,8 +1095,8 @@ class sdl92Lexer(Lexer):
_type = STATE
_channel = DEFAULT_CHANNEL
# sdl92.g:1176:17: ( S T A T E )
# sdl92.g:1176:25: S T A T E
# sdl92.g:1175:17: ( S T A T E )
# sdl92.g:1175:25: S T A T E
pass
self.mS()
self.mT()
......@@ -1124,8 +1124,8 @@ class sdl92Lexer(Lexer):
_type = TEXT
_channel = DEFAULT_CHANNEL
# sdl92.g:1177:17: ( T E X T )
# sdl92.g:1177:25: T E X T
# sdl92.g:1176:17: ( T E X T )
# sdl92.g:1176:25: T E X T
pass
self.mT()
self.mE()
......@@ -1152,8 +1152,8 @@ class sdl92Lexer(Lexer):
_type = PROCEDURE
_channel = DEFAULT_CHANNEL
# sdl92.g:1178: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:17: ( P R O C E D U R E )
# sdl92.g:1177:25: P R O C E D U R E
pass
self.mP()
self.mR()
......@@ -1185,8 +1185,8 @@ class sdl92Lexer(Lexer):
_type = ENDPROCEDURE
_channel = DEFAULT_CHANNEL
# sdl92.g:1179: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:17: ( 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
self.mE()
self.mN()
......@@ -1221,8 +1221,8 @@ class sdl92Lexer(Lexer):
_type = PROCEDURE_CALL
_channel = DEFAULT_CHANNEL
# sdl92.g:1180: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:17: ( 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
self.mP()
self.mR()
......@@ -1258,8 +1258,8 @@ class sdl92Lexer(Lexer):
_type = ENDSTATE
_channel = DEFAULT_CHANNEL
# sdl92.g:1181:17: ( E N D S T A T E )
# sdl92.g:1181:25: E N D S T A T E
# sdl92.g:1180:17: ( E N D S T A T E )
# sdl92.g:1180:25: E N D S T A T E
pass
self.mE()
self.mN()
......@@ -1290,8 +1290,8 @@ class sdl92Lexer(Lexer):
_type = INPUT
_channel = DEFAULT_CHANNEL
# sdl92.g:1182:17: ( I N P U T )
# sdl92.g:1182:25: I N P U T
# sdl92.g:1181:17: ( I N P U T )
# sdl92.g:1181:25: I N P U T
pass
self.mI()
self.mN()
......@@ -1319,8 +1319,8 @@ class sdl92Lexer(Lexer):
_type = PROVIDED
_channel = DEFAULT_CHANNEL
# sdl92.g:1183:17: ( P R O V I D E D )
# sdl92.g:1183:25: P R O V I D E D
# sdl92.g:1182:17: ( P R O V I D E D )
# sdl92.g:1182:25: P R O V I D E D
pass
self.mP()
self.mR()
......@@ -1351,8 +1351,8 @@ class sdl92Lexer(Lexer):
_type = PRIORITY
_channel = DEFAULT_CHANNEL
# sdl92.g:1184:17: ( P R I O R I T Y )
# sdl92.g:1184:25: P R I O R I T Y
# sdl92.g:1183:17: ( P R I O R I T Y )
# sdl92.g:1183:25: P R I O R I T Y
pass
self.mP()
self.mR()
......@@ -1383,8 +1383,8 @@ class sdl92Lexer(Lexer):
_type = SAVE
_channel = DEFAULT_CHANNEL
# sdl92.g:1185:17: ( S A V E )
# sdl92.g:1185:25: S A V E
# sdl92.g:1184:17: ( S A V E )
# sdl92.g:1184:25: S A V E
pass
self.mS()
self.mA()
......@@ -1411,8 +1411,8 @@ class sdl92Lexer(Lexer):
_type = NONE
_channel = DEFAULT_CHANNEL
# sdl92.g:1186:17: ( N O N E )
# sdl92.g:1186:25: N O N E
# sdl92.g:1185:17: ( N O N E )
# sdl92.g:1185:25: N O N E
pass
self.mN()
self.mO()
......@@ -1439,8 +1439,8 @@ class sdl92Lexer(Lexer):
_type = FOR
_channel = DEFAULT_CHANNEL
# sdl92.g:1193:17: ( F O R )
# sdl92.g:1193:25: F O R
# sdl92.g:1192:17: ( F O R )
# sdl92.g:1192:25: F O R
pass
self.mF()
self.mO()
......@@ -1466,8 +1466,8 @@ class sdl92Lexer(Lexer):
_type = ENDFOR
_channel = DEFAULT_CHANNEL
# sdl92.g:1194:17: ( E N D F O R )
# sdl92.g:1194:25: E N D F O R
# sdl92.g:1193:17: ( E N D F O R )
# sdl92.g:1193:25: E N D F O R
pass
self.mE()
self.mN()
......@@ -1496,8 +1496,8 @@ class sdl92Lexer(Lexer):
_type = RANGE
_channel = DEFAULT_CHANNEL
# sdl92.g:1195:17: ( R A N G E )
# sdl92.g:1195:25: R A N G E
# sdl92.g:1194:17: ( R A N G E )
# sdl92.g:1194:25: R A N G E
pass
self.mR()
self.mA()
......@@ -1525,8 +1525,8 @@ class sdl92Lexer(Lexer):
_type = NEXTSTATE
_channel = DEFAULT_CHANNEL
# sdl92.g:1196: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:17: ( N E X T S T A T E )
# sdl92.g:1195:25: N E X T S T A T E
pass
self.mN()
self.mE()
......@@ -1558,8 +1558,8 @@ class sdl92Lexer(Lexer):
_type = ANSWER
_channel = DEFAULT_CHANNEL
# sdl92.g:1197:17: ( A N S W E R )
# sdl92.g:1197:25: A N S W E R
# sdl92.g:1196:17: ( A N S W E R )
# sdl92.g:1196:25: A N S W E R
pass
self.mA()
self.mN()
......@@ -1588,8 +1588,8 @@ class sdl92Lexer(Lexer):
_type = COMMENT
_channel = DEFAULT_CHANNEL
# sdl92.g:1198:17: ( C O M M E N T )
# sdl92.g:1198:25: C O M M E N T
# sdl92.g:1197:17: ( C O M M E N T )
# sdl92.g:1197:25: C O M M E N T
pass
self.mC()
self.mO()
......@@ -1619,8 +1619,8 @@ class sdl92Lexer(Lexer):
_type = LABEL
_channel = DEFAULT_CHANNEL
# sdl92.g:1199:17: ( L A B E L )
# sdl92.g:1199:25: L A B E L
# sdl92.g:1198:17: ( L A B E L )
# sdl92.g:1198:25: L A B E L
pass
self.mL()
self.mA()
......@@ -1648,8 +1648,8 @@ class sdl92Lexer(Lexer):
_type = STOP
_channel = DEFAULT_CHANNEL
# sdl92.g:1200:17: ( S T O P )
# sdl92.g:1200:25: S T O P
# sdl92.g:1199:17: ( S T O P )
# sdl92.g:1199:25: S T O P
pass
self.mS()
self.mT()
......@@ -1676,8 +1676,8 @@ class sdl92Lexer(Lexer):
_type = IF
_channel = DEFAULT_CHANNEL
# sdl92.g:1201:17: ( I F )
# sdl92.g:1201:25: I F
# sdl92.g:1200:17: ( I F )
# sdl92.g:1200:25: I F
pass
self.mI()
self.mF()
......@@ -1702,8 +1702,8 @@ class sdl92Lexer(Lexer):
_type = THEN
_channel = DEFAULT_CHANNEL
# sdl92.g:1202:17: ( T H E N )
# sdl92.g:1202:25: T H E N
# sdl92.g:1201:17: ( T H E N )
# sdl92.g:1201:25: T H E N
pass
self.mT()
self.mH()
......@@ -1730,8 +1730,8 @@ class sdl92Lexer(Lexer):
_type = ELSE
_channel = DEFAULT_CHANNEL
# sdl92.g:1203:17: ( E L S E )
# sdl92.g:1203:25: E L S E
# sdl92.g:1202:17: ( E L S E )
# sdl92.g:1202:25: E L S E
pass
self.mE()
self.mL()
......@@ -1758,8 +1758,8 @@ class sdl92Lexer(Lexer):
_type = FI
_channel = DEFAULT_CHANNEL
# sdl92.g:1204:17: ( F I )
# sdl92.g:1204:25: F I
# sdl92.g:1203:17: ( F I )
# sdl92.g:1203:25: F I
pass
self.mF()
self.mI()
......@@ -1784,8 +1784,8 @@ class sdl92Lexer(Lexer):
_type = CREATE
_channel = DEFAULT_CHANNEL
# sdl92.g:1205:17: ( C R E A T E )
# sdl92.g:1205:25: C R E A T E
# sdl92.g:1204:17: ( C R E A T E )
# sdl92.g:1204:25: C R E A T E
pass
self.mC()
self.mR()
......@@ -1814,8 +1814,8 @@ class sdl92Lexer(Lexer):
_type = OUTPUT
_channel = DEFAULT_CHANNEL
# sdl92.g:1206:17: ( O U T P U T )
# sdl92.g:1206:25: O U T P U T
# sdl92.g:1205:17: ( O U T P U T )
# sdl92.g:1205:25: O U T P U T
pass
self.mO()
self.mU()
......@@ -1844,8 +1844,8 @@ class sdl92Lexer(Lexer):
_type = CALL
_channel = DEFAULT_CHANNEL
# sdl92.g:1207:17: ( C A L L )
# sdl92.g:1207:25: C A L L
# sdl92.g:1206:17: ( C A L L )
# sdl92.g:1206:25: C A L L
pass
self.mC()
self.mA()
......@@ -1872,8 +1872,8 @@ class sdl92Lexer(Lexer):
_type = THIS
_channel = DEFAULT_CHANNEL
# sdl92.g:1208:17: ( T H I S )
# sdl92.g:1208:25: T H I S
# sdl92.g:1207:17: ( T H I S )
# sdl92.g:1207:25: T H I S
pass
self.mT()
self.mH()
......@@ -1900,8 +1900,8 @@ class sdl92Lexer(Lexer):
_type = SET
_channel = DEFAULT_CHANNEL
# sdl92.g:1209:17: ( S E T )
# sdl92.g:1209:25: S E T
# sdl92.g:1208:17: ( S E T )
# sdl92.g:1208:25: S E T
pass
self.mS()
self.mE()
......@@ -1927,8 +1927,8 @@ class sdl92Lexer(Lexer):
_type = RESET
_channel = DEFAULT_CHANNEL
# sdl92.g:1210:17: ( R E S E T )
# sdl92.g:1210:25: R E S E T
# sdl92.g:1209:17: ( R E S E T )
# sdl92.g:1209:25: R E S E T
pass
self.mR()
self.mE()
......@@ -1956,8 +1956,8 @@ class sdl92Lexer(Lexer):
_type = ENDALTERNATIVE
_channel = DEFAULT_CHANNEL
# sdl92.g:1211:17: ( E N D A L T E R N A T I V E )
# sdl92.g:1211:25: E N D A L T E R N A T I V E
# sdl92.g:1210:17: ( E N D A L T E R N A T I V E )
# sdl92.g:1210:25: E N D A L T E R N A T I V E
pass
self.mE()
self.mN()
......@@ -1994,8 +1994,8 @@ class sdl92Lexer(Lexer):
_type = ALTERNATIVE
_channel = DEFAULT_CHANNEL
# sdl92.g:1212:17: ( A L T E R N A T I V E )
# sdl92.g:1212:25: A L T E R N A T I V E
# sdl92.g:1211:17: ( A L T E R N A T I V E )
# sdl92.g:1211:25: A L T E R N A T I V E
pass
self.mA()
self.mL()
......@@ -2029,8 +2029,8 @@ class sdl92Lexer(Lexer):
_type = DECISION
_channel = DEFAULT_CHANNEL
# sdl92.g:1213:17: ( D E C I S I O N )
# sdl92.g:1213:25: D E C I S I O N
# sdl92.g:1212:17: ( D E C I S I O N )
# sdl92.g:1212:25: D E C I S I O N
pass
self.mD()
self.mE()
......@@ -2061,8 +2061,8 @@ class sdl92Lexer(Lexer):
_type = ENDDECISION
_channel = DEFAULT_CHANNEL
# sdl92.g:1214:17: ( E N D D E C I S I O N )
# sdl92.g:1214:25: E N D D E C I S I O N
# sdl92.g:1213:17: ( E N D D E C I S I O N )
# sdl92.g:1213:25: E N D D E C I S I O N
pass
self.mE()
self.mN()
......@@ -2096,8 +2096,8 @@ class sdl92Lexer(Lexer):
_type = EXPORT
_channel = DEFAULT_CHANNEL
# sdl92.g:1215:17: ( E X P O R T )
# sdl92.g:1215:25: E X P O R T
# sdl92.g:1214:17: ( E X P O R T )
# sdl92.g:1214:25: E X P O R T
pass
self.mE()
self.mX()
......@@ -2126,8 +2126,8 @@ class sdl92Lexer(Lexer):
_type = EXTERNAL
_channel = DEFAULT_CHANNEL
# sdl92.g:1216:17: ( E X T E R N A L )
# sdl92.g:1216:25: E X T E R N A L
# sdl92.g:1215:17: ( E X T E R N A L )
# sdl92.g:1215:25: E X T E R N A L