Ignore:
Timestamp:
Feb 8, 2016, 10:07:42 AM (10 years ago)
Author:
Thierry Delisle <tdelisle@…>
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, with_gc
Children:
c44e622
Parents:
00ede9e (diff), bd85400 (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' into gc_noraii

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r00ede9e rd41280e  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Oct  8 17:17:54 2015
    13 // Update Count     : 1473
     12// Last Modified On : Mon Feb  1 18:22:42 2016
     13// Update Count     : 1483
    1414//
    1515
     
    7878%token ENUM STRUCT UNION
    7979%token TYPE FTYPE DTYPE CONTEXT                                                 // CFA
    80 %token SIZEOF
     80%token SIZEOF OFFSETOF
    8181%token ATTRIBUTE EXTENSION                                                              // GCC
    8282%token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
     
    319319        ;
    320320
    321 // no zero_one because ambiguity with 0.0 : double constant or field selection
    322321no_attr_identifier:
    323322        IDENTIFIER
     323        | zero_one                                                                                      // CFA
    324324        ;
    325325
     
    357357        | postfix_expression '(' argument_expression_list ')'
    358358                { $$ = new CompositeExprNode( $1, $3 ); }
     359        // ambiguity with .0 so space required after field-selection, e.g.
     360                //   struct S { int 0, 1; } s; s. 0 = 0; s. 1 = 1;
    359361        | postfix_expression '.' no_attr_identifier
    360362                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), $1, new VarRefNode( $3 )); }
     
    405407        no_attr_identifier
    406408                { $$ = new VarRefNode( $1 ); }
     409        // ambiguity with .0 so space required after field-selection, e.g.
     410                //   struct S { int 0, 1; } s; s. 0 = 0; s. 1 = 1;
    407411        | no_attr_identifier '.' field
    408412                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), new VarRefNode( $1 ), $3 ); }
     
    443447        | SIZEOF '(' type_name_no_function ')'
    444448                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::SizeOf ), new TypeValueNode( $3 )); }
     449        | OFFSETOF '(' type_name_no_function ',' no_attr_identifier ')'
     450        { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::OffsetOf ), new TypeValueNode( $3 ), new VarRefNode( $5 )); }
    445451        | ATTR_IDENTIFIER
    446452                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 )); }
Note: See TracChangeset for help on using the changeset viewer.