Open dhowe opened 4 years ago
Hi, could be that captureStackTrace is only available in Node.
could be that captureStackTrace is only available in Node ?
I don't think so, as everything works fine in Chrome browser.
Plus antlr4/js is intended to run in the browser, so it should work (at least for modern browsers - and this is the current stable version Firefox, 70.0.1)
Any status or update on this?
Can you try replicating for ParseCancellationException the RecognitionException constructor polyfill?
i.e.:
if (!!Error.captureStackTrace) {
Error.captureStackTrace(this, RecognitionException);
} else {
var stack = new Error().stack;
}
(which relates to my November comment)
(tbh not quite sure what to do with var stack
)
Sorry, not sure what you mean... you can see the file here. If there's a better way to do this, I'm happy to try it...
Yes, for now.
I mean change the antlr4 source code locally, until the fix is released
that fixes the problem temporarily, but we are working in a node environment and every time we install dependencies, these changes are written over and need to be remade
could be that captureStackTrace is only available in Node ?
I don't think so, as everything works fine in Chrome browser.
It is available both in Node.js and Chrome(ium) Browser because it is the feature of the V8 engine.
Other JavaScript engines does not support this method. This method is not mentioned in the ECMAScript specs.
So I think it's better to remove usages of this method. Or check its existence before using it.
Please submit a PR?
My antlr4 grammar/lexer/parser/visitor all work fine in the chrome browser and in the node runtime. When I use webpack to run my mocha tests in Firefox, however, I get the following error:
My LexerErrorHandler extends ParseCancellationException for which (I think) the polyfill for Error.captureStackTrace is either missing or broken.