| |
- object
-
- CallableParser
- ElementToken
-
- CILiteral
- EOF
- Group
-
- FirstOfGroup
- SequentialGroup
- LibraryElement
- Literal
- Name
- Range
- ErrorOnFail
- Match
- Updater
-
- UpdateErrorOnFail
-
- UpdateErrorOnFailLookahead(UpdateLookahead, UpdateErrorOnFail)
- UpdateLookahead
- UpdateStandard
- Exception(BaseException)
-
- NoMatch
-
- EOFReached
- UpdateLookahead(Updater)
-
- UpdateErrorOnFailLookahead(UpdateLookahead, UpdateErrorOnFail)
class CILiteral(ElementToken) |
| |
- Method resolution order:
- CILiteral
- ElementToken
- object
Methods defined here:
- __init__(self, value, negative=False, optional=False, repeating=False, report=True, errorOnFail=None, expanded=False, lookahead=False, generator=None)
- parse(self, buffer, start, stop, current)
Methods inherited from ElementToken:
- __repr__(self)
- final_method(self, generator=None, noReport=False)
- parse_negative(self, buffer, start, stop, current)
- parse_negative_optional(self, buffer, start, stop, current)
- parse_negative_repeating(self, buffer, start, stop, current)
- parse_negative_repeating_optional(self, buffer, start, stop, current)
- parse_optional(self, buffer, start, stop, current)
- By default, run the base parse and consider failure success
- parse_repeating(self, buffer, start, stop, current)
- By default, run base parse until it fails, push all tokens to the stack
- parse_repeating_optional(self, buffer, start, stop, current)
- to_parser(self, generator=None, noReport=False)
Data descriptors inherited from ElementToken:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class CallableParser(object) |
| |
Methods defined here:
- __call__(self, buffer, start=0, stop=None, current=None, *args, **named)
- __init__(self, grammar)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class EOF(ElementToken) |
| |
- Method resolution order:
- EOF
- ElementToken
- object
Methods defined here:
- parse(self, buffer, start, stop, current)
Methods inherited from ElementToken:
- __init__(self, value=None, negative=False, optional=False, repeating=False, report=True, errorOnFail=None, expanded=False, lookahead=False, generator=None)
- Initialize the object with named attributes
This method simply takes the named attributes and
updates the object's dictionary with them
- __repr__(self)
- final_method(self, generator=None, noReport=False)
- parse_negative(self, buffer, start, stop, current)
- parse_negative_optional(self, buffer, start, stop, current)
- parse_negative_repeating(self, buffer, start, stop, current)
- parse_negative_repeating_optional(self, buffer, start, stop, current)
- parse_optional(self, buffer, start, stop, current)
- By default, run the base parse and consider failure success
- parse_repeating(self, buffer, start, stop, current)
- By default, run base parse until it fails, push all tokens to the stack
- parse_repeating_optional(self, buffer, start, stop, current)
- to_parser(self, generator=None, noReport=False)
Data descriptors inherited from ElementToken:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class ElementToken(object) |
|
Base class for ElementTokens, provides fallback implementations for flag-parsing based on core "parse" method |
|
Methods defined here:
- __init__(self, value=None, negative=False, optional=False, repeating=False, report=True, errorOnFail=None, expanded=False, lookahead=False, generator=None)
- Initialize the object with named attributes
This method simply takes the named attributes and
updates the object's dictionary with them
- __repr__(self)
- final_method(self, generator=None, noReport=False)
- parse(self, buffer, start, stop, current)
- parse_negative(self, buffer, start, stop, current)
- parse_negative_optional(self, buffer, start, stop, current)
- parse_negative_repeating(self, buffer, start, stop, current)
- parse_negative_repeating_optional(self, buffer, start, stop, current)
- parse_optional(self, buffer, start, stop, current)
- By default, run the base parse and consider failure success
- parse_repeating(self, buffer, start, stop, current)
- By default, run base parse until it fails, push all tokens to the stack
- parse_repeating_optional(self, buffer, start, stop, current)
- to_parser(self, generator=None, noReport=False)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class ErrorOnFail(object) |
|
When called as a matching function, raises a SyntaxError
Attributes:
expected -- list of strings describing expected productions
production -- string name of the production that's failing to parse
message -- overrides default message generation if non-null
(something,something)+!
(something,something)!
(something,something)+!"Unable to parse somethings in my production"
(something,something)!"Unable to parse somethings in my production"
if string -> give an explicit message (with optional % values)
else -> use a default string |
|
Methods defined here:
- __call__(self, buffer, start, stop, current)
- Method called if our attached production fails
- __init__(self, production='', message='', expected='')
- copy(self)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- expected = ''
- message = ''
- production = ''
|
class FirstOfGroup(Group) |
| |
- Method resolution order:
- FirstOfGroup
- Group
- ElementToken
- object
Methods defined here:
- parse(self, buffer, start, stop, current, where=0)
Methods inherited from Group:
- __init__(self, children, negative=False, optional=False, repeating=False, report=True, errorOnFail=None, expanded=False, lookahead=False, generator=None)
- final_method(self, generator=None, noReport=False)
Methods inherited from ElementToken:
- __repr__(self)
- parse_negative(self, buffer, start, stop, current)
- parse_negative_optional(self, buffer, start, stop, current)
- parse_negative_repeating(self, buffer, start, stop, current)
- parse_negative_repeating_optional(self, buffer, start, stop, current)
- parse_optional(self, buffer, start, stop, current)
- By default, run the base parse and consider failure success
- parse_repeating(self, buffer, start, stop, current)
- By default, run base parse until it fails, push all tokens to the stack
- parse_repeating_optional(self, buffer, start, stop, current)
- to_parser(self, generator=None, noReport=False)
Data descriptors inherited from ElementToken:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Group(ElementToken) |
| |
- Method resolution order:
- Group
- ElementToken
- object
Methods defined here:
- __init__(self, children, negative=False, optional=False, repeating=False, report=True, errorOnFail=None, expanded=False, lookahead=False, generator=None)
- final_method(self, generator=None, noReport=False)
Methods inherited from ElementToken:
- __repr__(self)
- parse(self, buffer, start, stop, current)
- parse_negative(self, buffer, start, stop, current)
- parse_negative_optional(self, buffer, start, stop, current)
- parse_negative_repeating(self, buffer, start, stop, current)
- parse_negative_repeating_optional(self, buffer, start, stop, current)
- parse_optional(self, buffer, start, stop, current)
- By default, run the base parse and consider failure success
- parse_repeating(self, buffer, start, stop, current)
- By default, run base parse until it fails, push all tokens to the stack
- parse_repeating_optional(self, buffer, start, stop, current)
- to_parser(self, generator=None, noReport=False)
Data descriptors inherited from ElementToken:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class LibraryElement(ElementToken) |
|
Holder for a prebuilt item with it's own generator |
|
- Method resolution order:
- LibraryElement
- ElementToken
- object
Methods defined here:
- __init__(self, production, negative=False, optional=False, repeating=False, report=True, errorOnFail=None, expanded=False, lookahead=False, generator=None, methodSource=None)
- parse(self, buffer, start, stop, current)
- Implement expanded references for library elements
Data descriptors defined here:
- target
Methods inherited from ElementToken:
- __repr__(self)
- final_method(self, generator=None, noReport=False)
- parse_negative(self, buffer, start, stop, current)
- parse_negative_optional(self, buffer, start, stop, current)
- parse_negative_repeating(self, buffer, start, stop, current)
- parse_negative_repeating_optional(self, buffer, start, stop, current)
- parse_optional(self, buffer, start, stop, current)
- By default, run the base parse and consider failure success
- parse_repeating(self, buffer, start, stop, current)
- By default, run base parse until it fails, push all tokens to the stack
- parse_repeating_optional(self, buffer, start, stop, current)
- to_parser(self, generator=None, noReport=False)
Data descriptors inherited from ElementToken:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Literal(ElementToken) |
| |
- Method resolution order:
- Literal
- ElementToken
- object
Methods defined here:
- __init__(self, value, negative=False, optional=False, repeating=False, report=True, errorOnFail=None, expanded=False, lookahead=False, generator=None)
- parse(self, buffer, start, stop, current)
Methods inherited from ElementToken:
- __repr__(self)
- final_method(self, generator=None, noReport=False)
- parse_negative(self, buffer, start, stop, current)
- parse_negative_optional(self, buffer, start, stop, current)
- parse_negative_repeating(self, buffer, start, stop, current)
- parse_negative_repeating_optional(self, buffer, start, stop, current)
- parse_optional(self, buffer, start, stop, current)
- By default, run the base parse and consider failure success
- parse_repeating(self, buffer, start, stop, current)
- By default, run base parse until it fails, push all tokens to the stack
- parse_repeating_optional(self, buffer, start, stop, current)
- to_parser(self, generator=None, noReport=False)
Data descriptors inherited from ElementToken:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Match(object) |
|
A token generated during a parse
token -- the token which matched
tag -- the tag (token.value) which matched
start -- the index at which the match started
children -- the children (if any) of the match |
|
Methods defined here:
- __cmp__(self, other)
- __eq__(self, other)
- __getitem__(self, index)
- __init__(self, token, start=None, stop=None, current=None, children=None)
- __len__(self)
- __repr__(self)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Name(ElementToken) |
|
Reference to another rule in the grammar
The Name element token allows you to reference another
production within the grammar. There are three major
sub-categories of reference depending on both the Name
element token and the referenced table's values.
if the Name token's report attribute is false,
or the target table's report attribute is false,
or the Name token negative attribute is true,
the Name reference will report nothing in the result tree
if the target's expand attribute is true, however,
the Name reference will report the children
of the target production without reporting the
target production's results (SubTable match)
finally:
if the target is not expanded and the Name token
should report something, the generator object is
asked to supply the tag object and flags for
processing the results of the target. See the
generator.MethodSource documentation for details.
Notes:
expanded and un-reported productions won't get any
methodsource methods called when
they are finished, that's just how I decided to
do it, not sure if there's some case where you'd
want it. As a result, it's possible to have a
method getting called for one instance (where a
name ref is reporting) and not for another (where
the name ref isn't reporting). |
|
- Method resolution order:
- Name
- ElementToken
- object
Methods defined here:
- parse(self, buffer, start, stop, current)
- Implement wrapping of results for name references
Data descriptors defined here:
- target
Data and other attributes defined here:
- expand_child = False
- report_child = True
Methods inherited from ElementToken:
- __init__(self, value=None, negative=False, optional=False, repeating=False, report=True, errorOnFail=None, expanded=False, lookahead=False, generator=None)
- Initialize the object with named attributes
This method simply takes the named attributes and
updates the object's dictionary with them
- __repr__(self)
- final_method(self, generator=None, noReport=False)
- parse_negative(self, buffer, start, stop, current)
- parse_negative_optional(self, buffer, start, stop, current)
- parse_negative_repeating(self, buffer, start, stop, current)
- parse_negative_repeating_optional(self, buffer, start, stop, current)
- parse_optional(self, buffer, start, stop, current)
- By default, run the base parse and consider failure success
- parse_repeating(self, buffer, start, stop, current)
- By default, run base parse until it fails, push all tokens to the stack
- parse_repeating_optional(self, buffer, start, stop, current)
- to_parser(self, generator=None, noReport=False)
Data descriptors inherited from ElementToken:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Range(ElementToken) |
|
Match a range (set of ranges) of characters |
|
- Method resolution order:
- Range
- ElementToken
- object
Methods defined here:
- parse(self, buffer, start, stop, current)
- parse_negative(self, buffer, start, stop, current)
- parse_negative_repeating(self, buffer, start, stop, current)
- parse_repeating(self, buffer, start, stop, current)
Methods inherited from ElementToken:
- __init__(self, value=None, negative=False, optional=False, repeating=False, report=True, errorOnFail=None, expanded=False, lookahead=False, generator=None)
- Initialize the object with named attributes
This method simply takes the named attributes and
updates the object's dictionary with them
- __repr__(self)
- final_method(self, generator=None, noReport=False)
- parse_negative_optional(self, buffer, start, stop, current)
- parse_negative_repeating_optional(self, buffer, start, stop, current)
- parse_optional(self, buffer, start, stop, current)
- By default, run the base parse and consider failure success
- parse_repeating_optional(self, buffer, start, stop, current)
- to_parser(self, generator=None, noReport=False)
Data descriptors inherited from ElementToken:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class SequentialGroup(Group) |
|
Parse a sequence of elements as a single token (with back-tracking) |
|
- Method resolution order:
- SequentialGroup
- Group
- ElementToken
- object
Methods defined here:
- parse(self, buffer, start, stop, current)
Methods inherited from Group:
- __init__(self, children, negative=False, optional=False, repeating=False, report=True, errorOnFail=None, expanded=False, lookahead=False, generator=None)
- final_method(self, generator=None, noReport=False)
Methods inherited from ElementToken:
- __repr__(self)
- parse_negative(self, buffer, start, stop, current)
- parse_negative_optional(self, buffer, start, stop, current)
- parse_negative_repeating(self, buffer, start, stop, current)
- parse_negative_repeating_optional(self, buffer, start, stop, current)
- parse_optional(self, buffer, start, stop, current)
- By default, run the base parse and consider failure success
- parse_repeating(self, buffer, start, stop, current)
- By default, run base parse until it fails, push all tokens to the stack
- parse_repeating_optional(self, buffer, start, stop, current)
- to_parser(self, generator=None, noReport=False)
Data descriptors inherited from ElementToken:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Updater(object) |
|
Base class for the various updater algorithms |
|
Methods defined here:
- __call__(self, buffer, start, stop, current)
- __init__(self, final_parser, token)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |