UNPKG

cordbuilder

Version:

Simple dsl to create discord builders simple.

33 lines (32 loc) 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const ast_1 = require("../types/ast"); class Token { constructor(kind, text, line, col) { this.kind = kind; this.text = text; this.line = line; this.col = col; } static eof(line = -1, col = -1) { return new Token(ast_1.TokenKind.Eof, 'EndOfFile', line, col); } ; static getLexemeByKind(kind) { switch (kind) { case ast_1.TokenKind.String: return '"string here"'; case ast_1.TokenKind.Identifier: return "identifier"; case ast_1.TokenKind.OpenParen: return "("; case ast_1.TokenKind.CloseParen: return ")"; case ast_1.TokenKind.OpenBracket: return "["; case ast_1.TokenKind.CloseBracket: return "]"; case ast_1.TokenKind.Comma: return ","; case ast_1.TokenKind.At: return "@"; case ast_1.TokenKind.Colon: return ":"; case ast_1.TokenKind.Skippable: return " "; case ast_1.TokenKind.Eof: return "\0"; case ast_1.TokenKind.Boolean: return "true or false"; } } } exports.default = Token;