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
90446440
Commit
90446440
authored
Nov 11, 2014
by
Maxime Perrotin
Browse files
Better handling of mixed case in sequences
parent
a683085a
Changes
3
Hide whitespace changes
Inline
Side-by-side
AdaGenerator.py
View file @
90446440
...
...
@@ -1364,8 +1364,10 @@ def _sequence(seq):
for
elem
,
value
in
seq
.
value
.
viewitems
():
# Set the type of the field - easy thanks to ASN.1 flattened AST
delem
=
elem
.
replace
(
'_'
,
'-'
)
# XXX not sure the case is well handled
elem_spec
=
type_children
[
delem
]
for
each
in
type_children
:
if
each
.
lower
()
==
delem
.
lower
():
elem_spec
=
type_children
[
each
]
break
elem_specty
=
elem_spec
.
type
value_stmts
,
value_str
,
local_var
=
expression
(
value
)
if
isinstance
(
value
,
(
ogAST
.
PrimSequenceOf
,
ogAST
.
PrimStringLiteral
)):
...
...
ogParser.py
View file @
90446440
...
...
@@ -692,10 +692,6 @@ def check_type_compatibility(primary, type_ref, context):
for
field
,
val
in
basic_type
.
Children
.
viewitems
()
if
val
.
Optional
==
'True'
]
user_fields
=
[
field
.
lower
()
for
field
in
primary
.
value
.
keys
()]
# if user_nb_elem != type_nb_elem:
# raise TypeError('Wrong number of fields in SEQUENCE of type {}'
# .format(type_name(type_ref)))
# else:
for
field
,
fd_data
in
basic_type
.
Children
.
viewitems
():
ufield
=
field
.
replace
(
'-'
,
'_'
)
if
ufield
.
lower
()
not
in
optional_fields
\
...
...
@@ -709,14 +705,19 @@ def check_type_compatibility(primary, type_ref, context):
continue
else
:
# If the user field is a raw value
if
primary
.
value
[
ufield
].
is_raw
:
check_type_compatibility
(
primary
.
value
[
ufield
],
casefield
=
ufield
for
each
in
primary
.
value
:
if
each
.
lower
()
==
ufield
.
lower
():
casefield
=
each
break
if
primary
.
value
[
casefield
].
is_raw
:
check_type_compatibility
(
primary
.
value
[
casefield
],
fd_data
.
type
,
context
)
else
:
# Compare the types for semantic equivalence
try
:
compare_types
(
primary
.
value
[
u
field
].
exprType
,
fd_data
.
type
)
primary
.
value
[
case
field
].
exprType
,
fd_data
.
type
)
except
TypeError
as
err
:
raise
TypeError
(
'Field '
+
ufield
+
' is not of the proper type, i.e. '
+
...
...
tests/regression/test-debug/orchestrator.pr
View file @
90446440
...
...
@@ -2,7 +2,7 @@
PROCESS orchestrator
/* CIF COMMENT (405, 192), (71, 35) */
COMMENT 'Hello';
/* CIF TEXT (39, 94), (3
8
9, 293) */
/* CIF TEXT (39, 94), (39
8
, 293) */
dcl seq tastE_Peek_id_list;
dcl fixed FixedString := 'Hello';
...
...
@@ -21,16 +21,16 @@ dcl check tasTE_Peek_id;
dcl choice choice;
dcl opt SeqOpt := {
a
TRUE, b FALSE }; -- test optional fields
dcl opt SeqOpt := {
A
TRUE, b FALSE }; -- test optional fields
/* CIF ENDTEXT */
/* CIF PROCEDURE (727, 175), (106, 35) */
PROCEDURE emptyproc;
ENDPROCEDURE;
/* CIF START (502, 224), (80, 36) */
START;
/* CIF TASK (47
4
, 275), (1
36
, 35) */
TASK opt := {
b
TRUE }
/* CIF COMMENT (63
0
, 275), (155, 35) */
/* CIF TASK (47
0
, 275), (1
44
, 35) */
TASK opt := {
B
TRUE }
/* CIF COMMENT (63
4
, 275), (155, 35) */
COMMENT 'Test optional fields';
/* CIF DECISION (492, 325), (99, 50) */
DECISION 'informal'
...
...
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