From caa581a9e015540f969faa533084a362e2bbcec2 Mon Sep 17 00:00:00 2001 From: Eric Vergnaud Date: Mon, 12 Dec 2016 23:52:09 +0800 Subject: [PATCH] success! --- .../runtime/descriptors/ParseTreesDescriptors.java | 2 +- runtime/JavaScript/src/antlr4/ParserRuleContext.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParseTreesDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParseTreesDescriptors.java index 6db9769e8..feb32081f 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParseTreesDescriptors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParseTreesDescriptors.java @@ -112,7 +112,7 @@ public class ParseTreesDescriptors { @Override public boolean ignore(String targetName) { - return !targetName.matches("Java|Python2|Python3"); + return !targetName.matches("Java|Python2|Python3|Node"); } } diff --git a/runtime/JavaScript/src/antlr4/ParserRuleContext.js b/runtime/JavaScript/src/antlr4/ParserRuleContext.js index 2d0493cb4..c21051c6b 100644 --- a/runtime/JavaScript/src/antlr4/ParserRuleContext.js +++ b/runtime/JavaScript/src/antlr4/ParserRuleContext.js @@ -64,6 +64,17 @@ ParserRuleContext.prototype.copyFrom = function(ctx) { this.children = null; this.start = ctx.start; this.stop = ctx.stop; + // copy any error nodes to alt label node + if(ctx.children) { + this.children = []; + // reset parent pointer for any error nodes + ctx.children.map(function(child) { + if (child instanceof ErrorNodeImpl) { + this.children.push(child); + child.parentCtx = this; + } + }, this); + } }; // Double dispatch methods for listeners