fix: use module.exports instead of exports to follow node best practices

cosmetic changes
This commit is contained in:
Camilo Roca 2020-02-02 23:52:47 +01:00
parent a7017d1a49
commit aeebc0bb0b
3 changed files with 23 additions and 22 deletions

View File

@ -547,15 +547,15 @@ class DefaultErrorStrategy extends ErrorStrategy {
return recognizer.getExpectedTokens();
}
/**
* How should a token be displayed in an error message? The default
* is to display just the text, but during development you might
* want to have a lot of information spit out. Override in that case
* to use t.toString() (which, for CommonToken, dumps everything about
* the token). This is better than forcing you to override a method in
* your token objects because you don't have to go modify your lexer
* so that it creates a new Java type.
*/
/**
* How should a token be displayed in an error message? The default
* is to display just the text, but during development you might
* want to have a lot of information spit out. Override in that case
* to use t.toString() (which, for CommonToken, dumps everything about
* the token). This is better than forcing you to override a method in
* your token objects because you don't have to go modify your lexer
* so that it creates a new Java type.
*/
getTokenErrorDisplay(t) {
if (t === null) {
return "<no token>";
@ -746,10 +746,10 @@ class BailErrorStrategy extends DefaultErrorStrategy {
throw new ParseCancellationException(e);
}
/**
* Make sure we don't attempt to recover inline; if the parser
* successfully recovers, it won't throw an exception.
* */
/**
* Make sure we don't attempt to recover inline; if the parser
* successfully recovers, it won't throw an exception.
*/
recoverInline(recognizer) {
this.recover(recognizer, new InputMismatchException(recognizer));
}

View File

@ -169,4 +169,5 @@ module.exports = {
LexerNoViableAltException,
InputMismatchException,
FailedPredicateException,
ParseCancellationException};
ParseCancellationException
};

View File

@ -3,11 +3,11 @@
* can be found in the LICENSE.txt file in the project root.
*/
exports.RecognitionException = require('./Errors').RecognitionException;
exports.NoViableAltException = require('./Errors').NoViableAltException;
exports.LexerNoViableAltException = require('./Errors').LexerNoViableAltException;
exports.InputMismatchException = require('./Errors').InputMismatchException;
exports.FailedPredicateException = require('./Errors').FailedPredicateException;
exports.DiagnosticErrorListener = require('./DiagnosticErrorListener').DiagnosticErrorListener;
exports.BailErrorStrategy = require('./ErrorStrategy').BailErrorStrategy;
exports.ErrorListener = require('./ErrorListener').ErrorListener;
module.exports.RecognitionException = require('./Errors').RecognitionException;
module.exports.NoViableAltException = require('./Errors').NoViableAltException;
module.exports.LexerNoViableAltException = require('./Errors').LexerNoViableAltException;
module.exports.InputMismatchException = require('./Errors').InputMismatchException;
module.exports.FailedPredicateException = require('./Errors').FailedPredicateException;
module.exports.DiagnosticErrorListener = require('./DiagnosticErrorListener').DiagnosticErrorListener;
module.exports.BailErrorStrategy = require('./ErrorStrategy').BailErrorStrategy;
module.exports.ErrorListener = require('./ErrorListener').ErrorListener;