Skip to content

Commit

Permalink
update generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
rkaminsk committed Jul 10, 2024
1 parent cb61fb2 commit 8522235
Show file tree
Hide file tree
Showing 10 changed files with 10,023 additions and 9,436 deletions.
740 changes: 406 additions & 334 deletions libgringo/gen/src/input/groundtermgrammar/grammar.cc

Large diffs are not rendered by default.

502 changes: 316 additions & 186 deletions libgringo/gen/src/input/groundtermgrammar/grammar.hh

Large diffs are not rendered by default.

140 changes: 62 additions & 78 deletions libgringo/gen/src/input/groundtermgrammar/location.hh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// A Bison parser, made by GNU Bison 3.3.2.
// A Bison parser, made by GNU Bison 3.8.2.

// Locations for Bison parsers in C++

// Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
// Copyright (C) 2002-2015, 2018-2021 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
Expand All @@ -15,7 +15,7 @@
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// along with this program. If not, see <https://www.gnu.org/licenses/>.

// As a special exception, you may create a larger work that contains
// part or all of the Bison parser skeleton and distribute that work
Expand All @@ -31,14 +31,13 @@
// version 2.2 of Bison.

/**
** \file /mnt/scratch/kaminski/build/clingo/debug/libgringo/src/input/groundtermgrammar/location.hh
** \file /home/kaminski/Documents/git/potassco/clingo/build/debug/libgringo/src/input/groundtermgrammar/location.hh
** Define the Gringo::Input::GroundTermGrammar::location class.
*/

#ifndef YY_GRINGOGROUNDTERMGRAMMAR_MNT_SCRATCH_KAMINSKI_BUILD_CLINGO_DEBUG_LIBGRINGO_SRC_INPUT_GROUNDTERMGRAMMAR_LOCATION_HH_INCLUDED
# define YY_GRINGOGROUNDTERMGRAMMAR_MNT_SCRATCH_KAMINSKI_BUILD_CLINGO_DEBUG_LIBGRINGO_SRC_INPUT_GROUNDTERMGRAMMAR_LOCATION_HH_INCLUDED
#ifndef YY_GRINGOGROUNDTERMGRAMMAR_HOME_KAMINSKI_DOCUMENTS_GIT_POTASSCO_CLINGO_BUILD_DEBUG_LIBGRINGO_SRC_INPUT_GROUNDTERMGRAMMAR_LOCATION_HH_INCLUDED
# define YY_GRINGOGROUNDTERMGRAMMAR_HOME_KAMINSKI_DOCUMENTS_GIT_POTASSCO_CLINGO_BUILD_DEBUG_LIBGRINGO_SRC_INPUT_GROUNDTERMGRAMMAR_LOCATION_HH_INCLUDED

# include <algorithm> // std::max
# include <iostream>
# include <string>

Expand All @@ -54,27 +53,33 @@
# endif
# endif

#line 26 "/home/kaminski/Documents/git/potassco/clingo/libgringo/src/input/groundtermgrammar.yy" // location.cc:339
#line 26 "/home/kaminski/Documents/git/potassco/clingo/libgringo/src/input/groundtermgrammar.yy"
namespace Gringo { namespace Input { namespace GroundTermGrammar {
#line 60 "/mnt/scratch/kaminski/build/clingo/debug/libgringo/src/input/groundtermgrammar/location.hh" // location.cc:339
#line 59 "/home/kaminski/Documents/git/potassco/clingo/build/debug/libgringo/src/input/groundtermgrammar/location.hh"

/// A point in a source file.
class position
{
public:
/// Type for file name.
typedef const std::string filename_type;
/// Type for line and column numbers.
typedef int counter_type;

/// Construct a position.
explicit position (std::string* f = YY_NULLPTR,
unsigned l = 1u,
unsigned c = 1u)
explicit position (filename_type* f = YY_NULLPTR,
counter_type l = 1,
counter_type c = 1)
: filename (f)
, line (l)
, column (c)
{}


/// Initialization.
void initialize (std::string* fn = YY_NULLPTR,
unsigned l = 1u,
unsigned c = 1u)
void initialize (filename_type* fn = YY_NULLPTR,
counter_type l = 1,
counter_type c = 1)
{
filename = fn;
line = l;
Expand All @@ -84,85 +89,66 @@ namespace Gringo { namespace Input { namespace GroundTermGrammar {
/** \name Line and Column related manipulators
** \{ */
/// (line related) Advance to the COUNT next lines.
void lines (int count = 1)
void lines (counter_type count = 1)
{
if (count)
{
column = 1u;
column = 1;
line = add_ (line, count, 1);
}
}

/// (column related) Advance to the COUNT next columns.
void columns (int count = 1)
void columns (counter_type count = 1)
{
column = add_ (column, count, 1);
}
/** \} */

/// File name to which this position refers.
std::string* filename;
filename_type* filename;
/// Current line number.
unsigned line;
counter_type line;
/// Current column number.
unsigned column;
counter_type column;

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

/// Add \a width columns, in place.
inline position&
operator+= (position& res, int width)
operator+= (position& res, position::counter_type width)
{
res.columns (width);
return res;
}

/// Add \a width columns.
inline position
operator+ (position res, int width)
operator+ (position res, position::counter_type width)
{
return res += width;
}

/// Subtract \a width columns, in place.
inline position&
operator-= (position& res, int width)
operator-= (position& res, position::counter_type width)
{
return res += -width;
}

/// Subtract \a width columns.
inline position
operator- (position res, int width)
operator- (position res, position::counter_type width)
{
return res -= width;
}

/// Compare two position objects.
inline bool
operator== (const position& pos1, const position& pos2)
{
return (pos1.line == pos2.line
&& pos1.column == pos2.column
&& (pos1.filename == pos2.filename
|| (pos1.filename && pos2.filename
&& *pos1.filename == *pos2.filename)));
}

/// Compare two position objects.
inline bool
operator!= (const position& pos1, const position& pos2)
{
return !(pos1 == pos2);
}

/** \brief Intercept output stream redirection.
** \param ostr the destination output stream
** \param pos a reference to the position to redirect
Expand All @@ -180,6 +166,10 @@ namespace Gringo { namespace Input { namespace GroundTermGrammar {
class location
{
public:
/// Type for file name.
typedef position::filename_type filename_type;
/// Type for line and column numbers.
typedef position::counter_type counter_type;

/// Construct a location from \a b to \a e.
location (const position& b, const position& e)
Expand All @@ -194,18 +184,18 @@ namespace Gringo { namespace Input { namespace GroundTermGrammar {
{}

/// Construct a 0-width location in \a f, \a l, \a c.
explicit location (std::string* f,
unsigned l = 1u,
unsigned c = 1u)
explicit location (filename_type* f,
counter_type l = 1,
counter_type c = 1)
: begin (f, l, c)
, end (f, l, c)
{}


/// Initialization.
void initialize (std::string* f = YY_NULLPTR,
unsigned l = 1u,
unsigned c = 1u)
void initialize (filename_type* f = YY_NULLPTR,
counter_type l = 1,
counter_type c = 1)
{
begin.initialize (f, l, c);
end = begin;
Expand All @@ -221,13 +211,13 @@ namespace Gringo { namespace Input { namespace GroundTermGrammar {
}

/// Extend the current location to the COUNT next columns.
void columns (int count = 1)
void columns (counter_type count = 1)
{
end += count;
}

/// Extend the current location to the COUNT next lines.
void lines (int count = 1)
void lines (counter_type count = 1)
{
end.lines (count);
}
Expand All @@ -242,57 +232,49 @@ namespace Gringo { namespace Input { namespace GroundTermGrammar {
};

/// Join two locations, in place.
inline location& operator+= (location& res, const location& end)
inline location&
operator+= (location& res, const location& end)
{
res.end = end.end;
return res;
}

/// Join two locations.
inline location operator+ (location res, const location& end)
inline location
operator+ (location res, const location& end)
{
return res += end;
}

/// Add \a width columns to the end position, in place.
inline location& operator+= (location& res, int width)
inline location&
operator+= (location& res, location::counter_type width)
{
res.columns (width);
return res;
}

/// Add \a width columns to the end position.
inline location operator+ (location res, int width)
inline location
operator+ (location res, location::counter_type width)
{
return res += width;
}

/// Subtract \a width columns to the end position, in place.
inline location& operator-= (location& res, int width)
inline location&
operator-= (location& res, location::counter_type width)
{
return res += -width;
}

/// Subtract \a width columns to the end position.
inline location operator- (location res, int width)
inline location
operator- (location res, location::counter_type width)
{
return res -= width;
}

/// Compare two location objects.
inline bool
operator== (const location& loc1, const location& loc2)
{
return loc1.begin == loc2.begin && loc1.end == loc2.end;
}

/// Compare two location objects.
inline bool
operator!= (const location& loc1, const location& loc2)
{
return !(loc1 == loc2);
}

/** \brief Intercept output stream redirection.
** \param ostr the destination output stream
** \param loc a reference to the location to redirect
Expand All @@ -303,7 +285,8 @@ namespace Gringo { namespace Input { namespace GroundTermGrammar {
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;
location::counter_type end_col
= 0 < loc.end.column ? loc.end.column - 1 : 0;
ostr << loc.begin;
if (loc.end.filename
&& (!loc.begin.filename
Expand All @@ -316,7 +299,8 @@ namespace Gringo { namespace Input { namespace GroundTermGrammar {
return ostr;
}

#line 26 "/home/kaminski/Documents/git/potassco/clingo/libgringo/src/input/groundtermgrammar.yy" // location.cc:339
#line 26 "/home/kaminski/Documents/git/potassco/clingo/libgringo/src/input/groundtermgrammar.yy"
} } } // Gringo::Input::GroundTermGrammar
#line 322 "/mnt/scratch/kaminski/build/clingo/debug/libgringo/src/input/groundtermgrammar/location.hh" // location.cc:339
#endif // !YY_GRINGOGROUNDTERMGRAMMAR_MNT_SCRATCH_KAMINSKI_BUILD_CLINGO_DEBUG_LIBGRINGO_SRC_INPUT_GROUNDTERMGRAMMAR_LOCATION_HH_INCLUDED
#line 305 "/home/kaminski/Documents/git/potassco/clingo/build/debug/libgringo/src/input/groundtermgrammar/location.hh"

#endif // !YY_GRINGOGROUNDTERMGRAMMAR_HOME_KAMINSKI_DOCUMENTS_GIT_POTASSCO_CLINGO_BUILD_DEBUG_LIBGRINGO_SRC_INPUT_GROUNDTERMGRAMMAR_LOCATION_HH_INCLUDED
4 changes: 2 additions & 2 deletions libgringo/gen/src/input/groundtermgrammar/position.hh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// A Bison parser, made by GNU Bison 3.3.2.
// A Bison parser, made by GNU Bison 3.8.2.

// Starting with Bison 3.2, this file is useless: the structure it
// used to define is now defined in "location.hh".
//
// To get rid of this file:
// 1. add 'require "3.2"' (or newer) to your grammar file
// 1. add '%require "3.2"' (or newer) to your grammar file
// 2. remove references to this file from your build system
// 3. if you used to include it, include "location.hh" instead.

Expand Down
4 changes: 2 additions & 2 deletions libgringo/gen/src/input/groundtermgrammar/stack.hh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// A Bison parser, made by GNU Bison 3.3.2.
// A Bison parser, made by GNU Bison 3.8.2.

// Starting with Bison 3.2, this file is useless: the structure it
// used to define is now defined with the parser itself.
//
// To get rid of this file:
// 1. add 'require "3.2"' (or newer) to your grammar file
// 1. add '%require "3.2"' (or newer) to your grammar file
// 2. remove references to this file from your build system.
Loading

0 comments on commit 8522235

Please sign in to comment.