Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r525f7ad rf678c53b  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jun 11 21:32:15 2024
    13 // Update Count     : 6641
     12// Last Modified On : Mon Jun 17 21:43:02 2024
     13// Update Count     : 6643
    1414//
    1515
     
    284284} // forCtrl
    285285
    286 ForCtrl * enumRangeCtrl( ExpressionNode * index_expr, ExpressionNode * range_over_expr ) {
    287         if ( auto identifier = dynamic_cast<ast::NameExpr *>(index_expr->expr.get()) ) {
    288                 DeclarationNode * indexDecl =
    289                         DeclarationNode::newName( new std::string(identifier->name) );
    290                 assert( range_over_expr );
    291                 auto node = new StatementNode( indexDecl ); // <- this cause this error
    292                 return new ForCtrl( node, range_over_expr );
    293         } else if (auto commaExpr = dynamic_cast<ast::CommaExpr *>( index_expr->expr.get() )) {
    294                 if ( auto identifier = commaExpr->arg1.as<ast::NameExpr>() ) {
    295                         assert( range_over_expr );
    296                         DeclarationNode * indexDecl = distAttr(
    297                                 DeclarationNode::newTypeof( range_over_expr, true ),
    298                                 DeclarationNode::newName( new std::string( identifier->name) ) );
    299                         return new ForCtrl( new StatementNode( indexDecl ), range_over_expr );
    300                 } else {
    301                         SemanticError( yylloc, "syntax error, loop-index name missing. Expression disallowed." ); return nullptr;
    302                 } // if
    303         } else {
    304                 SemanticError( yylloc, "syntax error, loop-index name missing. Expression disallowed." ); return nullptr;
    305         } // if
    306 } // enumRangeCtrl
    307 
    308286static void IdentifierBeforeIdentifier( string & identifier1, string & identifier2, const char * kind ) {
    309287        SemanticError( yylloc, "syntax error, adjacent identifiers \"%s\" and \"%s\" are not meaningful in an %s.\n"
     
    390368%token DECIMAL32 DECIMAL64 DECIMAL128                                   // GCC
    391369%token ZERO_T ONE_T                                                                             // CFA
    392 %token SIZEOF TYPEOF VA_LIST VA_ARG AUTO_TYPE COUNT             // GCC
     370%token SIZEOF TYPEOF VA_LIST VA_ARG AUTO_TYPE                   // GCC
    393371%token OFFSETOF BASETYPEOF TYPEID                                               // CFA
    394372%token ENUM STRUCT UNION
     
    990968                        // $$ = new ExpressionNode( build_offsetOf( $3, build_varref( $5 ) ) );
    991969                }
    992         | COUNT '(' type ')'
    993                 {
    994                         // SemanticError( yylloc, "Count is currently unimplemented. "); $$ = nullptr;
    995                         $$ = new ExpressionNode( new ast::CountExpr( yylloc, maybeMoveBuildType( $3 ) ) );
    996                 }
    997970        ;
    998971
     
    16261599                { SemanticError( yylloc, "syntax error, missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; }
    16271600
    1628         | comma_expression ';' enum_type                                        // CFA, enum type
    1629                 {
    1630                         $$ = enumRangeCtrl( $1, new ExpressionNode( new ast::TypeExpr(yylloc, $3->buildType() ) ) );
    1631                 }
    1632         | comma_expression ';' downupdowneq enum_type           // CFA, enum type, reverse direction
     1601        | comma_expression ';' enum_key                                         // CFA, enum type
     1602                {
     1603                        SemanticError( yylloc, "Type iterator is currently unimplemented." ); $$ = nullptr;
     1604                        //$$ = forCtrl( new ExpressionNode( build_varref( $3 ) ), $1, nullptr, OperKinds::Range, nullptr, nullptr );
     1605                }
     1606        | comma_expression ';' downupdowneq enum_key            // CFA, enum type, reverse direction
    16331607                {
    16341608                        if ( $3 == OperKinds::LEThan || $3 == OperKinds::GEThan ) {
     
    16371611                        SemanticError( yylloc, "Type iterator is currently unimplemented." ); $$ = nullptr;
    16381612                }
     1613        ;
     1614
     1615enum_key:
     1616        TYPEDEFname
     1617        | ENUM identifier_or_type_name
    16391618        ;
    16401619
     
    40294008//
    40304009// The pattern precludes declaring an array of functions versus a pointer to an array of functions, and returning arrays
    4031 // and functions versus pointers to arrays and functions. In addition, the pattern handles the
    4032 // special meaning of parenthesis around a typedef name:
     4010// and functions versus pointers to arrays and functions. In addition, the pattern handles the special meaning of
     4011// parenthesis around a typedef name:
    40334012//
    40344013//              ISO/IEC 9899:1999 Section 6.7.5.3(11) : "In a parameter declaration, a single typedef name in
Note: See TracChangeset for help on using the changeset viewer.