Exemple #1
0
 def validate_ast(self, ast):
     if ast[0] in main_grammar.validators:
         print "VALIDATING", ast, "=>",
         ret = main_grammar.validators[ast[0]](ast)
         print ret
         print 'ROOT', id_engine.root()
         print 'CURPATH', id_engine.current().full_path
         print 'CURRENT', id_engine.current()
         return ret
     else:
         print "AST", ast
         return ast
Exemple #2
0
def expr_p1(ast):
    id = ast[-1]
    spec = len(id) == 3 and id[-1] or None
    print
    print "EXPR_P1", len(ast), ast, id[1][1]
    if len(ast) == 2:
        what = id_engine.resolve(id[1][1], False)
    elif len(ast) == 3:
        what = id_engine.root().resolve(id[1][1], False)
    else:
        what = ast[1].resolve(id[1][1], True)
    if spec:
        return what.match_specialization(spec)
    else:
        return what