Changeset d41735a


Ignore:
Timestamp:
Nov 21, 2022, 10:37:30 PM (18 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
29702ad
Parents:
7bc84b8
Message:

parse CFA dimension-list with types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r7bc84b8 rd41735a  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Nov 20 09:41:25 2022
    13 // Update Count     : 5816
     12// Last Modified On : Mon Nov 21 22:34:30 2022
     13// Update Count     : 5848
    1414//
    1515
     
    383383%type<ifctl> conditional_declaration
    384384%type<fctl> for_control_expression              for_control_expression_list
    385 %type<compop> updown updowneq downupdowneq
     385%type<compop> upupeq updown updowneq downupdowneq
    386386%type<en> subrange
    387387%type<decl> asm_name_opt
     
    489489%type<decl> type_parameter type_parameter_list type_initializer_opt
    490490
    491 %type<en> type_parameters_opt type_list
     491%type<en> type_parameters_opt type_list array_type_list
    492492
    493493%type<decl> type_qualifier type_qualifier_name forall type_qualifier_list_opt type_qualifier_list
     
    36543654                { $$ = DeclarationNode::newArray( 0, 0, false )->addArray( $3 ); }
    36553655                // Cannot use constant_expression because of tuples => semantic check
    3656         | '[' push assignment_expression pop ',' comma_expression ']'
     3656        | '[' push assignment_expression pop ',' comma_expression ']' // CFA
    36573657                { $$ = DeclarationNode::newArray( $3, 0, false )->addArray( DeclarationNode::newArray( $6, 0, false ) ); }
    36583658                // { SemanticError( yylloc, "New array dimension is currently unimplemented." ); $$ = nullptr; }
    3659         | '[' push TYPEDEFname pop ']'
     3659        | '[' push array_type_list pop ']'                                      // CFA
    36603660                { SemanticError( yylloc, "Type array dimension is currently unimplemented." ); $$ = nullptr; }
    36613661        | multi_array_dimension
    36623662        ;
     3663
     3664array_type_list:
     3665        basic_type_name
     3666                { $$ = new ExpressionNode( new TypeExpr( maybeMoveBuildType( $1 ) ) ); }
     3667        | type_name
     3668                { $$ = new ExpressionNode( new TypeExpr( maybeMoveBuildType( $1 ) ) ); }
     3669        | assignment_expression upupeq assignment_expression
     3670        | array_type_list ',' basic_type_name
     3671                { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) )); }
     3672        | array_type_list ',' type_name
     3673                { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) )); }
     3674        | array_type_list ',' assignment_expression upupeq assignment_expression
     3675        ;
     3676
     3677upupeq:
     3678        '~'
     3679                { $$ = OperKinds::LThan; }
     3680        | ErangeUpEq
     3681                { $$ = OperKinds::LEThan; }
     3682        ;
    36633683
    36643684multi_array_dimension:
Note: See TracChangeset for help on using the changeset viewer.