Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
224b89b1
Commit
224b89b1
authored
Apr 26, 2016
by
Maxime Perrotin
Browse files
Fix bug with empty sequence/string assignment
parent
1c9bd93f
Changes
5
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
224b89b1
...
...
@@ -144,6 +144,7 @@ Changelog
1.
3.18 (04/2016)
-
Add support for value notation of NULL type
-
Remove warning when accessing CHOICE fields
1.
3.17 (04/2016)
-
Add support for value notation of empty SEQUENCEs ("{}")
...
...
opengeode/AdaGenerator.py
View file @
224b89b1
...
...
@@ -2293,6 +2293,8 @@ def array_content(prim, values, asnty):
inputs: prim is of type PrimStringLiteral or PrimSequenceOf
values is a string with the sequence of numbers as processed by expression
asnty is the reference type of the string literal '''
if
isinstance
(
prim
,
ogAST
.
PrimEmptyString
):
return
values
if
asnty
.
Min
!=
asnty
.
Max
:
length
=
len
(
prim
.
value
)
if
isinstance
(
prim
,
ogAST
.
PrimStringLiteral
):
...
...
opengeode/ogParser.py
View file @
224b89b1
...
...
@@ -1736,6 +1736,7 @@ def primary(root, context):
# Primary "{ }" used in empty SEQUENCE OF (i.e. "{}")
# and also in value notation of SEQUENCEs that have no fields
prim
=
ogAST
.
PrimEmptyString
()
prim
.
value
=
[]
prim
.
exprType
=
type
(
'PrES'
,
(
object
,),
{
'kind'
:
'SequenceOfType'
,
'Min'
:
'0'
,
...
...
@@ -1840,7 +1841,10 @@ def variables(root, ta_ast, context):
expr
.
right
.
inputString
+
', type= '
+
type_name
(
expr
.
right
.
exprType
)
+
') '
+
str
(
err
))
else
:
if
def_value
.
exprType
==
UNKNOWN_TYPE
:
if
def_value
.
exprType
==
UNKNOWN_TYPE
or
not
\
isinstance
(
def_value
,
(
ogAST
.
ExprAppend
,
ogAST
.
PrimSequenceOf
,
ogAST
.
PrimStringLiteral
)):
def_value
.
exprType
=
asn1_sort
def_value
.
expected_type
=
asn1_sort
...
...
tests/regression/test-choice/dataview.asn
View file @
224b89b1
...
...
@@ -2,6 +2,7 @@ TASTE-Dataview DEFINITIONS ::=
BEGIN
EmptySeq ::= SEQUENCE {}
SeqOf ::= SEQUENCE (SIZE(0..10)) OF BOOLEAN
AnotherEmptySeq ::= SEQUENCE {}
...
...
tests/regression/test-choice/og.pr
View file @
224b89b1
...
...
@@ -16,7 +16,7 @@ signal we;
FROM ENV TO og WITH dd;
FROM og TO ENV WITH we;
CONNECT c AND r;
/* CIF PROCESS (225,
49
), (150, 75) */
/* CIF PROCESS (225,
50
), (150, 75) */
PROCESS og;
/* CIF TEXT (56, 58), (337, 130) */
-- Test choice assignments and access
...
...
@@ -24,17 +24,21 @@ signal we;
dcl ch ChoiceWithEmptySeq := a: NULL;
dcl em EmptySeq := {};
dcl eso SeqOf := {};
/* CIF ENDTEXT */
/* CIF START (160, 226), (70, 35) */
START;
/* CIF TASK (14
8
, 276), (9
3
, 35) */
/* CIF TASK (14
6
, 276), (9
8
, 35) */
TASK ch := b: {};
/* CIF TASK (144, 326), (100, 35) */
/* CIF TASK (152, 326), (85, 35) */
TASK eso := {};
/* CIF TASK (142, 376), (106, 35) */
TASK em := ch!b
/* CIF COMMENT (26
1
, 3
2
4), (17
5
, 40) */
/* CIF COMMENT (26
4
, 3
7
4), (17
7
, 40) */
COMMENT 'This is ok, there should
be no warning raised';
/* CIF NEXTSTATE (160,
37
6), (70, 35) */
/* CIF NEXTSTATE (160,
42
6), (70, 35) */
NEXTSTATE wait;
/* CIF STATE (460, 231), (70, 35) */
STATE wait;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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