class documentation

class Scanner: (source)

View In Hierarchy

Simple scanner All method patterns are regular expression strings (not compiled expressions!)

Method __init__ :param text: The text which should be scanned :param flags: default regular expression flags
Method __repr__ Undocumented
Method check Apply `pattern` on the current position and return the match object. (Doesn't touch pos). Use this for lookahead.
Method eos `True` if the scanner reached the end of text.
Method get_char Scan exactly one char.
Method scan Scan the text for the given pattern and update pos/match and related fields. The return value is a boolean that indicates if the pattern matched. The matched value is stored on the instance as ``match``, the last value is stored as ``last``...
Method test Apply a pattern on the current position and check if it patches. Doesn't touch pos.
Instance Variable data Undocumented
Instance Variable data_length Undocumented
Instance Variable flags Undocumented
Instance Variable last Undocumented
Instance Variable match Undocumented
Instance Variable pos Undocumented
Instance Variable start_pos Undocumented
Instance Variable _re_cache Undocumented
def __init__(self, text, flags=0): (source)

:param text: The text which should be scanned :param flags: default regular expression flags

def __repr__(self): (source)

Undocumented

def check(self, pattern): (source)

Apply `pattern` on the current position and return the match object. (Doesn't touch pos). Use this for lookahead.

def eos(self): (source)

`True` if the scanner reached the end of text.

def get_char(self): (source)

Scan exactly one char.

def scan(self, pattern): (source)

Scan the text for the given pattern and update pos/match and related fields. The return value is a boolean that indicates if the pattern matched. The matched value is stored on the instance as ``match``, the last value is stored as ``last``. ``start_pos`` is the position of the pointer before the pattern was matched, ``pos`` is the end position.

def test(self, pattern): (source)

Apply a pattern on the current position and check if it patches. Doesn't touch pos.

Undocumented

data_length = (source)

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

start_pos = (source)

Undocumented

_re_cache: dict = (source)

Undocumented