]> git.saurik.com Git - bison.git/blobdiff - data/c.m4
cosmetics: prettify names for compiled object for bison
[bison.git] / data / c.m4
index 0d30a4966a271cff0e9bbf0cf741880590d8d85b..2b7e9d63c9523372a5a78807e56eb1ec36db8f7c 100644 (file)
--- a/data/c.m4
+++ b/data/c.m4
@@ -567,3 +567,40 @@ b4_locations_if([, yylocationp])[]b4_user_args[);
   YYFPRINTF (yyoutput, ")");
 }]dnl
 ])
+
+## -------------- ##
+## Declarations.  ##
+## -------------- ##
+
+# b4_declare_yylstype
+# ------------------
+# Declaration that might either go into the header (if --defines)
+# or open coded in the parser body.  Declare YYSTYPE and YYLTYPE.
+m4_define([b4_declare_yylstype],
+[[#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+]m4_ifdef([b4_stype],
+[[typedef union ]b4_union_name[
+{
+]b4_user_stype[
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1]],
+[m4_if(b4_tag_seen_flag, 0,
+[[typedef int YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1]])])[
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+#endif]b4_locations_if([[
+
+#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
+typedef struct YYLTYPE
+{
+  int first_line;
+  int first_column;
+  int last_line;
+  int last_column;
+} YYLTYPE;
+# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
+# define YYLTYPE_IS_DECLARED 1
+# define YYLTYPE_IS_TRIVIAL 1
+#endif]])
+])