Skip to content

simple

“Simple” text format to canonical string parser

Attributes

STATE_INITIAL module-attribute

STATE_INITIAL = 'INITIAL'

STATE_MESSAGE module-attribute

STATE_MESSAGE = 'message'

states module-attribute

states = ((STATE_MESSAGE, 'exclusive'))

t_message_error module-attribute

t_message_error = t_error

tokens module-attribute

tokens = ('NAME', 'MESSAGE', 'WHITESPACE')

Classes

Simple

Simple(env: Environment)

Bases: BaseCanonical

Attributes

name property
name: str

Functions

to_canonical
to_canonical(data: str, **kwargs) -> CanonicalChat

Functions

t_NAME

t_NAME(t: LexToken)

[a-zA-Z0-9_]+:

t_WHITESPACE

t_WHITESPACE(t: LexToken)

[ \t\n]+

t_error

t_error(t: LexToken)

t_message_MESSAGE

t_message_MESSAGE(t: LexToken)

[\s\S]+?(?=(\n{2}[a-zA-Z0-9_]+:|$))