Changes in src/Parser/parser.yy [525f7ad:a8ced63]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r525f7ad ra8ced63 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Jun 11 21:32:15202413 // Update Count : 66 4112 // Last Modified On : Thu Jun 20 21:34:49 2024 13 // Update Count : 6654 14 14 // 15 15 … … 302 302 } // if 303 303 } else { 304 SemanticError( yylloc, "syntax error, loop-index name missing. Expression disallowed." ); return nullptr;304 assert( false ); 305 305 } // if 306 306 } // enumRangeCtrl … … 390 390 %token DECIMAL32 DECIMAL64 DECIMAL128 // GCC 391 391 %token ZERO_T ONE_T // CFA 392 %token SIZEOF TYPEOF VA_LIST VA_ARG AUTO_TYPE COUNT 392 %token SIZEOF TYPEOF VA_LIST VA_ARG AUTO_TYPE COUNTOF // GCC 393 393 %token OFFSETOF BASETYPEOF TYPEID // CFA 394 394 %token ENUM STRUCT UNION … … 508 508 %type<decl> elaborated_type elaborated_type_nobody 509 509 510 %type<decl> enumerator_list enum_type enum_type_nobody enum erator_type510 %type<decl> enumerator_list enum_type enum_type_nobody enum_key enumerator_type 511 511 %type<init> enumerator_value_opt 512 512 … … 990 990 // $$ = new ExpressionNode( build_offsetOf( $3, build_varref( $5 ) ) ); 991 991 } 992 | COUNT '(' type ')' 993 { 994 // SemanticError( yylloc, "Count is currently unimplemented. "); $$ = nullptr; 995 $$ = new ExpressionNode( new ast::CountExpr( yylloc, maybeMoveBuildType( $3 ) ) ); 996 } 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; } 997 996 ; 998 997 … … 1626 1625 { SemanticError( yylloc, "syntax error, missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; } 1627 1626 1628 | comma_expression ';' enum_ type// CFA, enum type1629 { 1630 $$ = enumRangeCtrl( $1, new ExpressionNode( new ast::TypeExpr( yylloc, $3->buildType() ) ) );1631 } 1632 | comma_expression ';' downupdowneq enum_ type// CFA, enum type, reverse direction1627 | 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 1633 1632 { 1634 1633 if ( $3 == OperKinds::LEThan || $3 == OperKinds::GEThan ) { … … 1637 1636 SemanticError( yylloc, "Type iterator is currently unimplemented." ); $$ = nullptr; 1638 1637 } 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 ); } 1639 1647 ; 1640 1648 … … 4029 4037 // 4030 4038 // 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 ofparenthesis around a typedef name:4039 // and functions versus pointers to arrays and functions. In addition, the pattern handles the special meaning of 4040 // parenthesis around a typedef name: 4033 4041 // 4034 4042 // 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.