tea.parsing

class tea.parsing.RegexLexer

Base for simple stateful regular expression-based lexers. Simplifies the lexing process so that you need only provide a list of states and regular expressions.

lex(text)

Do the lexical analysis

class tea.parsing.Formatter(lexer=None, style=None, stream=None)

Formatter class

Properties:

lexer: Current lexer style: Current style stream: Current output stream (if not set use sys.stdout)

format(data)

Use this method for formatting data

format_text(style, text)

Format a single peace of a text using the provided style

class tea.parsing.ConsoleFormatter(lexer=None, style=None, stream=None)

Simple console output formatter using ConsoleStyleAdapter and tea.console.color cprint

class tea.parsing.StyleAdapter(style)

Style adapter is a helper class for adapting a style for restricted environments, where not all colors or font styles are available.

For example the terminal console doesn’t have the full range of colors and also doesn’t have font styles. Look in the ConsoleStyleAdapter for example implementation.

adapt(style)

Override this method to implement the adaptation logic

class tea.parsing.ConsoleStyleAdapter(*args, **kwargs)

Simple hex color to console color adapter

class tea.parsing.formatter.ConsoleFormatter(lexer=None, style=None, stream=None)

Simple console output formatter using ConsoleStyleAdapter and tea.console.color cprint

class tea.parsing.formatter.Formatter(lexer=None, style=None, stream=None)

Formatter class

Properties:

lexer: Current lexer style: Current style stream: Current output stream (if not set use sys.stdout)

format(data)

Use this method for formatting data

format_text(style, text)

Format a single peace of a text using the provided style

class tea.parsing.lexer.RegexLexer

Base for simple stateful regular expression-based lexers. Simplifies the lexing process so that you need only provide a list of states and regular expressions.

lex(text)

Do the lexical analysis

class tea.parsing.style.ConsoleStyleAdapter(*args, **kwargs)

Simple hex color to console color adapter

class tea.parsing.style.Font

Font properties

class tea.parsing.style.StyleAdapter(style)

Style adapter is a helper class for adapting a style for restricted environments, where not all colors or font styles are available.

For example the terminal console doesn’t have the full range of colors and also doesn’t have font styles. Look in the ConsoleStyleAdapter for example implementation.

adapt(style)

Override this method to implement the adaptation logic

Project Versions

Previous topic

tea.msg

Next topic

tea.process

This Page