Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: 3.1.6-pws-9: Line numbers wrong on "unmatched" errors



The ideal thing here would be to print the error message *AFTER* the
hungetc(c); at the "brk:" label, but that requires too much rewriting.

Index: Src/lex.c
===================================================================
@@ -1119,7 +1119,9 @@
 		}
 		ALLOWHIST
 		if (c != '\'') {
+		    lineno -= (c == '\n');
 		    zerr("unmatched \'", NULL, 0);
+		    lineno += (c == '\n');
 		    peek = LEXERR;
 		    cmdpop();
 		    goto brk;
@@ -1141,7 +1143,9 @@
 	    c = dquote_parse('"', sub);
 	    cmdpop();
 	    if (c) {
+		lineno -= (c == '\n');
 		zerr("unmatched \"", NULL, 0);
+		lineno += (c == '\n');
 		peek = LEXERR;
 		goto brk;
 	    }
@@ -1178,7 +1182,9 @@
 		ALLOWHIST
 	    cmdpop();
 	    if (c != '`') {
+		lineno -= (c == '\n');
 		zerr("unmatched `", NULL, 0);
+		lineno += (c == '\n');
 		peek = LEXERR;
 		goto brk;
 	    }

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author