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
c9f59d74
Commit
c9f59d74
authored
Jul 16, 2014
by
dbarbera
Browse files
flake8 fixes
parent
370bd8b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
AdaGenerator.py
View file @
c9f59d74
...
...
@@ -91,7 +91,6 @@ PROCEDURES = []
@
singledispatch
def
generate
(
ast
):
''' Generate the code for an item of the AST '''
_
=
ast
raise
TypeError
(
'[AdaGenerator] Unsupported AST construct'
)
return
[],
[]
...
...
@@ -223,7 +222,7 @@ package {process_name} is'''.format(process_name=process_name,
if
'type'
in
signal
:
typename
=
signal
[
'type'
].
ReferencedTypeName
.
replace
(
'-'
,
'_'
)
pi_header
+=
'({pName}: access asn1Scc{pType})'
.
format
(
pName
=
param_name
,
pType
=
typename
)
pName
=
param_name
,
pType
=
typename
)
# Add declaration of the provided interface in the .ads file
ads_template
.
append
(
'-- Provided interface "'
+
signal
[
'name'
]
+
'"'
)
...
...
@@ -279,7 +278,7 @@ package {process_name} is'''.format(process_name=process_name,
taste_template
.
append
(
'null;'
)
taste_template
.
append
(
'end case;'
)
taste_template
.
append
(
u
'end {sig_name};'
.
format
(
sig_name
=
signal
[
'name'
]))
sig_name
=
signal
[
'name'
]))
taste_template
.
append
(
'
\n
'
)
# for the .ads file, generate the declaration of the required interfaces
...
...
@@ -308,7 +307,7 @@ package {process_name} is'''.format(process_name=process_name,
if
params
:
ri_header
+=
u
'('
+
u
';'
.
join
(
params
)
+
')'
ads_template
.
append
(
u
'-- Sync required interface "'
+
proc
.
inputString
)
u
'-- Sync required interface "'
+
proc
.
inputString
)
ads_template
.
append
(
ri_header
+
u
';'
)
ads_template
.
append
(
u
'pragma import(C, {sig}, "{proc}_RI_{sig}");'
.
format
(
sig
=
proc
.
inputString
,
proc
=
process_name
))
...
...
@@ -444,7 +443,7 @@ def write_statement(param, newline):
.
format
(
tmp
=
localstr
,
st
=
string
,
sep
=
sep
),
u
"end loop;"
])
if
basic_type
.
Min
!=
basic_type
.
Max
:
code
.
extend
([
"if {string}.Length < {to} then"
code
.
extend
([
"if {string}.Length < {to} then"
.
format
(
string
=
string
,
to
=
basic_type
.
Max
),
u
"{tmp}({string}.Length + 1 .. {to}) "
u
":= (others=>Character'Val(0));"
...
...
@@ -562,7 +561,7 @@ def _call_external_function(output):
# Create a temporary variable for input parameters only
# (If needed, i.e. if argument is not a local variable)
if
param_direction
==
'in'
\
and
(
not
(
isinstance
(
param
,
ogAST
.
PrimVariable
)
and
and
(
not
(
isinstance
(
param
,
ogAST
.
PrimVariable
)
and
p_id
.
startswith
(
'l_'
))
or
isinstance
(
param
,
ogAST
.
PrimFPAR
)):
tmp_id
=
out
[
'tmpVars'
][
idx
]
local_decl
.
append
(
'tmp{idx} : aliased asn1Scc{oType};'
...
...
@@ -639,7 +638,7 @@ def _task_forloop(task):
start_str
,
stop_str
=
'0'
,
''
if
loop
[
'range'
][
'start'
]:
start_stmt
,
start_str
,
start_local
=
expression
(
loop
[
'range'
][
'start'
])
loop
[
'range'
][
'start'
])
local_decl
.
extend
(
start_local
)
stmt
.
extend
(
start_stmt
)
# ASN.1 Integers are 64 bits - we need to convert to 32 bits
...
...
@@ -654,8 +653,8 @@ def _task_forloop(task):
# stop_str = 'Integer({})'.format(stop_str)
if
loop
[
'range'
][
'step'
]
==
1
:
stmt
.
append
(
'for {it} in {start}{stop} loop'
.
format
(
it
=
loop
[
'var'
],
start
=
start_str
,
stop
=
stop_str
))
'for {it} in {start}{stop} loop'
.
format
(
it
=
loop
[
'var'
],
start
=
start_str
,
stop
=
stop_str
))
else
:
# Step is not directly supported in Ada, we need to use 'while'
stmt
.
extend
([
'declare'
,
...
...
@@ -713,7 +712,6 @@ def expression(expr):
- useable string corresponding to the evaluation of the expression,
- list of local declarations
'''
_
=
expr
raise
TypeError
(
'Unsupported expression: '
+
str
(
expr
))
return
[],
''
,
[]
...
...
@@ -854,16 +852,19 @@ def _prim_substring(prim):
local_decl
.
extend
(
r1_local
)
local_decl
.
extend
(
r2_local
)
local_decl
.
append
(
'tmp{idx} : aliased asn1Scc{parent_type};'
.
format
(
idx
=
prim
.
value
[
1
][
'tmpVar'
],
parent_type
=
receiver_ty_name
))
local_decl
.
append
(
'tmp{idx} : aliased asn1Scc{parent_type};'
.
format
(
idx
=
prim
.
value
[
1
][
'tmpVar'
],
parent_type
=
receiver_ty_name
))
# XXX types with fixed length: substrings will not work
if
unicode
.
isnumeric
(
r1_string
)
and
unicode
.
isnumeric
(
r2_string
):
length
=
int
(
r2_string
)
-
int
(
r1_string
)
+
1
else
:
length
=
(
'{r2} - {r1} + 1'
.
format
(
r2
=
r2_string
,
r1
=
r1_string
))
stmts
.
append
(
'tmp{idx}.Length := {length};'
.
format
(
idx
=
prim
.
value
[
1
][
'tmpVar'
],
length
=
length
))
stmts
.
append
(
'tmp{idx}.Length := {length};'
.
format
(
idx
=
prim
.
value
[
1
][
'tmpVar'
],
length
=
length
))
stmts
.
append
(
'tmp{idx}.Data(1..{length}) := {data};'
.
format
(
idx
=
prim
.
value
[
1
][
'tmpVar'
],
length
=
length
,
data
=
ada_string
))
stmts
.
append
(
'tmp{idx}.Data(1..{length}) := {data};'
.
format
(
idx
=
prim
.
value
[
1
][
'tmpVar'
],
length
=
length
,
data
=
ada_string
))
ada_string
=
'tmp{idx}'
.
format
(
idx
=
prim
.
value
[
1
][
'tmpVar'
])
return
stmts
,
ada_string
,
local_decl
...
...
@@ -885,7 +886,8 @@ def _prim_selector(prim):
receiver_ty_name
=
receiver
.
exprType
.
ReferencedTypeName
.
replace
(
'-'
,
'_'
)
if
receiver_bty
.
kind
==
'ChoiceType'
:
ada_string
=
(
'asn1Scc{typename}_{field_name}_get({ada_string})'
.
format
(
typename
=
receiver_ty_name
,
field_name
=
field_name
,
ada_string
=
ada_string
))
ada_string
=
(
'asn1Scc{typename}_{field_name}_get({ada_string})'
.
format
(
typename
=
receiver_ty_name
,
field_name
=
field_name
,
ada_string
=
ada_string
))
else
:
ada_string
+=
'.'
+
field_name
...
...
@@ -947,10 +949,10 @@ def _bitwise_operators(expr):
ada_string
+=
u
')'
else
:
ada_string
=
u
'({left} {op}{short} {right})'
.
format
(
left
=
left_str
,
op
=
expr
.
operand
,
short
=
expr
.
shortcircuit
,
right
=
right_str
)
left
=
left_str
,
op
=
expr
.
operand
,
short
=
expr
.
shortcircuit
,
right
=
right_str
)
code
.
extend
(
left_stmts
)
code
.
extend
(
right_stmts
)
local_decl
.
extend
(
left_local
)
...
...
@@ -1039,7 +1041,6 @@ def _append(expr):
return
stmts
,
ada_string
,
local_decl
@
expression
.
register
(
ogAST
.
ExprIn
)
def
_expr_in
(
expr
):
''' IN expressions: check if item is in a SEQUENCE OF '''
...
...
@@ -1101,7 +1102,7 @@ def _integer(primary):
@
expression
.
register
(
ogAST
.
PrimBoolean
)
def
_
integer
(
primary
):
def
_
boolean
(
primary
):
''' Generate code for a raw boolean value '''
ada_string
=
primary
.
value
[
0
]
return
[],
ada_string
,
[]
...
...
@@ -1111,7 +1112,7 @@ def _integer(primary):
def
_empty_string
(
primary
):
''' Generate code for an empty SEQUENCE OF: {} '''
ada_string
=
'asn1Scc{typeRef}_Init'
.
format
(
typeRef
=
primary
.
exprType
.
ReferencedTypeName
.
replace
(
'-'
,
'_'
))
typeRef
=
primary
.
exprType
.
ReferencedTypeName
.
replace
(
'-'
,
'_'
))
return
[],
ada_string
,
[]
...
...
@@ -1124,7 +1125,7 @@ def _string_literal(primary):
# as expected by the Ada type corresponding to Octet String
unsigned_8
=
[
str
(
ord
(
val
))
for
val
in
primary
.
value
[
1
:
-
1
]]
ada_string
=
'(Data => ('
+
', '
.
join
(
unsigned_8
)
+
', others => 0)'
unsigned_8
)
+
', others => 0)'
if
basic_type
.
Min
!=
basic_type
.
Max
:
# Non-fixed string size -> add Length field
ada_string
+=
', Length => {}'
.
format
(
...
...
@@ -1143,7 +1144,6 @@ def _constant(primary):
def
_mantissa_base_exp
(
primary
):
''' Generate code for a Real with Mantissa-base-Exponent representation '''
# TODO
_
=
primary
return
[],
''
,
[]
...
...
@@ -1161,9 +1161,9 @@ def _if_then_else(ifThenElse):
tmp_type
=
'String(1 .. {})'
.
format
(
max
(
lens
)
-
2
)
# Ada require fixed-length strings, adjust with spaces
if
lens
[
0
]
<
lens
[
1
]:
then_str
=
then_str
[
0
:
-
1
]
+
' '
*
(
lens
[
1
]
-
lens
[
0
])
+
'"'
then_str
=
then_str
[
0
:
-
1
]
+
' '
*
(
lens
[
1
]
-
lens
[
0
])
+
'"'
elif
lens
[
1
]
<
lens
[
0
]:
else_str
=
else_str
[
0
:
-
1
]
+
' '
*
(
lens
[
0
]
-
lens
[
1
])
+
'"'
else_str
=
else_str
[
0
:
-
1
]
+
' '
*
(
lens
[
0
]
-
lens
[
1
])
+
'"'
else
:
tmp_type
=
'asn1Scc'
+
resType
.
ReferencedTypeName
.
replace
(
'-'
,
'_'
)
local_decl
=
[
'tmp{idx} : {tmpType};'
.
format
(
...
...
@@ -1255,7 +1255,7 @@ def _choiceitem(choice):
stmts
,
choice_str
,
local_decl
=
expression
(
choice
.
value
[
'value'
])
choiceType
=
choice
.
exprType
actual_type
=
getattr
(
choiceType
,
'ReferencedTypeName'
,
None
)
or
choiceType
.
kind
choiceType
,
'ReferencedTypeName'
,
None
)
or
choiceType
.
kind
actual_type
=
actual_type
.
replace
(
'-'
,
'_'
)
ada_string
=
'asn1Scc{cType}_{opt}_set({expr})'
.
format
(
cType
=
actual_type
,
...
...
@@ -1379,7 +1379,7 @@ def _transition(tr):
unicode
(
tr
.
terminator
.
next_id
)
+
u
';'
)
if
tr
.
terminator
.
next_id
==
-
1
:
code
.
append
(
u
'state := {nextState};'
.
format
(
nextState
=
tr
.
terminator
.
inputString
))
nextState
=
tr
.
terminator
.
inputString
))
else
:
if
any
(
next_id
for
next_id
in
tr
.
terminator
.
candidate_id
.
viewkeys
()
...
...
ogParser.py
View file @
c9f59d74
...
...
@@ -83,8 +83,8 @@ INTEGER = type('IntegerType', (object,), {'kind': 'IntegerType',
'Min'
:
str
(
-
(
2
**
63
)),
'Max'
:
str
(
2
**
63
-
1
)})
INT32
=
type
(
'Integer32Type'
,
(
object
,),
{
'kind'
:
'Integer32Type'
,
'Min'
:
'-2147483648'
,
'Max'
:
'2147483647'
})
'Min'
:
'-2147483648'
,
'Max'
:
'2147483647'
})
NUMERICAL
=
type
(
'NumericalType'
,
(
object
,),
{
'kind'
:
'Numerical'
})
TIMER
=
type
(
'TimerType'
,
(
object
,),
{
'kind'
:
'TimerType'
})
REAL
=
type
(
'RealType'
,
(
object
,),
{
'kind'
:
'RealType'
,
...
...
@@ -347,7 +347,6 @@ def fix_special_operators(op_name, expr_list, context):
elif
op_name
.
lower
()
==
'power'
:
if
len
(
expr_list
)
!=
2
:
raise
AttributeError
(
'The "power" operator takes two parameters'
)
types
=
{}
for
idx
,
expr
in
enumerate
(
expr_list
):
if
expr
.
exprType
is
UNKNOWN_TYPE
:
expr
.
exprType
=
find_variable
(
expr
.
value
[
0
],
context
)
...
...
@@ -377,7 +376,7 @@ def fix_special_operators(op_name, expr_list, context):
# Has to be a variable...otherwise, error!
try
:
param
.
exprType
=
find_variable
(
param
.
value
[
0
],
context
)
except
KeyError
,
AttributeError
:
except
(
KeyError
,
AttributeError
)
:
raise
TypeError
(
'Could not determine type of argument'
' "{}"'
.
format
(
param
.
inputString
))
basic
=
find_basic_type
(
param
.
exprType
)
...
...
@@ -604,7 +603,7 @@ def check_type_compatibility(primary, typeRef, context):
# Compare the types for semantic equivalence
try
:
compare_types
(
primary
.
value
[
ufield
].
exprType
,
fd_data
.
type
)
primary
.
value
[
ufield
].
exprType
,
fd_data
.
type
)
except
TypeError
as
err
:
raise
TypeError
(
'Field '
+
ufield
+
' is not of the proper type, i.e. '
+
...
...
@@ -640,10 +639,10 @@ def check_type_compatibility(primary, typeRef, context):
value
.
exprType
=
choice_field_type
# XXX
return
elif
isinstance
(
primary
,
ogAST
.
PrimChoiceDeterminant
)
\
and
actual_type
.
kind
.
startswith
(
'Choice'
):
and
actual_type
.
kind
.
startswith
(
'Choice'
):
for
choicekey
,
choice
in
actual_type
.
EnumValues
.
viewitems
():
if
choicekey
.
replace
(
'-'
,
'_'
).
lower
()
==
\
primary
.
inputString
.
lower
():
primary
.
inputString
.
lower
():
break
else
:
raise
TypeError
(
'Non-existent choice "{choice}" in type {t1}'
...
...
@@ -657,7 +656,7 @@ def check_type_compatibility(primary, typeRef, context):
return
elif
basic_type
.
kind
.
endswith
(
'StringType'
):
if
int
(
basic_type
.
Min
)
<=
len
(
primary
.
value
[
1
:
-
1
])
<=
int
(
basic_type
.
Max
):
primary
.
value
[
1
:
-
1
])
<=
int
(
basic_type
.
Max
):
return
else
:
raise
TypeError
(
'Invalid string literal - check that length is'
...
...
@@ -702,8 +701,7 @@ def compare_types(type_a, type_b):
else
:
raise
TypeError
(
'Incompatible arrays'
)
return
elif
type_a
.
kind
.
endswith
(
'StringType'
)
and
type_b
.
kind
.
endswith
(
'StringType'
):
elif
type_a
.
kind
.
endswith
(
'StringType'
)
and
type_b
.
kind
.
endswith
(
'StringType'
):
# Allow Octet String values to be printable strings.. for convenience
return
elif
not
(
type_a
.
kind
in
(
'IntegerType'
,
'Integer32Type'
)
and
...
...
@@ -824,7 +822,7 @@ def fix_expression_types(expr, context):
if
fd_expr
.
exprType
==
UNKNOWN_TYPE
:
try
:
expected_type
=
asn_type
.
Children
.
get
(
field
.
replace
(
'_'
,
'-'
)).
type
field
.
replace
(
'_'
,
'-'
)).
type
except
AttributeError
:
raise
TypeError
(
'Field not found: '
+
field
)
check_expr
=
ogAST
.
ExprAssign
()
...
...
@@ -1804,7 +1802,6 @@ def procedure(root, parent=None, context=None):
def
floating_label
(
root
,
parent
,
context
):
''' Floating label: name and optional transition '''
_
=
parent
errors
=
[]
warnings
=
[]
lab
=
ogAST
.
Floating_label
()
...
...
@@ -1840,6 +1837,7 @@ def floating_label(root, parent, context):
lab
.
terminators
=
list
(
context
.
terminators
[
terminators
:])
return
lab
,
errors
,
warnings
def
newtype_gettype
(
root
,
ta_ast
,
context
):
''' Returns the name of the new type created by a NEWTYPE construction '''
errors
=
[]
...
...
@@ -1847,27 +1845,29 @@ def newtype_gettype(root, ta_ast, context):
newtypename
=
""
if
(
root
.
getChild
(
0
).
type
!=
lexer
.
SORT
):
warnings
.
append
(
"Expected SORT in newtype identifier, got type:"
+
str
(
child
.
type
))
+
str
(
root
.
type
))
return
newtypename
,
errors
,
warnings
newtypename
=
root
.
getChild
(
0
).
getChild
(
0
).
text
return
newtypename
,
errors
,
warnings
def
get_array_type
(
root
):
''' Returns the subtype associated to an NEWTYPE ARRAY construction '''
indexSort
=
root
.
getChild
(
0
).
text
typeSort
=
root
.
getChild
(
1
).
text
#
indexSort = root.getChild(0).text
typeSort
=
root
.
getChild
(
1
).
text
typeSortLine
=
root
.
getChild
(
1
).
getLine
()
typeSortChar
=
root
.
getChild
(
1
).
getCharPositionInLine
()
# Constructing ASN.1 AST subtype
newtype
=
type
(
"SeqOf_type"
,
(
object
,),
{
"Line"
:
typeSortLine
,
"CharPositionInLine"
:
typeSortChar
,
"Kind"
:
"ReferenceType"
,
"ReferencedTypeName"
:
typeSort
"Line"
:
typeSortLine
,
"CharPositionInLine"
:
typeSortChar
,
"Kind"
:
"ReferenceType"
,
"ReferencedTypeName"
:
typeSort
})
return
newtype
def
get_struct_children
(
root
):
''' Returns the fields of a STRUCT as a dictionary '''
children
=
{}
...
...
@@ -1884,7 +1884,7 @@ def get_struct_children(root):
line
=
field
.
getChild
(
0
).
getLine
()
charpos
=
field
.
getChild
(
0
).
getCharPositionInLine
()
children
[
fieldname
]
=
type
(
str
(
fieldname
),
(
object
,),
{
children
[
fieldname
]
=
type
(
str
(
fieldname
),
(
object
,),
{
"Optional"
:
"False"
,
"Line"
:
line
,
"CharPositionInLine"
:
charpos
,
"type"
:
type
(
str
(
fieldname
+
"_type"
),
(
object
,),
{
...
...
@@ -1894,6 +1894,7 @@ def get_struct_children(root):
})
return
children
def
syntype
(
root
,
ta_ast
,
context
):
''' Parse a SYNTYPE definition and inject it in ASN1 AST'''
errors
=
[]
...
...
@@ -1903,21 +1904,22 @@ def syntype(root, ta_ast, context):
global
DV
newtypename
=
root
.
getChild
(
0
).
getChild
(
0
).
text
reftypename
=
root
.
getChild
(
1
).
getChild
(
0
).
text
#
reftypename = root.getChild(1).getChild(0).text
newtype
=
type
(
str
(
newtypename
),
(
object
,),
{
"Line"
:
root
.
getChild
(
0
).
getLine
(),
"CharPositionInLine"
:
root
.
getChild
(
0
).
getCharPositionInLine
(),
"Line"
:
root
.
getChild
(
0
).
getLine
(),
"CharPositionInLine"
:
root
.
getChild
(
0
).
getCharPositionInLine
(),
})
newtype
.
type
=
type
(
str
(
newtypename
)
+
"_type"
,
(
object
,),
{
"Line"
:
root
.
getChild
(
1
).
getLine
(),
"CharPositionInLine"
:
root
.
getChild
(
1
).
getCharPositionInLine
(),
"kind"
:
reftype
+
"Type"
"Line"
:
root
.
getChild
(
1
).
getLine
(),
"CharPositionInLine"
:
root
.
getChild
(
1
).
getCharPositionInLine
(),
"kind"
:
reftype
+
"Type"
})
DV
.
types
[
str
(
newtypename
)]
=
newtype
LOG
.
debug
(
"Found new SYNTYPE "
+
newtypename
)
return
errors
,
warnings
def
newtype
(
root
,
ta_ast
,
context
):
''' Parse a NEWTYPE definition and inject it in ASN1 AST'''
errors
=
[]
...
...
@@ -1929,8 +1931,8 @@ def newtype(root, ta_ast, context):
return
errors
,
warnings
newtype
=
type
(
str
(
newtypename
),
(
object
,),
{
"Line"
:
root
.
getLine
(),
"CharPositionInLine"
:
root
.
getCharPositionInLine
()})
"Line"
:
root
.
getLine
(),
"CharPositionInLine"
:
root
.
getCharPositionInLine
()})
if
(
root
.
getChild
(
1
).
type
==
lexer
.
ARRAY
):
newtype
.
kind
=
"SequenceOfType"
...
...
@@ -1939,7 +1941,7 @@ def newtype(root, ta_ast, context):
newtype
.
Max
=
"Max"
DV
.
types
[
str
(
newtypename
)]
=
newtype
LOG
.
debug
(
"Found new ARRAY type "
+
newtypename
)
elif
(
root
.
getChild
(
1
).
type
==
lexer
.
STRUCT
):
elif
(
root
.
getChild
(
1
).
type
==
lexer
.
STRUCT
):
newtype
.
kind
=
"SequenceType"
newtype
.
Children
=
get_struct_children
(
root
.
getChild
(
1
))
DV
.
types
[
str
(
newtypename
)]
=
newtype
...
...
@@ -1947,11 +1949,12 @@ def newtype(root, ta_ast, context):
else
:
warnings
.
append
(
'Unsupported type definition in newtype, type: '
+
str
(
child
.
type
))
str
(
root
.
type
))
# STRUCT CASE
return
errors
,
warnings
def
synonym
(
root
,
ta_ast
,
context
):
def
synonym
(
root
,
ta_ast
,
context
):
''' Parse a SYNONYM definition and inject it in ASN1 exported variables'''
errors
=
[]
warnings
=
[]
...
...
@@ -1967,6 +1970,7 @@ def synonym (root, ta_ast, context):
child
.
getChild
(
0
).
getChild
(
0
).
text
)
return
errors
,
warnings
def
text_area_content
(
root
,
ta_ast
,
context
):
''' Content of a text area: DCL, NEWTYPES, SYNTYPES, SYNONYMS, operators,
procedures '''
...
...
@@ -2221,7 +2225,7 @@ def process_definition(root, parent=None, context=None):
elif
child
.
type
==
lexer
.
START
:
# START transition (fills the mapping structure)
process
.
content
.
start
,
err
,
warn
=
start
(
child
,
context
=
process
)
child
,
context
=
process
)
errors
.
extend
(
err
)
warnings
.
extend
(
warn
)
elif
child
.
type
==
lexer
.
STATE
:
...
...
@@ -2402,7 +2406,7 @@ def state(root, parent, context):
elif
child
.
type
==
lexer
.
INPUT
:
# A transition triggered by an INPUT
inp
,
err
,
warn
=
\
input_part
(
child
,
parent
=
state_def
,
context
=
context
)
input_part
(
child
,
parent
=
state_def
,
context
=
context
)
errors
.
extend
(
err
)
warnings
.
extend
(
warn
)
try
:
...
...
@@ -2419,8 +2423,8 @@ def state(root, parent, context):
asterisk_input
=
inp
elif
child
.
type
==
lexer
.
CONNECT
:
if
asterisk_state
or
len
(
state_def
.
statelist
)
!=
1
\
or
(
state_def
.
statelist
[
0
].
lower
()
not
in
(
comp
.
statename
for
comp
in
context
.
composite_states
)):
or
(
state_def
.
statelist
[
0
].
lower
()
not
in
(
comp
.
statename
for
comp
in
context
.
composite_states
)):
errors
.
append
(
'State {} is not a composite state and cannot '
'be followed by a connect statement'
.
format
(
state_def
.
statelist
[
0
]))
...
...
@@ -2903,7 +2907,7 @@ def terminator_statement(root, parent, context):
t
.
kind
=
'return'
if
term
.
children
:
t
.
return_expr
,
err
,
warn
=
expression
(
term
.
getChild
(
0
),
context
)
term
.
getChild
(
0
),
context
)
t
.
inputString
=
t
.
return_expr
.
inputString
errors
.
extend
(
err
)
warnings
.
extend
(
warn
)
...
...
@@ -3247,7 +3251,7 @@ def pr_file(root):
# In case no ASN.1 files are parsed, the DV structure is pre-initialised
# This to allow SDL types injection in ASN1 ASTs
DV
=
type
(
"ASNParseTree"
,
(
object
,
),
{
"types"
:
{},
"exportedVariables"
:
{},
"asn1Modules"
:
[]
})
{
"types"
:
{},
"exportedVariables"
:
{},
"asn1Modules"
:
[]})
# Re-order the children of the AST to make sure system and use clauses
# are parsed before process definition - to get signal definitions
...
...
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