This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: error diagnostics in 1.6.97


Bruce Lewis wrote:
> Kawa 1.6.97 is technically more correct to throw "unexpected EOF in
> list" with the line/column number where the error actually occurred,
> i.e. the EOF.  However, this information is less useful to the end user,
> who needs to figure out where the missing ) should go.  The patch below
> is a compromise; both line/column pairs are in the error message.

I don't see any particular value in having the line/column of the EOF,
so we might as well go just the start position.
How about this patch instead?
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/
Index: gnu/text/Lexer.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/text/Lexer.java,v
retrieving revision 1.7
diff -u -r1.7 Lexer.java
--- Lexer.java	2001/11/27 05:18:13	1.7
+++ Lexer.java	2002/01/22 19:38:15
@@ -127,6 +127,13 @@
     fatal(msg);
   }
 
+  public void eofError(String message, int startLine, int startColumn)
+    throws SyntaxException
+  {
+    error('f', port.getName(), startLine, startColumn, message);
+    throw new SyntaxException(messages);
+  }
+
   /** Read an optional signed integer.
    * If there is no integer in the input stream, return 1.
    * For excessively large exponents, return Integer.MIN_VALUE
Index: gnu/kawa/lispexpr/ReaderParens.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/kawa/lispexpr/ReaderParens.java,v
retrieving revision 1.4
diff -u -r1.4 ReaderParens.java
--- ReaderParens.java	2001/06/19 00:20:00	1.4
+++ ReaderParens.java	2002/01/22 19:38:16
@@ -81,7 +81,8 @@
 	    if (ch == close)
 	      break;
 	    if (ch < 0)
-	       lexer.eofError("unexpected EOF in list");
+	       lexer.eofError("unexpected EOF in list starting here",
+			      startLine + 1, startColumn);
 	    ReadTableEntry entry;
 	    if (ch == '.')
 	      {
@@ -101,7 +102,8 @@
 			break;
 		      }
 		    if (ch < 0)
-		      lexer.eofError("unexpected EOF in list");
+		      lexer.eofError("unexpected EOF in list starting here",
+				     startLine + 1, startColumn);
 		    if (sawDot)
 		      {
 			lexer.error("multiple '.' in list");

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]