Commit 01704451 authored by Henning Glawe's avatar Henning Glawe
Browse files

remove nomadmetainfo methods from concrete_node hierarchy

parent dc0c7015
......@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment