Changeset 7552fde for src


Ignore:
Timestamp:
Jun 27, 2024, 4:42:09 PM (6 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
5ccc733
Parents:
d3aa55e9 (diff), 55ba259e (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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rd3aa55e9 r7552fde  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jun 25 18:44:14 2024
    13 // Update Count     : 6692
     12// Last Modified On : Wed Jun 26 09:37:28 2024
     13// Update Count     : 6700
    1414//
    1515
     
    16071607        | comma_expression ';' enum_key                                         // CFA, enum type
    16081608                {
    1609                         $$ = enumRangeCtrl( $1, OperKinds::LThan, new ExpressionNode( new ast::TypeExpr( yylloc, $3->buildType() ) ) );
     1609                        $$ = enumRangeCtrl( $1, OperKinds::LEThan, new ExpressionNode( new ast::TypeExpr( yylloc, $3->buildType() ) ) );
    16101610                }
    16111611        | comma_expression ';' downupdowneq enum_key            // CFA, enum type, reverse direction
    16121612                {
    1613                         if ( $3 == OperKinds::LEThan || $3 == OperKinds::GEThan ) {
    1614                                 SemanticError( yylloc, "illegal syntax, all enumeration ranges are equal (all values). Remove \"=~\"." ); $$ = nullptr;
    1615                         }
     1613                        if ( $3 == OperKinds::GThan ) {
     1614                                SemanticError( yylloc, "all enumeration ranges are equal (all values). Add an equal, e.g., ~=, -~=." ); $$ = nullptr;
     1615                                $3 = OperKinds::GEThan;
     1616                        } // if
    16161617                        $$ = enumRangeCtrl( $1, $3, new ExpressionNode( new ast::TypeExpr( yylloc, $4->buildType() ) ) );
    16171618                }
     
    16271628        ;
    16281629
     1630// This rule exists to handle the ambiguity with unary operator '~'. The rule is the same as updowneq minus the '~'.
     1631// Specifically, "for ( ~5 )" means the complement of 5, not loop 0..4. Hence, in this case "for ( ~= 5 )", i.e., 0..5,
     1632// it is not possible to just remove the '='. The entire '~=' must be removed.
    16291633downupdowneq:
    16301634        ErangeDown
Note: See TracChangeset for help on using the changeset viewer.