Changeset 6803ff1


Ignore:
Timestamp:
Jun 25, 2024, 12:09:43 PM (9 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
d96d4f0
Parents:
f3b67b6 (diff), 5eb3f65 (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

Files:
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • TabularUnified libcfa/src/enum.cfa

    rf3b67b6 r6803ff1  
    66forall(ostype & | basic_ostream(ostype), E, V| CfaEnum(E, V))
    77ostype & ?|?(ostype& os, E e) {
    8     return os | type_name(e) | "." | labelE(e);
     8    return os | type_name(e) | "." | label(e);
    99}
    1010
    1111forall(ostype & | basic_ostream(ostype), E| CfaEnum(E, quasi_void))
    1212ostype & ?|?(ostype& os, E e) {
    13     return os | type_name(e) | "." | labelE(e);
     13    return os | type_name(e) | "." | label(e);
    1414}
    1515
    1616forall(ostype & | basic_ostream(ostype), E, V| CfaEnum(E, V)) {
    17     int ?==?(E l, E r) { return posE(l) == posE(r); }
    18     int ?<=?(E l, E r) { return posE(l) <= posE(r); }
    19     int ?>=?(E l, E r) { return posE(l) >= posE(r); }
    20     int ?<?(E l, E r) { return posE(l) < posE(r); }
    21     int ?>?(E l, E r) { return posE(l) > posE(r); }
     17    int ?==?(E l, E r) { return posn(l) == posn(r); }
     18    int ?<=?(E l, E r) { return posn(l) <= posn(r); }
     19    int ?>=?(E l, E r) { return posn(l) >= posn(r); }
     20    int ?<?(E l, E r) { return posn(l) < posn(r); }
     21    int ?>?(E l, E r) { return posn(l) > posn(r); }
    2222}
  • TabularUnified libcfa/src/enum.hfa

    rf3b67b6 r6803ff1  
    1717// Design one
    1818forall(E, V | Serial(E)) trait CfaEnum {
    19     char* labelE(E e);
    20     unsigned int posE(E e);
    21     V valueE(E e);
    22     char* type_name(E e);
     19    char * label(E e);
     20    unsigned int posn(E e);
     21    V value(E e);
     22    char * type_name(E e);
    2323};
    2424
    25 forall(ostype & | basic_ostream(ostype), E, V| CfaEnum(E, V))
     25forall(ostype & | basic_ostream(ostype), E, V | CfaEnum(E, V))
    2626ostype & ?|?(ostype&, E);
    2727
     
    3131// Design two <- should go for this if we have change the cost model
    3232// forall(E | Serial(E)) trait CfaEnum {
    33 //     char* labelE(E e);
    34 //     unsigned int posE(E e);
     33//     char * label(E e);
     34//     unsigned int posn(E e);
    3535// };
    3636
    3737// forall(E, V| CfaEnum(E)) trait TypedEnum {
    38 //     V valueE(E e);
     38//     V value(E e);
    3939// };
    4040
  • TabularUnified src/ControlStruct/TranslateEnumRange.cpp

    rf3b67b6 r6803ff1  
    1 #include "TrasnlateEnumRange.hpp"
     1#include "TranslateEnumRange.hpp"
    22
    33#include "AST/Pass.hpp"
  • TabularUnified src/Parser/parser.yy

    rf3b67b6 r6803ff1  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jun 20 21:34:49 2024
    13 // Update Count     : 6654
     12// Last Modified On : Mon Jun 24 22:45:20 2024
     13// Update Count     : 6684
    1414//
    1515
     
    223223#define NEW_ONE  new ExpressionNode( build_constantInteger( yylloc, *new string( "1" ) ) )
    224224#define UPDOWN( compop, left, right ) (compop == OperKinds::LThan || compop == OperKinds::LEThan ? left : right)
    225 #define MISSING_ANON_FIELD "syntax error, missing loop fields with an anonymous loop index is meaningless as loop index is unavailable in loop body."
    226 #define MISSING_LOW "syntax error, missing low value for up-to range so index is uninitialized."
    227 #define MISSING_HIGH "syntax error, missing high value for down-to range so index is uninitialized."
    228 
    229 static ForCtrl * makeForCtrl(
    230                 const CodeLocation & location,
    231                 DeclarationNode * init,
    232                 enum OperKinds compop,
    233                 ExpressionNode * comp,
    234                 ExpressionNode * inc ) {
     225#define MISSING_ANON_FIELD "illegal syntax, missing loop fields with an anonymous loop index is meaningless as loop index is unavailable in loop body."
     226#define MISSING_LOW "illegal syntax, missing low value for up-to range so index is uninitialized."
     227#define MISSING_HIGH "illegal syntax, missing high value for down-to range so index is uninitialized."
     228
     229static ForCtrl * makeForCtrl( const CodeLocation & location, DeclarationNode * init, enum OperKinds compop,
     230                                                          ExpressionNode * comp, ExpressionNode * inc ) {
    235231        // Wrap both comp/inc if they are non-null.
    236232        if ( comp ) comp = new ExpressionNode( build_binary_val( location,
     
    249245ForCtrl * forCtrl( const CodeLocation & location, DeclarationNode * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) {
    250246        if ( index->initializer ) {
    251                 SemanticError( yylloc, "syntax error, direct initialization disallowed. Use instead: type var; initialization ~ comparison ~ increment." );
     247                SemanticError( yylloc, "illegal syntax, direct initialization disallowed. Use instead: type var; initialization ~ comparison ~ increment." );
    252248        } // if
    253249        if ( index->next ) {
    254                 SemanticError( yylloc, "syntax error, multiple loop indexes disallowed in for-loop declaration." );
     250                SemanticError( yylloc, "illegal syntax, multiple loop indexes disallowed in for-loop declaration." );
    255251        } // if
    256252        DeclarationNode * initDecl = index->addInitializer( new InitializerNode( start ) );
     
    270266} // forCtrl
    271267
     268#define MISSING_LOOP_INDEX "illegal syntax, only a single identifier or declaration allowed in initialization, e.g., for ( i; ... ) or for ( int i; ... ). Expression disallowed."
     269
    272270ForCtrl * forCtrl( const CodeLocation & location, ExpressionNode * type, ExpressionNode * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) {
    273271        if ( auto identifier = dynamic_cast<ast::NameExpr *>(index->expr.get()) ) {
    274272                return forCtrl( location, type, new string( identifier->name ), start, compop, comp, inc );
    275         } else if ( auto commaExpr = dynamic_cast<ast::CommaExpr *>( index->expr.get() ) ) {
    276                 if ( auto identifier = commaExpr->arg1.as<ast::NameExpr>() ) {
    277                         return forCtrl( location, type, new string( identifier->name ), start, compop, comp, inc );
    278                 } else {
    279                         SemanticError( yylloc, "syntax error, loop-index name missing. Expression disallowed." ); return nullptr;
    280                 } // if
     273        // } else if ( auto commaExpr = dynamic_cast<ast::CommaExpr *>( index->expr.get() ) ) {
     274        //      if ( auto identifier = commaExpr->arg2.as<ast::NameExpr>() ) {
     275        //              return forCtrl( location, type, new string( identifier->name ), start, compop, comp, inc );
     276        //      } else {
     277        //              SemanticError( yylloc, "illegal syntax, loop-index name missing. Expression disallowed." ); return nullptr;
     278        //      } // if
    281279        } else {
    282                 SemanticError( yylloc, "syntax error, loop-index name missing. Expression disallowed." ); return nullptr;
     280                SemanticError( yylloc, MISSING_LOOP_INDEX ); return nullptr;
    283281        } // if
    284282} // forCtrl
     
    286284ForCtrl * enumRangeCtrl( ExpressionNode * index_expr, ExpressionNode * range_over_expr ) {
    287285        if ( auto identifier = dynamic_cast<ast::NameExpr *>(index_expr->expr.get()) ) {
    288                 DeclarationNode * indexDecl =
    289                         DeclarationNode::newName( new std::string(identifier->name) );
     286                DeclarationNode * indexDecl = DeclarationNode::newName( new std::string(identifier->name) );
    290287                assert( range_over_expr );
    291                 auto node = new StatementNode( indexDecl ); // <- this cause this error
    292                 return new ForCtrl( node, range_over_expr );
    293         } else if (auto commaExpr = dynamic_cast<ast::CommaExpr *>( index_expr->expr.get() )) {
    294                 if ( auto identifier = commaExpr->arg1.as<ast::NameExpr>() ) {
    295                         assert( range_over_expr );
    296                         DeclarationNode * indexDecl = distAttr(
    297                                 DeclarationNode::newTypeof( range_over_expr, true ),
    298                                 DeclarationNode::newName( new std::string( identifier->name) ) );
    299                         return new ForCtrl( new StatementNode( indexDecl ), range_over_expr );
    300                 } else {
    301                         SemanticError( yylloc, "syntax error, loop-index name missing. Expression disallowed." ); return nullptr;
    302                 } // if
     288                return new ForCtrl( new StatementNode( indexDecl ), range_over_expr );
     289        // } else if (auto commaExpr = dynamic_cast<ast::CommaExpr *>( index_expr->expr.get() )) {
     290        //      if ( auto identifier = commaExpr->arg1.as<ast::NameExpr>() ) {
     291        //              assert( range_over_expr );
     292        //              DeclarationNode * indexDecl = distAttr(
     293        //                      DeclarationNode::newTypeof( range_over_expr, true ),
     294        //                      DeclarationNode::newName( new std::string( identifier->name) ) );
     295        //              return new ForCtrl( new StatementNode( indexDecl ), range_over_expr );
     296        //      } else {
     297        //              SemanticError( yylloc, "illegal syntax, loop-index name missing. Comma expression disallowed." ); return nullptr;
     298        //      } // if
    303299        } else {
    304                 assert( false );
     300                SemanticError( yylloc, MISSING_LOOP_INDEX ); return nullptr;
    305301        } // if
    306302} // enumRangeCtrl
    307303
    308304static void IdentifierBeforeIdentifier( string & identifier1, string & identifier2, const char * kind ) {
    309         SemanticError( yylloc, "syntax error, adjacent identifiers \"%s\" and \"%s\" are not meaningful in an %s.\n"
     305        SemanticError( yylloc, "illegal syntax, adjacent identifiers \"%s\" and \"%s\" are not meaningful in an %s.\n"
    310306                                   "Possible cause is misspelled type name or missing generic parameter.",
    311307                                   identifier1.c_str(), identifier2.c_str(), kind );
     
    313309
    314310static void IdentifierBeforeType( string & identifier, const char * kind ) {
    315         SemanticError( yylloc, "syntax error, identifier \"%s\" cannot appear before a %s.\n"
     311        SemanticError( yylloc, "illegal syntax, identifier \"%s\" cannot appear before a %s.\n"
    316312                                   "Possible cause is misspelled storage/CV qualifier, misspelled typename, or missing generic parameter.",
    317313                                   identifier.c_str(), kind );
     
    12871283                { assert( $1 ); $1->set_last( $2 ); $$ = $1; }
    12881284        | statement_list_nodecl error                                           // invalid syntax rule
    1289                 { SemanticError( yylloc, "syntax error, declarations only allowed at the start of the switch body,"
     1285                { SemanticError( yylloc, "illegal syntax, declarations only allowed at the start of the switch body,"
    12901286                                                 " i.e., after the '{'." ); $$ = nullptr; }
    12911287        ;
     
    13481344                }
    13491345        | CHOOSE '(' comma_expression ')' '{' error '}'         // CFA, invalid syntax rule
    1350                 { SemanticError( yylloc, "syntax error, declarations can only appear before the list of case clauses." ); $$ = nullptr; }
     1346                { SemanticError( yylloc, "illegal syntax, declarations can only appear before the list of case clauses." ); $$ = nullptr; }
    13511347        ;
    13521348
     
    13801376case_label:                                                                                             // CFA
    13811377        CASE error                                                                                      // invalid syntax rule
    1382                 { SemanticError( yylloc, "syntax error, case list missing after case." ); $$ = nullptr; }
     1378                { SemanticError( yylloc, "illegal syntax, case list missing after case." ); $$ = nullptr; }
    13831379        | CASE case_value_list ':'                                      { $$ = $2; }
    13841380        | CASE case_value_list error                                            // invalid syntax rule
    1385                 { SemanticError( yylloc, "syntax error, colon missing after case list." ); $$ = nullptr; }
     1381                { SemanticError( yylloc, "illegal syntax, colon missing after case list." ); $$ = nullptr; }
    13861382        | DEFAULT ':'                                                           { $$ = new ClauseNode( build_default( yylloc ) ); }
    13871383                // A semantic check is required to ensure only one default clause per switch/choose statement.
    13881384        | DEFAULT error                                                                         //  invalid syntax rule
    1389                 { SemanticError( yylloc, "syntax error, colon missing after default." ); $$ = nullptr; }
     1385                { SemanticError( yylloc, "illegal syntax, colon missing after default." ); $$ = nullptr; }
    13901386        ;
    13911387
     
    14761472        | comma_expression ';' comma_expression_opt ';' comma_expression_opt
    14771473                {
    1478                         StatementNode * init = $1 ? new StatementNode( new ast::ExprStmt( yylloc, maybeMoveBuild( $1 ) ) ) : nullptr;
    1479                         $$ = new ForCtrl( init, $3, $5 );
     1474                        $$ = new ForCtrl( $1 ? new StatementNode( new ast::ExprStmt( yylloc, maybeMoveBuild( $1 ) ) ) : nullptr, $3, $5 );
    14801475                }
    14811476        | declaration comma_expression_opt ';' comma_expression_opt // C99, declaration has ';'
     
    15421537                {
    15431538                        if ( $4 == OperKinds::GThan || $4 == OperKinds::GEThan ) { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; }
    1544                         else if ( $4 == OperKinds::LEThan ) { SemanticError( yylloc, "syntax error, equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; }
     1539                        else if ( $4 == OperKinds::LEThan ) { SemanticError( yylloc, "illegal syntax, equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; }
    15451540                        else $$ = forCtrl( yylloc, $3, $1, $3->clone(), $4, nullptr, NEW_ONE );
    15461541                }
    15471542        | comma_expression ';' '@' updowneq '@'                         // CFA, invalid syntax rule
    1548                 { SemanticError( yylloc, "syntax error, missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; }
     1543                { SemanticError( yylloc, "illegal syntax, missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; }
    15491544
    15501545        | comma_expression ';' comma_expression updowneq comma_expression '~' comma_expression // CFA
     
    15581553                {
    15591554                        if ( $4 == OperKinds::GThan || $4 == OperKinds::GEThan ) { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; }
    1560                         else if ( $4 == OperKinds::LEThan ) { SemanticError( yylloc, "syntax error, equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; }
     1555                        else if ( $4 == OperKinds::LEThan ) { SemanticError( yylloc, "illegal syntax, equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; }
    15611556                        else $$ = forCtrl( yylloc, $3, $1, $3->clone(), $4, nullptr, $7 );
    15621557                }
     
    15711566                {
    15721567                        if ( $4 == OperKinds::GThan || $4 == OperKinds::GEThan ) { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; }
    1573                         else if ( $4 == OperKinds::LEThan ) { SemanticError( yylloc, "syntax error, equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; }
     1568                        else if ( $4 == OperKinds::LEThan ) { SemanticError( yylloc, "illegal syntax, equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; }
    15741569                        else $$ = forCtrl( yylloc, $3, $1, $3->clone(), $4, nullptr, nullptr );
    15751570                }
    15761571        | comma_expression ';' '@' updowneq '@' '~' '@' // CFA
    1577                 { SemanticError( yylloc, "syntax error, missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; }
     1572                { SemanticError( yylloc, "illegal syntax, missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; }
    15781573
    15791574        | declaration comma_expression                                          // CFA
     
    15921587                {
    15931588                        if ( $3 == OperKinds::GThan || $3 == OperKinds::GEThan ) { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; }
    1594                         else if ( $3 == OperKinds::LEThan ) { SemanticError( yylloc, "syntax error, equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; }
     1589                        else if ( $3 == OperKinds::LEThan ) { SemanticError( yylloc, "illegal syntax, equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; }
    15951590                        else $$ = forCtrl( yylloc, $1, $2, $3, nullptr, NEW_ONE );
    15961591                }
     
    16061601                {
    16071602                        if ( $3 == OperKinds::GThan || $3 == OperKinds::GEThan ) { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; }
    1608                         else if ( $3 == OperKinds::LEThan ) { SemanticError( yylloc, "syntax error, equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; }
     1603                        else if ( $3 == OperKinds::LEThan ) { SemanticError( yylloc, "illegal syntax, equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; }
    16091604                        else $$ = forCtrl( yylloc, $1, $2, $3, nullptr, $6 );
    16101605                }
     
    16191614                {
    16201615                        if ( $3 == OperKinds::GThan || $3 == OperKinds::GEThan ) { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; }
    1621                         else if ( $3 == OperKinds::LEThan ) { SemanticError( yylloc, "syntax error, equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; }
     1616                        else if ( $3 == OperKinds::LEThan ) { SemanticError( yylloc, "illegal syntax, equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; }
    16221617                        else $$ = forCtrl( yylloc, $1, $2, $3, nullptr, nullptr );
    16231618                }
    16241619        | declaration '@' updowneq '@' '~' '@'                          // CFA, invalid syntax rule
    1625                 { SemanticError( yylloc, "syntax error, missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; }
     1620                { SemanticError( yylloc, "illegal syntax, missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; }
    16261621
    16271622        | comma_expression ';' enum_key                                         // CFA, enum type
     
    16321627                {
    16331628                        if ( $3 == OperKinds::LEThan || $3 == OperKinds::GEThan ) {
    1634                                 SemanticError( yylloc, "syntax error, all enumeration ranges are equal (all values). Remove \"=~\"." ); $$ = nullptr;
     1629                                SemanticError( yylloc, "illegal syntax, all enumeration ranges are equal (all values). Remove \"=~\"." ); $$ = nullptr;
    16351630                        }
    16361631                        SemanticError( yylloc, "Type iterator is currently unimplemented." ); $$ = nullptr;
     
    17371732        MUTEX '(' argument_expression_list_opt ')' statement
    17381733                {
    1739                         if ( ! $3 ) { SemanticError( yylloc, "syntax error, mutex argument list cannot be empty." ); $$ = nullptr; }
     1734                        if ( ! $3 ) { SemanticError( yylloc, "illegal syntax, mutex argument list cannot be empty." ); $$ = nullptr; }
    17401735                        $$ = new StatementNode( build_mutex( yylloc, $3, $5 ) );
    17411736                }
     
    17851780        // "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless)
    17861781        | wor_waitfor_clause wor when_clause_opt timeout statement wor ELSE statement // invalid syntax rule
    1787                 { SemanticError( yylloc, "syntax error, else clause must be conditional after timeout or timeout never triggered." ); $$ = nullptr; }
     1782                { SemanticError( yylloc, "illegal syntax, else clause must be conditional after timeout or timeout never triggered." ); $$ = nullptr; }
    17881783        | wor_waitfor_clause wor when_clause_opt timeout statement wor when_clause ELSE statement
    17891784                { $$ = build_waitfor_else( yylloc, build_waitfor_timeout( yylloc, $1, $3, $4, maybe_build_compound( yylloc, $5 ) ), $7, maybe_build_compound( yylloc, $9 ) ); }
     
    21772172                        assert( $1->type );
    21782173                        if ( $1->type->qualifiers.any() ) {                     // CV qualifiers ?
    2179                                 SemanticError( yylloc, "syntax error, useless type qualifier(s) in empty declaration." ); $$ = nullptr;
     2174                                SemanticError( yylloc, "illegal syntax, useless type qualifier(s) in empty declaration." ); $$ = nullptr;
    21802175                        }
    21812176                        // enums are never empty declarations because there must have at least one enumeration.
    21822177                        if ( $1->type->kind == TypeData::AggregateInst && $1->storageClasses.any() ) { // storage class ?
    2183                                 SemanticError( yylloc, "syntax error, useless storage qualifier(s) in empty aggregate declaration." ); $$ = nullptr;
     2178                                SemanticError( yylloc, "illegal syntax, useless storage qualifier(s) in empty aggregate declaration." ); $$ = nullptr;
    21842179                        }
    21852180                }
     
    22142209        | sue_declaration_specifier invalid_types                       // invalid syntax rule
    22152210                {
    2216                         SemanticError( yylloc, "syntax error, expecting ';' at end of \"%s\" declaration.",
     2211                        SemanticError( yylloc, "illegal syntax, expecting ';' at end of \"%s\" declaration.",
    22172212                                                   ast::AggregateDecl::aggrString( $1->type->aggregate.kind ) );
    22182213                        $$ = nullptr;
     
    26922687        | type_specifier field_declaring_list_opt '}'           // invalid syntax rule
    26932688                {
    2694                         SemanticError( yylloc, "syntax error, expecting ';' at end of previous declaration." );
     2689                        SemanticError( yylloc, "illegal syntax, expecting ';' at end of previous declaration." );
    26952690                        $$ = nullptr;
    26962691                }
     
    27882783                {
    27892784                        if ( $3 == EnumHiding::Hide ) {
    2790                                 SemanticError( yylloc, "syntax error, hiding ('!') the enumerator names of an anonymous enumeration means the names are inaccessible." ); $$ = nullptr;
     2785                                SemanticError( yylloc, "illegal syntax, hiding ('!') the enumerator names of an anonymous enumeration means the names are inaccessible." ); $$ = nullptr;
    27912786                        } // if
    27922787                        $$ = DeclarationNode::newEnum( nullptr, $5, true, false )->addQualifiers( $2 );
     
    27952790                {
    27962791                        if ( $2 && ($2->storageClasses.val != 0 || $2->type->qualifiers.any()) ) {
    2797                                 SemanticError( yylloc, "syntax error, storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." );
     2792                                SemanticError( yylloc, "illegal syntax, storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." );
    27982793                        }
    27992794                        if ( $4 == EnumHiding::Hide ) {
    2800                                 SemanticError( yylloc, "syntax error, hiding ('!') the enumerator names of an anonymous enumeration means the names are inaccessible." ); $$ = nullptr;
     2795                                SemanticError( yylloc, "illegal syntax, hiding ('!') the enumerator names of an anonymous enumeration means the names are inaccessible." ); $$ = nullptr;
    28012796                        } // if
    28022797                        $$ = DeclarationNode::newEnum( nullptr, $6, true, true, $2 )->addQualifiers( $3 );
     
    28132808                {
    28142809                        if ( $2 && ($2->storageClasses.any() || $2->type->qualifiers.val != 0) ) {
    2815                                 SemanticError( yylloc, "syntax error, storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." );
     2810                                SemanticError( yylloc, "illegal syntax, storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." );
    28162811                        }
    28172812                        typedefTable.makeTypedef( *$4, "enum_type 2" );
     
    33363331                {
    33373332                        if ( $1->type->qualifiers.any() ) {
    3338                                 SemanticError( yylloc, "syntax error, CV qualifiers cannot be distributed; only storage-class and forall qualifiers." );
     3333                                SemanticError( yylloc, "illegal syntax, CV qualifiers cannot be distributed; only storage-class and forall qualifiers." );
    33393334                        }
    33403335                        if ( $1->type->forall ) forall = true;          // remember generic type
     
    33493344                {
    33503345                        if ( $1->type && $1->type->qualifiers.any() ) {
    3351                                 SemanticError( yylloc, "syntax error, CV qualifiers cannot be distributed; only storage-class and forall qualifiers." );
     3346                                SemanticError( yylloc, "illegal syntax, CV qualifiers cannot be distributed; only storage-class and forall qualifiers." );
    33523347                        }
    33533348                        if ( $1->type && $1->type->forall ) forall = true; // remember generic type
     
    33623357                {
    33633358                        if ( ($1->type && $1->type->qualifiers.any()) || ($2->type && $2->type->qualifiers.any()) ) {
    3364                                 SemanticError( yylloc, "syntax error, CV qualifiers cannot be distributed; only storage-class and forall qualifiers." );
     3359                                SemanticError( yylloc, "illegal syntax, CV qualifiers cannot be distributed; only storage-class and forall qualifiers." );
    33653360                        }
    33663361                        if ( ($1->type && $1->type->forall) || ($2->type && $2->type->forall) ) forall = true; // remember generic type
     
    33943389                        $$ = $3; forall = false;
    33953390                        if ( $5 ) {
    3396                                 SemanticError( yylloc, "syntax error, attributes cannot be associated with function body. Move attribute(s) before \"with\" clause." );
     3391                                SemanticError( yylloc, "illegal syntax, attributes cannot be associated with function body. Move attribute(s) before \"with\" clause." );
    33973392                                $$ = nullptr;
    33983393                        } // if
  • TabularUnified src/ResolvExpr/CandidateFinder.cpp

    rf3b67b6 r6803ff1  
    99// Author           : Aaron B. Moss
    1010// Created On       : Wed Jun 5 14:30:00 2019
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Mar 16 11:58:00 2022
    13 // Update Count     : 3
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Jun 22 08:07:26 2024
     13// Update Count     : 4
    1414//
    1515
     
    909909                        auto location = expr->location;
    910910                        auto callExpr = new ast::UntypedExpr(
    911                                 location, new ast::NameExpr( location, "valueE" ), {expr}
     911                                location, new ast::NameExpr( location, "value" ), {expr}
    912912                        );
    913913                        finder.find( callExpr );
    914914                        CandidateList winners = findMinCost( finder.candidates );
    915915                        if (winners.size() != 1) {
    916                                 SemanticError( callExpr, "Ambiguous expression in valueE..." );
     916                                SemanticError( callExpr, "Ambiguous expression in value..." );
    917917                        }
    918918                        CandidateRef & choice = winners.front();
  • TabularUnified src/Validate/ImplementEnumFunc.cpp

    rf3b67b6 r6803ff1  
    175175ast::FunctionDecl* EnumAttrFuncGenerator::genPosnProto() const {
    176176    return genProto(
    177         "posE",
     177        "posn",
    178178        {new ast::ObjectDecl(getLocation(), "_i", new ast::EnumInstType(decl))},
    179179        {new ast::ObjectDecl(getLocation(), "_ret",
     
    183183ast::FunctionDecl* EnumAttrFuncGenerator::genLabelProto() const {
    184184        return genProto(
    185                 "labelE",
     185                "label",
    186186                {new ast::ObjectDecl(getLocation(), "_i", new ast::EnumInstType(decl))},
    187187                {new ast::ObjectDecl(
     
    193193        if (decl->base)
    194194                return genProto(
    195                         "valueE",
     195                        "value",
    196196                        {new ast::ObjectDecl(getLocation(), "_i", new ast::EnumInstType(decl))},
    197197                        {new ast::ObjectDecl(getLocation(), "_ret",
     
    203203ast::FunctionDecl* EnumAttrFuncGenerator::genQuasiValueProto() const {
    204204        return genProto(
    205                 "valueE",
     205                "value",
    206206                {new ast::ObjectDecl(getLocation(), "_i", new ast::EnumInstType(decl))},
    207207                {new ast::ObjectDecl(getLocation(), "_ret",
     
    254254        auto param = params.front();
    255255        ast::UntypedExpr* untyped = ast::UntypedExpr::createCall(
    256                 func->location, "posE", { new ast::VariableExpr(func->location, param) });
     256                func->location, "posn", { new ast::VariableExpr(func->location, param) });
    257257        func->stmts = new ast::CompoundStmt(
    258258                func->location, {new ast::ReturnStmt(func->location, untyped)}
  • TabularUnified src/main.cpp

    rf3b67b6 r6803ff1  
    1010// Created On       : Fri May 15 23:12:02 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Nov  1 21:12:58 2023
    13 // Update Count     : 690
     12// Last Modified On : Sun Jun 23 16:38:09 2024
     13// Update Count     : 691
    1414//
    1515
     
    5353#include "ControlStruct/FixLabels.hpp"      // for fixLabels
    5454#include "ControlStruct/HoistControlDecls.hpp" //  hoistControlDecls
    55 #include "ControlStruct/TrasnlateEnumRange.hpp" // translateEnumRange
     55#include "ControlStruct/TranslateEnumRange.hpp" // translateEnumRange
    5656#include "GenPoly/Box.hpp"                  // for box
    5757#include "GenPoly/InstantiateGeneric.hpp"   // for instantiateGeneric
  • TabularUnified tests/enum_tests/enumInlineValue.cfa

    rf3b67b6 r6803ff1  
    3838// Note: variable name (cat in this case) cannot be overloaded with those declared in enum,
    3939// Probably for the same reason as const overloading problem
    40 // i.e. int identity_t(enum ACD a) would not work as the valueE(a) is ambigious currently
     40// i.e. int identity_t(enum ACD a) would not work as the value(a) is ambigious currently
    4141int identity_t(enum ACD cat) {
    42     return valueE(cat);
     42    return value(cat);
    4343}
    4444
     
    4747    // Because Inline introduce ambiguity on symbols
    4848    sout | "Symbols (enumerator) should have the same values:" |nl;
    49     sout | "Symbol a: (10) " | valueE(A.a) | "," | valueE(AB.a) | "," | valueE(ACD.a) | nl;
    50     sout | "Symbol b: (20) " | valueE(B.b) | "," | valueE(AB.b) | nl;
    51     sout | "Symbol ab: (30) " | valueE(AB.ab) | nl;
    52     sout | "Symbol c: (40) " | valueE(C.c) | "," | valueE(CD.c) | "," | valueE(ACD.c) | nl;
    53     sout | "Symbol d: (50) " | valueE(D.d) | "," | valueE(CD.d) | "," | valueE(ACD.d) | nl;
    54     sout | "Symbol cd: (60) " | valueE(CD.cd) | "," | valueE(ACD.cd) | nl;
    55     sout | "Symbol acd: (70) " | valueE(ACD.acd) | nl;
     49    sout | "Symbol a: (10) " | value(A.a) | "," | value(AB.a) | "," | value(ACD.a) | nl;
     50    sout | "Symbol b: (20) " | value(B.b) | "," | value(AB.b) | nl;
     51    sout | "Symbol ab: (30) " | value(AB.ab) | nl;
     52    sout | "Symbol c: (40) " | value(C.c) | "," | value(CD.c) | "," | value(ACD.c) | nl;
     53    sout | "Symbol d: (50) " | value(D.d) | "," | value(CD.d) | "," | value(ACD.d) | nl;
     54    sout | "Symbol cd: (60) " | value(CD.cd) | "," | value(ACD.cd) | nl;
     55    sout | "Symbol acd: (70) " | value(ACD.acd) | nl;
    5656
    5757    sout | "Casting/Upcasting:" | nl;
    58     sout | "Symbol a: (10) " | valueE((A)A.a) | "," | valueE((AB)A.a) | "," | valueE((ACD)A.a) | nl;
    59     sout | "Symbol b: (20) " | valueE((B)B.b) | "," | valueE((AB)B.b) | nl;
    60     sout | "Symbol ab: (30) " | valueE((AB)AB.ab) | nl;
    61     sout | "Symbol c: (40) " | valueE((C)C.c) | "," | valueE((CD)C.c) | "," | valueE((ACD)C.c) | "," | valueE((CD)CD.c)| "," | valueE((ACD)CD.c) | nl;
    62     sout | "Symbol d: (50) " | valueE((D)D.d) | "," | valueE((CD)D.d) | "," | valueE((ACD)D.d) | "," | valueE((ACD)CD.d) | nl;
    63     sout | "Symbol cd: (60) " | valueE((CD)CD.cd) | "," | valueE((ACD)CD.cd) | nl;
    64     sout | "Symbol acd: (70) " | valueE((ACD)ACD.acd) | nl;
     58    sout | "Symbol a: (10) " | value((A)A.a) | "," | value((AB)A.a) | "," | value((ACD)A.a) | nl;
     59    sout | "Symbol b: (20) " | value((B)B.b) | "," | value((AB)B.b) | nl;
     60    sout | "Symbol ab: (30) " | value((AB)AB.ab) | nl;
     61    sout | "Symbol c: (40) " | value((C)C.c) | "," | value((CD)C.c) | "," | value((ACD)C.c) | "," | value((CD)CD.c)| "," | value((ACD)CD.c) | nl;
     62    sout | "Symbol d: (50) " | value((D)D.d) | "," | value((CD)D.d) | "," | value((ACD)D.d) | "," | value((ACD)CD.d) | nl;
     63    sout | "Symbol cd: (60) " | value((CD)CD.cd) | "," | value((ACD)CD.cd) | nl;
     64    sout | "Symbol acd: (70) " | value((ACD)ACD.acd) | nl;
    6565
    6666    sout | "Function Call:" | nl;
  • TabularUnified tests/enum_tests/position.cfa

    rf3b67b6 r6803ff1  
    1717    Colour c2 = fishy;
    1818
    19     sout | "Compile Time: blue value: " | valueE(Colour.Blue) | ", position: " | posE(Colour.Blue) | ", label: " | labelE(Colour.Blue) | ", default return value: " | Colour.Blue;
    20     sout | "Runtime: fishy value: " | valueE(fishy) | ", position: " | posE(fishy) | ", label: " | labelE(fishy) | ", default return value: " | fishy;
    21     sout | "Runtime: C2 value: " | valueE(c2) | ", position: " | posE(c2) | ", label: " | labelE(c2) | ", default return value: " | c2;
     19    sout | "Compile Time: blue value: " | value(Colour.Blue) | ", position: " | posn(Colour.Blue) | ", label: " | label(Colour.Blue) | ", default return value: " | Colour.Blue;
     20    sout | "Runtime: fishy value: " | value(fishy) | ", position: " | posn(fishy) | ", label: " | label(fishy) | ", default return value: " | fishy;
     21    sout | "Runtime: C2 value: " | value(c2) | ", position: " | posn(c2) | ", label: " | label(c2) | ", default return value: " | c2;
    2222    Colour.Red;
    2323    char * ao = Colour.Red;
  • TabularUnified tests/enum_tests/voidEnum.cfa

    rf3b67b6 r6803ff1  
    2828    sout | b;
    2929   
    30     sout | labelE(v_1);
    31     sout | labelE(v_2);
    32 
     30    sout | label(v_1);
     31    sout | label(v_2);
    3332}
Note: See TracChangeset for help on using the changeset viewer.