[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/10] java: handle eof in yytranslate
From: |
Akim Demaille |
Subject: |
[PATCH 10/10] java: handle eof in yytranslate |
Date: |
Sun, 1 Sep 2019 18:41:23 +0200 |
* data/skeletons/lalr1.java (yytranslate_): Handle eof here, as is done
in lalr1.cc.
* tests/javapush.at: Adjust.
---
data/skeletons/lalr1.java | 20 +++++++-------------
tests/javapush.at | 1 +
2 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/data/skeletons/lalr1.java b/data/skeletons/lalr1.java
index af120404..08e8f58b 100644
--- a/data/skeletons/lalr1.java
+++ b/data/skeletons/lalr1.java
@@ -1,4 +1,4 @@
-# Java skeleton for Bison -*- autoconf -*-
+# Java skeleton for Bison -*- autoconf -*-
# Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
@@ -631,17 +631,9 @@ b4_dollar_popdef[]dnl
}
/* Convert token to internal form. */
- if (yychar <= Lexer.EOF)
- {
- yychar = yytoken = Lexer.EOF;]b4_parse_trace_if([[
- yycdebug ("Now at end of input.\n");]])[
- }
- else
- {
- yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
- yySymbolPrint ("Next token is", yytoken,
- yylval]b4_locations_if([, yylloc])[);]])[
- }
+ yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
+ yySymbolPrint ("Next token is", yytoken,
+ yylval]b4_locations_if([, yylloc])[);]])[
/* If the proper action on seeing token YYTOKEN is to reduce or to
detect an error, take that action. */
@@ -1026,7 +1018,9 @@ b4_dollar_popdef[]dnl
}
]],
[[ {
- if (0 <= t && t <= yyuser_token_number_max_)
+ if (t <= 0)
+ return Lexer.EOF;
+ else if (t <= yyuser_token_number_max_)
return yytranslate_table_[t];
else
return yyundef_token_;
diff --git a/tests/javapush.at b/tests/javapush.at
index f2d4309d..0271296e 100644
--- a/tests/javapush.at
+++ b/tests/javapush.at
@@ -826,6 +826,7 @@ Next token is token '=' (13.8: 3)
Next token is token "number" (13.9: 64)
Next token is token '\n' (14.0: 64)
Next token is token '\n' (14.0: 64)
+Next token is token $end (14.1: 64)
]])
# Define the calculator input.
--
2.23.0
- RFC: Introduce api.token.raw, Akim Demaille, 2019/09/01
- [PATCH 01/10] style: tidy yacc.c, Akim Demaille, 2019/09/01
- [PATCH 02/10] api.token.raw: implement, Akim Demaille, 2019/09/01
- [PATCH 03/10] api.token.raw: check it, Akim Demaille, 2019/09/01
- [PATCH 04/10] api.token.raw: apply to the other skeletons, Akim Demaille, 2019/09/01
- [PATCH 05/10] api.token.raw: cannot be used with character literals, Akim Demaille, 2019/09/01
- [PATCH 06/10] api.token.raw: document it, Akim Demaille, 2019/09/01
- [PATCH 07/10] parser: use api.token.raw, Akim Demaille, 2019/09/01
- [PATCH 09/10] d: handle eof in yytranslate, Akim Demaille, 2019/09/01
- [PATCH 10/10] java: handle eof in yytranslate,
Akim Demaille <=
- [PATCH 08/10] regen, Akim Demaille, 2019/09/01
- Re: RFC: Introduce api.token.raw, Akim Demaille, 2019/09/14