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
20666c3c
Commit
20666c3c
authored
Apr 22, 2017
by
Maxime Perrotin
Browse files
Fix Helper/Model flatten function
rename everything did not cover variable indexes
parent
4a1ca33e
Changes
3
Hide whitespace changes
Inline
Side-by-side
opengeode/AdaGenerator.py
View file @
20666c3c
...
...
@@ -1443,11 +1443,11 @@ def expression(expr):
def
_primary_variable
(
prim
):
''' Single variable reference '''
var
=
find_var
(
prim
.
value
[
0
])
#print prim.inputString, prim.value[0].encode('utf-8')
if
not
var
or
is_local
(
var
):
sep
=
''
else
:
sep
=
LPREFIX
+
'.'
#sep = (LPREFIX + '.') if find_var(prim.value[0]) else u''
ada_string
=
u
'{sep}{name}'
.
format
(
sep
=
sep
,
name
=
prim
.
value
[
0
])
...
...
@@ -1619,19 +1619,19 @@ def _prim_index(prim):
receiver
=
prim
.
value
[
0
]
receiver_stms
,
reciver_string
,
receiver_decl
=
expression
(
receiver
)
ada_string
=
reciver_string
receiver_stms
,
ada_string
,
receiver_decl
=
expression
(
receiver
)
stmts
.
extend
(
receiver_stms
)
local_decl
.
extend
(
receiver_decl
)
idx_stmts
,
idx_string
,
idx_var
=
expression
(
prim
.
value
[
1
][
'index'
][
0
])
index
=
prim
.
value
[
1
][
'index'
][
0
]
idx_stmts
,
idx_string
,
idx_var
=
expression
(
index
)
if
unicode
.
isnumeric
(
idx_string
):
idx_string
=
int
(
idx_string
)
+
1
else
:
idx_string
=
'1
+
Integer({idx})'
.
format
(
idx
=
idx_string
)
idx_string
=
u
'1
+
Integer({idx})'
.
format
(
idx
=
idx_string
)
if
not
isinstance
(
receiver
,
ogAST
.
PrimSubstring
):
ada_string
+=
'.Data'
ada_string
+=
'({idx})'
.
format
(
idx
=
idx_string
)
ada_string
+=
u
'.Data'
ada_string
+=
u
'({idx})'
.
format
(
idx
=
idx_string
)
stmts
.
extend
(
idx_stmts
)
local_decl
.
extend
(
idx_var
)
...
...
opengeode/Helper.py
View file @
20666c3c
...
...
@@ -367,6 +367,7 @@ def rename_everything(ast, from_name, to_name):
in the scope of a composite state, so that they do not overwrite
a variable with the same name declared at a higher scope.
'''
LOG
.
debug
(
'rename_everything - '
+
str
(
ast
))
_
,
_
,
_
=
ast
,
from_name
,
to_name
...
...
@@ -499,6 +500,13 @@ def _rename_expr(ast, from_name, to_name):
rename_everything
(
ast
.
right
,
from_name
,
to_name
)
@
rename_everything
.
register
(
ogAST
.
PrimIndex
)
def
_rename_index
(
ast
,
from_name
,
to_name
):
''' Index of an array '''
for
each
in
ast
.
value
[
1
][
'index'
]:
rename_everything
(
each
,
from_name
,
to_name
)
@
rename_everything
.
register
(
ogAST
.
PrimVariable
)
def
_rename_path
(
ast
,
from_name
,
to_name
):
''' Ultimate seek point for the renaming: primary path/variables '''
...
...
opengeode/ogParser.py
View file @
20666c3c
...
...
@@ -4017,8 +4017,8 @@ def transition(root, parent, context):
trans
.
actions
.
append
(
proc_call
)
parent
=
proc_call
elif
child
.
type
==
lexer
.
LABEL
:
term_count
=
len
(
context
.
terminators
)
lab
,
err
,
warn
=
label
(
child
,
parent
=
parent
)
term_count
=
len
(
context
.
terminators
)
lab
,
err
,
warn
=
label
(
child
,
parent
=
parent
)
terminators
[
lab
]
=
term_count
errors
.
extend
(
err
)
warnings
.
extend
(
warn
)
...
...
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