Пример #1
0
def p_statement_declaration_affetation_shape(p):
    '''STATEMENT : SHAPE ABSTRACT_VARIABLE_NAME AFFECTATION EXPRESSION'''
    declaration = AST.DeclarationNode(AST.TypeShapeNode(), p[2])
    affectation = AST.AffectationNode(copy(p[2]), p[4], lineno=p.lineno(2))
    p[0] = AST.BlockNode([declaration, affectation], "declaraffect")
Пример #2
0
def p_statement_declaration_affetation_boolean(p):
    '''STATEMENT : BOOLEAN ABSTRACT_VARIABLE_NAME AFFECTATION EXPRESSION'''
    declaration = AST.DeclarationNode(AST.TypeBooleanNode(), p[2])
    affectation = AST.AffectationNode(copy(p[2]), p[4], lineno=p.lineno(2))
    # micro block for the shorthand (can't use the list syntax because it's a STATEMENT (one-line), and not a ABSTRACT_STATEMENT)
    p[0] = AST.BlockNode([declaration, affectation], "declaraffect")
Пример #3
0
def p_statement_declaration_integer(p):
    '''STATEMENT : INTEGER ABSTRACT_VARIABLE_NAME'''
    p[0] = AST.DeclarationNode(AST.TypeIntegerNode(), p[2])
Пример #4
0
def p_statement_declaration_shape(p):
    '''STATEMENT : SHAPE ABSTRACT_VARIABLE_NAME'''
    p[0] = AST.DeclarationNode(AST.TypeShapeNode(), p[2])
Пример #5
0
def p_statement_declaration_boolean(p):
    '''STATEMENT : BOOLEAN ABSTRACT_VARIABLE_NAME'''
    p[0] = AST.DeclarationNode(AST.TypeBooleanNode(), p[2])