#ifndef YY_LOCATION_PRINT
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
-]b4_c_function_def([yy_location_print_],
+
+ /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
+
+ __attribute__((__unused__))
-# define YY_LOCATION_PRINT(File, Loc) \
++]b4_function_define([yy_location_print_],
+ [static unsigned],
+ [[FILE *yyo], [yyo]],
+ [[YYLTYPE const * const yylocp], [yylocp]])[
+ {
+ unsigned res = 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);
+ if (0 <= yylocp->first_column)
+ res += fprintf (yyo, ".%d", yylocp->first_column);
+ }
+ if (0 <= yylocp->last_line)
+ {
+ if (yylocp->first_line < yylocp->last_line)
+ {
+ res += fprintf (yyo, "-%d", yylocp->last_line);
+ if (0 <= end_col)
+ res += fprintf (yyo, ".%d", end_col);
+ }
+ else if (0 <= end_col && yylocp->first_column < end_col)
+ res += fprintf (yyo, "-%d", end_col);
+ }
+ return res;
+ }
+
- do { \
- fprintf (File, "%d.%d", (Loc).first_line, (Loc).first_column); \
- if ((Loc).first_line < (Loc).last_line) \
- fprintf (File, "-%d.%d", (Loc).last_line, (Loc).last_column - 1); \
- else if ((Loc).first_column < (Loc).last_column - 1) \
- fprintf (File, "-%d", (Loc).last_column - 1); \
- } while (0)
+# define YY_LOCATION_PRINT(File, Loc) \
+ yy_location_print_ (File, &(Loc))
+
# else
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif
]b4_namespace_close[
]b4_percent_code_get([[provides]])[
+]m4_popdef([b4_parse_param])dnl
+])
+
+b4_defines_if(
+[m4_changecom()dnl
+m4_divert_push(0)dnl
+@output(b4_spec_defines_file@)@
+b4_copyright([Skeleton interface for Bison GLR parsers in C++],
+ [2002-2012])[
+
+/* C++ GLR parser skeleton written by Akim Demaille. */
+
+]b4_cpp_guard_open([b4_spec_defines_file])[
+]b4_shared_declarations[
]b4_cpp_guard_close([b4_spec_defines_file])[
- ]m4_divert_pop(0)
- m4_changecom[#])])
-]b4_output_end()
++]b4_output_end()])
+
+# Let glr.c (and b4_shared_declarations) believe that the user
+# arguments include the parser itself.
+m4_ifset([b4_parse_param],
+[m4_pushdef([b4_parse_param],
+ [[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]],]
+m4_defn([b4_parse_param]))],
+[m4_pushdef([b4_parse_param],
+ [[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]]])
+])
+m4_include(b4_pkgdatadir/[glr.c])
+m4_popdef([b4_parse_param])
#endif
])[
]b4_percent_code_get([[provides]])[
+]])
+
+# We do want M4 expansion after # for CPP macros.
+m4_changecom()
+b4_defines_if(
+[m4_divert_push(0)dnl
+@output(b4_spec_defines_file@)@
+b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
+[
+/**
+ ** \file ]b4_spec_defines_file[
+ ** Define the ]b4_namespace_ref[::parser class.
+ */
+
+/* C++ LALR(1) parser skeleton written by Akim Demaille. */
+
+]b4_cpp_guard_open([b4_spec_defines_file])[
+]b4_shared_declarations[
]b4_cpp_guard_close([b4_spec_defines_file])
- m4_divert_pop(0)dnl
+ b4_output_end()
])
- m4_divert_push(0)dnl
- @output(b4_parser_file_name@)@
+ b4_output_begin([b4_parser_file_name])
-b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++],
- [2002-2012])
+b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++])
b4_percent_code_get([[top]])[]dnl
m4_if(b4_prefix, [yy], [],
[
}
#endif // ]b4_api_PREFIX[DEBUG
- /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
- ]b4_parser_class_name[::token_number_type
- ]b4_parser_class_name[::yytranslate_ (int t)
- {
- static
- const token_number_type
- translate_table[] =
- {
- ]b4_translate[
- };
- if ((unsigned int) t <= yyuser_token_number_max_)
- return translate_table[t];
- else
- return yyundef_token_;
- }
-
- const int ]b4_parser_class_name[::yyeof_ = 0;
- const int ]b4_parser_class_name[::yylast_ = ]b4_last[;
- const int ]b4_parser_class_name[::yynnts_ = ]b4_nterms_number[;
- const int ]b4_parser_class_name[::yyempty_ = -2;
- const int ]b4_parser_class_name[::yyfinal_ = ]b4_final_state_number[;
- const int ]b4_parser_class_name[::yyterror_ = 1;
- const int ]b4_parser_class_name[::yyerrcode_ = 256;
- const int ]b4_parser_class_name[::yyntokens_ = ]b4_tokens_number[;
-
- const unsigned int ]b4_parser_class_name[::yyuser_token_number_max_ = ]b4_user_token_number_max[;
- const ]b4_parser_class_name[::token_number_type ]b4_parser_class_name[::yyundef_token_ = ]b4_undef_token_number[;
-
+]b4_token_ctor_if([], [b4_yytranslate_define])[
]b4_namespace_close[
]b4_epilogue[]dnl
- m4_divert_pop(0)
+ b4_output_end()
++
++
+m4_popdef([b4_copyright_years])dnl
m4_include(b4_pkgdatadir/[java.m4])
-b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java], [b4_skeleton])])
-m4_ifval(m4_defn([b4_symbol_destructors]),
- [b4_fatal([%s: %%destructor does not make sense in Java], [b4_skeleton])],
- [])
+b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java],
+ [b4_skeleton])])
+
+# We don't depend on %debug in Java, but pacify warnings about non-used flags.
+b4_parse_trace_if([0], [0])
+
+m4_define([b4_symbol_no_destructor_assert],
+[b4_symbol_if([$1], [has_destructor],
+ [b4_fatal([%s: %s: %%destructor does not make sense in Java],
+ [b4_skeleton],
+ [b4_symbol_action_location([$1], [destructor])])])])
+b4_symbol_foreach([b4_symbol_no_destructor_assert])
- m4_divert_push(0)dnl
- @output(b4_parser_file_name@)@
+ b4_output_begin([b4_parser_file_name])
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
[2007-2012])
}
-b4_epilogue
+b4_epilogue[]dnl
- m4_divert_pop(0)dnl
+ b4_output_end()
ostr << '-' << last.column;
return ostr;
}
+]])
+
- m4_divert_push(0)dnl
- @output(b4_dir_prefix[]position.hh@)@
+# We do want M4 expansion after # for CPP macros.
+m4_changecom()
+b4_defines_if([
++b4_output_begin([b4_dir_prefix[]position.hh])
+b4_copyright([Positions for Bison parsers in C++])[
+
+/**
+ ** \file ]b4_dir_prefix[position.hh
+ ** Define the ]b4_namespace_ref[::position class.
+ */
+
+]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
+
+# include <algorithm> // std::max
+# include <iostream>
+# include <string>
+
+]b4_null_define[
+
+]b4_namespace_open[
+]b4_position_define[
]b4_namespace_close[
- @output(b4_dir_prefix[]location.hh@)@
+]b4_cpp_guard_close([b4_dir_prefix[]position.hh])
++b4_output_end()
++
++
++b4_output_begin([b4_dir_prefix[]location.hh])
+b4_copyright([Locations for Bison parsers in C++])[
+
+/**
+ ** \file ]b4_dir_prefix[location.hh
+ ** Define the ]b4_namespace_ref[::location class.
+ */
+]b4_cpp_guard_open([b4_dir_prefix[]location.hh])[
+
+# include "position.hh"
+
+]b4_namespace_open[
+]b4_location_define[
+]b4_namespace_close[
]b4_cpp_guard_close([b4_dir_prefix[]location.hh])
- m4_divert_pop(0)
- ])# b4_defines_if
- m4_popdef([b4_copyright_years])dnl
- m4_changecom([#])
+ b4_output_end()
++])
++
++
++m4_popdef([b4_copyright_years])
const S& stack_;
unsigned int range_;
};
- [# We do want M4 expansion after # for CPP macros.
- m4_changecom()
- m4_divert_push(0)dnl
- @output(b4_dir_prefix[]stack.hh@)@
+]])
+
+b4_defines_if(
++[b4_output_begin([b4_dir_prefix[]stack.hh])
+b4_copyright([Stack handling for Bison parsers in C++])[
+
+/**
+ ** \file ]b4_dir_prefix[stack.hh
+ ** Define the ]b4_namespace_ref[::stack class.
+ */
+
+]b4_cpp_guard_open([b4_dir_prefix[]stack.hh])[
+
+# include <deque>
+
+]b4_namespace_open[
+]b4_stack_define[
]b4_namespace_close[
]b4_cpp_guard_close([b4_dir_prefix[]stack.hh])
- m4_divert_pop(0)
- m4_popdef([b4_copyright_years])dnl
- m4_changecom([#])
+ b4_output_end()
+])
+
+ m4_popdef([b4_copyright_years])
## Output files. ##
## -------------- ##
- # We do want M4 expansion after # for CPP macros.
- m4_changecom()
- m4_divert_push(0)dnl
- @output(b4_parser_file_name@)@
+ b4_output_begin([b4_parser_file_name])
-b4_copyright([Bison implementation for Yacc-like parsers in C],
- [1984, 1989-1990, 2000-2012])[
+b4_copyright([Bison implementation for Yacc-like parsers in C])[
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
- /* Make sure YYID is used. */
- return YYID (yyresult);
+ return yyresult;
}
-
-
]b4_epilogue[]dnl
+ b4_output_end()
+
b4_defines_if(
- [@output(b4_spec_defines_file@)@
- b4_copyright([Bison interface for Yacc-like parsers in C])[
+ [b4_output_begin([b4_spec_defines_file])[
-]b4_copyright([Bison interface for Yacc-like parsers in C],
- [1984, 1989-1990, 2000-2012])[
++]b4_copyright([Bison interface for Yacc-like parsers in C])[
]b4_shared_declarations[
- ]])dnl b4_defines_if
- m4_divert_pop(0)
- m4_popdef([b4_copyright_years])
+ ]b4_output_end()
-])
++])# b4_defines_if
/xsize.h
/xstrndup.c
/xstrndup.h
-/xmemdup0.c
-/xmemdup0.h
-/sys_types.in.h
-/obstack_printf.c
/binary-io.c
-/mbuiter.c
/xsize.c
+ /bitrotate.c
+ /math.c
+ /sig-handler.c
+ /stdio.c
+ /unistd.c
+ /wctype-h.c
/hash.m4
/iconv.m4
/include_next.m4
- /inline.m4
/intdiv0.m4
/intl.m4
+/intl.m4~
/intldir.m4
/intlmacosx.m4
/intmax.m4
static void
handle_syncline (char *args, location loc)
{
- char *after_num;
- unsigned long int lineno = strtoul (args, &after_num, 10);
- char *file = strchr (after_num, '"') + 1;
- *strchr (file, '"') = '\0';
+ char *file;
+ unsigned long int lineno = strtoul (args, &file, 10);
if (INT_MAX <= lineno)
{
- warn_at (loc, _("line number overflow"));
+ complain (&loc, Wother, _("line number overflow"));
lineno = INT_MAX;
}
- current_file = uniqstr_new (file);
+
- file = mbschr (file, '"');
++ file = strchr (file, '"');
+ if (file)
+ {
- *mbschr (file + 1, '"') = '\0';
++ *strchr (file + 1, '"') = '\0';
+ current_file = uniqstr_new (file + 1);
+ }
boundary_set (&scanner_cursor, current_file, lineno, 1);
}