Ignore:
Timestamp:
Sep 16, 2016, 10:48:28 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
2298f728
Parents:
ba7aa2d
Message:

more refactoring of parser code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rba7aa2d r1b77274  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 12 17:29:45 2016
    13 // Update Count     : 1969
     12// Last Modified On : Fri Sep 16 18:12:21 2016
     13// Update Count     : 1978
    1414//
    1515
     
    359359                { $$ = $2; }
    360360        | '(' compound_statement ')'                                            // GCC, lambda expression
    361         { $$ = new ExpressionNode( build_valexpr( $2 ) ); }
     361                { $$ = new ExpressionNode( build_valexpr( $2 ) ); }
    362362        ;
    363363
     
    896896                { $$ = new StatementNode( build_catch( $5, $8 ) ); }
    897897        | handler_clause CATCH '(' push push exception_declaration pop ')' compound_statement pop
    898         { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $6, $9 ) ) ); }
     898                { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $6, $9 ) ) ); }
    899899        | CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop
    900900                { $$ = new StatementNode( build_catch( $5, $8 ) ); }
     
    968968                { $$ = new ExpressionNode( build_asmexpr( 0, $1, $3 ) ); }
    969969        | '[' constant_expression ']' string_literal '(' constant_expression ')'
    970         { $$ = new ExpressionNode( build_asmexpr( $2, $4, $6 ) ); }
     970                { $$ = new ExpressionNode( build_asmexpr( $2, $4, $6 ) ); }
    971971        ;
    972972
     
    14671467aggregate_name:
    14681468        aggregate_key '{' field_declaration_list '}'
    1469                 { $$ = DeclarationNode::newAggregate( $1, 0, 0, $3, true ); }
     1469                { $$ = DeclarationNode::newAggregate( $1, new std::string( "" ), nullptr, $3, true ); }
    14701470        | aggregate_key no_attr_identifier_or_type_name
    14711471                {
     
    14761476                { typedefTable.makeTypedef( *$2 ); }
    14771477                '{' field_declaration_list '}'
    1478                 { $$ = DeclarationNode::newAggregate( $1, $2, 0, $5, true ); }
     1478                { $$ = DeclarationNode::newAggregate( $1, $2, nullptr, $5, true ); }
    14791479        | aggregate_key '(' type_name_list ')' '{' field_declaration_list '}' // CFA
    1480                 { $$ = DeclarationNode::newAggregate( $1, 0, $3, $6, false ); }
     1480                { $$ = DeclarationNode::newAggregate( $1, new std::string( "" ), $3, $6, false ); }
    14811481        | aggregate_key typegen_name                                            // CFA, S/R conflict
    14821482                { $$ = $2; }
     
    15591559enum_name:
    15601560        enum_key '{' enumerator_list comma_opt '}'
    1561                 { $$ = DeclarationNode::newEnum( 0, $3 ); }
     1561                { $$ = DeclarationNode::newEnum( new std::string( "" ), $3 ); }
    15621562        | enum_key no_attr_identifier_or_type_name
    15631563                {
     
    25202520abstract_function:
    25212521        '(' push parameter_type_list_opt pop ')'                        // empty parameter list OBSOLESCENT (see 3)
    2522                 { $$ = DeclarationNode::newFunction( 0, 0, $3, 0 ); }
     2522                { $$ = DeclarationNode::newFunction( new std::string( "" ), nullptr, $3, nullptr ); }
    25232523        | '(' abstract_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
    25242524                { $$ = $2->addParamList( $6 ); }
     
    25892589abstract_parameter_function:
    25902590        '(' push parameter_type_list_opt pop ')'                        // empty parameter list OBSOLESCENT (see 3)
    2591                 { $$ = DeclarationNode::newFunction( 0, 0, $3, 0 ); }
     2591                { $$ = DeclarationNode::newFunction( new std::string( "" ), nullptr, $3, nullptr ); }
    25922592        | '(' abstract_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
    25932593                { $$ = $2->addParamList( $6 ); }
     
    28132813new_abstract_function:                                                                  // CFA
    28142814        '[' ']' '(' new_parameter_type_list_opt ')'
    2815                 { $$ = DeclarationNode::newFunction( 0, DeclarationNode::newTuple( 0 ), $4, 0 ); }
     2815        { $$ = DeclarationNode::newFunction( new std::string( "" ), DeclarationNode::newTuple( nullptr ), $4, nullptr ); }
    28162816        | new_abstract_tuple '(' push new_parameter_type_list_opt pop ')'
    2817                 { $$ = DeclarationNode::newFunction( 0, $1, $4, 0 ); }
     2817                { $$ = DeclarationNode::newFunction( new std::string( "" ), $1, $4, nullptr ); }
    28182818        | new_function_return '(' push new_parameter_type_list_opt pop ')'
    2819                 { $$ = DeclarationNode::newFunction( 0, $1, $4, 0 ); }
     2819                { $$ = DeclarationNode::newFunction( new std::string( "" ), $1, $4, nullptr ); }
    28202820        ;
    28212821
Note: See TracChangeset for help on using the changeset viewer.