Package yagdoc :: Module parser :: Class Parser
[show private | hide private]
[frames | no frames]

Type Parser

object --+
         |
        Parser


Token soup parser.

Attributes are only available after parse.
Method Summary
  __init__(self)
  add_keywords(self, typ, *words)
Define identifiers that produce special tokens.
  parse(self, tokenizer)
Parse token soup into code statements.
  rectify_tokens(self, srctokens, srcranges)
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Instance Variable Summary
list of ParserError errors: Errors encountered.
  ranges: Dictionary of special ranges, the same as tokenizer.Tokenizer.ranges, but with positions recalculated for tokens.
str source: Equal to tokenizer.Tokenizer.source instance variable.
list of tokenizer.Token tokens: Rectified token soup, this is what is actually parsed instead of what we obtained from the tokenizer.
  tree: Parse tree in simpleparser.parser form.

Method Details

add_keywords(self, typ, *words)

Define identifiers that produce special tokens.
Parameters:
typ - Token soup letter identifying the token type.
           (type=signle character string)
words - The words that should produce typ.
           (type=strings, if a single parameter is given, then iterable of strings or a string (will be split on whitespace))

parse(self, tokenizer)

Parse token soup into code statements.

After parser() finishes, tokenizer's data is no longer needed and can be used for something else without breaking the parser state.
Parameters:
tokenizer - Tokenizer with tokenized file.
           (type=tokenizer.Tokenizer)

Instance Variable Details

errors

Errors encountered.
Type:
list of ParserError

ranges

Dictionary of special ranges, the same as tokenizer.Tokenizer.ranges, but with positions recalculated for tokens.

source

Equal to tokenizer.Tokenizer.source instance variable.
Type:
str

tokens

Rectified token soup, this is what is actually parsed instead of what we obtained from the tokenizer.
Type:
list of tokenizer.Token

tree

Parse tree in simpleparser.parser form. Position references are to the token soup.

Generated by Epydoc 2.1 on Fri Oct 5 00:36:53 2007 http://epydoc.sf.net