UNPKG

toylang

Version:

A toy programming language built with TypeScript for learning purposes

52 lines (51 loc) 1.41 kB
export declare enum TokenTypes { let = "let", if = "if", else = "else", while = "while", do = "do", for = "for", true = "true", false = "false", null = "null", def = "def", return = "return", class = "class", new = "new", this = "this", super = "super", extends = "extends", SEMI = "SEMI", CURLY_END = "CURLY_END", CURLY_START = "CURLY_START", PAREN_START = "PAREN_START", PAREN_END = "PAREN_END", COMMA = "COMMA", DOT = "DOT", BRACKET_END = "BRACKET_END", BRACKET_START = "BRACKET_START", STRING = "STRING", NUMBER = "NUMBER", IDENTIFIER = "IDENTIFIER", EQUALITY_OPERATOR = "EQUALITY_OPERATOR", SIMPLE_ASSIGNMENT = "SIMPLE_ASSIGNMENT", COMPLEX_ASSIGNMENT = "COMPLEX_ASSIGNMENT", ADDITITIVE_OPERATOR = "ADDITITIVE_OPERATOR", MULTIPLICATIVE_OPERATOR = "MULTIPLICATIVE_OPERATOR", RELATIONAL_OPERATOR = "RELATIONAL_OPERATOR", LOGICAL_AND = "LOGICAL_AND", LOGICAL_OR = "LOGICAL_OR", LOGICAL_NOT = "LOGICAL_NOT" } export declare type Token = { type: TokenTypes; value: string; }; export declare class Tokenizer { _string: string; _cursor: number; init(string: string): void; hasMoreTokens(): boolean; getNextToken(): Token | null; _match(regex: RegExp, string: string): string | null; }