textoutpc.lexer – Lexer definition#

class textoutpc.lexer.CloseTagToken(*, name: str, raw: str = '')#

Bases: BaseToken

Closing of a tag closing object for textout BBCode.

name: str#

Name of the tag that is being closed.

raw: str#

Raw token, if need be to yield it.

class textoutpc.lexer.OpenTagToken(*, name: str, value: str | None = None, raw: str = '')#

Bases: BaseToken

Explicit opening of a tag.

name: str#

Name of the tag that is being opened.

value: str | None#

Optional value transmitted with the tag.

raw: str#

Raw token, if need be to yield it.

class textoutpc.lexer.SpecialToken(*, value: str)#

Bases: BaseToken

Special characters that could mean the opening or closing of a tag.

value: str#

Special character(s) for the token.

class textoutpc.lexer.TextToken(*, content: str)#

Bases: BaseToken

Token representing raw text.

content: str#

Content in the text.

textoutpc.lexer.parse_textout_tokens(stream_or_string: TextIO | str, /) Iterator[Token]#

Parse tokens from text input.

Parameters:

stream_or_string – The text stream or string to read from.

Returns:

The iterator for lexer tokens.