UNPKG

pegisland

Version:

General PEG-based parser supporting island grammars with lake symbols

25 lines 898 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DepthFirstTraverser = void 0; const PostorderExpressionTraverser_1 = require("./PostorderExpressionTraverser"); class DepthFirstTraverser extends PostorderExpressionTraverser_1.PostorderExpressionTraverser { constructor(visitor, startExpressions) { super(visitor); this.startExpressions = startExpressions; this.visitedExpressions = new Set(); } traverse() { this.startExpressions.forEach((e) => { e.accept(this); }); } visitNonterminal(pe) { if (!this.visitedExpressions.has(pe.rule.rhs)) { this.visitedExpressions.add(pe.rule.rhs); pe.rule.rhs.accept(this); } pe.accept(this.visitor); } } exports.DepthFirstTraverser = DepthFirstTraverser; //# sourceMappingURL=DepthFirstTraverser.js.map