Changes in / [9d6082c:006d4c4]


Ignore:
Location:
src/Parser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/lex.ll

    r9d6082c r006d4c4  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Thu Jun 20 16:54:05 2024
    13  * Update Count     : 778
     12 * Last Modified On : Sat Feb 24 11:47:24 2024
     13 * Update Count     : 777
    1414 */
    1515
     
    321321__signed__              { KEYWORD_RETURN(SIGNED); }                             // GCC
    322322sizeof                  { KEYWORD_RETURN(SIZEOF); }
    323 countof                 { KEYWORD_RETURN(COUNTOF); }                    // GCC
     323__count_e__             { KEYWORD_RETURN(COUNT); }                              // GCC
    324324static                  { KEYWORD_RETURN(STATIC); }
    325325_Static_assert  { KEYWORD_RETURN(STATICASSERT); }               // C11
  • src/Parser/parser.yy

    r9d6082c r006d4c4  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jun 20 21:34:49 2024
    13 // Update Count     : 6654
     12// Last Modified On : Mon Jun 17 21:43:02 2024
     13// Update Count     : 6643
    1414//
    1515
     
    302302                } // if
    303303        } else {
    304                 assert( false );
     304                SemanticError( yylloc, "syntax error, loop-index name missing. Expression disallowed." ); return nullptr;
    305305        } // if
    306306} // enumRangeCtrl
     
    390390%token DECIMAL32 DECIMAL64 DECIMAL128                                   // GCC
    391391%token ZERO_T ONE_T                                                                             // CFA
    392 %token SIZEOF TYPEOF VA_LIST VA_ARG AUTO_TYPE COUNTOF   // GCC
     392%token SIZEOF TYPEOF VA_LIST VA_ARG AUTO_TYPE COUNT             // GCC
    393393%token OFFSETOF BASETYPEOF TYPEID                                               // CFA
    394394%token ENUM STRUCT UNION
     
    508508%type<decl> elaborated_type elaborated_type_nobody
    509509
    510 %type<decl> enumerator_list enum_type enum_type_nobody enum_key enumerator_type
     510%type<decl> enumerator_list enum_type enum_type_nobody enumerator_type
    511511%type<init> enumerator_value_opt
    512512
     
    990990                        // $$ = new ExpressionNode( build_offsetOf( $3, build_varref( $5 ) ) );
    991991                }
    992         | COUNTOF '(' type_no_function ')'
    993                 { $$ = new ExpressionNode( new ast::CountExpr( yylloc, maybeMoveBuildType( $3 ) ) ); }
    994         | COUNTOF unary_expression
    995                 { SemanticError( yylloc, "countof for expressions is currently unimplemented. "); $$ = nullptr; }
     992        | COUNT '(' type ')'
     993                {
     994                        // SemanticError( yylloc, "Count is currently unimplemented. "); $$ = nullptr;
     995                        $$ = new ExpressionNode( new ast::CountExpr( yylloc, maybeMoveBuildType( $3 ) ) );
     996                }
    996997        ;
    997998
     
    16251626                { SemanticError( yylloc, "syntax error, missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; }
    16261627
    1627         | comma_expression ';' enum_key                                         // CFA, enum type
    1628                 {
    1629                         $$ = enumRangeCtrl( $1, new ExpressionNode( new ast::TypeExpr( yylloc, $3->buildType() ) ) );
    1630                 }
    1631         | comma_expression ';' downupdowneq enum_key            // CFA, enum type, reverse direction
     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
    16321633                {
    16331634                        if ( $3 == OperKinds::LEThan || $3 == OperKinds::GEThan ) {
     
    16361637                        SemanticError( yylloc, "Type iterator is currently unimplemented." ); $$ = nullptr;
    16371638                }
    1638         ;
    1639 
    1640 enum_key:
    1641         type_name
    1642                 { $$ = DeclarationNode::newEnum( $1->symbolic.name, nullptr, false, false ); }
    1643         | ENUM identifier
    1644                 { $$ = DeclarationNode::newEnum( $2, nullptr, false, false ); }
    1645         | ENUM type_name
    1646                 { $$ = DeclarationNode::newEnum( $2->symbolic.name, nullptr, false, false ); }
    16471639        ;
    16481640
Note: See TracChangeset for help on using the changeset viewer.