• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/** Queues up nodes matched on left side of -> in a tree parser. This is
2 *  the analog of RewriteRuleTokenStream for normal parsers.
3 */
4org.antlr.runtime.tree.RewriteRuleNodeStream = function(adaptor, elementDescription, el) {
5    org.antlr.runtime.tree.RewriteRuleNodeStream.superclass.constructor.apply(this, arguments);
6};
7
8org.antlr.lang.extend(org.antlr.runtime.tree.RewriteRuleNodeStream,
9                  org.antlr.runtime.tree.RewriteRuleElementStream,
10{
11    nextNode: function() {
12        return this._next();
13    },
14
15    toTree: function(el) {
16        return this.adaptor.dupNode(el);
17    },
18
19    dup: function() {
20        // we dup every node, so don't have to worry about calling dup; short-
21        // circuited next() so it doesn't call.
22        throw new Error("dup can't be called for a node stream.");
23    }
24});
25