Changeset 496
- Timestamp:
- 01/02/08 06:01:56 (1 year ago)
- Files:
-
- cly/trunk/doc/developers-guide.rst (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cly/trunk/doc/developers-guide.rst
r492 r496 499 499 parameter. 500 500 501 .. code-block:: python 502 from cly import * 503 504 def echo(context): 505 print context 506 507 grammar = Grammar(one=Node(Action(with_user_context=True, callback=echo))) 508 509 my_context = 'hi' 510 parser = Parser(grammar) 511 parser.execute('one', user_context=my_context) 512 513 Will print:: 514 515 hi 516 517 501 518 One way of applying this is by binding all callbacks to methods on a 502 519 single *class*, then passing an instance of that class as the context:
