module Token

Defined in:

token/token.cr

Constant Summary

ASSIGN = Token.new("ASSIGN", "=")

Operators

ASTERISK = Token.new("ASTERISK", "*")
ASTERISK_ASSIGN = Token.new("ASTERISK_ASSIGN", "*=")
BANG = Token.new("BANG", "!")
BREAK = Token.new("BREAK", "break")
COLON = Token.new("COLON", ":")
COMMA = Token.new("COMMA", ",")
CONST = Token.new("CONST", "const")
DECREMENT = Token.new("DECREMENT", "--")
DO = Token.new("DO", "do")
ELSE = Token.new("ELSE", "else")
EMPTY = Token.new("EMPTY", "EMPTY")

Meta types

EOF = Token.new("EOF", Char::ZERO.to_s)
EQ = Token.new("EQ", "==")

Comparators

FALSE = Token.new("FALSE", "false")
FLOAT = Token.new("FLOAT", "float")
FOR = Token.new("FOR", "for")
FUNCTION = Token.new("FUNCTION", "fn")

Keywords

GT = Token.new("GT", ">")
GT_EQ = Token.new("GT_EQ", ">=")
IDENT = Token.new("IDENT", "ident")

Identifiers and literals

IF = Token.new("IF", "if")
ILLEGAL = Token.new("ILLEGAL", "ILLEGAL")
INCREMENT = Token.new("INCREMENT", "++")
INT = Token.new("INT", "int")
KEYWORDS = {"fn" => FUNCTION, "let" => LET, "const" => CONST, "true" => TRUE, "false" => FALSE, "null" => NULL, "if" => IF, "else" => ELSE, "return" => RETURN, "do" => DO, "for" => FOR, "while" => WHILE, "break" => BREAK} of String => Token
LBRACE = Token.new("LBRACE", "{")
LBRACKET = Token.new("LBRACKET", "[")
LET = Token.new("LET", "let")
LPAREN = Token.new("LPAREN", "(")
LT = Token.new("LT", "<")
LT_EQ = Token.new("LT_EQ", "<=")
MINUS = Token.new("MINUS", "-")
MINUS_ASSIGN = Token.new("MINUS_ASSIGN", "-=")
MODULUS = Token.new("MODULUS", "%")
NOT_EQ = Token.new("NOT_EQ", "!=")
NULL = Token.new("NULL", "null")
PERIOD = Token.new("PERIOD", ".")

Delimiters

PLUS = Token.new("PLUS", "+")
PLUS_ASSIGN = Token.new("PLUS_ASSIGN", "+=")
RBRACE = Token.new("RBRACE", "}")
RBRACKET = Token.new("RBRACKET", "]")
RETURN = Token.new("RETURN", "return")
RPAREN = Token.new("RPAREN", ")")
SEMICOLON = Token.new("SEMICOLON", ";")
SLASH = Token.new("SLASH", "/")
SLASH_ASSIGN = Token.new("SLASH_ASSIGN", "/=")
STRING = Token.new("STRING", "string")
TRUE = Token.new("TRUE", "true")
WHILE = Token.new("WHILE", "while")

Class Method Summary

Class Method Detail

def self.lookup_ident(ident : String) #

[View source]