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
01704451
Commit
01704451
authored
8 years ago
by
Henning Glawe
Browse files
Options
Downloads
Patches
Plain Diff
remove nomadmetainfo methods from concrete_node hierarchy
parent
dc0c7015
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
+0
-39
0 additions, 39 deletions
parser/parser-fplo/FploInputParser.py
with
0 additions
and
39 deletions
parser/parser-fplo/FploInputParser.py
+
0
−
39
View file @
01704451
...
...
@@ -341,43 +341,11 @@ class concrete_node(object):
result
=
result
+
indent
+
'
'
+
str
(
item
)
+
'
\n
'
return
result
def
nomadmetainfo
(
self
,
prefix
):
pass
def
to_AST
(
self
):
raise
Exception
(
"
unimplemented to_AST in %s
"
%
(
self
.
__class__
.
__name__
))
class
concrete_statement
(
concrete_node
):
def
nomadmetainfo
(
self
,
prefix
,
indent
):
if
len
(
self
.
items
)
<
1
:
return
None
if
isinstance
(
self
.
items
[
0
],
token_keyword
):
if
self
.
items
[
0
].
value
==
'
section
'
:
# section
secname
=
prefix
+
'
.
'
+
self
.
items
[
1
].
value
sys
.
stderr
.
write
(
"
%ssection %s
\n
"
%
(
indent
,
secname
))
if
isinstance
(
self
.
items
[
2
],
concrete_block
):
self
.
items
[
2
].
nomadmetainfo
(
secname
,
indent
+
'
'
)
else
:
raise
Exception
(
"
No block for %s
"
%
(
indent
+
'
'
))
elif
self
.
items
[
0
].
value
==
'
struct
'
:
structname
=
prefix
+
'
.
'
+
self
.
items
[
2
].
value
if
len
(
self
.
items
)
>
3
and
isinstance
(
self
.
items
[
3
],
concrete_subscript
):
struct_subscript
=
str
(
self
.
items
[
3
])
else
:
struct_subscript
=
''
# struct
sys
.
stderr
.
write
(
"
%sstruct %s%s
\n
"
%
(
indent
,
structname
,
struct_subscript
))
if
isinstance
(
self
.
items
[
1
],
concrete_block
):
self
.
items
[
1
].
nomadmetainfo
(
structname
,
indent
+
'
'
)
else
:
sys
.
stderr
.
write
(
"
%s NOBLOCK
"
%
(
indent
+
'
'
))
elif
isinstance
(
self
.
items
[
0
],
token_datatype
):
sys
.
stderr
.
write
(
"
%s%s
\n
"
%
(
indent
+
'
'
,
self
.
items
[
0
].
value
))
else
:
LOGGER
.
error
(
"
no idea what to do with statement starting with %s
"
,
str
(
self
.
items
[
0
]))
def
to_AST
(
self
):
if
len
(
self
.
items
)
<
1
:
return
None
...
...
@@ -519,12 +487,6 @@ class concrete_statement(concrete_node):
return
(
result_names
,
result_values
)
class
concrete_block
(
concrete_node
):
def
nomadmetainfo
(
self
,
prefix
,
indent
):
if
len
(
self
.
items
)
<
1
:
return
None
for
item
in
self
.
items
:
item
.
nomadmetainfo
(
prefix
,
indent
)
def
to_AST
(
self
):
if
len
(
self
.
items
)
<
1
:
return
None
...
...
@@ -688,7 +650,6 @@ class FploInputParser(object):
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
# sys.stderr.write(self.concrete_statements.indented_dump('')) # json.dumps(self.concrete_statements, sort_keys=True, indent=4, separators=(',', ': ')))
# self.concrete_statements.nomadmetainfo('x_fplo_in','')
AST
=
self
.
concrete_statements
.
to_AST
()
sys
.
stderr
.
write
(
'
AST:
\n
'
)
sys
.
stderr
.
flush
()
...
...
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