示例#1
0
文件: cpp.py 项目: bl0b/cppy
 def __init__(self, f):
     #Scope.__init__(self)
     self.parent = None
     lines = cpp_read(f)
     start = 0
     self.sub = []
     #self.root = Namespace()
     self.root = namespace.root()
     #self.root.enter()
     for t in ('int', 'float', 'double', 'char', 'wchar_t'):
         #self[tuple(tokenize(t))] = 'type'
         #Namespace.current().add_type(('symbol', t))
         namespace.add_type((('symbol', t),))
     #print self
     #print str(namespace.current())
     while start < len(lines):
         statement, start = Cpp.parse(self, lines, start, 0)
         self.sub.append(statement)
     namespace.leave(self.root)
示例#2
0
文件: parser.py 项目: bl0b/cppy
 def __init__(self):
     Automaton.__init__(self, start_symbol, grammar, cpp_scanner)
     self.scope_stack = [{}]
     self.root = ns.root()
     self.ns = self.root