This commit is contained in:
Anatol Belski 2018-06-28 11:15:39 +02:00
Родитель 871816e56c
Коммит a5426ba7bb
25 изменённых файлов: 166 добавлений и 176 удалений

Двоичные данные
msys2/usr/bin/bison.exe

Двоичный файл не отображается.

Просмотреть файл

@ -1,6 +1,7 @@
# bison-i18n.m4 serial 2
dnl Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
dnl Copyright (C) 2005-2006, 2009-2015, 2018 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,

Просмотреть файл

@ -52,7 +52,7 @@ into various formats.
-----
Copyright (C) 2002, 2008-2015 Free Software Foundation, Inc.
Copyright (C) 2002, 2008-2015, 2018 Free Software Foundation, Inc.
This file is part of GNU Bison.

Просмотреть файл

@ -2,7 +2,7 @@
# Language-independent M4 Macros for Bison.
# Copyright (C) 2002, 2004-2015 Free Software Foundation, Inc.
# Copyright (C) 2002, 2004-2015, 2018 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

Просмотреть файл

@ -2,7 +2,8 @@
# C++ skeleton dispatching for Bison.
# Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
# Copyright (C) 2006-2007, 2009-2015, 2018 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

Просмотреть файл

@ -2,7 +2,7 @@
# C++ skeleton for Bison
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
# Copyright (C) 2002-2018 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
@ -30,6 +30,16 @@ m4_include(b4_pkgdatadir/[c.m4])
m4_define([b4_comment],
[b4_comment_([$1], [$2// ], [$2// ])])
# b4_inline(hh|cc)
# ----------------
# Expand to `inline\n ` if $1 is hh.
m4_define([b4_inline],
[m4_case([$1],
[cc], [],
[hh], [[inline
]],
[m4_fatal([$0: invalid argument: $1])])])
## -------- ##
## Checks. ##
## -------- ##
@ -275,25 +285,22 @@ m4_define([b4_public_types_declare],
]b4_symbol_constructor_declare])
# b4_public_types_define
# ----------------------
# b4_public_types_define(hh|cc)
# -----------------------------
# Provide the implementation needed by the public types.
m4_define([b4_public_types_define],
[[ inline
]b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
[ b4_inline([$1])b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
: std::runtime_error (m)]b4_locations_if([
, location (l)])[
{}
// basic_symbol.
template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol ()
: value ()
{}
template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
: Base (other)
, value ()]b4_locations_if([
@ -304,9 +311,7 @@ m4_define([b4_public_types_define],
[value = other.value;])[
}
template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
[typename Base::kind_type t],
[const semantic_type& v],
@ -323,7 +328,6 @@ m4_define([b4_public_types_define],
]b4_type_foreach([b4_basic_symbol_constructor_define])], [[
/// Constructor for valueless symbols.
template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
[typename Base::kind_type t],
b4_locations_if([const location_type& l]))[)
@ -333,14 +337,12 @@ m4_define([b4_public_types_define],
{}]])[
template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol ()
{
clear ();
}
template <typename Base>
inline
void
]b4_parser_class_name[::basic_symbol<Base>::clear ()
{]b4_variant_if([[
@ -361,7 +363,6 @@ m4_define([b4_public_types_define],
}
template <typename Base>
inline
bool
]b4_parser_class_name[::basic_symbol<Base>::empty () const
{
@ -369,11 +370,10 @@ m4_define([b4_public_types_define],
}
template <typename Base>
inline
void
]b4_parser_class_name[::basic_symbol<Base>::move (basic_symbol& s)
{
super_type::move(s);
super_type::move (s);
]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [move],
[s.value])],
[value = s.value;])[]b4_locations_if([
@ -381,45 +381,38 @@ m4_define([b4_public_types_define],
}
// by_type.
inline
]b4_parser_class_name[::by_type::by_type ()
]b4_inline([$1])b4_parser_class_name[::by_type::by_type ()
: type (empty_symbol)
{}
inline
]b4_parser_class_name[::by_type::by_type (const by_type& other)
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (const by_type& other)
: type (other.type)
{}
inline
]b4_parser_class_name[::by_type::by_type (token_type t)
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (token_type t)
: type (yytranslate_ (t))
{}
inline
void
]b4_inline([$1])[void
]b4_parser_class_name[::by_type::clear ()
{
type = empty_symbol;
}
inline
void
]b4_inline([$1])[void
]b4_parser_class_name[::by_type::move (by_type& that)
{
type = that.type;
that.clear ();
}
inline
int
]b4_inline([$1])[int
]b4_parser_class_name[::by_type::type_get () const
{
return type;
}
]b4_token_ctor_if([[
inline
]b4_parser_class_name[::token_type
]b4_inline([$1])b4_parser_class_name[::token_type
]b4_parser_class_name[::by_type::token () const
{
// YYTOKNUM[NUM] -- (External) token number corresponding to the
@ -445,14 +438,13 @@ m4_define([b4_symbol_constructor_declare], [])
m4_define([b4_symbol_constructor_define], [])
# b4_yytranslate_define
# ---------------------
# Define yytranslate_. Sometimes used in the header file,
# b4_yytranslate_define(cc|hh)
# ----------------------------
# Define yytranslate_. Sometimes used in the header file ($1=hh),
# sometimes in the cc file.
m4_define([b4_yytranslate_define],
[[ // Symbol number corresponding to token number t.
inline
]b4_parser_class_name[::token_number_type
]b4_inline([$1])b4_parser_class_name[::token_number_type
]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type],
[int])[ t)
{
@ -462,12 +454,12 @@ m4_define([b4_yytranslate_define],
{
]b4_translate[
};
const unsigned int user_token_number_max_ = ]b4_user_token_number_max[;
const unsigned user_token_number_max_ = ]b4_user_token_number_max[;
const token_number_type undef_token_ = ]b4_undef_token_number[;
if (static_cast<int>(t) <= yyeof_)
if (static_cast<int> (t) <= yyeof_)
return yyeof_;
else if (static_cast<unsigned int> (t) <= user_token_number_max_)
else if (static_cast<unsigned> (t) <= user_token_number_max_)
return translate_table[t];
else
return undef_token_;

Просмотреть файл

@ -2,7 +2,7 @@
# Common code for C-like languages (C, C++, Java, etc.)
# Copyright (C) 2012-2015 Free Software Foundation, Inc.
# Copyright (C) 2012-2015, 2018 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

Просмотреть файл

@ -2,7 +2,8 @@
# C skeleton dispatching for Bison.
# Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
# Copyright (C) 2006-2007, 2009-2015, 2018 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

Просмотреть файл

@ -2,7 +2,7 @@
# C M4 Macros for Bison.
# Copyright (C) 2002, 2004-2015 Free Software Foundation, Inc.
# Copyright (C) 2002, 2004-2015, 2018 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

Просмотреть файл

@ -2,7 +2,7 @@
# GLR skeleton for Bison
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
# Copyright (C) 2002-2015, 2018 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
@ -198,7 +198,7 @@ m4_if(b4_skeleton, ["glr.c"],
[b4_defines_if(
[b4_output_begin([b4_spec_defines_file])
b4_copyright([Skeleton interface for Bison GLR parsers in C],
[2002-2015])[
[2002-2015, 2018])[
]b4_cpp_guard_open([b4_spec_defines_file])[
]b4_shared_declarations[
@ -213,7 +213,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C],
b4_output_begin([b4_parser_file_name])
b4_copyright([Skeleton implementation for Bison GLR parsers in C],
[2002-2015])[
[2002-2015, 2018])[
/* C GLR parser skeleton written by Paul Hilfinger. */
@ -808,6 +808,7 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
*yyvalp = yyval_default;
else
*yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;]b4_locations_if([[
/* Default location. */
YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen);
yystackp->yyerror_range[1].yystate.yyloc = *yylocp;
]])[
@ -2085,6 +2086,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
case N: \
yyformat = S; \
break
default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@ -2305,8 +2307,8 @@ b4_dollar_popdef])[]dnl
{
yyrule = yydefaultAction (yystate);
if (yyrule == 0)
{
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
{]b4_locations_if([[
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
yyreportSyntaxError (&yystack]b4_user_args[);
goto yyuser_error;
}
@ -2345,8 +2347,8 @@ b4_dollar_popdef])[]dnl
yystack.yyerrState -= 1;
}
else if (yyisErrorAction (yyaction))
{
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
{]b4_locations_if([[
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
yyreportSyntaxError (&yystack]b4_user_args[);
goto yyuser_error;
}
@ -2391,8 +2393,8 @@ b4_dollar_popdef])[]dnl
if (yystack.yytops.yysize == 0)
yyFail (&yystack][]b4_lpure_args[, YY_("syntax error"));
YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));]b4_locations_if([[
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
yyreportSyntaxError (&yystack]b4_user_args[);
goto yyuser_error;
}
@ -2473,9 +2475,9 @@ b4_dollar_popdef])[]dnl
{
while (yystates[yyk])
{
yyGLRState *yys = yystates[yyk];
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]]
)[ if (yys->yypred != YY_NULLPTR)
yyGLRState *yys = yystates[yyk];]b4_locations_if([[
yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
if (yys->yypred != YY_NULLPTR)
yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
yystates[yyk] = yys->yypred;
yystack.yynextFree -= 1;

Просмотреть файл

@ -1,6 +1,6 @@
# C++ GLR skeleton for Bison
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
# Copyright (C) 2002-2015, 2018 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
@ -177,7 +177,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
| Print this symbol. |
`--------------------*/
inline void
void
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
const semantic_type* yyvaluep]b4_locations_if([[,
const location_type* yylocationp]])[)
@ -329,7 +329,7 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
b4_defines_if(
[b4_output_begin([b4_spec_defines_file])
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
[2002-2015])[
[2002-2015, 2018])[
// C++ GLR parser skeleton written by Akim Demaille.

Просмотреть файл

@ -2,7 +2,7 @@
# Java skeleton dispatching for Bison.
# Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
# Copyright (C) 2007, 2009-2015, 2018 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

Просмотреть файл

@ -2,7 +2,7 @@
# Java language support for Bison
# Copyright (C) 2007-2015 Free Software Foundation, Inc.
# Copyright (C) 2007-2015, 2018 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

Просмотреть файл

@ -1,6 +1,6 @@
# C++ skeleton for Bison
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
# Copyright (C) 2002-2015, 2018 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
@ -131,7 +131,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
m4_pushdef([b4_copyright_years],
[2002-2015])
[2002-2015, 2018])
m4_define([b4_parser_class_name],
[b4_percent_define_get([[parser_class_name]])])
@ -142,9 +142,9 @@ b4_bison_locations_if([# Backward compatibility.
m4_include(b4_pkgdatadir/[stack.hh])
b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
# b4_shared_declarations
# ----------------------
# Declaration that might either go into the header (if --defines)
# b4_shared_declarations(hh|cc)
# -----------------------------
# Declaration that might either go into the header (if --defines, $1 = hh)
# or open coded in the parser body.
m4_define([b4_shared_declarations],
[b4_percent_code_get([[requires]])[
@ -314,6 +314,8 @@ b4_location_define])])[
typedef basic_symbol<by_state> super_type;
/// Construct an empty symbol.
stack_symbol_type ();
/// Copy construct.
stack_symbol_type (const stack_symbol_type& that);
/// Steal the contents from \a sym to build this.
stack_symbol_type (state_type s, symbol_type& sym);
/// Assignment, needed by push_back.
@ -342,7 +344,7 @@ b4_location_define])])[
void yypush_ (const char* m, state_type s, symbol_type& sym);
/// Pop \a n symbols the three stacks.
void yypop_ (unsigned int n = 1);
void yypop_ (unsigned n = 1);
/// Constants.
enum
@ -359,8 +361,8 @@ b4_location_define])])[
]b4_parse_param_vars[
};
]b4_token_ctor_if([b4_yytranslate_define
b4_public_types_define])[
]b4_token_ctor_if([b4_yytranslate_define([$1])[
]b4_public_types_define([$1])])[
]b4_namespace_close[
]b4_percent_define_flag_if([[global_tokens_and_yystype]],
@ -386,7 +388,7 @@ b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
// C++ LALR(1) parser skeleton written by Akim Demaille.
]b4_cpp_guard_open([b4_spec_defines_file])[
]b4_shared_declarations[
]b4_shared_declarations(hh)[
]b4_cpp_guard_close([b4_spec_defines_file])
b4_output_end()
])
@ -406,7 +408,7 @@ m4_if(b4_prefix, [yy], [],
]b4_null_define[
]b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
[b4_shared_declarations])[
[b4_shared_declarations([cc])])[
// User implementation prologue.
]b4_user_post_prologue[
@ -443,7 +445,7 @@ m4_if(b4_prefix, [yy], [],
{ \
*yycdebug_ << Title << ' '; \
yy_print_ (*yycdebug_, Symbol); \
*yycdebug_ << std::endl; \
*yycdebug_ << '\n'; \
} \
} while (false)
@ -462,9 +464,9 @@ m4_if(b4_prefix, [yy], [],
#else // !]b4_api_PREFIX[DEBUG
# define YYCDEBUG if (false) std::cerr
# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE(Symbol)
# define YY_REDUCE_PRINT(Rule) static_cast<void>(0)
# define YY_STACK_PRINT() static_cast<void>(0)
# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol)
# define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
# define YY_STACK_PRINT() static_cast<void> (0)
#endif // !]b4_api_PREFIX[DEBUG
@ -533,27 +535,23 @@ m4_if(b4_prefix, [yy], [],
| Symbol types. |
`---------------*/
]b4_token_ctor_if([], [b4_public_types_define])[
]b4_token_ctor_if([], [b4_public_types_define([cc])])[
// by_state.
inline
]b4_parser_class_name[::by_state::by_state ()
: state (empty_state)
{}
inline
]b4_parser_class_name[::by_state::by_state (const by_state& other)
: state (other.state)
{}
inline
void
]b4_parser_class_name[::by_state::clear ()
{
state = empty_state;
}
inline
void
]b4_parser_class_name[::by_state::move (by_state& that)
{
@ -561,12 +559,10 @@ m4_if(b4_prefix, [yy], [],
that.clear ();
}
inline
]b4_parser_class_name[::by_state::by_state (state_type s)
: state (s)
{}
inline
]b4_parser_class_name[::symbol_number_type
]b4_parser_class_name[::by_state::type_get () const
{
@ -576,12 +572,17 @@ m4_if(b4_prefix, [yy], [],
return yystos_[state];
}
inline
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type ()
{}
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (const stack_symbol_type& that)
: super_type (that.state]b4_locations_if([, that.location])[)
{
]b4_variant_if([b4_symbol_variant([that.type_get ()],
[value], [copy], [that.value])],
[[value = that.value;]])[
}
inline
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (state_type s, symbol_type& that)
: super_type (s]b4_locations_if([, that.location])[)
{
@ -592,7 +593,6 @@ m4_if(b4_prefix, [yy], [],
that.type = empty_symbol;
}
inline
]b4_parser_class_name[::stack_symbol_type&
]b4_parser_class_name[::stack_symbol_type::operator= (const stack_symbol_type& that)
{
@ -606,7 +606,6 @@ m4_if(b4_prefix, [yy], [],
template <typename Base>
inline
void
]b4_parser_class_name[::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
{
@ -638,7 +637,6 @@ m4_if(b4_prefix, [yy], [],
}
#endif
inline
void
]b4_parser_class_name[::yypush_ (const char* m, state_type s, symbol_type& sym)
{
@ -646,7 +644,6 @@ m4_if(b4_prefix, [yy], [],
yypush_ (m, t);
}
inline
void
]b4_parser_class_name[::yypush_ (const char* m, stack_symbol_type& s)
{
@ -655,9 +652,8 @@ m4_if(b4_prefix, [yy], [],
yystack_.push (s);
}
inline
void
]b4_parser_class_name[::yypop_ (unsigned int n)
]b4_parser_class_name[::yypop_ (unsigned n)
{
yystack_.pop (n);
}
@ -689,7 +685,7 @@ m4_if(b4_prefix, [yy], [],
}
#endif // ]b4_api_PREFIX[DEBUG
inline ]b4_parser_class_name[::state_type
]b4_parser_class_name[::state_type
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yysym)
{
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
@ -699,13 +695,13 @@ m4_if(b4_prefix, [yy], [],
return yydefgoto_[yysym - yyntokens_];
}
inline bool
bool
]b4_parser_class_name[::yy_pact_value_is_default_ (int yyvalue)
{
return yyvalue == yypact_ninf_;
}
inline bool
bool
]b4_parser_class_name[::yy_table_value_is_error_ (int yyvalue)
{
return yyvalue == yytable_ninf_;
@ -736,7 +732,7 @@ m4_if(b4_prefix, [yy], [],
// avoid gratuitous conflicts when merging into the master branch.
try
{
YYCDEBUG << "Starting parse" << std::endl;
YYCDEBUG << "Starting parse\n";
]m4_ifdef([b4_initial_action], [
b4_dollar_pushdef([yyla.value], [], [yyla.location])dnl
@ -753,7 +749,7 @@ b4_dollar_popdef])[]dnl
// A new symbol was pushed on the stack.
yynewstate:
YYCDEBUG << "Entering state " << yystack_[0].state << std::endl;
YYCDEBUG << "Entering state " << yystack_[0].state << '\n';
// Accept?
if (yystack_[0].state == yyfinal_)
@ -827,7 +823,7 @@ b4_dollar_popdef])[]dnl
yylen = yyr2_[yyn];
{
stack_symbol_type yylhs;
yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
/* Variants are always initialized to an empty instance of the
correct type. The default '$$ = $1' action is NOT applied
when using variants. */
@ -844,10 +840,11 @@ b4_dollar_popdef])[]dnl
yylhs.value = yystack_@{0@}.value;])[
]b4_locations_if([dnl
[
// Compute the default @@$.
// Default location.
{
slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
YYLLOC_DEFAULT (yylhs.location, slice, yylen);
yyerror_range[1].location = yylhs.location;
}]])[
// Perform the reduction.
@ -918,8 +915,7 @@ b4_dollar_popdef])[]dnl
YYERROR and the label yyerrorlab therefore never appears in user
code. */
if (false)
goto yyerrorlab;]b4_locations_if([[
yyerror_range[1].location = yystack_[yylen - 1].location;]])[
goto yyerrorlab;
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
yypop_ (yylen);
@ -993,8 +989,7 @@ b4_dollar_popdef])[]dnl
}
catch (...)
{
YYCDEBUG << "Exception caught: cleaning lookahead and stack"
<< std::endl;
YYCDEBUG << "Exception caught: cleaning lookahead and stack\n";
// Do not try to display the values of the reclaimed symbols,
// as their printer might throw an exception.
if (!yyla.empty ())
@ -1013,7 +1008,7 @@ b4_dollar_popdef])[]dnl
]b4_parser_class_name[::error (const syntax_error& yyexc)
{
error (]b4_join(b4_locations_if([yyexc.location]),
[[yyexc.what()]])[);
[[yyexc.what ()]])[);
}
// Generate an error message.
@ -1091,12 +1086,13 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
case N: \
yyformat = S; \
break
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
default: // Avoid compiler warnings.
YYCASE_ (0, YY_("syntax error"));
YYCASE_ (1, YY_("syntax error, unexpected %s"));
YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
#undef YYCASE_
}
@ -1144,18 +1140,18 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
i_end = yystack_.end ();
i != i_end; ++i)
*yycdebug_ << ' ' << i->state;
*yycdebug_ << std::endl;
*yycdebug_ << '\n';
}
// Report on the debug stream that the rule \a yyrule is going to be reduced.
void
]b4_parser_class_name[::yy_reduce_print_ (int yyrule)
{
unsigned int yylno = yyrline_[yyrule];
unsigned yylno = yyrline_[yyrule];
int yynrhs = yyr2_[yyrule];
// Print the symbols being reduced, and their result.
*yycdebug_ << "Reducing stack by rule " << yyrule - 1
<< " (line " << yylno << "):" << std::endl;
<< " (line " << yylno << "):\n";
// The symbols being reduced.
for (int yyi = 0; yyi < yynrhs; yyi++)
YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
@ -1163,7 +1159,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
}
#endif // ]b4_api_PREFIX[DEBUG
]b4_token_ctor_if([], [b4_yytranslate_define])[
]b4_token_ctor_if([], [b4_yytranslate_define([cc])])[
]b4_namespace_close[
]b4_epilogue[]dnl
b4_output_end()

Просмотреть файл

@ -1,6 +1,6 @@
# Java skeleton for Bison -*- autoconf -*-
# Copyright (C) 2007-2015 Free Software Foundation, Inc.
# Copyright (C) 2007-2015, 2018 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
@ -84,7 +84,7 @@ m4_define([b4_define_state],[[
b4_output_begin([b4_parser_file_name])
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
[2007-2015])
[2007-2015, 2018])
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
])[/* First part of user declarations. */

Просмотреть файл

@ -1,6 +1,6 @@
# C++ skeleton for Bison
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
# Copyright (C) 2002-2015, 2018 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
@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_pushdef([b4_copyright_years],
[2002-2015])
[2002-2015, 2018])
# b4_position_define
# ------------------
@ -28,19 +28,18 @@ m4_define([b4_position_define],
public:]m4_ifdef([b4_location_constructors], [[
/// Construct a position.
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
unsigned int l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u)
unsigned l = ]b4_location_initial_line[u,
unsigned c = ]b4_location_initial_column[u)
: filename (f)
, line (l)
, column (c)
{
}
{}
]])[
/// Initialization.
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR,
unsigned int l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u)
unsigned l = ]b4_location_initial_line[u,
unsigned c = ]b4_location_initial_column[u)
{
filename = fn;
line = l;
@ -69,15 +68,15 @@ m4_define([b4_position_define],
/// File name to which this position refers.
]b4_percent_define_get([[filename_type]])[* filename;
/// Current line number.
unsigned int line;
unsigned line;
/// Current column number.
unsigned int column;
unsigned column;
private:
/// Compute max(min, lhs+rhs) (provided min <= lhs).
static unsigned int add_ (unsigned int lhs, int rhs, unsigned int min)
static unsigned add_ (unsigned lhs, int rhs, unsigned min)
{
return (0 < rhs || -static_cast<unsigned int>(rhs) < lhs
return (0 < rhs || -static_cast<unsigned>(rhs) < lhs
? rhs + lhs
: min);
}
@ -157,30 +156,27 @@ m4_define([b4_location_define],
location (const position& b, const position& e)
: begin (b)
, end (e)
{
}
{}
/// Construct a 0-width location in \a p.
explicit location (const position& p = position ())
: begin (p)
, end (p)
{
}
{}
/// Construct a 0-width location in \a f, \a l, \a c.
explicit location (]b4_percent_define_get([[filename_type]])[* f,
unsigned int l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u)
unsigned l = ]b4_location_initial_line[u,
unsigned c = ]b4_location_initial_column[u)
: begin (f, l, c)
, end (f, l, c)
{
}
{}
])[
/// Initialization.
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
unsigned int l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u)
unsigned l = ]b4_location_initial_line[u,
unsigned c = ]b4_location_initial_column[u)
{
begin.initialize (f, l, c);
end = begin;
@ -278,7 +274,7 @@ m4_define([b4_location_define],
inline std::basic_ostream<YYChar>&
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
{
unsigned int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
unsigned end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
ostr << loc.begin;
if (loc.end.filename
&& (!loc.begin.filename

Просмотреть файл

@ -4,7 +4,7 @@
# Speeds up GNU M4 1.4.x by avoiding quadratic $@ recursion, but penalizes
# GNU M4 1.6 by requiring more memory and macro expansions.
#
# Copyright (C) 2008-2013 Free Software Foundation, Inc.
# Copyright (C) 2008-2017 Free Software Foundation, Inc.
# This file is part of Autoconf. This program is free
# software; you can redistribute it and/or modify it under the
@ -24,7 +24,7 @@
# You should have received a copy of the GNU General Public License
# and a copy of the Autoconf Configure Script Exception along with
# this program; see the files COPYINGv3 and COPYING.EXCEPTION
# respectively. If not, see <http://www.gnu.org/licenses/>.
# respectively. If not, see <https://www.gnu.org/licenses/>.
# Written by Eric Blake.

Просмотреть файл

@ -3,7 +3,7 @@ divert(-1)# -*- Autoconf -*-
# Base M4 layer.
# Requires GNU M4.
#
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
# This file is part of Autoconf. This program is free
# software; you can redistribute it and/or modify it under the
@ -23,7 +23,7 @@ divert(-1)# -*- Autoconf -*-
# You should have received a copy of the GNU General Public License
# and a copy of the Autoconf Configure Script Exception along with
# this program; see the files COPYINGv3 and COPYING.EXCEPTION
# respectively. If not, see <http://www.gnu.org/licenses/>.
# respectively. If not, see <https://www.gnu.org/licenses/>.
# Written by Akim Demaille.
@ -2000,7 +2000,7 @@ m4_define([_m4_defun_once],
# m4_pattern_forbid(ERE, [WHY])
# -----------------------------
# Declare that no token matching the forbidden extended regular
# Declare that no token matching the forbidden perl extended regular
# expression ERE should be seen in the output unless...
m4_define([m4_pattern_forbid], [])
@ -2008,7 +2008,7 @@ m4_define([m4_pattern_forbid], [])
# m4_pattern_allow(ERE)
# ---------------------
# ... that token also matches the allowed extended regular expression ERE.
# Both used via traces.
# Both used via traces, by autom4te post-processing.
m4_define([m4_pattern_allow], [])
@ -2107,7 +2107,7 @@ m4_define([_m4_require_check],
[m4_if(_m4_defn([_m4_diverting]), [$2], [m4_ignore],
m4_ifdef([_m4_diverting([$2])], [-]), [-], [m4_warn([syntax],
[$3: `$1' was expanded before it was required
http://www.gnu.org/software/autoconf/manual/autoconf.html#Expanded-Before-Required])_m4_require_call],
https://www.gnu.org/software/autoconf/manual/autoconf.html#Expanded-Before-Required])_m4_require_call],
[m4_ignore])])
@ -3126,7 +3126,8 @@ m4_define([m4_set_empty],
# guaranteed. This is faster than the corresponding m4_foreach([VAR],
# m4_indir([m4_dquote]m4_set_listc([SET])), [ACTION])
m4_define([m4_set_foreach],
[m4_pushdef([$2])m4_set_map_sep([$1], [m4_define([$2],], [)$3])])
[m4_pushdef([$2])m4_set_map_sep([$1],
[m4_define([$2],], [)$3])m4_popdef([$2])])
# m4_set_intersection(SET1, SET2)
# -------------------------------

Просмотреть файл

@ -1,6 +1,6 @@
# C++ skeleton for Bison
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
# Copyright (C) 2002-2015, 2018 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
@ -16,12 +16,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_pushdef([b4_copyright_years],
[2002-2015])
[2002-2015, 2018])
# b4_stack_define
# ---------------
m4_define([b4_stack_define],
[[ template <class T, class S = std::vector<T> >
[[ /// A stack with random access from its top.
template <class T, class S = std::vector<T> >
class stack
{
public:
@ -35,20 +36,24 @@ m4_define([b4_stack_define],
seq_.reserve (200);
}
stack (unsigned int n)
stack (unsigned n)
: seq_ (n)
{}
inline
/// Random access.
///
/// Index 0 returns the topmost element.
T&
operator[] (unsigned int i)
operator[] (unsigned i)
{
return seq_[seq_.size () - 1 - i];
}
inline
/// Random access.
///
/// Index 0 returns the topmost element.
const T&
operator[] (unsigned int i) const
operator[] (unsigned i) const
{
return seq_[seq_.size () - 1 - i];
}
@ -56,7 +61,6 @@ m4_define([b4_stack_define],
/// Steal the contents of \a t.
///
/// Close to move-semantics.
inline
void
push (T& t)
{
@ -64,9 +68,8 @@ m4_define([b4_stack_define],
operator[](0).move (t);
}
inline
void
pop (unsigned int n = 1)
pop (unsigned n = 1)
{
for (; n; --n)
seq_.pop_back ();
@ -78,21 +81,18 @@ m4_define([b4_stack_define],
seq_.clear ();
}
inline
typename S::size_type
size () const
{
return seq_.size ();
}
inline
const_iterator
begin () const
{
return seq_.rbegin ();
}
inline
const_iterator
end () const
{
@ -111,21 +111,20 @@ m4_define([b4_stack_define],
class slice
{
public:
slice (const S& stack, unsigned int range)
slice (const S& stack, unsigned range)
: stack_ (stack)
, range_ (range)
{}
inline
const T&
operator [] (unsigned int i) const
operator [] (unsigned i) const
{
return stack_[range_ - i];
}
private:
const S& stack_;
unsigned int range_;
unsigned range_;
};
]])

Просмотреть файл

@ -1,6 +1,6 @@
# C++ skeleton for Bison
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
# Copyright (C) 2002-2015, 2018 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
@ -27,7 +27,7 @@
m4_define([b4_symbol_variant],
[m4_pushdef([b4_dollar_dollar],
[$2.$3< $][3 > (m4_shift3($@))])dnl
switch ($1)
switch ($1)
{
b4_type_foreach([b4_type_action_])[]dnl
default:

Просмотреть файл

@ -3,7 +3,7 @@
<!--
bison.xsl - common templates for Bison XSLT.
Copyright (C) 2007-2015 Free Software Foundation, Inc.
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.

Просмотреть файл

@ -3,7 +3,7 @@
<!--
xml2dot.xsl - transform Bison XML Report into DOT.
Copyright (C) 2007-2015 Free Software Foundation, Inc.
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.

Просмотреть файл

@ -3,7 +3,7 @@
<!--
xml2text.xsl - transform Bison XML Report into plain text.
Copyright (C) 2007-2015 Free Software Foundation, Inc.
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.

Просмотреть файл

@ -3,7 +3,7 @@
<!--
xml2html.xsl - transform Bison XML Report into XHTML.
Copyright (C) 2007-2015 Free Software Foundation, Inc.
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.

Просмотреть файл

@ -1,11 +1,11 @@
-*- C -*-
# Yacc compatible skeleton for Bison
# Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation,
# Inc.
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software
# Foundation, Inc.
m4_pushdef([b4_copyright_years],
[1984, 1989-1990, 2000-2015])
[1984, 1989-1990, 2000-2015, 2018])
# 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
@ -1207,6 +1207,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
case N: \
yyformat = S; \
break
default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@ -1641,8 +1642,9 @@ yyreduce:
yyval = yyvsp[1-yylen];
]b4_locations_if(
[[ /* Default location. */
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[
[[ /* Default location. */
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
yyerror_range[1] = yyloc;]])[
YY_REDUCE_PRINT (yyn);]b4_lac_if([[
{
int yychar_backup = yychar;
@ -1782,8 +1784,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
]b4_locations_if([[ yyerror_range[1] = yylsp[1-yylen];
]])[ /* Do not reclaim the symbols of the rule whose action triggered
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;