mpylab.tools.plyparser module

mpylab.tools.plyparser module.

class mpylab.tools.plyparser.Parser(**kw)

Bases: object

Base class for PLY lexers and parsers whose rules are methods.

Parameters:

**kw (object) – Parser options. filename selects the input source, SearchPaths supplies directories used to locate a relative filename, and debug enables PLY diagnostics. Unknown options are ignored for compatibility with existing parser configurations.

Notes

filename may be a readable file-like object, a path, a filename found below SearchPaths, or the supported legacy inline StringIO form. If no input source is supplied, run() reads interactively from standard input.

precedence = ()
run()

Parse the configured input source.

Returns:

Semantic result produced by the concrete parser. The exact type is defined by its grammar; for example, DatFile returns a dictionary indexed by frequency.

Return type:

object

Raises:

ValueError – If the configured input source cannot be read.

tokens = ()