# C M4 Macros for Bison.
-# Copyright (C) 2002, 2004-2012 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
## Identification. ##
## ---------------- ##
-# b4_comment_(TEXT, OPEN, CONTINUE, END)
-# --------------------------------------
-# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
-# Avoid adding indentation to the first line, as the indentation comes
-# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
-#
-# Prefix all the output lines with PREFIX.
-m4_define([b4_comment_],
-[$2[]m4_bpatsubst(m4_expand([$1]), [
-\(.\)], [
-$3\1])$4])
-
-
-# b4_comment(TEXT, [PREFIX])
-# --------------------------
-# Put TEXT in comment. Prefix all the output lines with PREFIX.
-m4_define([b4_comment],
-[b4_comment_([$1], [$2/* ], [$2 ], [ */])])
-
-
# b4_identification
# -----------------
# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
# --------------------------------
# `YYUSE' VAL, LOC if locations are enabled, and all the parse-params.
m4_define([b4_parse_param_use],
-[m4_ifvaln([$1], [ YYUSE([$1]);])dnl
+[m4_ifvaln([$1], [ YYUSE ([$1]);])dnl
b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl
b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
])dnl
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
# -------------------------------------------------------------
-# Define "yy<TABLE-NAME>" which contents is CONTENT.
+# Define "yy<TABLE-NAME>" whose contents is CONTENT.
m4_define([b4_integral_parser_table_define],
[m4_ifvaln([$3], [b4_comment([$3], [ ])])dnl
static const b4_int_type_for([$2]) yy$1[[]] =
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
m4_ifset([b4_parse_param], [, b4_parse_param]))[
{
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+ YYFPRINTF (yyoutput, "%s %s (",
+ yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
YYFPRINTF (yyoutput, ": ");
m4_define([b4_value_type_define],
[[/* Value type. */
#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
-]m4_ifdef([b4_stype],
+]m4_ifdef([b4_union_members],
[[typedef union ]b4_union_name[ ]b4_api_PREFIX[STYPE;
union ]b4_union_name[
{
-]b4_user_stype[
+]b4_user_union_members[
};
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]],
[m4_if(b4_tag_seen_flag, 0,
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
if (0 <= yylocp->first_line)
{
- res += fprintf (yyo, "%d", yylocp->first_line);
+ res += YYFPRINTF (yyo, "%d", yylocp->first_line);
if (0 <= yylocp->first_column)
- res += fprintf (yyo, ".%d", yylocp->first_column);
+ res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
}
if (0 <= yylocp->last_line)
{
if (yylocp->first_line < yylocp->last_line)
{
- res += fprintf (yyo, "-%d", yylocp->last_line);
+ res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
if (0 <= end_col)
- res += fprintf (yyo, ".%d", end_col);
+ res += YYFPRINTF (yyo, ".%d", end_col);
}
else if (0 <= end_col && yylocp->first_column < end_col)
- res += fprintf (yyo, "-%d", end_col);
+ res += YYFPRINTF (yyo, "-%d", end_col);
}
return res;
}
-# define YY_LOCATION_PRINT(File, Loc) \
+# define YY_LOCATION_PRINT(File, Loc) \
yy_location_print_ (File, &(Loc))
# else