Skip to content

Commit

Permalink
[#66,!115] regen flex/bison
Browse files Browse the repository at this point in the history
  • Loading branch information
fxdupont authored and tomaszmrugalski committed Nov 7, 2018
1 parent 5f5b4e4 commit b8d6780
Show file tree
Hide file tree
Showing 10 changed files with 1,008 additions and 1,056 deletions.
408 changes: 195 additions & 213 deletions src/bin/agent/agent_parser.cc

Large diffs are not rendered by default.

64 changes: 27 additions & 37 deletions src/bin/agent/agent_parser.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// A Bison parser, made by GNU Bison 3.1.
// A Bison parser, made by GNU Bison 3.0.5.

// Skeleton interface for Bison LALR(1) parsers in C++

Expand Down Expand Up @@ -40,7 +40,7 @@
#ifndef YY_AGENT_AGENT_PARSER_H_INCLUDED
# define YY_AGENT_AGENT_PARSER_H_INCLUDED
// // "%code requires" blocks.
#line 17 "agent_parser.yy" // lalr1.cc:380
#line 17 "agent_parser.yy" // lalr1.cc:379

#include <string>
#include <cc/data.h>
Expand All @@ -51,7 +51,7 @@ using namespace isc::agent;
using namespace isc::data;
using namespace std;

#line 55 "agent_parser.h" // lalr1.cc:380
#line 55 "agent_parser.h" // lalr1.cc:379

# include <cassert>
# include <cstdlib> // std::abort
Expand Down Expand Up @@ -102,7 +102,7 @@ using namespace std;
# define YYUSE(E) /* empty */
#endif

#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
Expand All @@ -121,13 +121,6 @@ using namespace std;
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif

# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULLPTR nullptr
# else
# define YY_NULLPTR 0
# endif
# endif
/* Debug traces. */
#ifndef AGENT_DEBUG
# if defined YYDEBUG
Expand All @@ -141,9 +134,9 @@ using namespace std;
# endif /* ! defined YYDEBUG */
#endif /* ! defined AGENT_DEBUG */

#line 14 "agent_parser.yy" // lalr1.cc:380
#line 14 "agent_parser.yy" // lalr1.cc:379
namespace isc { namespace agent {
#line 147 "agent_parser.h" // lalr1.cc:380
#line 140 "agent_parser.h" // lalr1.cc:379



Expand All @@ -160,8 +153,7 @@ namespace isc { namespace agent {

/// Empty construction.
variant ()
: yybuffer_ ()
, yytypeid_ (YY_NULLPTR)
: yytypeid_ (YY_NULLPTR)
{}

/// Construct and fill.
Expand All @@ -187,7 +179,7 @@ namespace isc { namespace agent {
YYASSERT (!yytypeid_);
YYASSERT (sizeof (T) <= S);
yytypeid_ = & typeid (T);
return *new (yyas_<T> ()) T ();
return *new (yyas_<T> ()) T;
}

/// Instantiate a \a T in here from \a t.
Expand All @@ -206,7 +198,6 @@ namespace isc { namespace agent {
T&
as ()
{
YYASSERT (yytypeid_);
YYASSERT (*yytypeid_ == typeid (T));
YYASSERT (sizeof (T) <= S);
return *yyas_<T> ();
Expand All @@ -217,7 +208,6 @@ namespace isc { namespace agent {
const T&
as () const
{
YYASSERT (yytypeid_);
YYASSERT (*yytypeid_ == typeid (T));
YYASSERT (sizeof (T) <= S);
return *yyas_<T> ();
Expand Down Expand Up @@ -431,15 +421,15 @@ namespace isc { namespace agent {

basic_symbol (typename Base::kind_type t, const location_type& l);

basic_symbol (typename Base::kind_type t, const ElementPtr& v, const location_type& l);
basic_symbol (typename Base::kind_type t, const ElementPtr v, const location_type& l);

basic_symbol (typename Base::kind_type t, const bool& v, const location_type& l);
basic_symbol (typename Base::kind_type t, const bool v, const location_type& l);

basic_symbol (typename Base::kind_type t, const double& v, const location_type& l);
basic_symbol (typename Base::kind_type t, const double v, const location_type& l);

basic_symbol (typename Base::kind_type t, const int64_t& v, const location_type& l);
basic_symbol (typename Base::kind_type t, const int64_t v, const location_type& l);

basic_symbol (typename Base::kind_type t, const std::string& v, const location_type& l);
basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l);


/// Constructor for symbols with semantic value.
Expand Down Expand Up @@ -747,7 +737,7 @@ namespace isc { namespace agent {
// Tables.
// YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
// STATE-NUM.
static const short yypact_[];
static const short int yypact_[];

// YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
// Performed when YYTABLE does not specify something else to do. Zero
Expand All @@ -758,14 +748,14 @@ namespace isc { namespace agent {
static const signed char yypgoto_[];

// YYDEFGOTO[NTERM-NUM].
static const short yydefgoto_[];
static const short int yydefgoto_[];

// YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
// positive, shift that token. If negative, reduce the rule whose
// number is the opposite. If YYTABLE_NINF, syntax error.
static const unsigned char yytable_[];

static const short yycheck_[];
static const short int yycheck_[];

// YYSTOS[STATE-NUM] -- The (internal number of the) accessing
// symbol of state STATE-NUM.
Expand All @@ -786,7 +776,7 @@ namespace isc { namespace agent {
static const char* const yytname_[];
#if AGENT_DEBUG
// YYRLINE[YYN] -- Source line where rule number YYN was defined.
static const unsigned short yyrline_[];
static const unsigned short int yyrline_[];
/// Report on the debug stream that the rule \a r is going to be reduced.
virtual void yy_reduce_print_ (int r);
/// Print the state stack on the debug stream.
Expand Down Expand Up @@ -851,7 +841,7 @@ namespace isc { namespace agent {
typedef basic_symbol<by_state> super_type;
/// Construct an empty symbol.
stack_symbol_type ();
/// Copy construct (for efficiency).
/// 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);
Expand Down Expand Up @@ -961,7 +951,6 @@ namespace isc { namespace agent {
template <typename Base>
AgentParser::basic_symbol<Base>::basic_symbol ()
: value ()
, location ()
{}

template <typename Base>
Expand Down Expand Up @@ -1042,39 +1031,40 @@ namespace isc { namespace agent {
template <typename Base>
AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const location_type& l)
: Base (t)
, value ()
, location (l)
{}

template <typename Base>
AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const ElementPtr& v, const location_type& l)
AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const ElementPtr v, const location_type& l)
: Base (t)
, value (v)
, location (l)
{}

template <typename Base>
AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const bool& v, const location_type& l)
AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const bool v, const location_type& l)
: Base (t)
, value (v)
, location (l)
{}

template <typename Base>
AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const double& v, const location_type& l)
AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const double v, const location_type& l)
: Base (t)
, value (v)
, location (l)
{}

template <typename Base>
AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const int64_t& v, const location_type& l)
AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const int64_t v, const location_type& l)
: Base (t)
, value (v)
, location (l)
{}

template <typename Base>
AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::string& v, const location_type& l)
AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l)
: Base (t)
, value (v)
, location (l)
Expand Down Expand Up @@ -1221,7 +1211,7 @@ namespace isc { namespace agent {
// YYTOKNUM[NUM] -- (External) token number corresponding to the
// (internal) symbol number NUM (which must be that of a token). */
static
const unsigned short
const unsigned short int
yytoken_number_[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
Expand Down Expand Up @@ -1492,9 +1482,9 @@ namespace isc { namespace agent {
}


#line 14 "agent_parser.yy" // lalr1.cc:380
#line 14 "agent_parser.yy" // lalr1.cc:379
} } // isc::agent
#line 1498 "agent_parser.h" // lalr1.cc:380
#line 1488 "agent_parser.h" // lalr1.cc:379



Expand Down
13 changes: 7 additions & 6 deletions src/bin/agent/location.hh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// A Bison parser, made by GNU Bison 3.1.
// Generated 201811071038
// A Bison parser, made by GNU Bison 3.0.5.

// Locations for Bison parsers in C++

Expand Down Expand Up @@ -40,9 +41,9 @@

# include "position.hh"

#line 14 "agent_parser.yy" // location.cc:290
#line 14 "agent_parser.yy" // location.cc:292
namespace isc { namespace agent {
#line 46 "location.hh" // location.cc:290
#line 46 "location.hh" // location.cc:292
/// Abstract a location.
class location
{
Expand Down Expand Up @@ -167,7 +168,7 @@ namespace isc { namespace agent {
** Avoid duplicate information.
*/
template <typename YYChar>
std::basic_ostream<YYChar>&
inline std::basic_ostream<YYChar>&
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
{
unsigned end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
Expand All @@ -183,7 +184,7 @@ namespace isc { namespace agent {
return ostr;
}

#line 14 "agent_parser.yy" // location.cc:290
#line 14 "agent_parser.yy" // location.cc:292
} } // isc::agent
#line 189 "location.hh" // location.cc:290
#line 189 "location.hh" // location.cc:292
#endif // !YY_AGENT_LOCATION_HH_INCLUDED
21 changes: 12 additions & 9 deletions src/bin/agent/position.hh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// A Bison parser, made by GNU Bison 3.1.
// Generated 201811071038
// A Bison parser, made by GNU Bison 3.0.5.

// Positions for Bison parsers in C++

Expand Down Expand Up @@ -50,9 +51,9 @@
# endif
# endif

#line 14 "agent_parser.yy" // location.cc:290
#line 14 "agent_parser.yy" // location.cc:292
namespace isc { namespace agent {
#line 56 "position.hh" // location.cc:290
#line 56 "position.hh" // location.cc:292
/// Abstract a position.
class position
{
Expand Down Expand Up @@ -104,10 +105,12 @@ namespace isc { namespace agent {
unsigned column;

private:
/// Compute max(min, lhs+rhs).
static unsigned add_ (unsigned lhs, int rhs, int min)
/// Compute max(min, lhs+rhs) (provided min <= lhs).
static unsigned add_ (unsigned lhs, int rhs, unsigned min)
{
return static_cast<unsigned>(std::max(min, static_cast<int>(lhs) + rhs));
return (0 < rhs || -static_cast<unsigned>(rhs) < lhs
? rhs + lhs
: min);
}
};

Expand Down Expand Up @@ -163,15 +166,15 @@ namespace isc { namespace agent {
** \param pos a reference to the position to redirect
*/
template <typename YYChar>
std::basic_ostream<YYChar>&
inline std::basic_ostream<YYChar>&
operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
{
if (pos.filename)
ostr << *pos.filename << ':';
return ostr << pos.line << '.' << pos.column;
}

#line 14 "agent_parser.yy" // location.cc:290
#line 14 "agent_parser.yy" // location.cc:292
} } // isc::agent
#line 177 "position.hh" // location.cc:290
#line 179 "position.hh" // location.cc:292
#endif // !YY_AGENT_POSITION_HH_INCLUDED
Loading

0 comments on commit b8d6780

Please sign in to comment.