[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/13] glr.c: move some functions after the definition of types
From: |
Akim Demaille |
Subject: |
[PATCH 01/13] glr.c: move some functions after the definition of types |
Date: |
Sat, 18 Jan 2020 16:40:00 +0100 |
Currently yy_symbol_print is defined before yytokenName, although it
should use it instead of read yytname directly. Move blocks around to
avoid this.
* data/skeletons/glr.c (yy_symbol_print): Move its definition after
that of yytokenName.
---
data/skeletons/glr.c | 112 +++++++++++++++++++++----------------------
1 file changed, 56 insertions(+), 56 deletions(-)
diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c
index 389e75ff..cf6b1d8a 100644
--- a/data/skeletons/glr.c
+++ b/data/skeletons/glr.c
@@ -461,62 +461,6 @@ typedef enum { yyok, yyaccept, yyabort, yyerr }
YYRESULTTAG;
return yychk_flag; \
} while (0)
-#if ]b4_api_PREFIX[DEBUG
-
-# ifndef YYFPRINTF
-# define YYFPRINTF fprintf
-# endif
-
-# define YY_FPRINTF \
- YY_IGNORE_USELESS_CAST_BEGIN YY_FPRINTF_
-
-# define YY_FPRINTF_(Args) \
- do { \
- YYFPRINTF Args; \
- YY_IGNORE_USELESS_CAST_END \
- } while (0)
-
-# define YY_DPRINTF \
- YY_IGNORE_USELESS_CAST_BEGIN YY_DPRINTF_
-
-# define YY_DPRINTF_(Args) \
- do { \
- if (yydebug) \
- YYFPRINTF Args; \
- YY_IGNORE_USELESS_CAST_END \
- } while (0)
-
-]b4_yy_location_print_define[
-
-]b4_yy_symbol_print_define[
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
- do { \
- if (yydebug) \
- { \
- YY_FPRINTF ((stderr, "%s ", Title)); \
- yy_symbol_print (stderr, Type, Value]b4_locuser_args([Location])[);
\
- YY_FPRINTF ((stderr, "\n")); \
- } \
- } while (0)
-
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-
-struct yyGLRStack;
-static void yypstack (struct yyGLRStack* yystackp, ptrdiff_t yyk)
- YY_ATTRIBUTE_UNUSED;
-static void yypdumpstack (struct yyGLRStack* yystackp)
- YY_ATTRIBUTE_UNUSED;
-
-#else /* !]b4_api_PREFIX[DEBUG */
-
-# define YY_DPRINTF(Args) do {} while (yyfalse)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-
-#endif /* !]b4_api_PREFIX[DEBUG */
-
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
# define YYINITDEPTH ]b4_stack_depth_init[
@@ -755,6 +699,62 @@ yytokenName (yySymbol yytoken)
}
#endif
+#if ]b4_api_PREFIX[DEBUG
+
+# ifndef YYFPRINTF
+# define YYFPRINTF fprintf
+# endif
+
+# define YY_FPRINTF \
+ YY_IGNORE_USELESS_CAST_BEGIN YY_FPRINTF_
+
+# define YY_FPRINTF_(Args) \
+ do { \
+ YYFPRINTF Args; \
+ YY_IGNORE_USELESS_CAST_END \
+ } while (0)
+
+# define YY_DPRINTF \
+ YY_IGNORE_USELESS_CAST_BEGIN YY_DPRINTF_
+
+# define YY_DPRINTF_(Args) \
+ do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+ YY_IGNORE_USELESS_CAST_END \
+ } while (0)
+
+]b4_yy_location_print_define[
+
+]b4_yy_symbol_print_define[
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+ do { \
+ if (yydebug) \
+ { \
+ YY_FPRINTF ((stderr, "%s ", Title)); \
+ yy_symbol_print (stderr, Type, Value]b4_locuser_args([Location])[);
\
+ YY_FPRINTF ((stderr, "\n")); \
+ } \
+ } while (0)
+
+/* Nonzero means print parse trace. It is left uninitialized so that
+ multiple parsers can coexist. */
+int yydebug;
+
+struct yyGLRStack;
+static void yypstack (struct yyGLRStack* yystackp, ptrdiff_t yyk)
+ YY_ATTRIBUTE_UNUSED;
+static void yypdumpstack (struct yyGLRStack* yystackp)
+ YY_ATTRIBUTE_UNUSED;
+
+#else /* !]b4_api_PREFIX[DEBUG */
+
+# define YY_DPRINTF(Args) do {} while (yyfalse)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+
+#endif /* !]b4_api_PREFIX[DEBUG */
+
/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
* at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
* containing the pointer to the next state in the chain. */
--
2.24.1
- [PATCH 00/13] Better error messages, Akim Demaille, 2020/01/18
- [PATCH 01/13] glr.c: move some functions after the definition of types,
Akim Demaille <=
- [PATCH 02/13] c: use yysymbol_name in traces, Akim Demaille, 2020/01/18
- [PATCH 03/13] yacc.c: add support for parse.error detailed, Akim Demaille, 2020/01/18
- [PATCH 04/13] yacc.c: tests: check detailed error messages, Akim Demaille, 2020/01/18
- [PATCH 05/13] regen, Akim Demaille, 2020/01/18
- [PATCH 06/13] bison: use detailed error messages, Akim Demaille, 2020/01/18
- [PATCH 07/13] regen, Akim Demaille, 2020/01/18
- [PATCH 09/13] tests: check that detailed error messages preserve UTF-8 characters, Akim Demaille, 2020/01/18
- [PATCH 08/13] yacc.c: escape trigraphs in detailed parse.error, Akim Demaille, 2020/01/18
- [PATCH 10/13] parsers: support translatable token aliases, Akim Demaille, 2020/01/18