Changeset 6a99803


Ignore:
Timestamp:
Feb 3, 2021, 6:41:45 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
29c9b23
Parents:
4b393ba
Message:

add parsing for new array declaration and subscript

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r4b393ba r6a99803  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jan 27 08:58:56 2021
    13 // Update Count     : 4680
     12// Last Modified On : Wed Feb  3 18:30:12 2021
     13// Update Count     : 4700
    1414//
    1515
     
    618618postfix_expression:
    619619        primary_expression
     620        | postfix_expression '[' assignment_expression ',' comma_expression ']'
     621                // { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, new ExpressionNode( build_binary_val( OperKinds::Index, $3, $5 ) ) ) ); }
     622                { SemanticError( yylloc, "New array subscript is currently unimplemented." ); $$ = nullptr; }
    620623        | postfix_expression '[' assignment_expression ']'
    621624                // CFA, comma_expression disallowed in this context because it results in a common user error: subscripting a
     
    31873190        | '[' ']' multi_array_dimension
    31883191                { $$ = DeclarationNode::newArray( 0, 0, false )->addArray( $3 ); }
     3192        | '[' push assignment_expression pop ',' comma_expression ']'
     3193                { $$ = DeclarationNode::newArray( $3, 0, false )->addArray( DeclarationNode::newArray( $6, 0, false ) ); }
     3194                // { SemanticError( yylloc, "New array dimension is currently unimplemented." ); $$ = nullptr; }
    31893195        | multi_array_dimension
    31903196        ;
Note: See TracChangeset for help on using the changeset viewer.