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
20aea56d
Commit
20aea56d
authored
Apr 24, 2017
by
Maxime Perrotin
Browse files
Complete "rename_everything" functions
parent
9fb7b05b
Changes
3
Hide whitespace changes
Inline
Side-by-side
opengeode/AdaGenerator.py
View file @
20aea56d
...
...
@@ -1393,12 +1393,12 @@ def _task_forloop(task, **kwargs):
else
:
# Step is not directly supported in Ada, we need to use 'while'
stmt
.
extend
([
'declare'
,
u
'{it} :
Integer := Integer(
{start}
)
;'
u
'{it} :
Asn1Int :=
{start};'
.
format
(
it
=
loop
[
'var'
],
start
=
start_str
),
''
,
'begin'
,
u
'while {it} <
Integer(
{stop}
)
loop'
u
'while {it} < {stop} loop'
.
format
(
it
=
loop
[
'var'
],
stop
=
stop_str
)])
# Add iterator to the list of local variables
LOCAL_VAR
.
update
({
loop
[
'var'
]:
(
loop
[
'type'
],
None
)})
...
...
opengeode/Helper.py
View file @
20aea56d
...
...
@@ -508,10 +508,19 @@ def _rename_expr(ast, from_name, to_name):
@
rename_everything
.
register
(
ogAST
.
PrimIndex
)
def
_rename_index
(
ast
,
from_name
,
to_name
):
''' Index of an array '''
rename_everything
(
ast
.
value
[
0
],
from_name
,
to_name
)
for
each
in
ast
.
value
[
1
][
'index'
]:
rename_everything
(
each
,
from_name
,
to_name
)
@
rename_everything
.
register
(
ogAST
.
PrimSubstring
)
def
_rename_substring
(
ast
,
from_name
,
to_name
):
''' Substrings '''
rename_everything
(
ast
.
value
[
0
],
from_name
,
to_name
)
for
each
in
ast
.
value
[
1
][
'substring'
]:
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 '''
...
...
tests/regression/test-strings/og.pr
View file @
20aea56d
...
...
@@ -43,8 +43,8 @@ endfor;
/* CIF PROCEDURECALL (609, 306), (129, 35) */
CALL writeln(result);
/* CIF TASK (596, 356), (155, 53) */
TASK for sep in a:
call writeln(sep);
TASK for sep
2
in a:
call writeln(sep
2
);
endfor
/* CIF COMMENT (771, 365), (194, 38) */
COMMENT 'Test to check scope
...
...
@@ -58,4 +58,4 @@ endfor
ENDSTATE;
ENDPROCESS og;
ENDBLOCK;
ENDSYSTEM;
\ No newline at end of file
ENDSYSTEM;
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