lex2.excs

Components of exceptions.

Exceptions

EOF

Raised whenever a lexer has reached the end of input data from a textstream.

UnexpectedTokenError

Raised whenever an unexpected token type has been encountered.

UnknownTokenError

Raised whenever an unknown token type has been encountered.

exception lex2.excs.UnknownTokenError

Bases: Exception

Raised whenever an unknown token type has been encountered.

__init__(pos, data)
pos: TextPosition

<readonly> Position in the textstream where the token occurs.

data: str

<readonly> String data of the received token.

exception lex2.excs.UnexpectedTokenError

Bases: Exception

Raised whenever an unexpected token type has been encountered.

__init__(pos, data, received_id, expected_ids)
pos: TextPosition

<readonly> Position in the textstream where the token occurs.

data: str

<readonly> String data of the received token.

received_id: str

<readonly> Identifying string value of received token’s type.

expected_ids: List[str]

<readonly> List of identifying string values of expected tokens’ type.

exception lex2.excs.EOF

Bases: Exception

Raised whenever a lexer has reached the end of input data from a textstream.

__init__()