Commit 1ac65d77 authored by Sebastian Schrader's avatar Sebastian Schrader Committed by Tomek Mrugalski
Browse files

[5184] Generate lexer and parser files

This change is a separate commit to reduce noise.
parent 09987b3f
This diff is collapsed.
// A Bison parser, made by GNU Bison 3.0.4.
// A Bison parser, made by GNU Bison 3.1.
// Skeleton interface for Bison LALR(1) parsers in C++
// 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
......@@ -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:377
#line 17 "agent_parser.yy" // lalr1.cc:380
#include <string>
#include <cc/data.h>
......@@ -51,7 +51,7 @@ using namespace isc::agent;
using namespace isc::data;
using namespace std;
#line 55 "agent_parser.h" // lalr1.cc:377
#line 55 "agent_parser.h" // lalr1.cc:380
# include <cassert>
# include <cstdlib> // std::abort
......@@ -102,7 +102,7 @@ using namespace std;
# define YYUSE(E) /* empty */
#endif
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
......@@ -121,6 +121,13 @@ 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
......@@ -134,9 +141,9 @@ using namespace std;
# endif /* ! defined YYDEBUG */
#endif /* ! defined AGENT_DEBUG */
#line 14 "agent_parser.yy" // lalr1.cc:377
#line 14 "agent_parser.yy" // lalr1.cc:380
namespace isc { namespace agent {
#line 140 "agent_parser.h" // lalr1.cc:377
#line 147 "agent_parser.h" // lalr1.cc:380
......@@ -153,7 +160,8 @@ namespace isc { namespace agent {
/// Empty construction.
variant ()
: yytypeid_ (YY_NULLPTR)
: yybuffer_ ()
, yytypeid_ (YY_NULLPTR)
{}
/// Construct and fill.
......@@ -179,7 +187,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.
......@@ -198,6 +206,7 @@ namespace isc { namespace agent {
T&
as ()
{
YYASSERT (yytypeid_);
YYASSERT (*yytypeid_ == typeid (T));
YYASSERT (sizeof (T) <= S);
return *yyas_<T> ();
......@@ -208,6 +217,7 @@ namespace isc { namespace agent {
const T&
as () const
{
YYASSERT (yytypeid_);
YYASSERT (*yytypeid_ == typeid (T));
YYASSERT (sizeof (T) <= S);
return *yyas_<T> ();
......@@ -421,15 +431,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.
......@@ -737,7 +747,7 @@ namespace isc { namespace agent {
// Tables.
// YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
// STATE-NUM.
static const short int yypact_[];
static const short yypact_[];
// YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
// Performed when YYTABLE does not specify something else to do. Zero
......@@ -748,14 +758,14 @@ namespace isc { namespace agent {
static const signed char yypgoto_[];
// YYDEFGOTO[NTERM-NUM].
static const short int yydefgoto_[];
static const short 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 int yycheck_[];
static const short yycheck_[];
// YYSTOS[STATE-NUM] -- The (internal number of the) accessing
// symbol of state STATE-NUM.
......@@ -776,7 +786,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 int yyrline_[];
static const unsigned short 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.
......@@ -841,6 +851,8 @@ namespace isc { namespace agent {
typedef basic_symbol<by_state> super_type;
/// Construct an empty symbol.
stack_symbol_type ();
/// Copy construct (for efficiency).
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.
......@@ -869,7 +881,7 @@ namespace isc { namespace agent {
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
......@@ -928,12 +940,12 @@ namespace isc { namespace agent {
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44
};
const unsigned int user_token_number_max_ = 299;
const unsigned user_token_number_max_ = 299;
const token_number_type undef_token_ = 2;
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_;
......@@ -947,19 +959,18 @@ namespace isc { namespace agent {
// basic_symbol.
template <typename Base>
inline
AgentParser::basic_symbol<Base>::basic_symbol ()
: value ()
, location ()
{}
template <typename Base>
inline
AgentParser::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
: Base (other)
, value ()
, location (other.location)
{
switch (other.type_get ())
switch (other.type_get ())
{
case 53: // value
case 56: // map_value
......@@ -989,16 +1000,14 @@ namespace isc { namespace agent {
}
template <typename Base>
inline
AgentParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const semantic_type& v, const location_type& l)
: Base (t)
, value ()
, location (l)
{
(void) v;
switch (this->type_get ())
switch (this->type_get ())
{
case 53: // value
case 56: // map_value
......@@ -1033,40 +1042,39 @@ 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)
......@@ -1074,14 +1082,12 @@ namespace isc { namespace agent {
template <typename Base>
inline
AgentParser::basic_symbol<Base>::~basic_symbol ()
{
clear ();
}
template <typename Base>
inline
void
AgentParser::basic_symbol<Base>::clear ()
{
......@@ -1096,7 +1102,7 @@ namespace isc { namespace agent {
}
// Type destructor.
switch (yytype)
switch (yytype)
{
case 53: // value
case 56: // map_value
......@@ -1128,7 +1134,6 @@ namespace isc { namespace agent {
}
template <typename Base>
inline
bool
AgentParser::basic_symbol<Base>::empty () const
{
......@@ -1136,12 +1141,11 @@ namespace isc { namespace agent {
}
template <typename Base>
inline
void
AgentParser::basic_symbol<Base>::move (basic_symbol& s)
{
super_type::move(s);
switch (this->type_get ())
super_type::move (s);
switch (this->type_get ())
{
case 53: // value
case 56: // map_value
......@@ -1217,7 +1221,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 int
const unsigned short
yytoken_number_[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
......@@ -1488,9 +1492,9 @@ namespace isc { namespace agent {
}
#line 14 "agent_parser.yy" // lalr1.cc:377
#line 14 "agent_parser.yy" // lalr1.cc:380
} } // isc::agent
#line 1494 "agent_parser.h" // lalr1.cc:377
#line 1498 "agent_parser.h" // lalr1.cc:380
......
// Generated 201804111444
// A Bison parser, made by GNU Bison 3.0.4.
// A Bison parser, made by GNU Bison 3.1.
// Locations for Bison parsers in C++
// 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
......@@ -41,9 +40,9 @@
# include "position.hh"
#line 14 "agent_parser.yy" // location.cc:296
#line 14 "agent_parser.yy" // location.cc:290
namespace isc { namespace agent {
#line 46 "location.hh" // location.cc:296
#line 46 "location.hh" // location.cc:290
/// Abstract a location.
class location
{
......@@ -53,30 +52,27 @@ namespace isc { namespace agent {
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 (std::string* f,
unsigned int l = 1u,
unsigned int c = 1u)
unsigned l = 1u,
unsigned c = 1u)
: begin (f, l, c)
, end (f, l, c)
{
}
{}
/// Initialization.
void initialize (std::string* f = YY_NULLPTR,
unsigned int l = 1u,
unsigned int c = 1u)
unsigned l = 1u,
unsigned c = 1u)
{
begin.initialize (f, l, c);
end = begin;
......@@ -171,10 +167,10 @@ namespace isc { namespace agent {
** Avoid duplicate information.
*/
template <typename YYChar>
inline std::basic_ostream<YYChar>&
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
......@@ -187,7 +183,7 @@ namespace isc { namespace agent {
return ostr;
}
#line 14 "agent_parser.yy" // location.cc:296
#line 14 "agent_parser.yy" // location.cc:290
} } // isc::agent
#line 192 "location.hh" // location.cc:296
#line 189 "location.hh" // location.cc:290
#endif // !YY_AGENT_LOCATION_HH_INCLUDED
// Generated 201804111444
// A Bison parser, made by GNU Bison 3.0.4.
// A Bison parser, made by GNU Bison 3.1.
// Positions for Bison parsers in C++
// 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
......@@ -51,28 +50,27 @@
# endif
# endif
#line 14 "agent_parser.yy" // location.cc:296
#line 14 "agent_parser.yy" // location.cc:290
namespace isc { namespace agent {
#line 56 "position.hh" // location.cc:296
#line 56 "position.hh" // location.cc:290
/// Abstract a position.
class position
{
public:
/// Construct a position.
explicit position (std::string* f = YY_NULLPTR,
unsigned int l = 1u,
unsigned int c = 1u)
unsigned l = 1u,
unsigned c = 1u)
: filename (f)
, line (l)
, column (c)
{
}
{}
/// Initialization.
void initialize (std::string* fn = YY_NULLPTR,
unsigned int l = 1u,
unsigned int c = 1u)
unsigned l = 1u,
unsigned c = 1u)
{
filename = fn;
line = l;
......@@ -101,17 +99,15 @@ namespace isc { namespace agent {
/// File name to which this position refers.
std::string* 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)
/// Compute max(min, lhs+rhs).
static unsigned add_ (unsigned lhs, int rhs, int min)
{
return (0 < rhs || -static_cast<unsigned int>(rhs) < lhs
? rhs + lhs
: min);
return static_cast<unsigned>(std::max(min, static_cast<int>(lhs) + rhs));
}
};
......@@ -167,7 +163,7 @@ namespace isc { namespace agent {
** \param pos a reference to the position to redirect
*/
template <typename YYChar>
inline std::basic_ostream<YYChar>&
std::basic_ostream<YYChar>&
operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
{
if (pos.filename)
......@@ -175,7 +171,7 @@ namespace isc { namespace agent {
return ostr << pos.line << '.' << pos.column;
}
#line 14 "agent_parser.yy" // location.cc:296
#line 14 "agent_parser.yy" // location.cc:290
} } // isc::agent
#line 180 "position.hh" // location.cc:296
#line 177 "position.hh" // location.cc:290
#endif // !YY_AGENT_POSITION_HH_INCLUDED
// Generated 201804111444
// A Bison parser, made by GNU Bison 3.0.4.
// A Bison parser, made by GNU Bison 3.1.
// Stack handling for Bison parsers in C++
// 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
......@@ -44,6 +43,7 @@
#line 14 "agent_parser.yy" // stack.hh:132
namespace isc { namespace agent {
#line 46 "stack.hh" // stack.hh:132
/// A stack with random access from its top.
template <class T, class S = std::vector<T> >
class stack
{
......@@ -51,27 +51,31 @@ namespace isc { namespace agent {
// Hide our reversed order.
typedef typename S::reverse_iterator iterator;
typedef typename S::const_reverse_iterator const_iterator;
typedef typename S::size_type size_type;
stack ()
: seq_ ()
{
seq_.reserve (200);
}
stack (unsigned int n)
stack (size_type n)
: seq_ (n)
{}
inline
/// Random access.
///
/// Index 0 returns the topmost element.
T&
operator[] (unsigned int i)
operator[] (size_type i)
{
return seq_[seq_.size () - 1 - i];
}
inline
/// Random access.
///
/// Index 0 returns the topmost element.
const T&
operator[] (unsigned int i) const
operator[] (size_type i) const
{
return seq_[seq_.size () - 1 - i];
}
......@@ -79,7 +83,6 @@ namespace isc { namespace agent {
/// Steal the contents of \a t.
///
/// Close to move-semantics.
inline
void
push (T& t)
{
......@@ -87,9 +90,8 @@ namespace isc { namespace agent {
operator[](0).move (t);
}
inline
void
pop (unsigned int n = 1)
pop (size_type n = 1)
{
for (; n; --n)
seq_.pop_back ();
......@@ -101,21 +103,18 @@ namespace isc { namespace agent {
seq_.clear ();
}
inline
typename S::size_type
size_type
size () const
{
return seq_.size ();
}
inline
const_iterator
begin () const
{
return seq_.rbegin ();
}
inline
const_iterator
end () const
{
......@@ -134,21 +133,21 @@ namespace isc { namespace agent {
class slice
{
public:
slice (const S& stack, unsigned int range)
typedef typename S::size_type size_type;
slice (const S& stack, size_type range)
: stack_ (stack)
, range_ (range)
{}
inline
const T&
operator [] (unsigned int i) const
operator[] (size_type i) const
{
return stack_[range_ - i];
}
private:
const S& stack_;
unsigned int range_;
size_type range_;
};
#line 14 "agent_parser.yy" // stack.hh:132
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.