Ignore:
Timestamp:
Mar 2, 2016, 6:15:02 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
36ebd03, b63e376
Parents:
8f610e85
Message:

change keyword type to otype and context to trait

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r8f610e85 r4040425  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Feb 28 11:49:18 2016
    13 // Update Count     : 1492
     12// Last Modified On : Wed Mar  2 17:24:45 2016
     13// Update Count     : 1495
    1414//
    1515
     
    7878%token TYPEOF LABEL                                                                             // GCC
    7979%token ENUM STRUCT UNION
    80 %token TYPE FTYPE DTYPE CONTEXT                                                 // CFA
     80%token OTYPE FTYPE DTYPE TRAIT                                          // CFA
    8181%token SIZEOF OFFSETOF
    8282%token ATTRIBUTE EXTENSION                                                              // GCC
     
    172172%type<decl> basic_declaration_specifier basic_type_name basic_type_specifier direct_type_name indirect_type_name
    173173
    174 %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
    175175
    176176%type<decl> declaration declaration_list declaration_list_opt declaration_qualifier_list
     
    198198%type<decl> new_array_parameter_1st_dimension
    199199
    200 %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
    201201%type<decl> new_function_declaration new_function_return new_function_specifier
    202202
     
    10211021        | new_function_declaration pop ';'
    10221022        | type_declaring_list pop ';'
    1023         | context_specifier pop ';'
     1023        | trait_specifier pop ';'
    10241024        ;
    10251025
     
    18061806
    18071807type_class:                                                                                             // CFA
    1808         TYPE
     1808        OTYPE
    18091809                { $$ = DeclarationNode::Type; }
    18101810        | DTYPE
     
    18241824        '|' no_attr_identifier_or_type_name '(' type_name_list ')'
    18251825                {
    1826                         typedefTable.openContext( *$2 );
    1827                         $$ = DeclarationNode::newContextUse( $2, $4 );
    1828                 }
    1829         | '|' '{' push context_declaration_list '}'
     1826                        typedefTable.openTrait( *$2 );
     1827                        $$ = DeclarationNode::newTraitUse( $2, $4 );
     1828                }
     1829        | '|' '{' push trait_declaration_list '}'
    18301830                { $$ = $4; }
    1831         | '|' '(' 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 ')'
    18321832                { $$ = 0; }
    18331833        ;
     
    18441844
    18451845type_declaring_list:                                                                    // CFA
    1846         TYPE type_declarator
    1847                 { $$ = $2; }
    1848         | storage_class_list TYPE type_declarator
     1846        OTYPE type_declarator
     1847                { $$ = $2; }
     1848        | storage_class_list OTYPE type_declarator
    18491849                { $$ = $3->addQualifiers( $1 ); }
    18501850        | type_declaring_list ',' type_declarator
     
    18721872        ;
    18731873
    1874 context_specifier:                                                                              // CFA
    1875         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 ')' '{' '}'
    18761876                {
    18771877                        typedefTable.addToEnclosingScope( *$2, TypedefTable::ID );
    1878                         $$ = DeclarationNode::newContext( $2, $5, 0 );
    1879                 }
    1880         | CONTEXT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{'
    1881                 {
    1882                         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 );
    18831883                        typedefTable.enterScope();
    18841884                }
    1885           context_declaration_list '}'
    1886                 {
    1887                         typedefTable.leaveContext();
     1885          trait_declaration_list '}'
     1886                {
     1887                        typedefTable.leaveTrait();
    18881888                        typedefTable.addToEnclosingScope( *$2, TypedefTable::ID );
    1889                         $$ = DeclarationNode::newContext( $2, $5, $10 );
    1890                 }
    1891         ;
    1892 
    1893 context_declaration_list:                                                               // CFA
    1894         context_declaration
    1895         | 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
    18961896                { $$ = $1->appendList( $3 ); }
    18971897        ;
    18981898
    1899 context_declaration:                                                                    // CFA
    1900         new_context_declaring_list pop ';'
    1901         | context_declaring_list pop ';'
    1902         ;
    1903 
    1904 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
    19051905        new_variable_specifier
    19061906                {
     
    19131913                        $$ = $1;
    19141914                }
    1915         | new_context_declaring_list pop ',' push identifier_or_type_name
     1915        | new_trait_declaring_list pop ',' push identifier_or_type_name
    19161916                {
    19171917                        typedefTable.addToEnclosingScope2( *$5, TypedefTable::ID );
     
    19201920        ;
    19211921
    1922 context_declaring_list:                                                                 // CFA
     1922trait_declaring_list:                                                                   // CFA
    19231923        type_specifier declarator
    19241924                {
     
    19261926                        $$ = $2->addType( $1 );
    19271927                }
    1928         | context_declaring_list pop ',' push declarator
     1928        | trait_declaring_list pop ',' push declarator
    19291929                {
    19301930                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
Note: See TracChangeset for help on using the changeset viewer.