Example #1
0
 def __bstmt(self):
     if self.__check_tokentype(token.VAR):
         return self.__vdecl()
     elif self.__check_tokentype(token.SET):
         return self.__assign()
     elif self.__check_tokentype(token.IF):
         return self.__cond()
     elif self.__check_tokentype(token.WHILE):
         return self.__while()
     elif self.__check_tokentype(token.RETURN):
         return self.__exit()
     else:
         expr_stmt_node = ast.ExprStmt()
         expr_stmt_node.expr = self.__expr()
         self.__eat(token.SEMICOLON)
         return expr_stmt_node
Example #2
0
def p_stmt_stmt_expr(p):
    'stmt : stmt_expr SEMICOLON'
    p[0] = ast.ExprStmt(p[1], p.lineno(2))