Package ZestyParser :: Module Parser
[show private | hide private]
[frames | no frames]

Module ZestyParser.Parser


Version: 0.8.0

Author: Adam Atlas

Contact: adam@atlas.st

Copyright: Copyright 2006-2007 Adam Atlas. Released under the MIT license (see LICENSE.txt).

Classes
ZestyParser Parses one stream of data, by means of tokens.

Exceptions
NotMatched Raised by a token if it has failed to match at the parser's current cursor.
ParseError Raised by a token to indicate that a parse error has occurred.

Function Summary
  CallbackFor(token)
Function decorator indicating that the function should be set as the callback of the given token; returns the token instead of the function.
  DebugNote(note)
Factory which creates a logging function usable as a token callback.

Function Details

CallbackFor(token)

Function decorator indicating that the function should be set as the callback of the given token; returns the token instead of the function.

Example:
   @CallbackFor(Token('([0-9]+)'))
   def T_INT(r):
       print r
This is equivalent to:
   def T_INT(r):
       print r
   T_INT = Token('([0-9]+)', callback=T_INT)

DebugNote(note)

Factory which creates a logging function usable as a token callback. The logging function prints note, the parser's coordinates, and the value matched. It then returns the value unmodified.

Example:
   T_FOO = TokenSeries(RawToken('foo')) >> DebugNote('foo_series')

Generated by Epydoc 2.1 on Thu Apr 26 01:32:22 2007 http://epydoc.sf.net