class documentation

class TNTLexer(Lexer):

View In Hierarchy

Lexer for Typographic Number Theory, as described in the book Gödel, Escher, Bach, by Douglas R. Hofstadter, or as summarized here: https://github.com/Kenny2github/language-tnt/blob/master/README.md#summary-of-tnt

New in version 2.7.
Constant COMMENT Undocumented
Constant LINENOS Undocumented
Constant LOGIC Undocumented
Constant NEGATORS Undocumented
Constant NUMBERS Undocumented
Constant OPERATORS Undocumented
Constant PRIMES Undocumented
Constant QUANTIFIERS Undocumented
Constant RULES Undocumented
Constant VARIABLES Undocumented
Constant WHITESPACE Undocumented
Method __init__ Undocumented
Method error​_till​_line​_end Mark everything from start to the end of the line as Error.
Method formula Tokenize a formula.
Method get​_tokens​_unprocessed Returns a list of TNT tokens.
Method lineno Tokenize a line referral.
Method rule Tokenize a rule.
Method term Tokenize a term.
Method variable Tokenize a variable.
Method whitespace Tokenize whitespace.
Class Variable aliases Undocumented
Class Variable filenames Undocumented
Class Variable name Undocumented
Instance Variable cur Undocumented

Inherited from Lexer:

Method analyse​_text No summary
Method get​_tokens Return an iterable of (tokentype, value) pairs generated from text. If unfiltered is set to True, the filtering mechanism is bypassed even if filters are defined.
Class Variable alias​_filenames Undocumented
Class Variable mimetypes Undocumented
Method __repr__ Undocumented
Method add​_filter Add a new stream filter to this lexer.
Class Variable priority Undocumented
Instance Variable encoding Undocumented
Instance Variable ensurenl Undocumented
Instance Variable filters Undocumented
Instance Variable options Undocumented
Instance Variable stripall Undocumented
Instance Variable stripnl Undocumented
Instance Variable tabsize Undocumented
COMMENT =

Undocumented

Value
re.compile(r'\[[^\n\]]+\]')
LINENOS =

Undocumented

Value
re.compile(r'(?:[0-9]+)(?:(?:, ?|,? and )(?:[0-9]+))*')
LOGIC =

Undocumented

Value
set('⊃→]&∧^|∨Vv')
NEGATORS =

Undocumented

Value
set('~!')
NUMBERS =

Undocumented

Value
set('0123456789')
OPERATORS =

Undocumented

Value
set('+.⋅*')
PRIMES =

Undocumented

Value
set('\'′')
QUANTIFIERS =

Undocumented

Value
set('AE∀∃')
RULES =

Undocumented

Value
re.compile('''(?xi)
        joining | separation | double-tilde | fantasy\\ rule
        | carry[- ]over(?:\\ of)?(?:\\ line)?\\ ([0-9]+) | detachment
        | contrapositive | De\\ Morgan | switcheroo
        | specification | generalization | interchange
        | existence | symmetry | transitivity
        | add\\ S | drop\\ S | induction
...
VARIABLES =

Undocumented

Value
set('abcde')
WHITESPACE =

Undocumented

Value
set('\t \v\n')
def __init__(self, *args, **kwargs):

Undocumented

def error_till_line_end(self, start, text):
Mark everything from start to the end of the line as Error.
def formula(self, start, text):
Tokenize a formula.
def get_tokens_unprocessed(self, text):
Returns a list of TNT tokens.
def lineno(self, start, text):
Tokenize a line referral.
def rule(self, start, text):
Tokenize a rule.
def term(self, start, text):
Tokenize a term.
def variable(self, start, text):
Tokenize a variable.
def whitespace(self, start, text, required=False):
Tokenize whitespace.
aliases: list[str] =

Undocumented

filenames: list[str] =

Undocumented

name: str =

Undocumented

cur: list =

Undocumented