Changeset 01afd8d


Ignore:
Timestamp:
Jun 28, 2024, 11:31:44 AM (4 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
259012e
Parents:
55ba259e
Message:

add +~ and +~= for-control operators to match with -~ and -~= operators

Location:
src/Parser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/lex.ll

    r55ba259e r01afd8d  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Thu Jun 20 16:54:05 2024
    13  * Update Count     : 778
     12 * Last Modified On : Thu Jun 27 14:38:27 2024
     13 * Update Count     : 780
    1414 */
    1515
     
    458458
    459459"@="                    { NAMEDOP_RETURN(ATassign); }                   // CFA
     460"+~"                    { NAMEDOP_RETURN(ErangeUp); }                   // CFA
    460461"~="                    { NAMEDOP_RETURN(ErangeUpEq); }                 // CFA
     462"+~="                   { NAMEDOP_RETURN(ErangeUpEq); }                 // CFA
    461463"-~"                    { NAMEDOP_RETURN(ErangeDown); }                 // CFA
    462464"-~="                   { NAMEDOP_RETURN(ErangeDownEq); }               // CFA
  • src/Parser/parser.yy

    r55ba259e r01afd8d  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 26 09:37:28 2024
    13 // Update Count     : 6700
     12// Last Modified On : Thu Jun 27 14:45:57 2024
     13// Update Count     : 6705
    1414//
    1515
     
    224224#define UPDOWN( compop, left, right ) (compop == OperKinds::LThan || compop == OperKinds::LEThan ? left : right)
    225225#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."
     226#define MISSING_LOW "illegal syntax, missing low value for ascanding range so index is uninitialized."
     227#define MISSING_HIGH "illegal syntax, missing high value for descending range so index is uninitialized."
    228228
    229229static ForCtrl * makeForCtrl( const CodeLocation & location, DeclarationNode * init, OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) {
     
    409409%token ANDassign        ERassign        ORassign                                // &=   ^=      |=
    410410
    411 %token ErangeUpEq       ErangeDown      ErangeDownEq                    // ~=   -~      -~=
     411%token ErangeUp         ErangeUpEq      ErangeDown      ErangeDownEq // +~      +~=/~=  -~      -~=
    412412%token ATassign                                                                                 // @=
    413413
     
    15261526                }
    15271527        | comma_expression ';' '@' updowneq '@'                         // CFA, invalid syntax rule
    1528                 { SemanticError( yylloc, "illegal syntax, missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; }
     1528                { SemanticError( yylloc, "illegal syntax, missing low/high value for ascending/descending range so index is uninitialized." ); $$ = nullptr; }
    15291529
    15301530        | comma_expression ';' comma_expression updowneq comma_expression '~' comma_expression // CFA
     
    15551555                }
    15561556        | comma_expression ';' '@' updowneq '@' '~' '@' // CFA
    1557                 { SemanticError( yylloc, "illegal syntax, missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; }
     1557                { SemanticError( yylloc, "illegal syntax, missing low/high value for ascending/descending range so index is uninitialized." ); $$ = nullptr; }
    15581558
    15591559        | declaration comma_expression                                          // CFA
     
    16031603                }
    16041604        | declaration '@' updowneq '@' '~' '@'                          // CFA, invalid syntax rule
    1605                 { SemanticError( yylloc, "illegal syntax, missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; }
     1605                { SemanticError( yylloc, "illegal syntax, missing low/high value for ascending/descending range so index is uninitialized." ); $$ = nullptr; }
    16061606
    16071607        | comma_expression ';' enum_key                                         // CFA, enum type
     
    16321632// it is not possible to just remove the '='. The entire '~=' must be removed.
    16331633downupdowneq:
    1634         ErangeDown
     1634        ErangeUp
     1635                { $$ = OperKinds::LThan; }
     1636        | ErangeDown
    16351637                { $$ = OperKinds::GThan; }
    16361638        | ErangeUpEq
     
    16411643
    16421644updown:
    1643         '~'
     1645        '~'                                                                                                     // shorthand 0 ~ 10 => 0 +~ 10
     1646                { $$ = OperKinds::LThan; }
     1647        | ErangeUp
    16441648                { $$ = OperKinds::LThan; }
    16451649        | ErangeDown
Note: See TracChangeset for help on using the changeset viewer.