lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [1/2] lucenenet git commit: Expressions: better error message on parse errors
Date Sat, 31 Jan 2015 22:19:45 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master 2c566585c -> d463487cc


Expressions: better error message on parse errors

Seems like the Antlr definition used or its compilation is faulty, currently all scripts with
numerics are failing


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/2fcf7d2b
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/2fcf7d2b
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/2fcf7d2b

Branch: refs/heads/master
Commit: 2fcf7d2b34b22a24a5c1bbb080851f6631af971a
Parents: 2c56658
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Sun Feb 1 00:19:05 2015 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Sun Feb 1 00:19:05 2015 +0200

----------------------------------------------------------------------
 src/Lucene.Net.Expressions/JS/JavascriptLexer.cs | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2fcf7d2b/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs b/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs
index 90c770e..80b8128 100644
--- a/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs
+++ b/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs
@@ -90,10 +90,9 @@ namespace Lucene.Net.Expressions.JS
 		// ANTLR GENERATED CODE: DO NOT EDIT
 		public override void DisplayRecognitionError(string[] tokenNames, RecognitionException
re)
 		{
-			string message = " unexpected character '" + (char)re.Character + "' at position (" +
re.CharPositionInLine + ").";
-			ParseException parseException = new ParseException(message, re.CharPositionInLine);
-			
-			throw new SystemException(parseException.Message, parseException);
+            var message = string.Format("Unable to parse '{0}': unexpected character '{1}'
at position ({2}).", re.Input
+                , (char)re.Character, re.CharPositionInLine);
+			throw new ParseException(message, re.CharPositionInLine);
 		}
 
 		// delegates
@@ -2169,9 +2168,11 @@ loop16_break: ;
 
     public class ParseException:Exception
     {
-        public ParseException(string message, int charPositionInLine)
+        private readonly int _charPositionInLine;
+
+        public ParseException(string message, int charPositionInLine) : base(message)
         {
-            
+            _charPositionInLine = charPositionInLine;
         }
     }
 }


Mime
View raw message