UNPKG

@abaplint/core

Version:
37 lines 957 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Result = void 0; class Result { constructor(tokens, tokenIndex, nodes) { // tokens: all tokens, from the tokenIndex = not yet matched // nodes: matched tokens this.tokens = tokens; this.tokenIndex = tokenIndex; this.nodes = nodes; if (this.nodes === undefined) { this.nodes = []; } } peek() { return this.tokens[this.tokenIndex]; } shift(node) { const cp = this.nodes.slice(); cp.push(node); return new Result(this.tokens, this.tokenIndex + 1, cp); } popNode() { return this.nodes.pop(); } getNodes() { return this.nodes; } setNodes(n) { this.nodes = n; } remainingLength() { return this.tokens.length - this.tokenIndex; } } exports.Result = Result; //# sourceMappingURL=result.js.map