Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rc6b4432 reb779d5  
    4848using namespace std;
    4949
     50#include "SynTree/Type.h"                               // for Type
    5051#include "DeclarationNode.h"                            // for DeclarationNode, ...
    5152#include "ExpressionNode.h"                             // for ExpressionNode, ...
     
    5758#include "Common/SemanticError.h"                                               // error_str
    5859#include "Common/utility.h"                                                             // for maybeMoveBuild, maybeBuild, CodeLo...
     60
     61#include "SynTree/Attribute.h"                                                  // for Attribute
    5962
    6063// lex uses __null in a boolean context, it's fine.
     
    17231726cofor_statement:
    17241727        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; }
    17261729        ;
    17271730
     
    21662169type_qualifier_name:
    21672170        CONST
    2168                 { $$ = DeclarationNode::newTypeQualifier( ast::CV::Const ); }
     2171                { $$ = DeclarationNode::newTypeQualifier( Type::Const ); }
    21692172        | RESTRICT
    2170                 { $$ = DeclarationNode::newTypeQualifier( ast::CV::Restrict ); }
     2173                { $$ = DeclarationNode::newTypeQualifier( Type::Restrict ); }
    21712174        | VOLATILE
    2172                 { $$ = DeclarationNode::newTypeQualifier( ast::CV::Volatile ); }
     2175                { $$ = DeclarationNode::newTypeQualifier( Type::Volatile ); }
    21732176        | ATOMIC
    2174                 { $$ = DeclarationNode::newTypeQualifier( ast::CV::Atomic ); }
     2177                { $$ = DeclarationNode::newTypeQualifier( Type::Atomic ); }
    21752178        | forall
    21762179                { $$ = DeclarationNode::newForall( $1 ); }
     
    22032206storage_class:
    22042207        EXTERN
    2205                 { $$ = DeclarationNode::newStorageClass( ast::Storage::Extern ); }
     2208                { $$ = DeclarationNode::newStorageClass( Type::Extern ); }
    22062209        | STATIC
    2207                 { $$ = DeclarationNode::newStorageClass( ast::Storage::Static ); }
     2210                { $$ = DeclarationNode::newStorageClass( Type::Static ); }
    22082211        | AUTO
    2209                 { $$ = DeclarationNode::newStorageClass( ast::Storage::Auto ); }
     2212                { $$ = DeclarationNode::newStorageClass( Type::Auto ); }
    22102213        | REGISTER
    2211                 { $$ = DeclarationNode::newStorageClass( ast::Storage::Register ); }
     2214                { $$ = DeclarationNode::newStorageClass( Type::Register ); }
    22122215        | THREADLOCALGCC                                                                                // GCC
    2213                 { $$ = DeclarationNode::newStorageClass( ast::Storage::ThreadLocalGcc ); }
     2216                { $$ = DeclarationNode::newStorageClass( Type::ThreadlocalGcc ); }
    22142217        | THREADLOCALC11                                                                                // C11
    2215                 { $$ = DeclarationNode::newStorageClass( ast::Storage::ThreadLocalC11 ); }
     2218                { $$ = DeclarationNode::newStorageClass( Type::ThreadlocalC11 ); }
    22162219                // Put function specifiers here to simplify parsing rules, but separate them semantically.
    22172220        | INLINE                                                                                        // C99
    2218                 { $$ = DeclarationNode::newFuncSpecifier( ast::Function::Inline ); }
     2221                { $$ = DeclarationNode::newFuncSpecifier( Type::Inline ); }
    22192222        | FORTRAN                                                                                       // C99
    2220                 { $$ = DeclarationNode::newFuncSpecifier( ast::Function::Fortran ); }
     2223                { $$ = DeclarationNode::newFuncSpecifier( Type::Fortran ); }
    22212224        | NORETURN                                                                                      // C11
    2222                 { $$ = DeclarationNode::newFuncSpecifier( ast::Function::Noreturn ); }
     2225                { $$ = DeclarationNode::newFuncSpecifier( Type::Noreturn ); }
    22232226        ;
    22242227
     
    37143717                { $$ = $1->addQualifiers( $2 ); }
    37153718        | '&' 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 ); }
    37173720        | identifier_parameter_ptr
    37183721        | identifier_parameter_array attribute_list_opt
     
    37643767                { $$ = $1->addQualifiers( $2 ); }
    37653768        | '&' 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 ); }
    37673770        | type_parameter_ptr
    37683771        | type_parameter_array attribute_list_opt
     
    39383941        abstract_parameter_ptr
    39393942        | '&' 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 ); }
    39413944        | abstract_parameter_array attribute_list_opt
    39423945                { $$ = $1->addQualifiers( $2 ); }
Note: See TracChangeset for help on using the changeset viewer.