Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenGEODE
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
TASTE
OpenGEODE
Commits
e69cc03f
Commit
e69cc03f
authored
Sep 28, 2019
by
Maxime Perrotin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep fixing index issues
parent
87a430eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletion
+31
-1
opengeode/ogParser.py
opengeode/ogParser.py
+31
-1
No files found.
opengeode/ogParser.py
View file @
e69cc03f
...
...
@@ -2112,6 +2112,11 @@ def primary_index(root, context, pos):
# pos is either right or left. left if it is an assigned variable
# root.children[1] is the index
# if pos is left, we check here if the type is mutable or not
# an array of variable size is immutable and must be assigned
# with an ASN.1 Value notation (to set the size)
# an array of fixed size is mutable - individual values can be updated
node
,
errors
,
warnings
=
ogAST
.
PrimIndex
(),
[],
[]
node
.
exprType
=
UNKNOWN_TYPE
...
...
@@ -2138,15 +2143,26 @@ def primary_index(root, context, pos):
r_min
,
r_max
=
substring_range
(
receiver
)
else
:
r_min
,
r_max
=
receiver_bty
.
Min
,
receiver_bty
.
Max
# check if the type is mutable (explanation above)
mutable_type
=
(
pos
==
"right"
)
or
(
r_min
==
r_max
)
if
not
mutable_type
:
errors
.
append
(
error
(
root
,
"Variable-length type is immutable, "
"you must assign all values at once to set the size "
"(syntax: variable := {3, 14, 15})"
))
# Is that correct for SEQOF ? the exprType of the node should be the
# type of the elements of the SEQOF, not the SEQOF type itself, no?
node
.
exprType
=
receiver_bty
.
type
idx_bty
=
find_basic_type
(
params
[
0
].
exprType
)
if
not
is_integer
(
idx_bty
):
errors
.
append
(
error
(
root
,
'Index is not an integer'
))
elif
is_number
(
idx_bty
):
# Check range only is index is given as a raw number
if
float
(
idx_bty
.
Max
)
>=
float
(
r_max
):
if
float
(
idx_bty
.
Max
)
>=
float
(
r_max
)
\
or
float
(
idx_bty
.
Min
)
<
1
:
errors
.
append
(
error
(
root
,
'Index range [{id1} .. {id2}] '
'outside of range [{r1} .. {r2}]'
...
...
@@ -2165,6 +2181,8 @@ def primary_index(root, context, pos):
def
primary_substring
(
root
,
context
,
pos
):
''' Primary substring analysis '''
# Check documentation of primary_index
node
,
errors
,
warnings
=
ogAST
.
PrimSubstring
(),
[],
[]
node
.
exprType
=
UNKNOWN_TYPE
...
...
@@ -2204,6 +2222,18 @@ def primary_substring(root, context, pos):
LOG
.
debug
(
'In primary_substring: '
+
str
(
err
))
min1
,
max1
=
0
,
0
# check if the type is mutable
if
isinstance
(
receiver
,
ogAST
.
PrimSubstring
):
r_min
,
r_max
=
substring_range
(
receiver
)
else
:
r_min
,
r_max
=
receiver_bty
.
Min
,
receiver_bty
.
Max
mutable_type
=
(
pos
==
"right"
)
or
(
r_min
==
r_max
)
if
not
mutable_type
:
errors
.
append
(
error
(
root
,
"Variable-length type is immutable, "
"you must assign all values at once to set the size "
"(syntax: variable := {3, 14, 15})"
))
#node.exprType = type('SubStr', (receiver_bty,),
# The substring has to be subtyping the original type to get its name
# This is needed to support expressions such as "a(1,2) := {1,1}"
...
...
Write
Preview
Markdown
is supported
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