diff --git a/runtime/JavaScript/spec/rewriter/TokenStreamRewriterSpec.js b/runtime/JavaScript/spec/rewriter/TokenStreamRewriterSpec.js index a58bc26ef0..022ac0db5f 100644 --- a/runtime/JavaScript/spec/rewriter/TokenStreamRewriterSpec.js +++ b/runtime/JavaScript/spec/rewriter/TokenStreamRewriterSpec.js @@ -8,7 +8,7 @@ import calc from "./generatedCode/calc.js"; * @param {string} input */ function getRewriter(lexerClass, input) { - const chars = new antlr4.InputStream(input); + const chars = new antlr4.CharStream(input); const lexer = new lexerClass(chars); const tokens = new antlr4.CommonTokenStream(lexer); tokens.fill(); @@ -385,7 +385,7 @@ describe("TokenStreamRewriter", () => { it("throws an error if second replace operation overlaps the first one on the left", () => { // Arrange - const chars = new antlr4.InputStream("abcccba"); + const chars = new antlr4.CharStream("abcccba"); const lexer = new abc(chars); const tokens = new antlr4.CommonTokenStream(lexer); tokens.fill(); diff --git a/runtime/JavaScript/src/antlr4/Lexer.js b/runtime/JavaScript/src/antlr4/Lexer.js index 0d1a494597..a686976b11 100644 --- a/runtime/JavaScript/src/antlr4/Lexer.js +++ b/runtime/JavaScript/src/antlr4/Lexer.js @@ -121,7 +121,9 @@ export default class Lexer extends Recognizer { this.notifyListeners(e); // report error this.recover(e); } else { - console.log(e.stack); + if (this._interp.debug) { + console.log(e.stack); + } throw e; } } diff --git a/runtime/JavaScript/src/antlr4/index.node.js b/runtime/JavaScript/src/antlr4/index.node.js index 78b55bdb89..4d06196e90 100644 --- a/runtime/JavaScript/src/antlr4/index.node.js +++ b/runtime/JavaScript/src/antlr4/index.node.js @@ -14,7 +14,7 @@ import { default as Utils } from './utils/index.js'; import Token from './Token.js'; import CommonToken from './CommonToken.js'; import InputStream from './InputStream.js'; -import CharStream from './InputStream.js'; +import CharStream from './CharStream.js'; import FileStream from './FileStream.js'; import CommonTokenStream from './CommonTokenStream.js'; import Lexer from './Lexer.js'; diff --git a/runtime/JavaScript/src/antlr4/index.web.js b/runtime/JavaScript/src/antlr4/index.web.js index dec5c91c70..3965b941d1 100644 --- a/runtime/JavaScript/src/antlr4/index.web.js +++ b/runtime/JavaScript/src/antlr4/index.web.js @@ -14,7 +14,7 @@ import { default as Utils } from './utils/index.js'; import Token from './Token.js'; import CommonToken from './CommonToken.js'; import InputStream from './InputStream.js'; -import CharStream from './InputStream.js'; +import CharStream from './CharStream.js'; import CommonTokenStream from './CommonTokenStream.js'; import Lexer from './Lexer.js'; import Parser from './Parser.js';