Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r1dda8de r1b54b54  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Apr 15 15:02:56 2019
    13 // Update Count     : 4290
     12// Last Modified On : Thu Feb 21 08:45:07 2019
     13// Update Count     : 4232
    1414//
    1515
     
    185185
    186186ForCtrl * forCtrl( ExpressionNode * type, string * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) {
    187         ConstantExpr * constant = dynamic_cast<ConstantExpr *>(type->expr.get());
     187        ConstantExpr * constant = dynamic_cast<ConstantExpr *>(type->get_expr());
    188188        if ( constant && (constant->get_constant()->get_value() == "0" || constant->get_constant()->get_value() == "1") ) {
    189189        type = new ExpressionNode( new CastExpr( maybeMoveBuild< Expression >(type), new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ) );
     
    198198
    199199ForCtrl * forCtrl( ExpressionNode * type, ExpressionNode * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) {
    200         if ( NameExpr * identifier = dynamic_cast<NameExpr *>(index->expr.get()) ) {
     200        if ( NameExpr * identifier = dynamic_cast<NameExpr *>(index->get_expr()) ) {
    201201                return forCtrl( type, new string( identifier->name ), start, compop, comp, inc );
    202         } else if ( CommaExpr * commaExpr = dynamic_cast<CommaExpr *>(index->expr.get()) ) {
     202        } else if ( CommaExpr * commaExpr = dynamic_cast<CommaExpr *>(index->get_expr()) ) {
    203203                if ( NameExpr * identifier = dynamic_cast<NameExpr *>(commaExpr->arg1 ) ) {
    204204                        return forCtrl( type, new string( identifier->name ), start, compop, comp, inc );
     
    265265%token RESTRICT                                                                                 // C99
    266266%token ATOMIC                                                                                   // C11
    267 %token FORALL MUTEX VIRTUAL COERCE                                              // CFA
     267%token FORALL MUTEX VIRTUAL                                                             // CFA
    268268%token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
    269269%token BOOL COMPLEX IMAGINARY                                                   // C99
     
    334334%type<en> subrange
    335335%type<decl> asm_name_opt
    336 %type<en> asm_operands_opt                              asm_operands_list                       asm_operand
     336%type<en> asm_operands_opt asm_operands_list asm_operand
    337337%type<label> label_list
    338338%type<en> asm_clobbers_list_opt
    339339%type<flag> asm_volatile_opt
    340340%type<en> handler_predicate_opt
    341 %type<genexpr> generic_association              generic_assoc_list
     341%type<genexpr> generic_association generic_assoc_list
    342342
    343343// statements
     
    795795        | '(' type_no_function ')' cast_expression
    796796                { $$ = new ExpressionNode( build_cast( $2, $4 ) ); }
    797                 // keyword cast cannot be grouped because of reduction in aggregate_key
    798797        | '(' COROUTINE '&' ')' cast_expression                         // CFA
    799798                { $$ = new ExpressionNode( build_keyword_cast( KeywordCastExpr::Coroutine, $5 ) ); }
     
    807806        | '(' VIRTUAL type_no_function ')' cast_expression      // CFA
    808807                { $$ = new ExpressionNode( new VirtualCastExpr( maybeMoveBuild< Expression >( $5 ), maybeMoveBuildType( $3 ) ) ); }
    809         | '(' RETURN type_no_function ')' cast_expression       // CFA
    810                 { SemanticError( yylloc, "Return cast is currently unimplemented." ); $$ = nullptr; }
    811         | '(' COERCE type_no_function ')' cast_expression       // CFA
    812                 { SemanticError( yylloc, "Coerce cast is currently unimplemented." ); $$ = nullptr; }
    813         | '(' qualifier_cast_list ')' cast_expression           // CFA
    814                 { SemanticError( yylloc, "Qualifier cast is currently unimplemented." ); $$ = nullptr; }
    815808//      | '(' type_no_function ')' tuple
    816809//              { $$ = new ExpressionNode( build_cast( $2, $4 ) ); }
    817         ;
    818 
    819 qualifier_cast_list:
    820         cast_modifier type_qualifier_name
    821         | cast_modifier MUTEX
    822         | qualifier_cast_list cast_modifier type_qualifier_name
    823         | qualifier_cast_list cast_modifier MUTEX
    824         ;
    825 
    826 cast_modifier:
    827         '-'
    828         | '+'
    829810        ;
    830811
     
    11641145        for_control_expression
    11651146        | for_control_expression_list ':' for_control_expression
    1166                 // ForCtrl + ForCtrl:
    1167                 //    init + init => multiple declaration statements that are hoisted
    1168                 //    condition + condition => (expression) && (expression)
    1169                 //    change + change => (expression), (expression)
    1170                 {
    1171                         $1->init->set_last( $3->init );
    1172                         if ( $1->condition ) {
    1173                                 if ( $3->condition ) {
    1174                                         $1->condition->expr.reset( new LogicalExpr( $1->condition->expr.release(), $3->condition->expr.release(), true ) );
    1175                                 } // if
    1176                         } else $1->condition = $3->condition;
    1177                         if ( $1->change ) {
    1178                                 if ( $3->change ) {
    1179                                         $1->change->expr.reset( new CommaExpr( $1->change->expr.release(), $3->change->expr.release() ) );
    1180                                 } // if
    1181                         } else $1->change = $3->change;
    1182                         $$ = $1;
    1183                 }
     1147                { $$ = $3; }
    11841148        ;
    11851149
     
    11911155        | declaration comma_expression_opt ';' comma_expression_opt // C99, declaration has ';'
    11921156                { $$ = new ForCtrl( $1, $2, $4 ); }
    1193 
    11941157        | comma_expression                                                                      // CFA
    11951158                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
     
    12061169        | comma_expression ';' comma_expression inclexcl comma_expression '~' comma_expression // CFA
    12071170                { $$ = forCtrl( $3, $1, $3->clone(), $4, $5, $7 ); }
    1208 
    1209                 // There is a S/R conflicit if ~ and -~ are factored out.
    1210         | comma_expression ';' comma_expression '~' '@'         // CFA
    1211                 { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::LThan, nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1212         | comma_expression ';' comma_expression ErangeDown '@' // CFA
    1213                 { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::GThan, nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    12141171        | comma_expression ';' comma_expression '~' '@' '~' comma_expression // CFA
    12151172                { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::LThan, nullptr, $7 ); }
Note: See TracChangeset for help on using the changeset viewer.