vrml.vrml97.parser
index
/home/mcfletch/pylive/vrml/vrml97/parser.py

VRML97-compliant SimpleParse 2.0 Parser
 
This example is a full VRML97 parser, originally created
for the mcf.vrml VRML-processing system.  It supports all
VRML97 constructs, and should be correct for any VRML97
content you can produce.  The parser is fairly fast
(parsing around 280,000 cps on a 1GHz Athlon machine).
 
This is the errorOnFail version of the grammar, otherwise
identical to the vrml.py module.  Note: there is basically
no speed penalty for the errorOnFail version compared to
the original version, as the errorOnFail code is not touched
unless a syntax error is actually found in the input text.

 
Modules
       
simpleparse.common.chartypes

 
Classes
       
Parser(BaseParser)
VRMLParser

 
class VRMLParser(Parser)
    Simple subclassing of Parser to create proper ParseProcessor
 
 
Method resolution order:
VRMLParser
Parser
BaseParser

Methods defined here:
buildProcessor(self)
Build and return a vrml.vrml97.parseprocessor.ParseProcessor

Methods inherited from Parser:
__init__(self, declaration, root='root', prebuilts=(), definitionSources=[{'EOF': Prebuilt( value = ((None, 101, 1),), ), 'ascii_letter': Range( value = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ), 'ascii_letters': Range( repeating = 1, value = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ), 'ascii_lowercase': Range( repeating = 1, value = 'abcdefghijklmnopqrstuvwxyz', ), 'ascii_lowercasechar': Range( value = 'abcdefghijklmnopqrstuvwxyz', ), 'ascii_uppercase': Range( repeating = 1, value = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', ), 'ascii_uppercasechar': Range( value = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', ), 'digit': Range( value = '0123456789', ), 'digits': Range( repeating = 1, value = '0123456789', ), 'hexdigit': Range( value = '0123456789abcdefABCDEF', ), ...}, {'locale_day_abbrs': FirstOfGroup( children = [ Literal( ...l( value = 'Fri', ), ], ), 'locale_day_abbrs_lc': FirstOfGroup( children = [ Literal( ...l( value = 'fri', ), ], ), 'locale_day_abbrs_uc': FirstOfGroup( children = [ Literal( ...l( value = 'FRI', ), ], ), 'locale_day_names': FirstOfGroup( children = [ Literal( ... value = 'Friday', ), ], ), 'locale_day_names_lc': FirstOfGroup( children = [ Literal( ... value = 'friday', ), ], ), 'locale_day_names_uc': FirstOfGroup( children = [ Literal( ... value = 'FRIDAY', ), ], ), 'locale_month_abbrs': FirstOfGroup( children = [ Literal( ...eral( value = '', ), ], ), 'locale_month_abbrs_lc': FirstOfGroup( children = [ Literal( ...eral( value = '', ), ], ), 'locale_month_abbrs_uc': FirstOfGroup( children = [ Literal( ...eral( value = '', ), ], ), 'locale_month_names': FirstOfGroup( children = [ Literal( ...eral( value = '', ), ], ), ...}, {'c_comment': LibraryElement( production = 'slashbang_comm...rse.generator.Generator instance at 0x65d0488>, ), 'c_nest_comment': LibraryElement( production = 'slashbang_nest...rse.generator.Generator instance at 0x63a4680>, ), 'hash_comment': LibraryElement( production = 'hash_comment',...rse.generator.Generator instance at 0x61c9ea8>, ), 'semicolon_comment': LibraryElement( production = 'semicolon_comm...rse.generator.Generator instance at 0x61c9ea8>, ), 'slashbang_comment': LibraryElement( production = 'slashbang_comm...rse.generator.Generator instance at 0x65d0488>, ), 'slashbang_nest_comment': LibraryElement( production = 'slashbang_nest...rse.generator.Generator instance at 0x63a4680>, ), 'slashslash_comment': LibraryElement( production = 'slashslash_com...rse.generator.Generator instance at 0x61c9ea8>, )}, {'binary_number': LibraryElement( production = 'binary_number'...rse.generator.Generator instance at 0x639a998>, ), 'float': LibraryElement( production = 'float', ge...rse.generator.Generator instance at 0x639a998>, ), 'float_floatexp': LibraryElement( production = 'float_floatexp...rse.generator.Generator instance at 0x639a998>, ), 'hex': LibraryElement( production = 'hex', gene...rse.generator.Generator instance at 0x639a998>, ), 'imaginary_number': LibraryElement( production = 'imaginary_numb...rse.generator.Generator instance at 0x639a998>, ), 'int': LibraryElement( production = 'int', gene...rse.generator.Generator instance at 0x639a998>, ), 'int_unsigned': LibraryElement( production = 'int_unsigned',...rse.generator.Generator instance at 0x639a998>, ), 'number': LibraryElement( production = 'number', g...rse.generator.Generator instance at 0x639a998>, ), 'number_full': LibraryElement( production = 'number_full', ...rse.generator.Generator instance at 0x639a998>, )}, {'ISO_date': LibraryElement( production = 'ISO_date', ...rse.generator.Generator instance at 0x65ca758>, ), 'ISO_date_time': LibraryElement( production = 'ISO_date_time'...rse.generator.Generator instance at 0x65ca758>, ), 'ISO_time': LibraryElement( production = 'ISO_time', ...rse.generator.Generator instance at 0x65ca758>, )}, {'ISO_date_loose': LibraryElement( production = 'ISO_date_loose...rse.generator.Generator instance at 0x63a0e60>, ), 'ISO_date_time_loose': LibraryElement( production = 'ISO_date_time_...rse.generator.Generator instance at 0x63a0e60>, ), 'ISO_time_loose': LibraryElement( production = 'ISO_time_loose...rse.generator.Generator instance at 0x63a0e60>, )}, {'military_alphabet_char': FirstOfGroup( children = [ Literal( ...( value = 'Zulu', ), ], ), 'military_alphabet_char_lower': FirstOfGroup( children = [ Literal( ...( value = 'zulu', ), ], )}, {'string': LibraryElement( production = 'string', g...rse.generator.Generator instance at 0x6372cb0>, ), 'string_double_quote': LibraryElement( production = 'str', gene...rse.generator.Generator instance at 0x65ce248>, ), 'string_single_quote': LibraryElement( production = 'str', gene...rse.generator.Generator instance at 0x63b0ef0>, ), 'string_triple_double': LibraryElement( production = 'str', gene...rse.generator.Generator instance at 0x6393c68>, ), 'string_triple_single': LibraryElement( production = 'str', gene...rse.generator.Generator instance at 0x63999e0>, )}, {'civilian_timezone_name': FirstOfGroup( children = [ Literal( ... value = 'ACSST', ), ], ), 'military_timezone_name': FirstOfGroup( children = [ Literal( ...ral( value = 'A', ), ], ), 'timezone_name': FirstOfGroup( children = [ Literal( ...ral( value = 'A', ), ], )}])
Initialise the parser, creating the tagging table for it
 
declaration -- simpleparse ebnf declaration of the language being parsed
root -- root production used for parsing if none explicitly specified
prebuilts -- sequence of (name,value) tuples with prebuilt tables, values
        can be either objectgenerator EventToken sub-classes or TextTools
        tables
definitionSources -- dictionaries of common constructs for use
        in building your grammar
buildTagger(self, production=None, processor=None)
Get a particular parsing table for a particular production

Methods inherited from BaseParser:
parse(self, data, production=None, processor=None, start=0, stop=None)
Parse data with production "production" of this parser
 
data -- data to be parsed, a Python string, for now
production -- optional string specifying a non-default production to use
        for parsing data
processor -- optional pointer to a Processor or MethodSource object for
        use in determining reporting format and/or post-processing the results
        of the parsing pass.  Can be None if neither is desired (default)
start -- starting index for the parsing, default 0
stop -- stoping index for the parsing, default len(data)
resetBeforeParse(self)
Called just before the parser's parse method starts working,
 
Allows you to set up special-purpose structures, such as stacks
or local storage values.  There is no base implementation.  The
base implementation does nothing.

 
Functions
       
buildParser(declaration="\nheader := -[\\n]*\nvrmlFile := head... := ( [ \\011-\\015,]+ / ('#',-'\\012'*,'\\n')+ )*\n")
Build a new VRMLParser object

 
Data
        __file__ = '/home/mcfletch/pylive/vrml/vrml97/parser.pyc'
__name__ = 'vrml.vrml97.parser'
__package__ = 'vrml.vrml97'
grammar = "\nheader := -[\\n]*\nvrmlFile := head... := ( [ \\011-\\015,]+ / ('#',-'\\012'*,'\\n')+ )*\n"