Show
Ignore:
Timestamp:
07/31/08 05:41:13 (5 months ago)
Author:
Chuck.Esterbrook
Message:

Added new all and any unary operators that take something enumerable (such as a list, set or generator) and return a boolean (true or false) indicating if all or any of the elements are true.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cobra/trunk/Source/CobraParser.cobra

    r1562 r1564  
    23802380                        'TILDE': _binaryOpPrec['PLUS']+1, 
    23812381                        'NOT':   _binaryOpPrec['AND']+1, 
     2382                        'ALL':   _binaryOpPrec['AND']+1,  # have to admit I'm just guessing at the precendence level for 'any' and 'all'. experience will tell. TODO: fix or not, then retire this comment (2008-07-31) 
     2383                        'ANY':   _binaryOpPrec['AND']+1, 
    23822384                        'REF':   _binaryOpPrec['STARSTAR']+1, 
    23832385                        'OLD':   _binaryOpPrec['STARSTAR']+1, 
     
    24792481                        token = .grab 
    24802482                        prec = _unaryOpPrec[peek] 
     2483                        unaryExpr = .expression(prec) 
    24812484                        branch token.which 
    2482                                 on 'OLD' 
    2483                                         return OldExpr(token, .expression(prec)) 
    2484                                 on 'REF' 
    2485                                         refTo = .expression(prec) 
    2486                                         return RefExpr(token, refTo) 
    2487                                 else 
    2488                                         return UnaryOpExpr(token, peek, .expression(prec)) 
     2485                                on 'ALL', return AllExpr(token, unaryExpr) 
     2486                                on 'ANY', return AnyExpr(token, unaryExpr) 
     2487                                on 'OLD', return OldExpr(token, unaryExpr) 
     2488                                on 'REF', return RefExpr(token, unaryExpr) 
     2489                                else, return UnaryOpExpr(token, peek, unaryExpr) 
    24892490                # TODO: make a branch statement 
    24902491                else if peek=='LPAREN'