Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r4040425 rbd85400  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  2 17:24:45 2016
    13 // Update Count     : 1495
     12// Last Modified On : Mon Feb  1 18:22:42 2016
     13// Update Count     : 1483
    1414//
    1515
     
    7474%token FORALL LVALUE                                                                    // CFA
    7575%token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
    76 %token VALIST                                                                                   // GCC
    7776%token BOOL COMPLEX IMAGINARY                                                   // C99
    7877%token TYPEOF LABEL                                                                             // GCC
    7978%token ENUM STRUCT UNION
    80 %token OTYPE FTYPE DTYPE TRAIT                                          // CFA
     79%token TYPE FTYPE DTYPE CONTEXT                                                 // CFA
    8180%token SIZEOF OFFSETOF
    8281%token ATTRIBUTE EXTENSION                                                              // GCC
     
    172171%type<decl> basic_declaration_specifier basic_type_name basic_type_specifier direct_type_name indirect_type_name
    173172
    174 %type<decl> trait_declaration trait_declaration_list trait_declaring_list trait_specifier
     173%type<decl> context_declaration context_declaration_list context_declaring_list context_specifier
    175174
    176175%type<decl> declaration declaration_list declaration_list_opt declaration_qualifier_list
     
    198197%type<decl> new_array_parameter_1st_dimension
    199198
    200 %type<decl> new_trait_declaring_list new_declaration new_field_declaring_list
     199%type<decl> new_context_declaring_list new_declaration new_field_declaring_list
    201200%type<decl> new_function_declaration new_function_return new_function_specifier
    202201
     
    449448                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::SizeOf ), new TypeValueNode( $3 )); }
    450449        | OFFSETOF '(' type_name_no_function ',' no_attr_identifier ')'
    451                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::OffsetOf ), new TypeValueNode( $3 ), new VarRefNode( $5 )); }
     450        { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::OffsetOf ), new TypeValueNode( $3 ), new VarRefNode( $5 )); }
    452451        | ATTR_IDENTIFIER
    453452                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 )); }
     
    10211020        | new_function_declaration pop ';'
    10221021        | type_declaring_list pop ';'
    1023         | trait_specifier pop ';'
     1022        | context_specifier pop ';'
    10241023        ;
    10251024
     
    13461345        | IMAGINARY                                                                                     // C99
    13471346                { $$ = DeclarationNode::newBasicType( DeclarationNode::Imaginary ); }
    1348         | VALIST                                                                                        // GCC, __builtin_va_list
    1349                 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
    13501347        ;
    13511348
     
    18061803
    18071804type_class:                                                                                             // CFA
    1808         OTYPE
     1805        TYPE
    18091806                { $$ = DeclarationNode::Type; }
    18101807        | DTYPE
     
    18241821        '|' no_attr_identifier_or_type_name '(' type_name_list ')'
    18251822                {
    1826                         typedefTable.openTrait( *$2 );
    1827                         $$ = DeclarationNode::newTraitUse( $2, $4 );
    1828                 }
    1829         | '|' '{' push trait_declaration_list '}'
     1823                        typedefTable.openContext( *$2 );
     1824                        $$ = DeclarationNode::newContextUse( $2, $4 );
     1825                }
     1826        | '|' '{' push context_declaration_list '}'
    18301827                { $$ = $4; }
    1831         | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list '}' '(' type_name_list ')'
     1828        | '|' '(' push type_parameter_list pop ')' '{' push context_declaration_list '}' '(' type_name_list ')'
    18321829                { $$ = 0; }
    18331830        ;
     
    18441841
    18451842type_declaring_list:                                                                    // CFA
    1846         OTYPE type_declarator
    1847                 { $$ = $2; }
    1848         | storage_class_list OTYPE type_declarator
     1843        TYPE type_declarator
     1844                { $$ = $2; }
     1845        | storage_class_list TYPE type_declarator
    18491846                { $$ = $3->addQualifiers( $1 ); }
    18501847        | type_declaring_list ',' type_declarator
     
    18721869        ;
    18731870
    1874 trait_specifier:                                                                                // CFA
    1875         TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' '}'
     1871context_specifier:                                                                              // CFA
     1872        CONTEXT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' '}'
    18761873                {
    18771874                        typedefTable.addToEnclosingScope( *$2, TypedefTable::ID );
    1878                         $$ = DeclarationNode::newTrait( $2, $5, 0 );
    1879                 }
    1880         | TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{'
    1881                 {
    1882                         typedefTable.enterTrait( *$2 );
     1875                        $$ = DeclarationNode::newContext( $2, $5, 0 );
     1876                }
     1877        | CONTEXT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{'
     1878                {
     1879                        typedefTable.enterContext( *$2 );
    18831880                        typedefTable.enterScope();
    18841881                }
    1885           trait_declaration_list '}'
    1886                 {
    1887                         typedefTable.leaveTrait();
     1882          context_declaration_list '}'
     1883                {
     1884                        typedefTable.leaveContext();
    18881885                        typedefTable.addToEnclosingScope( *$2, TypedefTable::ID );
    1889                         $$ = DeclarationNode::newTrait( $2, $5, $10 );
    1890                 }
    1891         ;
    1892 
    1893 trait_declaration_list:                                                         // CFA
    1894         trait_declaration
    1895         | trait_declaration_list push trait_declaration
     1886                        $$ = DeclarationNode::newContext( $2, $5, $10 );
     1887                }
     1888        ;
     1889
     1890context_declaration_list:                                                               // CFA
     1891        context_declaration
     1892        | context_declaration_list push context_declaration
    18961893                { $$ = $1->appendList( $3 ); }
    18971894        ;
    18981895
    1899 trait_declaration:                                                                      // CFA
    1900         new_trait_declaring_list pop ';'
    1901         | trait_declaring_list pop ';'
    1902         ;
    1903 
    1904 new_trait_declaring_list:                                                               // CFA
     1896context_declaration:                                                                    // CFA
     1897        new_context_declaring_list pop ';'
     1898        | context_declaring_list pop ';'
     1899        ;
     1900
     1901new_context_declaring_list:                                                             // CFA
    19051902        new_variable_specifier
    19061903                {
     
    19131910                        $$ = $1;
    19141911                }
    1915         | new_trait_declaring_list pop ',' push identifier_or_type_name
     1912        | new_context_declaring_list pop ',' push identifier_or_type_name
    19161913                {
    19171914                        typedefTable.addToEnclosingScope2( *$5, TypedefTable::ID );
     
    19201917        ;
    19211918
    1922 trait_declaring_list:                                                                   // CFA
     1919context_declaring_list:                                                                 // CFA
    19231920        type_specifier declarator
    19241921                {
     
    19261923                        $$ = $2->addType( $1 );
    19271924                }
    1928         | trait_declaring_list pop ',' push declarator
     1925        | context_declaring_list pop ',' push declarator
    19291926                {
    19301927                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
Note: See TracChangeset for help on using the changeset viewer.