Changeset fc12f05 for src/Parser/parser.yy
- Timestamp:
- Nov 13, 2023, 3:43:43 AM (23 months ago)
- Branches:
- master
- Children:
- 25f2798
- Parents:
- 0030b508 (diff), 2174191 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r0030b508 rfc12f05 48 48 using namespace std; 49 49 50 #include "SynTree/Type.h" // for Type51 50 #include "DeclarationNode.h" // for DeclarationNode, ... 52 51 #include "ExpressionNode.h" // for ExpressionNode, ... … … 58 57 #include "Common/SemanticError.h" // error_str 59 58 #include "Common/utility.h" // for maybeMoveBuild, maybeBuild, CodeLo... 60 61 #include "SynTree/Attribute.h" // for Attribute62 59 63 60 // lex uses __null in a boolean context, it's fine. … … 1726 1723 cofor_statement: 1727 1724 COFOR '(' for_control_expression_list ')' statement 1728 { SemanticError( yylloc, "cofor statement is currently unimplemented." ); $$ = nullptr; }1725 { $$ = new StatementNode( build_cofor( yylloc, $3, maybe_build_compound( yylloc, $5 ) ) ); } 1729 1726 ; 1730 1727 … … 2169 2166 type_qualifier_name: 2170 2167 CONST 2171 { $$ = DeclarationNode::newTypeQualifier( Type::Const ); }2168 { $$ = DeclarationNode::newTypeQualifier( ast::CV::Const ); } 2172 2169 | RESTRICT 2173 { $$ = DeclarationNode::newTypeQualifier( Type::Restrict ); }2170 { $$ = DeclarationNode::newTypeQualifier( ast::CV::Restrict ); } 2174 2171 | VOLATILE 2175 { $$ = DeclarationNode::newTypeQualifier( Type::Volatile ); }2172 { $$ = DeclarationNode::newTypeQualifier( ast::CV::Volatile ); } 2176 2173 | ATOMIC 2177 { $$ = DeclarationNode::newTypeQualifier( Type::Atomic ); }2174 { $$ = DeclarationNode::newTypeQualifier( ast::CV::Atomic ); } 2178 2175 | forall 2179 2176 { $$ = DeclarationNode::newForall( $1 ); } … … 2206 2203 storage_class: 2207 2204 EXTERN 2208 { $$ = DeclarationNode::newStorageClass( Type::Extern ); }2205 { $$ = DeclarationNode::newStorageClass( ast::Storage::Extern ); } 2209 2206 | STATIC 2210 { $$ = DeclarationNode::newStorageClass( Type::Static ); }2207 { $$ = DeclarationNode::newStorageClass( ast::Storage::Static ); } 2211 2208 | AUTO 2212 { $$ = DeclarationNode::newStorageClass( Type::Auto ); }2209 { $$ = DeclarationNode::newStorageClass( ast::Storage::Auto ); } 2213 2210 | REGISTER 2214 { $$ = DeclarationNode::newStorageClass( Type::Register ); }2211 { $$ = DeclarationNode::newStorageClass( ast::Storage::Register ); } 2215 2212 | THREADLOCALGCC // GCC 2216 { $$ = DeclarationNode::newStorageClass( Type::ThreadlocalGcc ); }2213 { $$ = DeclarationNode::newStorageClass( ast::Storage::ThreadLocalGcc ); } 2217 2214 | THREADLOCALC11 // C11 2218 { $$ = DeclarationNode::newStorageClass( Type::ThreadlocalC11 ); }2215 { $$ = DeclarationNode::newStorageClass( ast::Storage::ThreadLocalC11 ); } 2219 2216 // Put function specifiers here to simplify parsing rules, but separate them semantically. 2220 2217 | INLINE // C99 2221 { $$ = DeclarationNode::newFuncSpecifier( Type::Inline ); }2218 { $$ = DeclarationNode::newFuncSpecifier( ast::Function::Inline ); } 2222 2219 | FORTRAN // C99 2223 { $$ = DeclarationNode::newFuncSpecifier( Type::Fortran ); }2220 { $$ = DeclarationNode::newFuncSpecifier( ast::Function::Fortran ); } 2224 2221 | NORETURN // C11 2225 { $$ = DeclarationNode::newFuncSpecifier( Type::Noreturn ); }2222 { $$ = DeclarationNode::newFuncSpecifier( ast::Function::Noreturn ); } 2226 2223 ; 2227 2224 … … 3717 3714 { $$ = $1->addQualifiers( $2 ); } 3718 3715 | '&' MUTEX paren_identifier attribute_list_opt 3719 { $$ = $3->addPointer( DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( Type::Mutex ), OperKinds::AddressOf ) )->addQualifiers( $4 ); }3716 { $$ = $3->addPointer( DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( ast::CV::Mutex ), OperKinds::AddressOf ) )->addQualifiers( $4 ); } 3720 3717 | identifier_parameter_ptr 3721 3718 | identifier_parameter_array attribute_list_opt … … 3767 3764 { $$ = $1->addQualifiers( $2 ); } 3768 3765 | '&' MUTEX typedef_name attribute_list_opt 3769 { $$ = $3->addPointer( DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( Type::Mutex ), OperKinds::AddressOf ) )->addQualifiers( $4 ); }3766 { $$ = $3->addPointer( DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( ast::CV::Mutex ), OperKinds::AddressOf ) )->addQualifiers( $4 ); } 3770 3767 | type_parameter_ptr 3771 3768 | type_parameter_array attribute_list_opt … … 3941 3938 abstract_parameter_ptr 3942 3939 | '&' MUTEX attribute_list_opt 3943 { $$ = DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( Type::Mutex ), OperKinds::AddressOf )->addQualifiers( $3 ); }3940 { $$ = DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( ast::CV::Mutex ), OperKinds::AddressOf )->addQualifiers( $3 ); } 3944 3941 | abstract_parameter_array attribute_list_opt 3945 3942 { $$ = $1->addQualifiers( $2 ); }
Note:
See TracChangeset
for help on using the changeset viewer.