def FunCall(): fname = yield ps.token(TOKEN.IDENTIFIER) yield ps.token(TOKEN.PAR_OPEN) found_args = yield ps.times(ActArgs, 0, 1) found_args = found_args[0] if len(found_args) > 0 else [] yield ps.token(TOKEN.PAR_CLOSE) return AST.FUNCALL(id=fname, kind=FunKind.FUNC, args=found_args)
def PrefixOpExp(): op = yield ps.token(TOKEN.OP_IDENTIFIER) exp = yield ConvExp return AST.FUNCALL(kind=FunKind.PREFIX, id=op, args=[AST.DEFERREDEXPR(contents=[exp])])
AST.STMT(val=AST.RETURN(expr=None)), AST.LOOP( init=AST.ACTSTMT(val=AST.ASSIGNMENT( varref=AST.VARREF(id=Token(None, TOKEN.IDENTIFIER, "x"), fields=[]), expr=AST.DEFERREDEXPR( contents=[Token(None, TOKEN.IDENTIFIER, "x") ]))), cond=AST.DEFERREDEXPR(contents=[ Token(None, TOKEN.IDENTIFIER, "x"), Token(None, TOKEN.OP_IDENTIFIER, "=="), Token(None, TOKEN.IDENTIFIER, "y") ]), update=AST.FUNCALL(id=Token(None, TOKEN.IDENTIFIER, "f"), kind=FunKind.FUNC, args=[]), stmts=[ AST.STMT( val=AST.RETURN(expr=None)), AST.STMT(val=AST.IFELSE(condbranches=[ AST.CONDBRANCH(expr=AST.DEFERREDEXPR(contents=[ Token(None, TOKEN.IDENTIFIER, "x"), Token(None, TOKEN.OP_IDENTIFIER, "=="), Token(None, TOKEN.IDENTIFIER, "y") ]), stmts=[ AST.STMT(val=AST.RETURN( expr=None)) ]), AST.CONDBRANCH(expr=AST.DEFERREDEXPR(contents=[