Ignore:
Timestamp:
Oct 5, 2016, 2:29:13 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:
d58a39a0
Parents:
4b1fd2c
Message:

more refactoring of parser code, new tuple syntax

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r4b1fd2c rfaddbd8  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Sep 24 12:16:53 2016
    13 // Update Count     : 1992
     12// Last Modified On : Wed Oct  5 14:10:46 2016
     13// Update Count     : 2002
    1414//
    1515
     
    196196%type<decl> field_declaration field_declaration_list field_declarator field_declaring_list
    197197%type<en> field field_list
     198%type<tok> field_name
    198199
    199200%type<decl> external_function_definition function_definition function_array function_declarator function_no_ptr function_ptr
     
    378379                { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); }
    379380        | postfix_expression '.' '[' push field_list pop ']' // CFA, tuple field selector
     381        | postfix_expression '.' INTEGERconstant
    380382        | postfix_expression ARROW no_attr_identifier
    381383                { $$ = new ExpressionNode( build_pfieldSel( $1, build_varref( $3 ) ) ); }
     
    413415
    414416field:                                                                                                  // CFA, tuple field selector
    415         no_attr_identifier
    416                 { $$ = new ExpressionNode( build_varref( $1 ) ); }
     417        field_name
    417418                // ambiguity with .0 so space required after field-selection, e.g.
    418419                //   struct S { int 0, 1; } s; s. 0 = 0; s. 1 = 1;
    419         | no_attr_identifier '.' field
     420                { $$ = new ExpressionNode( build_varref( $1 ) ); }
     421        | field_name '.' field
    420422                { $$ = new ExpressionNode( build_fieldSel( $3, build_varref( $1 ) ) ); }
    421         | no_attr_identifier '.' '[' push field_list pop ']'
     423        | field_name '.' '[' push field_list pop ']'
    422424                { $$ = new ExpressionNode( build_fieldSel( $5, build_varref( $1 ) ) ); }
    423         | no_attr_identifier ARROW field
     425        | field_name ARROW field
    424426                { $$ = new ExpressionNode( build_pfieldSel( $3, build_varref( $1 ) ) ); }
    425         | no_attr_identifier ARROW '[' push field_list pop ']'
     427        | field_name ARROW '[' push field_list pop ']'
    426428                { $$ = new ExpressionNode( build_pfieldSel( $5, build_varref( $1 ) ) ); }
     429        ;
     430
     431field_name:
     432        no_attr_identifier
     433        | INTEGERconstant
    427434        ;
    428435
     
    20052012                {
    20062013                        linkageStack.push( linkage );                           // handle nested extern "C"/"Cforall"
    2007                         linkage = LinkageSpec::fromString( *$2 );
     2014                        linkage = LinkageSpec::linkageCheck( $2 );
    20082015                }
    20092016          '{' external_definition_list_opt '}'                          // C++-style linkage specifier
Note: See TracChangeset for help on using the changeset viewer.