pyk.kast.outer_lexer module

class Loc(line, col)[source]

Bases: NamedTuple

col: int

Alias for field number 1

line: int

Alias for field number 0

class LocationIterator(text: Iterable[str], line: int = 1, col: int = 0)[source]

Bases: Iterator[str]

A string iterator which tracks the line and column information of the characters in the string.

property loc: Loc

Return the (line, column) of the last character returned by the iterator.

If no character has been returned yet, it will be the location that this iterator was initialized with. The default is (1,0), which is the only time the column will be 0.

class State(value)[source]

Bases: Enum

An enumeration.

ATTR = 6
BUBBLE = 4
CONTEXT = 5
DEFAULT = 1
KLABEL = 3
MODNAME = 7
SYNTAX = 2
class Token(text, type, loc)[source]

Bases: NamedTuple

let(*, text: str | None = None, type: TokenType | None = None, loc: Loc | None = None) Token[source]
loc: Loc

Alias for field number 2

text: str

Alias for field number 0

type: TokenType

Alias for field number 1

class TokenType(value)[source]

Bases: Enum

An enumeration.

ATTR_CONTENT = 43
ATTR_KEY = 42
BUBBLE = 44
COLON = 15
COMMA = 1
DCOLONEQ = 16
EOF = 0
EQ = 9
GT = 10
ID_LOWER = 37
ID_UPPER = 38
KLABEL = 40
KW_ALIAS = 17
KW_CLAIM = 18
KW_CONFIG = 19
KW_CONTEXT = 20
KW_ENDMODULE = 21
KW_IMPORTS = 22
KW_LEFT = 23
KW_LEXICAL = 24
KW_MODULE = 25
KW_NONASSOC = 26
KW_PRIORITY = 27
KW_PRIVATE = 28
KW_PUBLIC = 29
KW_REQUIRES = 30
KW_RIGHT = 31
KW_RULE = 32
KW_SYNTAX = 33
LBRACE = 4
LBRACK = 6
LPAREN = 2
MODNAME = 39
NAT = 34
PLUS = 11
QUESTION = 13
RBRACE = 5
RBRACK = 7
REGEX = 36
RPAREN = 3
RULE_LABEL = 41
STRING = 35
TILDE = 14
TIMES = 12
VBAR = 8
outer_lexer(it: Iterable[str]) Iterator[Token][source]