2.1.1.1.1.5. racketinterpreter.classes.tokens

class Keyword(value)

Bases: enum.Enum

An enumeration.

CHECK_EXPECT = 'check-expect'
COND = 'cond'
CONS = 'cons'
DEFINE = 'define'
DEFINE_STRUCT = 'define-struct'
ELSE = 'else'
EMPTY = 'empty'
NULL = 'null'
class Token(type: racketinterpreter.classes.tokens.TokenType, value: Any, line_no: int, column: int)

Bases: object

A token from the lexing process.

Variables
  • type (TokenType) – The type of token.

  • value (tp.Any) – The value of the token.

  • line_no (int) – The line number of the tokens first character.

Ivar

int column: The column of the tokens first character.

Example
>>> Token(TokenType.ID, 'define', 5, 37)
<Token type:ID  value:define  position:5:37>
>>> Token(TokenType.SYMBOL, "'sym", 3, 69)
<Token type:SYMBOL  value:'sym  position:3:69>
property children
property column
static create_proc(name: str, line_no: Optional[int] = None, column: Optional[int] = None)racketinterpreter.classes.tokens.Token
property line_no
property type
property value
class TokenType(value)

Bases: enum.Enum

An enumeration.

BOOLEAN = 'BOOLEAN'
DECIMAL = 'DECIMAL'
EOF = 'EOF'
ID = 'ID'
INTEGER = 'INTEGER'
INVALID = 'INVALID'
LIST_ABRV = 'LIST_ABRV'
LPAREN = 'LPAREN'
RATIONAL = 'RATIONAL'
RPAREN = 'RPAREN'
STRING = 'STRING'
SYMBOL = 'SYMBOL'