cbon
Version:
Common Bracket Object Notation
115 lines (114 loc) • 2.59 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const token_1 = require("./token");
function MakeCommentItem(items) {
return items.map(i => i instanceof token_1.TLineComment ? new LineComment(i.range, i.items) : i instanceof token_1.TBlockComment ? new BlockComment(i.range, i.items) : i);
}
class Unit {
}
exports.Unit = Unit;
class Comment extends Unit {
}
exports.Comment = Comment;
class LineComment extends Comment {
constructor(range, items) {
super();
this.items = MakeCommentItem(items);
this.range = range;
}
}
exports.LineComment = LineComment;
class BlockComment extends Comment {
constructor(range, items) {
super();
this.items = MakeCommentItem(items);
this.range = range;
}
}
exports.BlockComment = BlockComment;
class Comma extends Unit {
constructor(range) {
super();
this.range = range;
}
}
exports.Comma = Comma;
class Null extends Unit {
constructor(range) {
super();
this.range = range;
}
}
exports.Null = Null;
class Str extends Unit {
constructor(range, val, col) {
super();
this.val = val;
this.col = col;
this.range = range;
}
}
exports.Str = Str;
class Num extends Unit {
constructor(range, val) {
super();
this.val = val;
this.range = range;
}
}
exports.Num = Num;
class Bool extends Unit {
constructor(range, val) {
super();
this.val = val;
this.range = range;
}
}
exports.Bool = Bool;
class Key {
constructor(range, key) {
this.key = key;
this.range = range;
}
}
exports.Key = Key;
class Split {
constructor(range, type) {
this.type = type;
this.range = range;
}
}
exports.Split = Split;
class KeyVal {
constructor(key, val, split) {
this.key = key;
this.val = val;
this.split = split;
}
}
exports.KeyVal = KeyVal;
class Block extends Unit {
constructor(begin, end, items) {
super();
this.items = items;
this.begin = begin;
this.end = end;
}
}
exports.Block = Block;
class Arr extends Unit {
constructor(begin, end, items) {
super();
this.items = items;
this.begin = begin;
this.end = end;
}
}
exports.Arr = Arr;
class Docs extends Unit {
constructor(items) {
super();
this.items = items;
}
}
exports.Docs = Docs;