Changeset 17c6edeb for src/Parser


Ignore:
Timestamp:
Aug 16, 2022, 2:52:24 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
71cf630
Parents:
32d1383 (diff), e116db3 (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src/Parser
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r32d1383 r17c6edeb  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 14 17:36:57 2021
    13 // Update Count     : 1154
     12// Last Modified On : Mon Aug  8 17:07:00 2022
     13// Update Count     : 1185
    1414//
    1515
     
    128128        if ( name ) {
    129129                os << *name << ": ";
    130         } else {
    131                 os << "unnamed: ";
    132130        } // if
    133131
     
    154152                initializer->printOneLine( os );
    155153                os << " maybe constructed? " << initializer->get_maybeConstructed();
    156 
    157         } // if
     154        } // if
     155
     156        for ( Attribute * attr: reverseIterate( attributes ) ) {
     157                os << string( indent + 2, ' ' ) << "attr " << attr->name.c_str();
     158        } // for
    158159
    159160        os << endl;
     
    243244        newnode->type = new TypeData( TypeData::Aggregate );
    244245        newnode->type->aggregate.kind = kind;
    245         newnode->type->aggregate.name =  name == nullptr ? new string( DeclarationNode::anonymous.newName() ) : name;
     246        newnode->type->aggregate.name = name == nullptr ? new string( DeclarationNode::anonymous.newName() ) : name;
    246247        newnode->type->aggregate.actuals = actuals;
    247248        newnode->type->aggregate.fields = fields;
     
    518519        storageClasses |= q->storageClasses;
    519520
    520         for ( Attribute *attr: reverseIterate( q->attributes ) ) {
     521        for ( Attribute * attr: reverseIterate( q->attributes ) ) {
    521522                attributes.push_front( attr->clone() );
    522523        } // for
     
    683684        } // if
    684685        delete o;
     686
    685687        return this;
    686688}
  • src/Parser/TypeData.cc

    r32d1383 r17c6edeb  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 15:12:51 2015
    11 // Last Modified By : Henry Xue
    12 // Last Modified On : Tue Jul 20 04:10:50 2021
    13 // Update Count     : 673
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Tue May 10 22:36:52 2022
     13// Update Count     : 677
    1414//
    1515
     
    283283                if ( signedness != DeclarationNode::NoSignedness ) os << DeclarationNode::signednessNames[ signedness ] << " ";
    284284                if ( length != DeclarationNode::NoLength ) os << DeclarationNode::lengthNames[ length ] << " ";
    285                 if ( complextype == DeclarationNode::NoComplexType ) { // basic type
    286                         assert( basictype != DeclarationNode::NoBasicType );
    287                         os << DeclarationNode::basicTypeNames[ basictype ] << " ";
    288                 } else {                                                                                // complex type
    289                         // handle double _Complex
    290                         if ( basictype != DeclarationNode::NoBasicType ) os << DeclarationNode::basicTypeNames[ basictype ] << " ";
    291                         os << DeclarationNode::complexTypeNames[ complextype ] << " ";
    292                 } // if
     285                if ( complextype != DeclarationNode::NoComplexType ) os << DeclarationNode::complexTypeNames[ complextype ] << " ";
     286                if ( basictype != DeclarationNode::NoBasicType ) os << DeclarationNode::basicTypeNames[ basictype ] << " ";
    293287                break;
    294288          case Pointer:
     
    437431                        __attribute__((fallthrough));
    438432                #endif
     433                // FALL THROUGH
    439434          case Typeof:
    440435                os << "type-of expression ";
     
    442437                        typeexpr->print( os, indent + 2 );
    443438                } // if
     439                break;
     440          case Vtable:
     441                os << "vtable";
    444442                break;
    445443          case Builtin:
  • src/Parser/TypeData.h

    r32d1383 r17c6edeb  
    1010// Created On       : Sat May 16 15:18:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 14 17:44:05 2021
    13 // Update Count     : 202
     12// Last Modified On : Tue May 10 22:18:49 2022
     13// Update Count     : 203
    1414//
    1515
     
    2727struct TypeData {
    2828        enum Kind { Basic, Pointer, Reference, Array, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,
    29                                 SymbolicInst, Tuple, Typeof, Basetypeof, Vtable, Builtin, GlobalScope, Qualified, Unknown };
     29                                SymbolicInst, Tuple, Basetypeof, Typeof, Vtable, Builtin, GlobalScope, Qualified, Unknown };
    3030
    3131        struct Aggregate_t {
  • src/Parser/TypedefTable.cc

    r32d1383 r17c6edeb  
    1010// Created On       : Sat May 16 15:20:13 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May 19 08:30:14 2021
    13 // Update Count     : 262
     12// Last Modified On : Tue Feb 15 08:27:24 2022
     13// Update Count     : 275
    1414//
    1515
     
    1818#include <cassert>                                                                              // for assert
    1919#include <iostream>
     20using namespace std;
    2021
    2122#if 0
     
    2829
    2930debugPrint(
    30 static const char *kindName( int kind ) {
    31         switch ( kind ) {
    32           case IDENTIFIER: return "identifier";
    33           case TYPEDIMname: return "typedim";
    34           case TYPEDEFname: return "typedef";
    35           case TYPEGENname: return "typegen";
    36           default:
    37                 cerr << "Error: cfa-cpp internal error, invalid kind of identifier" << endl;
    38                 abort();
    39         } // switch
    40 } // kindName
    41 )
     31        static const char *kindName( int kind ) {
     32                switch ( kind ) {
     33                  case IDENTIFIER: return "identifier";
     34                  case TYPEDIMname: return "typedim";
     35                  case TYPEDEFname: return "typedef";
     36                  case TYPEGENname: return "typegen";
     37                  default:
     38                        cerr << "Error: cfa-cpp internal error, invalid kind of identifier" << endl;
     39                        abort();
     40                } // switch
     41        } // kindName
     42);
    4243
    4344TypedefTable::~TypedefTable() {
     
    8081
    8182void TypedefTable::addToScope( const string & identifier, int kind, const char * locn __attribute__((unused)) ) {
    82         auto scope = kindTable.currentScope();
     83        KindTable::size_type scope = kindTable.currentScope();
    8384        debugPrint( cerr << "Adding current at " << locn << " " << identifier << " as " << kindName( kind ) << " scope " << scope << endl );
    8485        kindTable.insertAt( scope, identifier, kind );
     
    8687
    8788void TypedefTable::addToEnclosingScope( const string & identifier, int kind, const char * locn __attribute__((unused)) ) {
    88         auto scope = kindTable.currentScope() - 1 - kindTable.getNote( kindTable.currentScope() - 1 ).level;
    89 //      auto scope = level - kindTable.getNote( kindTable.currentScope() - 1 ).level;
     89        KindTable::size_type scope = kindTable.currentScope() - 1 - kindTable.getNote( kindTable.currentScope() - 1 ).level;
     90//      size_type scope = level - kindTable.getNote( kindTable.currentScope() - 1 ).level;
    9091        debugPrint( cerr << "Adding enclosing at " << locn << " " << identifier << " as " << kindName( kind ) << " scope " << scope << " level " << level << " note " << kindTable.getNote( kindTable.currentScope() - 1 ).level << endl );
    91         auto ret = kindTable.insertAt( scope, identifier, kind );
     92        pair< KindTable::iterator, bool > ret = kindTable.insertAt( scope, identifier, kind );
    9293        if ( ! ret.second ) ret.first->second = kind;           // exists => update
    9394} // TypedefTable::addToEnclosingScope
  • src/Parser/parser.yy

    r32d1383 r17c6edeb  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul  1 15:35:08 2022
    13 // Update Count     : 5405
     12// Last Modified On : Fri Aug 12 07:59:58 2022
     13// Update Count     : 5649
    1414//
    1515
     
    5858
    5959// lex uses __null in a boolean context, it's fine.
    60 #pragma GCC diagnostic ignored "-Wparentheses-equality"
     60//#pragma GCC diagnostic ignored "-Wparentheses-equality"
    6161
    6262extern DeclarationNode * parseTree;
     
    197197} // fieldDecl
    198198
     199#define NEW_ZERO new ExpressionNode( build_constantInteger( *new string( "0" ) ) )
     200#define NEW_ONE  new ExpressionNode( build_constantInteger( *new string( "1" ) ) )
     201#define UPDOWN( compop, left, right ) (compop == OperKinds::LThan || compop == OperKinds::LEThan ? left : right)
     202
     203ForCtrl * forCtrl( DeclarationNode * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) {
     204        if ( index->initializer ) {
     205                SemanticError( yylloc, "Direct initialization disallowed. Use instead: type var; initialization ~ comparison ~ increment." );
     206        } // if
     207        if ( index->next ) {
     208                SemanticError( yylloc, "Multiple loop indexes disallowed in for-loop declaration." );
     209        } // if
     210        return new ForCtrl( index->addInitializer( new InitializerNode( start ) ),
     211                // NULL comp/inc => leave blank
     212                comp ? new ExpressionNode( build_binary_val( compop, new ExpressionNode( build_varref( new string( *index->name ) ) ), comp ) ) : nullptr,
     213                inc ? new ExpressionNode( build_binary_val( compop == OperKinds::LThan || compop == OperKinds::LEThan ? // choose += or -= for upto/downto
     214                                                        OperKinds::PlusAssn : OperKinds::MinusAssn, new ExpressionNode( build_varref( new string( *index->name ) ) ), inc ) ) : nullptr );
     215} // forCtrl
     216
    199217ForCtrl * forCtrl( ExpressionNode * type, string * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) {
    200218        ConstantExpr * constant = dynamic_cast<ConstantExpr *>(type->expr.get());
     
    206224                distAttr( DeclarationNode::newTypeof( type, true ), DeclarationNode::newName( index )->addInitializer( new InitializerNode( start ) ) ),
    207225                // NULL comp/inc => leave blank
    208                 comp ? new ExpressionNode( build_binary_val( compop, new ExpressionNode( build_varref( new string( *index ) ) ), comp ) ) : 0,
     226                comp ? new ExpressionNode( build_binary_val( compop, new ExpressionNode( build_varref( new string( *index ) ) ), comp ) ) : nullptr,
    209227                inc ? new ExpressionNode( build_binary_val( compop == OperKinds::LThan || compop == OperKinds::LEThan ? // choose += or -= for upto/downto
    210                                                         OperKinds::PlusAssn : OperKinds::MinusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) : 0 );
     228                                                        OperKinds::PlusAssn : OperKinds::MinusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) : nullptr );
    211229} // forCtrl
    212230
     
    346364%type<ifctl> conditional_declaration
    347365%type<fctl> for_control_expression              for_control_expression_list
    348 %type<compop> inclexcl
     366%type<compop> updown updowneq downupdowneq
    349367%type<en> subrange
    350368%type<decl> asm_name_opt
     
    12391257iteration_statement:
    12401258        WHILE '(' ')' statement                                                         %prec THEN // CFA => while ( 1 )
    1241                 { $$ = new StatementNode( build_while( new CondCtl( nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ), maybe_build_compound( $4 ) ) ); }
     1259                { $$ = new StatementNode( build_while( new CondCtl( nullptr, NEW_ONE ), maybe_build_compound( $4 ) ) ); }
    12421260        | WHILE '(' ')' statement ELSE statement                        // CFA
    12431261                {
    1244                         $$ = new StatementNode( build_while( new CondCtl( nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ), maybe_build_compound( $4 ) ) );
     1262                        $$ = new StatementNode( build_while( new CondCtl( nullptr, NEW_ONE ), maybe_build_compound( $4 ) ) );
    12451263                        SemanticWarning( yylloc, Warning::SuperfluousElse, "" );
    12461264                }
     
    12501268                { $$ = new StatementNode( build_while( $3, maybe_build_compound( $5 ), $7 ) ); }
    12511269        | DO statement WHILE '(' ')' ';'                                        // CFA => do while( 1 )
    1252                 { $$ = new StatementNode( build_do_while( new ExpressionNode( build_constantInteger( *new string( "1" ) ) ), maybe_build_compound( $2 ) ) ); }
     1270                { $$ = new StatementNode( build_do_while( NEW_ONE, maybe_build_compound( $2 ) ) ); }
    12531271        | DO statement WHILE '(' ')' ELSE statement                     // CFA
    12541272                {
    1255                         $$ = new StatementNode( build_do_while( new ExpressionNode( build_constantInteger( *new string( "1" ) ) ), maybe_build_compound( $2 ) ) );
     1273                        $$ = new StatementNode( build_do_while( NEW_ONE, maybe_build_compound( $2 ) ) );
    12561274                        SemanticWarning( yylloc, Warning::SuperfluousElse, "" );
    12571275                }
     
    13051323
    13061324        | comma_expression                                                                      // CFA
    1307                 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    1308                                                 OperKinds::LThan, $1->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1309         | '=' comma_expression                                                          // CFA
    1310                 { $$ = forCtrl( $2, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    1311                                                 OperKinds::LEThan, $2->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1312         | comma_expression inclexcl comma_expression            // CFA
    1313                 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1314         | comma_expression inclexcl comma_expression '~' comma_expression // CFA
    1315                 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, $5 ); }
    1316         | comma_expression ';'                                                          // CFA
    1317                 { $$ = forCtrl( new ExpressionNode( build_constantInteger( *new string( "0u" ) ) ), $1, nullptr, OperKinds::LThan, nullptr, nullptr ); }
     1325                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), NEW_ZERO, OperKinds::LThan, $1->clone(), NEW_ONE ); }
     1326        | downupdowneq comma_expression                                         // CFA
     1327                { $$ = forCtrl( $2, new string( DeclarationNode::anonymous.newName() ), UPDOWN( $1, NEW_ZERO, $2->clone() ), $1, UPDOWN( $1, $2->clone(), NEW_ZERO ), NEW_ONE ); }
     1328
     1329        | comma_expression updowneq comma_expression            // CFA
     1330                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), UPDOWN( $2, $1->clone(), $3 ), $2, UPDOWN( $2, $3->clone(), $1->clone() ), NEW_ONE ); }
     1331        | '@' updowneq comma_expression                                         // CFA
     1332                {
     1333                        if ( $2 == OperKinds::LThan || $2 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1334                        else $$ = forCtrl( $3, new string( DeclarationNode::anonymous.newName() ), $3->clone(), $2, nullptr, NEW_ONE );
     1335                }
     1336        | comma_expression updowneq '@'                                         // CFA
     1337                {
     1338                        if ( $2 == OperKinds::LThan || $2 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing comparison ('@') with an anonymous loop index is meaningless." ); $$ = nullptr; }
     1339                        else { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1340                }
     1341        | comma_expression updowneq comma_expression '~' comma_expression // CFA
     1342                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), UPDOWN( $2, $1->clone(), $3 ), $2, UPDOWN( $2, $3->clone(), $1->clone() ), $5 ); }
     1343        | '@' updowneq comma_expression '~' comma_expression // CFA
     1344                {
     1345                        if ( $2 == OperKinds::LThan || $2 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1346                        else $$ = forCtrl( $3, new string( DeclarationNode::anonymous.newName() ), $3->clone(), $2, nullptr, $5 );
     1347                }
     1348        | comma_expression updowneq '@' '~' comma_expression // CFA
     1349                {
     1350                        if ( $2 == OperKinds::LThan || $2 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing comparison ('@') with an anonymous loop index is meaningless." ); $$ = nullptr; }
     1351                        else { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1352                }
     1353        | comma_expression updowneq comma_expression '~' '@' // CFA, error
     1354                { SemanticError( yylloc, "Missing increment ('@') with an anonymous loop index is meaningless." ); $$ = nullptr; }
     1355        | '@' updowneq comma_expression '~' '@'                         // CFA, error
     1356                { SemanticError( yylloc, "Missing loop fields ('@') with an anonymous loop index is meaningless." ); $$ = nullptr; }
     1357        | comma_expression updowneq '@' '~' '@'                         // CFA, error
     1358                { SemanticError( yylloc, "Missing loop fields ('@') with an anonymous loop index is meaningless." ); $$ = nullptr; }
     1359        | '@' updowneq '@' '~' '@'                                                      // CFA, error
     1360                { SemanticError( yylloc, "Missing loop fields ('@') with an anonymous loop index is meaningless." ); $$ = nullptr; }
     1361
    13181362        | comma_expression ';' comma_expression                         // CFA
    1319                 { $$ = forCtrl( $3, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    1320                                                 OperKinds::LThan, $3->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1321         | comma_expression ';' '=' comma_expression                     // CFA
    1322                 { $$ = forCtrl( $4, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    1323                                                 OperKinds::LEThan, $4->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1324         | comma_expression ';' comma_expression inclexcl comma_expression // CFA
    1325                 { $$ = forCtrl( $3, $1, $3->clone(), $4, $5, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1326         | comma_expression ';' comma_expression inclexcl comma_expression '~' comma_expression // CFA
    1327                 { $$ = forCtrl( $3, $1, $3->clone(), $4, $5, $7 ); }
     1363                { $$ = forCtrl( $3, $1, NEW_ZERO, OperKinds::LThan, $3->clone(), NEW_ONE ); }
     1364        | comma_expression ';' downupdowneq comma_expression // CFA
     1365                { $$ = forCtrl( $4, $1, UPDOWN( $3, NEW_ZERO, $4->clone() ), $3, UPDOWN( $3, $4->clone(), NEW_ZERO ), NEW_ONE ); }
     1366
     1367        | comma_expression ';' comma_expression updowneq comma_expression // CFA
     1368                { $$ = forCtrl( $3, $1, UPDOWN( $4, $3->clone(), $5 ), $4, UPDOWN( $4, $5->clone(), $3->clone() ), NEW_ONE ); }
     1369        | comma_expression ';' '@' updowneq comma_expression // CFA
     1370                {
     1371                        if ( $4 == OperKinds::LThan || $4 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1372                        else $$ = forCtrl( $5, $1, $5->clone(), $4, nullptr, NEW_ONE );
     1373                }
     1374        | comma_expression ';' comma_expression updowneq '@' // CFA
     1375                {
     1376                        if ( $4 == OperKinds::GThan || $4 == OperKinds::GEThan ) { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1377                        else if ( $4 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing comparison is meaningless. Use \"~\"." ); $$ = nullptr; }
     1378                        else $$ = forCtrl( $3, $1, $3->clone(), $4, nullptr, NEW_ONE );
     1379                }
     1380        | comma_expression ';' '@' updowneq '@'                         // CFA, error
     1381                { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1382
     1383        | comma_expression ';' comma_expression updowneq comma_expression '~' comma_expression // CFA
     1384                { $$ = forCtrl( $3, $1, UPDOWN( $4, $3->clone(), $5 ), $4, UPDOWN( $4, $5->clone(), $3->clone() ), $7 ); }
     1385        | comma_expression ';' '@' updowneq comma_expression '~' comma_expression // CFA, error
     1386                {
     1387                        if ( $4 == OperKinds::LThan || $4 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1388                        else $$ = forCtrl( $5, $1, $5->clone(), $4, nullptr, $7 );
     1389                }
     1390        | comma_expression ';' comma_expression updowneq '@' '~' comma_expression // CFA
     1391                {
     1392                        if ( $4 == OperKinds::GThan || $4 == OperKinds::GEThan ) { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1393                        else if ( $4 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing comparison is meaningless. Use \"~\"." ); $$ = nullptr; }
     1394                        else $$ = forCtrl( $3, $1, $3->clone(), $4, nullptr, $7 );
     1395                }
     1396        | comma_expression ';' comma_expression updowneq comma_expression '~' '@' // CFA
     1397                { $$ = forCtrl( $3, $1, UPDOWN( $4, $3->clone(), $5 ), $4, UPDOWN( $4, $5->clone(), $3->clone() ), nullptr ); }
     1398        | comma_expression ';' '@' updowneq comma_expression '~' '@' // CFA, error
     1399                {
     1400                        if ( $4 == OperKinds::LThan || $4 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1401                        else $$ = forCtrl( $5, $1, $5->clone(), $4, nullptr, nullptr );
     1402                }
     1403        | comma_expression ';' comma_expression updowneq '@' '~' '@' // CFA
     1404                {
     1405                        if ( $4 == OperKinds::GThan || $4 == OperKinds::GEThan ) { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1406                        else if ( $4 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing comparison is meaningless. Use \"~\"." ); $$ = nullptr; }
     1407                        else $$ = forCtrl( $3, $1, $3->clone(), $4, nullptr, nullptr );
     1408                }
     1409        | comma_expression ';' '@' updowneq '@' '~' '@' // CFA
     1410                { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1411
     1412        | declaration comma_expression                                          // CFA
     1413                { $$ = forCtrl( $1, NEW_ZERO, OperKinds::LThan, $2, NEW_ONE ); }
     1414        | declaration downupdowneq comma_expression                     // CFA
     1415                { $$ = forCtrl( $1, UPDOWN( $2, NEW_ZERO, $3 ), $2, UPDOWN( $2, $3->clone(), NEW_ZERO ), NEW_ONE ); }
     1416
     1417        | declaration comma_expression updowneq comma_expression // CFA
     1418                { $$ = forCtrl( $1, UPDOWN( $3, $2->clone(), $4 ), $3, UPDOWN( $3, $4->clone(), $2->clone() ), NEW_ONE ); }
     1419        | declaration '@' updowneq comma_expression                     // CFA
     1420                {
     1421                        if ( $3 == OperKinds::LThan || $3 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1422                        else $$ = forCtrl( $1, $4, $3, nullptr, NEW_ONE );
     1423                }
     1424        | declaration comma_expression updowneq '@'                     // CFA
     1425                {
     1426                        if ( $3 == OperKinds::GThan || $3 == OperKinds::GEThan ) { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1427                        else if ( $3 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing comparison is meaningless. Use \"~\"." ); $$ = nullptr; }
     1428                        else $$ = forCtrl( $1, $2, $3, nullptr, NEW_ONE );
     1429                }
     1430
     1431        | declaration comma_expression updowneq comma_expression '~' comma_expression // CFA
     1432                { $$ = forCtrl( $1, UPDOWN( $3, $2, $4 ), $3, UPDOWN( $3, $4->clone(), $2->clone() ), $6 ); }
     1433        | declaration '@' updowneq comma_expression '~' comma_expression // CFA
     1434                {
     1435                        if ( $3 == OperKinds::LThan || $3 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1436                        else $$ = forCtrl( $1, $4, $3, nullptr, $6 );
     1437                }
     1438        | declaration comma_expression updowneq '@' '~' comma_expression // CFA
     1439                {
     1440                        if ( $3 == OperKinds::GThan || $3 == OperKinds::GEThan ) { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1441                        else if ( $3 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing comparison is meaningless. Use \"~\"." ); $$ = nullptr; }
     1442                        else $$ = forCtrl( $1, $2, $3, nullptr, $6 );
     1443                }
     1444        | declaration comma_expression updowneq comma_expression '~' '@' // CFA
     1445                { $$ = forCtrl( $1, UPDOWN( $3, $2, $4 ), $3, UPDOWN( $3, $4->clone(), $2->clone() ), nullptr ); }
     1446        | declaration '@' updowneq comma_expression '~' '@' // CFA
     1447                {
     1448                        if ( $3 == OperKinds::LThan || $3 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1449                        else $$ = forCtrl( $1, $4, $3, nullptr, nullptr );
     1450                }
     1451        | declaration comma_expression updowneq '@' '~' '@'     // CFA
     1452                {
     1453                        if ( $3 == OperKinds::GThan || $3 == OperKinds::GEThan ) { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
     1454                        else if ( $3 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing comparison is meaningless. Use \"~\"." ); $$ = nullptr; }
     1455                        else $$ = forCtrl( $1, $2, $3, nullptr, nullptr );
     1456                }
     1457        | declaration '@' updowneq '@' '~' '@'                          // CFA, error
     1458                { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }
    13281459
    13291460        | comma_expression ';' TYPEDEFname                                      // CFA, array type
    13301461                {
    1331                         SemanticError( yylloc, "Array interator is currently unimplemented." ); $$ = nullptr;
    1332                         $$ = forCtrl( new ExpressionNode( build_varref( $3 ) ), $1, nullptr, OperKinds::Range, nullptr, nullptr );
    1333                 }
    1334 
    1335                 // There is a S/R conflicit if ~ and -~ are factored out.
    1336         | comma_expression ';' comma_expression '~' '@'         // CFA
    1337                 { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::LThan, nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1338         | comma_expression ';' comma_expression ErangeDown '@' // CFA
    1339                 { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::GThan, nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1340         | comma_expression ';' comma_expression '~' '@' '~' comma_expression // CFA
    1341                 { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::LThan, nullptr, $7 ); }
    1342         | comma_expression ';' comma_expression ErangeDown '@' '~' comma_expression // CFA
    1343                 { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::GThan, nullptr, $7 ); }
    1344         | comma_expression ';' comma_expression '~' '@' '~' '@' // CFA
    1345                 { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::LThan, nullptr, nullptr ); }
     1462                        SemanticError( yylloc, "Type iterator is currently unimplemented." ); $$ = nullptr;
     1463                        //$$ = forCtrl( new ExpressionNode( build_varref( $3 ) ), $1, nullptr, OperKinds::Range, nullptr, nullptr );
     1464                }
     1465        | comma_expression ';' downupdowneq TYPEDEFname         // CFA, array type
     1466                {
     1467                        if ( $3 == OperKinds::LEThan || $3 == OperKinds::GEThan ) { SemanticError( yylloc, "All enumation ranges are equal (all values). Remove \"=~\"." ); $$ = nullptr; }
     1468                        SemanticError( yylloc, "Type iterator is currently unimplemented." ); $$ = nullptr;
     1469                }
    13461470        ;
    13471471
    1348 inclexcl:
     1472downupdowneq:
     1473        ErangeDown
     1474                { $$ = OperKinds::GThan; }
     1475        | ErangeUpEq
     1476                { $$ = OperKinds::LEThan; }
     1477        | ErangeDownEq
     1478                { $$ = OperKinds::GEThan; }
     1479        ;
     1480
     1481updown:
    13491482        '~'
    13501483                { $$ = OperKinds::LThan; }
     1484        | ErangeDown
     1485                { $$ = OperKinds::GThan; }
     1486        ;
     1487
     1488updowneq:
     1489        updown
    13511490        | ErangeUpEq
    13521491                { $$ = OperKinds::LEThan; }
    1353         | ErangeDown
    1354                 { $$ = OperKinds::GThan; }
    13551492        | ErangeDownEq
    13561493                { $$ = OperKinds::GEThan; }
     
    23952532          '{' enumerator_list comma_opt '}'
    23962533                { $$ = DeclarationNode::newEnum( $3->name, $5, true )->addQualifiers( $2 ); }
     2534        | ENUM '(' ')' attribute_list_opt '{' enumerator_list comma_opt '}'
     2535                { SemanticError( yylloc, "Unvalued enumerated type is currently unimplemented." ); $$ = nullptr; }
    23972536        | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '{' enumerator_list comma_opt '}'
    23982537                {
Note: See TracChangeset for help on using the changeset viewer.