Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parser-fplo
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nomad-lab
parser-fplo
Commits
05f8a99e
Commit
05f8a99e
authored
8 years ago
by
Henning Glawe
Browse files
Options
Downloads
Patches
Plain Diff
replace end_of_declaration by pos_in_statement
parent
83d96a31
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
parser/parser-fplo/FploInputParser.py
+11
-11
11 additions, 11 deletions
parser/parser-fplo/FploInputParser.py
with
11 additions
and
11 deletions
parser/parser-fplo/FploInputParser.py
+
11
−
11
View file @
05f8a99e
...
...
@@ -356,18 +356,18 @@ class concrete_statement(concrete_node):
if
len
(
self
.
items
)
<
1
:
return
None
result
=
None
end_of_declaration
=
0
pos_in_statement
=
0
# check declarations
if
isinstance
(
self
.
items
[
0
],
token_keyword
):
if
self
.
items
[
0
].
value
==
'
section
'
:
result
=
AST_section
(
self
.
items
[
1
].
value
)
# name of section
result
.
append_block
(
self
.
items
[
2
].
to_AST
())
# section-block
end_of_declaration
=
2
pos_in_statement
=
3
if
self
.
items
[
0
].
value
==
'
struct
'
:
struct
=
AST_datatype_struct
()
struct
.
append_block
(
self
.
items
[
1
].
to_AST
())
result
=
AST_declaration
(
self
.
items
[
2
].
value
,
struct
)
end_of_declaration
=
2
pos_in_statement
=
3
elif
isinstance
(
self
.
items
[
0
],
token_datatype
):
primtype
=
AST_datatype_primitive
(
self
.
items
[
0
].
value
)
if
primtype
.
name
==
'
char
'
and
isinstance
(
self
.
items
[
1
],
concrete_subscript
):
...
...
@@ -375,22 +375,22 @@ class concrete_statement(concrete_node):
# not correct in C, but all declared chars in FPLO input
# are char arrays
declaration_name
=
self
.
items
[
2
].
value
end_of_declaration
=
2
pos_in_statement
=
3
else
:
declaration_name
=
self
.
items
[
1
].
value
end_of_declaration
=
1
pos_in_statement
=
2
result
=
AST_declaration
(
declaration_name
,
primtype
)
if
(
(
len
(
self
.
items
)
-
1
>
end_of_declaration
)
and
isinstance
(
self
.
items
[
end_of_declaration
+
1
],
concrete_subscript
)
(
len
(
self
.
items
)
>
pos_in_statement
)
and
isinstance
(
self
.
items
[
pos_in_statement
],
concrete_subscript
)
):
# subscript in LHS declares shape
if
not
isinstance
(
result
,
AST_declaration
):
raise
RuntimeError
(
'
encountered subscript on non-declaration
'
)
end_of_declaration
=
end_of_declaration
+
1
result
.
set_shape
(
self
.
items
[
end_of_declaration
].
to_AST_shape
())
if
len
(
self
.
items
)
-
1
>
end_of_declaration
:
LOGGER
.
error
(
"
token following declaration: %s
"
,
str
(
self
.
items
[
end_of_declaration
+
1
]))
result
.
set_shape
(
self
.
items
[
pos_in_statement
].
to_AST_shape
())
pos_in_statement
=
pos_in_statement
+
1
if
len
(
self
.
items
)
>
pos_in_statement
:
LOGGER
.
error
(
"
token following declaration: %s
"
,
str
(
self
.
items
[
pos_in_statement
]))
# else:
# LOGGER.error("token following declaration: None")
return
result
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment