Changeset 561

Show
Ignore:
Timestamp:
07/11/08 12:26:54 (5 months ago)
Author:
athomas
Message:

Add Parser.merge(). Unlike Node.update(), this updates labels correctly.

Files:

Legend:

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

    r556 r561  
    341341        return context 
    342342 
     343    def merge(self, where, grammar): 
     344        """Merge another grammar into this one. 
     345 
     346        Arguments: 
     347            :where: A label or path to a node. 
     348            :grammar: Grammar to merge. 
     349        """ 
     350        where = self.find(where) 
     351        where.update(grammar) 
     352        self._collect_labels() 
     353 
    343354    def execute(self, command, data=None): 
    344355        """Parse and execute the given command.