Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
c700dd2a
Commit
c700dd2a
authored
Nov 11, 2014
by
Maxime Perrotin
Browse files
Detect informal expressions and ignore them
parent
e7191b88
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
AdaGenerator.py
View file @
c700dd2a
...
@@ -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'
,
...
...
ogParser.py
View file @
c700dd2a
...
@@ -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
...
...
sdl92.g
View file @
c700dd2a
...
@@ -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);
...
...
sdl92Lexer.py
View file @
c700dd2a
This diff is collapsed.
Click to expand it.
sdl92Parser.py
View file @
c700dd2a
This diff is collapsed.
Click to expand it.
tests/regression/test-debug/orchestrator.pr
View file @
c700dd2a
...
@@ -23,77 +23,84 @@ dcl choice choice;
...
@@ -23,77 +23,84 @@ dcl choice choice;
/* CIF ENDTEXT */
/* CIF ENDTEXT */
/* CIF START (428, 223), (100, 45) */
/* CIF START (428, 223), (100, 45) */
START;
START;
/* CIF TASK (366, 283), (223, 38) */
/* CIF DECISION (428, 283), (99, 50) */
DECISION 'informal';
/* CIF ANSWER (398, 353), (70, 23) */
('a'):
/* CIF ANSWER (488, 353), (70, 33) */
('2'):
ENDDECISION;
/* CIF TASK (366, 401), (223, 38) */
TASK seqboolean := {true, false},
TASK seqboolean := {true, false},
seqboolean := not {true, false};
seqboolean := not {true, false};
/* CIF TASK (396,
336
), (164, 53) */
/* CIF TASK (396,
454
), (164, 53) */
TASK for x in seqen:
TASK for x in seqen:
call writeln(num(x));
call writeln(num(x));
endfor;
endfor;
/* CIF TASK (396,
404
), (164, 53) */
/* CIF TASK (396,
522
), (164, 53) */
TASK for x in seqen2:
TASK for x in seqen2:
call writeln(num(x));
call writeln(num(x));
endfor;
endfor;
/* CIF TASK (397,
472
), (162, 53) */
/* CIF TASK (397,
590
), (162, 53) */
TASK for x in seqboolean:
TASK for x in seqboolean:
call writeln(x);
call writeln(x);
endfor
endfor
/* CIF COMMENT (579,
481
), (168, 38) */
/* CIF COMMENT (579,
599
), (168, 38) */
COMMENT 'FOR with a basic type';
COMMENT 'FOR with a basic type';
/* CIF TASK (367,
540
), (222, 35) */
/* CIF TASK (367,
658
), (222, 35) */
TASK seqboolean := not seqboolean
TASK seqboolean := not seqboolean
/* CIF COMMENT (609,
540
), (279, 35) */
/* CIF COMMENT (609,
658
), (279, 35) */
COMMENT 'check NOT on a SEQUENCE of BOOLEAN';
COMMENT 'check NOT on a SEQUENCE of BOOLEAN';
/* CIF TASK (397,
590
), (162, 53) */
/* CIF TASK (397,
708
), (162, 53) */
TASK for x in seqboolean:
TASK for x in seqboolean:
call writeln(x);
call writeln(x);
endfor;
endfor;
/* CIF TASK (415,
658
), (126, 38) */
/* CIF TASK (415,
776
), (126, 38) */
TASK fixed := 'hello';
TASK fixed := 'hello';
/* CIF TASK (403,
711
), (149, 35) */
/* CIF TASK (403,
829
), (149, 35) */
TASK variable := 'HELLO';
TASK variable := 'HELLO';
/* CIF PROCEDURECALL (390,
761
), (176, 35) */
/* CIF PROCEDURECALL (390,
879
), (176, 35) */
CALL writeln(variable // '!!!');
CALL writeln(variable // '!!!');
/* CIF PROCEDURECALL (342,
811
), (272, 35) */
/* CIF PROCEDURECALL (342,
929
), (272, 35) */
CALL writeln(variable // variable // variable);
CALL writeln(variable // variable // variable);
/* CIF TASK (432,
861
), (91, 35) */
/* CIF TASK (432,
979
), (91, 35) */
TASK seq := {1};
TASK seq := {1};
/* CIF TASK (401,
911
), (153, 35) */
/* CIF TASK (401,
1029
), (153, 35) */
TASK seq := {1} // {2} // {3};
TASK seq := {1} // {2} // {3};
/* CIF TASK (392,
961
), (172, 35) */
/* CIF TASK (392,
1079
), (172, 35) */
TASK seq := seq // {2} // {1};
TASK seq := seq // {2} // {1};
/* CIF DECISION (443, 1
011
), (70, 50) */
/* CIF DECISION (443, 1
129
), (70, 50) */
DECISION any;
DECISION any;
/* CIF ANSWER (398, 1
081
), (70, 23) */
/* CIF ANSWER (398, 1
199
), (70, 23) */
('a'):
('a'):
/* CIF ANSWER (488, 1
081
), (70, 23) */
/* CIF ANSWER (488, 1
199
), (70, 23) */
('b'):
('b'):
ENDDECISION;
ENDDECISION;
/* CIF DECISION (433, 1
119
), (89, 50) */
/* CIF DECISION (433, 1
237
), (89, 50) */
DECISION myenum
DECISION myenum
/* CIF COMMENT (542, 1
126
), (183, 35) */
/* CIF COMMENT (542, 1
244
), (183, 35) */
COMMENT 'Check case insensitivity';
COMMENT 'Check case insensitivity';
/* CIF ANSWER (250, 1
189
), (70, 23) */
/* CIF ANSWER (250, 1
307
), (70, 23) */
(a):
(a):
/* CIF ANSWER (330, 1
189
), (70, 23) */
/* CIF ANSWER (330, 1
307
), (70, 23) */
(B):
(B):
/* CIF ANSWER (410, 1
189
), (70, 23) */
/* CIF ANSWER (410, 1
307
), (70, 23) */
(c):
(c):
/* CIF ANSWER (488, 1
189
), (70, 23) */
/* CIF ANSWER (488, 1
307
), (70, 23) */
(d):
(d):
/* CIF ANSWER (576, 1
189
), (70, 23) */
/* CIF ANSWER (576, 1
307
), (70, 23) */
(Ee):
(Ee):
ENDDECISION;
ENDDECISION;
/* CIF DECISION (40
8
, 1
227
), (138, 50) */
/* CIF DECISION (40
9
, 1
345
), (138, 50) */
DECISION present(choice)
DECISION present(choice)
/* CIF COMMENT (566, 1
234
), (183, 35) */
/* CIF COMMENT (566, 1
352
), (183, 35) */
COMMENT 'Check case insensitivity';
COMMENT 'Check case insensitivity';
/* CIF ANSWER (361, 1
297
), (70, 23) */
/* CIF ANSWER (361, 1
415
), (70, 23) */
(cde2):
(cde2):
/* CIF ANSWER (532, 1
297
), (70, 23) */
/* CIF ANSWER (532, 1
415
), (70, 23) */
ELSE:
ELSE:
ENDDECISION;
ENDDECISION;
/* CIF NEXTSTATE (419, 1
335
), (116, 33) */
/* CIF NEXTSTATE (419, 1
453
), (116, 33) */
NEXTSTATE Wait_for_GUI;
NEXTSTATE Wait_for_GUI;
/* CIF STATE (423, 163), (118, 50) */
/* CIF STATE (423, 163), (118, 50) */
STATE Wait_for_GUI;
STATE Wait_for_GUI;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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