• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1org.antlr.runtime.tree.RewriteRuleTokenStream = function(adaptor, elementDescription, el) {
2    var sup = org.antlr.runtime.tree.RewriteRuleTokenStream.superclass;
3    sup.constructor.apply(this, arguments);
4};
5
6org.antlr.lang.extend(org.antlr.runtime.tree.RewriteRuleTokenStream,
7                  org.antlr.runtime.tree.RewriteRuleElementStream, {
8    /** Get next token from stream and make a node for it */
9    nextNode: function() {
10        var t = this._next();
11        return this.adaptor.create(t);
12    },
13
14    nextToken: function() {
15        return this._next();
16    },
17
18    /** Don't convert to a tree unless they explicitly call nextTree.
19     *  This way we can do hetero tree nodes in rewrite.
20     */
21    toTree: function(el) {
22        return el;
23    },
24
25    dup: function(el) {
26        throw new Error("dup can't be called for a token stream.");
27    }
28});
29