@amplitude/ampli
Version:
Amplitude CLI
28 lines (27 loc) • 830 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const state_1 = require("./state");
class SingleLineComment extends state_1.State {
constructor(source, prefix) {
super('comment', source, prefix.length);
}
visit(fromIndex) {
if (this.source[fromIndex] === '\n' || this.source[fromIndex] === '\r') {
return undefined;
}
this.length += 1;
return this;
}
}
class SingleLineCommentFactory extends state_1.StateFactory {
constructor(source, prefix) {
super(source, prefix, '');
}
test(fromIndex) {
return this.isPrefix(this.prefix, fromIndex) ? this.prefix.length : 0;
}
createState() {
return new SingleLineComment(this.source, this.prefix);
}
}
exports.default = SingleLineCommentFactory;