Python: module simpleparse.generator

simpleparse.generator | index /home/mcfletch/pylive/simpleparse/generator.py

`Abstract representation of an in-memory grammar that generates parsers`

Modules
`` |  |
simpleparse.stt.TextTools.TextTools | traceback |  |

Classes
`` |  | Generator GeneratorAPI1
class Generator
`` | `Abstract representation of an in-memory grammar that generates parsers The generator class manages a collection of ElementToken objects. These element token objects allow the generator to be separated from the particular parser associated with any particular EBNF grammar. In fact, it is possible to create entire grammars using only the generator objects as a python API.`
| Methods defined here: __init__(self) `Initialise the Generator` addDefinition(self, name, rootElement) `Add a new definition (object) to the generator` addDefinitionSource(self, item) `Add a source for definitions when the current grammar doesn't supply a particular rule (effectively common/shared items for the grammar).` buildParser(self, name, methodSource=None) `Build the given parser definition, returning a TextTools parsing tuple` cacheCustomTerminalParser(self, index, flags, parser) `Optimization to reuse customized terminal parsers` getCustomTerminalParser(self, index, flags) `Retrieved a cached customized terminal parser or None` getNameIndex(self, name) `Return the index into the main list for the given name` getNames(self) `Return the list of root generator objects` getObjectForName(self, name) `Determine whether our methodSource has a parsing method for the given name returns ( flags or 0 , tagobject)` getParserList(self) getRootObject(self, name) `Get a particular root object by name` getRootObjects(self) `Return the list of root generator objects` getTagObjectForName(self, name) `Get any explicitly defined tag object for the given name` getTerminalParser(self, index) `Try to retrieve a parser from the parser-list` setTerminalParser(self, index, parser) `Explicitly set the parser value for given name`
class GeneratorAPI1
`` | `Stand-in class supporting operation of SimpleParse 1.0 applications There was really only the one method of interest, parserbyname, everything else was internal (and is now part of simpleparsegrammar.py).`
| Methods defined here: __init__(self, production, prebuilt=()) parserbyname(self, name) `Retrieve a tag-table by production name`

Functions
`` |  | buildParser(declaration, prebuiltnodes=()) `API 1.0 primary entry point, returns a GeneratorAPI1 instance That object will respond to the parserbyname API expected by SimpleParse 1.0 applications.`