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