Ignore:
Timestamp:
Mar 3, 2016, 1:28:56 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
3627356
Parents:
9d7b3ea (diff), 4040425 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r9d7b3ea r36ebd03  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Feb  1 18:22:42 2016
    13 // Update Count     : 1483
     12// Last Modified On : Wed Mar  2 17:24:45 2016
     13// Update Count     : 1495
    1414//
    1515
     
    7474%token FORALL LVALUE                                                                    // CFA
    7575%token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
     76%token VALIST                                                                                   // GCC
    7677%token BOOL COMPLEX IMAGINARY                                                   // C99
    7778%token TYPEOF LABEL                                                                             // GCC
    7879%token ENUM STRUCT UNION
    79 %token TYPE FTYPE DTYPE CONTEXT                                                 // CFA
     80%token OTYPE FTYPE DTYPE TRAIT                                          // CFA
    8081%token SIZEOF OFFSETOF
    8182%token ATTRIBUTE EXTENSION                                                              // GCC
     
    171172%type<decl> basic_declaration_specifier basic_type_name basic_type_specifier direct_type_name indirect_type_name
    172173
    173 %type<decl> context_declaration context_declaration_list context_declaring_list context_specifier
     174%type<decl> trait_declaration trait_declaration_list trait_declaring_list trait_specifier
    174175
    175176%type<decl> declaration declaration_list declaration_list_opt declaration_qualifier_list
     
    197198%type<decl> new_array_parameter_1st_dimension
    198199
    199 %type<decl> new_context_declaring_list new_declaration new_field_declaring_list
     200%type<decl> new_trait_declaring_list new_declaration new_field_declaring_list
    200201%type<decl> new_function_declaration new_function_return new_function_specifier
    201202
     
    448449                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::SizeOf ), new TypeValueNode( $3 )); }
    449450        | OFFSETOF '(' type_name_no_function ',' no_attr_identifier ')'
    450         { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::OffsetOf ), new TypeValueNode( $3 ), new VarRefNode( $5 )); }
     451                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::OffsetOf ), new TypeValueNode( $3 ), new VarRefNode( $5 )); }
    451452        | ATTR_IDENTIFIER
    452453                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 )); }
     
    10201021        | new_function_declaration pop ';'
    10211022        | type_declaring_list pop ';'
    1022         | context_specifier pop ';'
     1023        | trait_specifier pop ';'
    10231024        ;
    10241025
     
    13451346        | IMAGINARY                                                                                     // C99
    13461347                { $$ = DeclarationNode::newBasicType( DeclarationNode::Imaginary ); }
     1348        | VALIST                                                                                        // GCC, __builtin_va_list
     1349                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
    13471350        ;
    13481351
     
    18031806
    18041807type_class:                                                                                             // CFA
    1805         TYPE
     1808        OTYPE
    18061809                { $$ = DeclarationNode::Type; }
    18071810        | DTYPE
     
    18211824        '|' no_attr_identifier_or_type_name '(' type_name_list ')'
    18221825                {
    1823                         typedefTable.openContext( *$2 );
    1824                         $$ = DeclarationNode::newContextUse( $2, $4 );
    1825                 }
    1826         | '|' '{' push context_declaration_list '}'
     1826                        typedefTable.openTrait( *$2 );
     1827                        $$ = DeclarationNode::newTraitUse( $2, $4 );
     1828                }
     1829        | '|' '{' push trait_declaration_list '}'
    18271830                { $$ = $4; }
    1828         | '|' '(' push type_parameter_list pop ')' '{' push context_declaration_list '}' '(' type_name_list ')'
     1831        | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list '}' '(' type_name_list ')'
    18291832                { $$ = 0; }
    18301833        ;
     
    18411844
    18421845type_declaring_list:                                                                    // CFA
    1843         TYPE type_declarator
    1844                 { $$ = $2; }
    1845         | storage_class_list TYPE type_declarator
     1846        OTYPE type_declarator
     1847                { $$ = $2; }
     1848        | storage_class_list OTYPE type_declarator
    18461849                { $$ = $3->addQualifiers( $1 ); }
    18471850        | type_declaring_list ',' type_declarator
     
    18691872        ;
    18701873
    1871 context_specifier:                                                                              // CFA
    1872         CONTEXT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' '}'
     1874trait_specifier:                                                                                // CFA
     1875        TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' '}'
    18731876                {
    18741877                        typedefTable.addToEnclosingScope( *$2, TypedefTable::ID );
    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 );
     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 );
    18801883                        typedefTable.enterScope();
    18811884                }
    1882           context_declaration_list '}'
    1883                 {
    1884                         typedefTable.leaveContext();
     1885          trait_declaration_list '}'
     1886                {
     1887                        typedefTable.leaveTrait();
    18851888                        typedefTable.addToEnclosingScope( *$2, TypedefTable::ID );
    1886                         $$ = DeclarationNode::newContext( $2, $5, $10 );
    1887                 }
    1888         ;
    1889 
    1890 context_declaration_list:                                                               // CFA
    1891         context_declaration
    1892         | context_declaration_list push context_declaration
     1889                        $$ = DeclarationNode::newTrait( $2, $5, $10 );
     1890                }
     1891        ;
     1892
     1893trait_declaration_list:                                                         // CFA
     1894        trait_declaration
     1895        | trait_declaration_list push trait_declaration
    18931896                { $$ = $1->appendList( $3 ); }
    18941897        ;
    18951898
    1896 context_declaration:                                                                    // CFA
    1897         new_context_declaring_list pop ';'
    1898         | context_declaring_list pop ';'
    1899         ;
    1900 
    1901 new_context_declaring_list:                                                             // CFA
     1899trait_declaration:                                                                      // CFA
     1900        new_trait_declaring_list pop ';'
     1901        | trait_declaring_list pop ';'
     1902        ;
     1903
     1904new_trait_declaring_list:                                                               // CFA
    19021905        new_variable_specifier
    19031906                {
     
    19101913                        $$ = $1;
    19111914                }
    1912         | new_context_declaring_list pop ',' push identifier_or_type_name
     1915        | new_trait_declaring_list pop ',' push identifier_or_type_name
    19131916                {
    19141917                        typedefTable.addToEnclosingScope2( *$5, TypedefTable::ID );
     
    19171920        ;
    19181921
    1919 context_declaring_list:                                                                 // CFA
     1922trait_declaring_list:                                                                   // CFA
    19201923        type_specifier declarator
    19211924                {
     
    19231926                        $$ = $2->addType( $1 );
    19241927                }
    1925         | context_declaring_list pop ',' push declarator
     1928        | trait_declaring_list pop ',' push declarator
    19261929                {
    19271930                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
Note: See TracChangeset for help on using the changeset viewer.