From 796c98bf8e458d9c7b25ff6a03506abf93cd8381 Mon Sep 17 00:00:00 2001 From: David Majda Date: Sat, 13 Mar 2010 15:56:53 +0100 Subject: [PATCH] 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. --- lib/runtime.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/runtime.js b/lib/runtime.js index 592d42e..058b766 100644 --- a/lib/runtime.js +++ b/lib/runtime.js @@ -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;