UNPKG

cbon

Version:
87 lines (86 loc) 2.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Token { } exports.Token = Token; class TEOF extends Token { constructor(range) { super(); this.range = range; } } exports.TEOF = TEOF; class TComment extends Token { } exports.TComment = TComment; class TLineComment extends TComment { constructor(range, items) { super(); this.items = items; this.range = range; } } exports.TLineComment = TLineComment; class TBlockComment extends TComment { constructor(range, items) { super(); this.items = items; this.range = range; } } exports.TBlockComment = TBlockComment; class TWord extends Token { constructor(range, val) { super(); this.val = val; this.range = range; } } exports.TWord = TWord; class TStr extends Token { constructor(range, val, col) { super(); this.val = val; this.col = col; this.range = range; } } exports.TStr = TStr; class TSymbol extends Token { constructor(range, val) { super(); this.val = val; this.range = range; } } exports.TSymbol = TSymbol; class TSComma extends TSymbol { } exports.TSComma = TSComma; class TSSplit extends TSymbol { } exports.TSSplit = TSSplit; class TSArrStart extends TSymbol { } exports.TSArrStart = TSArrStart; class TSArrEnd extends TSymbol { } exports.TSArrEnd = TSArrEnd; class TSObjStart extends TSymbol { } exports.TSObjStart = TSObjStart; class TSObjEnd extends TSymbol { } exports.TSObjEnd = TSObjEnd; function makeTSymbol(range, val) { switch (val) { case ',': return new TSComma(range, val); case ':': case '=': return new TSSplit(range, val); case '[': return new TSArrStart(range, val); case ']': return new TSArrEnd(range, val); case '{': return new TSObjStart(range, val); case '}': return new TSObjEnd(range, val); } } exports.makeTSymbol = makeTSymbol;