From 3cbc456355a23f131dd7acf499ad4e4f97a4d086 Mon Sep 17 00:00:00 2001 From: Eric Vergnaud Date: Thu, 1 Dec 2016 22:23:26 +0800 Subject: [PATCH 1/2] cleanup test files --- runtime/JavaScript/src/input | 1 - runtime/JavaScript/src/test.js | 42 ---------------------------------- 2 files changed, 43 deletions(-) delete mode 100644 runtime/JavaScript/src/input delete mode 100644 runtime/JavaScript/src/test.js diff --git a/runtime/JavaScript/src/input b/runtime/JavaScript/src/input deleted file mode 100644 index feab4548e..000000000 --- a/runtime/JavaScript/src/input +++ /dev/null @@ -1 +0,0 @@ -a=b+1; \ No newline at end of file diff --git a/runtime/JavaScript/src/test.js b/runtime/JavaScript/src/test.js deleted file mode 100644 index fb1d9eacc..000000000 --- a/runtime/JavaScript/src/test.js +++ /dev/null @@ -1,42 +0,0 @@ -var antlr4 = require('./antlr4/index'); -var DesignScriptLexer = require('./DesignScriptLexer'); -var DesignScriptParser = require('./DesignScriptParser'); -var DesignScriptListener = require('./DesignScriptListener').DesignScriptListener; -// var TVisitor = require('./parser/TVisitor').TVisitor; - -function TreeShapeListener() { - antlr4.tree.ParseTreeListener.call(this); - return this; -} - -TreeShapeListener.prototype = Object.create(antlr4.tree.ParseTreeListener.prototype); -TreeShapeListener.prototype.constructor = TreeShapeListener; - -TreeShapeListener.prototype.enterEveryRule = function(ctx) { - for(var i=0;i Date: Thu, 1 Dec 2016 22:23:53 +0800 Subject: [PATCH 2/2] fix a typo in optimisation code --- runtime/JavaScript/src/antlr4/atn/ParserATNSimulator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/JavaScript/src/antlr4/atn/ParserATNSimulator.js b/runtime/JavaScript/src/antlr4/atn/ParserATNSimulator.js index 3bb12eaea..90f16d409 100644 --- a/runtime/JavaScript/src/antlr4/atn/ParserATNSimulator.js +++ b/runtime/JavaScript/src/antlr4/atn/ParserATNSimulator.js @@ -1385,7 +1385,7 @@ ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function( // Look for complex prefix 'between expr and expr' case where 2nd expr's // return state points at block end state of (...)* internal block - if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitionslength == 1 + if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1 && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p) continue;