Module Name:    src
Committed By:   rillig
Date:           Mon Feb  8 23:54:03 UTC 2021

Modified Files:
        src/tests/lib/libcurses/director: testlang_conf.l testlang_parse.y

Log Message:
tests/libcurses: fix off-by-one error in line numbers in diagnostics

I had broken this in testlang_parse.y 1.22 from 2021-02-07, when I
extracted the common 'eol' from the statements.  Extracting 'eol' had
the effect that the action for the statement was run before the line
number increased.

Now the line numbers in the diagnostics are the same again as before.

For lines that end with a backslash, the reported line number is the one
from the last of these lines, not the first one, also as before.  This
feature is not used by any of the current tests though.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/lib/libcurses/director/testlang_conf.l
cvs rdiff -u -r1.42 -r1.43 src/tests/lib/libcurses/director/testlang_parse.y

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libcurses/director/testlang_conf.l
diff -u src/tests/lib/libcurses/director/testlang_conf.l:1.17 src/tests/lib/libcurses/director/testlang_conf.l:1.18
--- src/tests/lib/libcurses/director/testlang_conf.l:1.17	Mon Feb  8 19:15:20 2021
+++ src/tests/lib/libcurses/director/testlang_conf.l	Mon Feb  8 23:54:03 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_conf.l,v 1.17 2021/02/08 19:15:20 rillig Exp $ 	*/
+/*	$NetBSD: testlang_conf.l,v 1.18 2021/02/08 23:54:03 rillig Exp $ 	*/
 
 /*-
  * Copyright 2009 Brett Lymn <bl...@netbsd.org>
@@ -212,7 +212,7 @@ include		BEGIN(incl);
 		cur_file = strdup(inc_file);
 		if (cur_file == NULL)
 			err(2, "Cannot allocate new include file string");
-		line = 0;
+		line = 1;
 		BEGIN(INITIAL);
 	}
 

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.42 src/tests/lib/libcurses/director/testlang_parse.y:1.43
--- src/tests/lib/libcurses/director/testlang_parse.y:1.42	Mon Feb  8 20:55:42 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Mon Feb  8 23:54:03 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.42 2021/02/08 20:55:42 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.43 2021/02/08 23:54:03 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn <bl...@netbsd.org>
@@ -60,7 +60,7 @@ extern char *cur_file;		/* from director
 
 int yylex(void);
 
-size_t line;
+size_t line = 1;
 
 static int input_delay;
 
@@ -1433,7 +1433,7 @@ init_parse_variables(int initial)
 		}
 		free(command.args);
 	} else {
-		line = 0;
+		line = 1;
 		input_delay = 0;
 		vars = NULL;
 		nvars = 0;

Reply via email to