Exemple #1
0
def p_opaque_enum_declaration(p):
    """ opaque-enum-declaration : enum-key IDENTIFIER """
    p[0] = risha_ast.enums.EnumHead(enum_key=p[1],
                                    identifier=risha_ast.Identifier(
                                        identifier=p[2],
                                        row=p.lineno(2),
                                        col=p.lexpos(2)),
                                    row=p[1].row,
                                    col=p[1].col)
Exemple #2
0
def p_elaborated_type_specifier_class(p):
    """ elaborated-type-specifier : CLASS IDENTIFIER """
    p[0] = risha_ast.ClassHead(class_key=p[1],
                               class_name=risha_ast.Identifier(
                                   identifier=p[2],
                                   row=p.lineno(2),
                                   col=p.lexpos(2)),
                               row=p.lineno(1),
                               col=p.lexpos(1))
Exemple #3
0
def p_elaborated_type_specifier_enum(p):
    """ elaborated-type-specifier : enum-key IDENTIFIER """
    p[0] = risha_ast.enums.EnumHead(enum_key=p[1],
                                    identifier=risha_ast.Identifier(
                                        identifier=p[2],
                                        row=p.lineno(2),
                                        col=p.lexpos(2)),
                                    row=p[1].row,
                                    col=p[1].col)
Exemple #4
0
def p_alias_declaration(p):
    """ alias-declaration : USING IDENTIFIER ASSIGNMENT type-id SEMICOLON """
    p[0] = risha_ast.AliasDeclaration(
        identifier=risha_ast.Identifier(identifier=p[2],
                                        row=p.lineno(2),
                                        col=p.lexpos(2)),
        type_id=p[4],
        row=p.lineno(1),
        col=p.lexpos(1))
Exemple #5
0
def p_enum_head(p):
    """ enum-head : enum-key
                  | enum-key IDENTIFIER """
    if len(p) == 2:
        p[0] = risha_ast.enums.EnumHead(enum_key=p[1],
                                        identifier=None,
                                        row=p[1].row,
                                        col=p[1].col)
    else:
        p[0] = risha_ast.enums.EnumHead(enum_key=p[1],
                                        identifier=risha_ast.Identifier(
                                            identifier=p[2],
                                            row=p.lineno(2),
                                            col=p.lexpos(2)),
                                        row=p[1].row,
                                        col=p[1].col)
Exemple #6
0
def p_enumerator(p):
    """ enumerator : IDENTIFIER """
    p[0] = risha_ast.Identifier(identifier=p[1],
                                row=p.lineno(1),
                                col=p.lexpos(1))
Exemple #7
0
def p_enum_name(p):
    """ enum-name : IDENTIFIER """
    p[0] = risha_ast.Identifier(identifier=p[1],
                                row=p.lineno(1),
                                col=p.lineno(1))
Exemple #8
0
def p_unqualified_id_identifier(p):
    """ unqualified-id : IDENTIFIER """
    p[0] = risha_ast.Identifier(identifier=p[1],
                                row=p.lineno(1),
                                col=p.lexpos(1))
Exemple #9
0
def p_class_name(p):
    """ class-name : IDENTIFIER """
    p[0] = risha_ast.Identifier(identifier=p[1],
                                row=p.lineno(1),
                                col=p.lexpos(1))