Changeset 564
- Timestamp:
- 07/12/08 00:49:49 (5 months ago)
- Files:
-
- cly/trunk/cly/parser.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cly/trunk/cly/parser.py
r562 r564 276 276 :grammar: Grammar to parse with. 277 277 :data: User data to attach to Context. 278 :context_factory: A callable used to create new :class:`Context` 279 objects. 278 280 """ 279 def __init__(self, grammar, data=None ):281 def __init__(self, grammar, data=None, context_factory=None): 280 282 """Construct a new Parser.""" 281 283 self.grammar = grammar 282 284 self.data = data 283 285 self.labels = self._collect_labels() 286 self.context_factory = context_factory 284 287 285 288 def _set_grammar(self, grammar): … … 321 324 if data is None: 322 325 data = self.data 323 context = Context(self, command, data)326 context = self.context_factory(self, command, data) 324 327 325 328 def parse(node, match):
