[PATCH 2/4] bistromathic: don't stupidly reset the location for each token

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
That quite defeats the whole point of locations...  But anyway, we
should not see these messages at all.

* examples/c/bistromathic/parse.y (expected_tokens): Fix (useless)
location tracking.
---
 examples/c/bistromathic/bistromathic.test | 6 +++---
 examples/c/bistromathic/parse.y           | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/c/bistromathic/bistromathic.test b/examples/c/bistromathic/bistromathic.test
index 2e853157..4f8e24ad 100755
--- a/examples/c/bistromathic/bistromathic.test
+++ b/examples/c/bistromathic/bistromathic.test
@@ -313,7 +313,7 @@ sed -e 's/\\t/	/g' >input <<EOF
 EOF
 run -n 0 '> 1++ ''
 > ''
-err: 1.1: syntax error: expected - or ( or number or function or variable before +
+err: 1.3: syntax error: expected - or ( or number or function or variable before +
 err: 1.3: syntax error: expected - or ( or number or function or variable before +
 '
 
@@ -323,8 +323,8 @@ sed -e 's/\\t/	/g' >input <<EOF
 EOF
 run -n 0 '> (1++2) + 3 +  ''
 > ''
-err: 1.1: syntax error: expected - or ( or number or function or variable before +
-err: 1.1: syntax error: expected - or ( or number or function or variable before +
+err: 1.4: syntax error: expected - or ( or number or function or variable before +
+err: 1.4: syntax error: expected - or ( or number or function or variable before +
 err: 1.4: syntax error: expected - or ( or number or function or variable before +
 err: 1.15: syntax error: expected - or ( or number or function or variable before end of file
 '
diff --git a/examples/c/bistromathic/parse.y b/examples/c/bistromathic/parse.y
index 9ba07ea5..43b41e32 100644
--- a/examples/c/bistromathic/parse.y
+++ b/examples/c/bistromathic/parse.y
@@ -473,8 +473,8 @@ expected_tokens (const char *input,
   // Parse the current state of the line.
   yypstate *ps = yypstate_new ();
   int status = 0;
+  YYLTYPE lloc = { 1, 1, 1, 1 };
   do {
-    YYLTYPE lloc = { 1, 1, 1, 1 };
     YYSTYPE lval;
     yytoken_kind_t token = yylex (&input, &lval, &lloc);
     // Don't let the parser know when we reach the end of input.
-- 
2.27.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.