Changed order of parameters in the SyntaxError constructor to make creating error with unknown location easier. Also fixes bug with reporting of invalid ranges such as [b-a] in the metagrammar.

redux
David Majda 15 years ago
parent 00a258d246
commit 796c98bf8e

@ -181,9 +181,9 @@ PEG.Parser.prototype = {
if (result === null || this._pos !== input.length) {
var errorPosition = computeErrorPosition();
throw new PEG.Parser.SyntaxError(
buildErrorMessage(),
errorPosition.line,
errorPosition.column,
buildErrorMessage()
errorPosition.column
);
}
@ -230,11 +230,11 @@ PEG.Parser.NamedRuleMatchFailure.prototype = {
/* Thrown when a parser encounters a syntax error. */
PEG.Parser.SyntaxError = function(line, column, message) {
PEG.Parser.SyntaxError = function(message, line, column) {
this.name = "PEG.Parser.SyntaxError";
this.message = message;
this.line = line;
this.column = column;
this.message = message;
};
PEG.Parser.SyntaxError.prototype = Error.prototype;

Loading…
Cancel
Save