Package rxpy :: Package parser :: Module support :: Class ParserState
[hide private]
[frames] | no frames]

Class ParserState

source code


Encapsulate state needed by the parser. This includes information about flags (which may change during processing and is related to alphabets) and groups.
Instance Methods [hide private]
 
__init__(self, flags=0, alphabet=None, hint_alphabet=None)
flags - initial flags set by user (bits as int)
source code
 
deep_eq(self, other)
Used only for testing.
source code
 
has_new_flags(self)
Have flags change during parsing (possible when flags are embedded in the regular expression)?
source code
 
clone_with_new_flags(self)
This discards group information because the expression will be parsed again with new flags.
source code
 
next_group_index(self, name=None)
Get the index number for the next group, possibly associating it with a name.
source code
 
index_for_name(self, name)
Given a group name, return the group index.
source code
 
index_for_name_or_count(self, name)
Given a group name or index (as text), return the group index (as int).
source code
 
new_flag(self, flag)
Add a new flag (called by the parser for embedded flags).
source code
 
significant(self, character)
Returns false if character should be ignored (extended syntax).
source code
 
alphabet(self)
The alphabet to be used.
source code
 
flags(self)
Current flags (this does not change as new flags are added; instead the entire expression must be reparsed if has_new_flags is True.
source code
 
group_names(self)
Map from group names to index.
source code
 
group_indices(self)
Map from group index to name.
source code
 
group_count(self)
Total number of groups.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, flags=0, alphabet=None, hint_alphabet=None)
(Constructor)

source code 

flags - initial flags set by user (bits as int)

alphabet - optional alphabet (if given, checked against flags; if not given inferred from flags and hint)

hint_alphabet - used to help auto-detect ASCII and Unicode in 2.6

Overrides: object.__init__

has_new_flags(self)

source code 
Have flags change during parsing (possible when flags are embedded in the regular expression)?
Decorators:
  • @property

index_for_name_or_count(self, name)

source code 
Given a group name or index (as text), return the group index (as int). First, we parser as an integer, then we try as a name.

alphabet(self)

source code 
The alphabet to be used.
Decorators:
  • @property

flags(self)

source code 
Current flags (this does not change as new flags are added; instead the entire expression must be reparsed if has_new_flags is True.
Decorators:
  • @property

group_names(self)

source code 
Map from group names to index.
Decorators:
  • @property

group_indices(self)

source code 
Map from group index to name.
Decorators:
  • @property

group_count(self)

source code 
Total number of groups.
Decorators:
  • @property