Changeset 565

Show
Ignore:
Timestamp:
07/12/08 01:38:15 (5 months ago)
Author:
athomas
Message:

Remove any() and all() from XMLGrammar. Add c (current Context).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cly/trunk/cly/builder.py

    r560 r565  
    931931    to the evaluated expression, as well as some additional variables: 
    932932 
    933         :v: All variables from the parse Context. 
     933        :c: :class:`~cly.parser.Context` object. 
     934        :v: All variables from the :class:`~cly.parser.Context`. 
    934935        :d: The "data" dictionary. 
    935936        :a: Any positional arguments. 
    936937        :kw: Any keyword arguments. 
    937         :all(*keys): Returns true if all keys are valid symbols. 
    938         :any(*keys): Returns true if any keys are valiid symbols. 
    939938 
    940939    v in particular is useful for passing all collected arguments to 
     
    10911090    positional_args = positional_args or [] 
    10921091    def xml_attr_evaluator(*args, **kwargs): 
    1093         def all(*v): 
    1094             """Return true if all arguments are defined symbols.""" 
    1095             for i in v: 
    1096                 if i not in locals: 
    1097                     return False 
    1098             return True 
    1099  
    1100         def any(*v): 
    1101             """Return true if any arguments are defined symbols.""" 
    1102             for i in v: 
    1103                 if i in locals: 
    1104                     return True 
    1105             return False 
    1106  
    11071092        locals = dict(kwargs) 
    11081093 
     
    11301115        locals['kw'] = kwargs 
    11311116        locals['d'] = data 
    1132         locals['all'] = all 
    1133         locals['any'] = any 
     1117        locals['c'] = context 
    11341118        try: 
    11351119            return eval(attr, locals)