mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 13:56:01 +03:00
parser: new bison version
This commit is contained in:
parent
136db3e582
commit
6a0df8ca5c
@ -1,8 +1,8 @@
|
|||||||
// A Bison parser, made by GNU Bison 3.3.2.
|
// A Bison parser, made by GNU Bison 3.5.1.
|
||||||
|
|
||||||
// Locations for Bison parsers in C++
|
// Locations for Bison parsers in C++
|
||||||
|
|
||||||
// Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
|
// Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// 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
|
// it under the terms of the GNU General Public License as published by
|
||||||
@ -38,7 +38,6 @@
|
|||||||
#ifndef YY_YY_LOCATION_HH_INCLUDED
|
#ifndef YY_YY_LOCATION_HH_INCLUDED
|
||||||
# define YY_YY_LOCATION_HH_INCLUDED
|
# define YY_YY_LOCATION_HH_INCLUDED
|
||||||
|
|
||||||
# include <algorithm> // std::max
|
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
# include <string>
|
# include <string>
|
||||||
|
|
||||||
@ -54,17 +53,20 @@
|
|||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|
||||||
namespace yy {
|
namespace yy {
|
||||||
#line 60 "location.hh" // location.cc:339
|
#line 58 "location.hh"
|
||||||
|
|
||||||
/// A point in a source file.
|
/// A point in a source file.
|
||||||
class position
|
class position
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/// Type for line and column numbers.
|
||||||
|
typedef int counter_type;
|
||||||
|
|
||||||
/// Construct a position.
|
/// Construct a position.
|
||||||
explicit position (std::string* f = YY_NULLPTR,
|
explicit position (std::string* f = YY_NULLPTR,
|
||||||
unsigned l = 1u,
|
counter_type l = 1,
|
||||||
unsigned c = 1u)
|
counter_type c = 1)
|
||||||
: filename (f)
|
: filename (f)
|
||||||
, line (l)
|
, line (l)
|
||||||
, column (c)
|
, column (c)
|
||||||
@ -73,8 +75,8 @@ namespace yy {
|
|||||||
|
|
||||||
/// Initialization.
|
/// Initialization.
|
||||||
void initialize (std::string* fn = YY_NULLPTR,
|
void initialize (std::string* fn = YY_NULLPTR,
|
||||||
unsigned l = 1u,
|
counter_type l = 1,
|
||||||
unsigned c = 1u)
|
counter_type c = 1)
|
||||||
{
|
{
|
||||||
filename = fn;
|
filename = fn;
|
||||||
line = l;
|
line = l;
|
||||||
@ -84,17 +86,17 @@ namespace yy {
|
|||||||
/** \name Line and Column related manipulators
|
/** \name Line and Column related manipulators
|
||||||
** \{ */
|
** \{ */
|
||||||
/// (line related) Advance to the COUNT next lines.
|
/// (line related) Advance to the COUNT next lines.
|
||||||
void lines (int count = 1)
|
void lines (counter_type count = 1)
|
||||||
{
|
{
|
||||||
if (count)
|
if (count)
|
||||||
{
|
{
|
||||||
column = 1u;
|
column = 1;
|
||||||
line = add_ (line, count, 1);
|
line = add_ (line, count, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// (column related) Advance to the COUNT next columns.
|
/// (column related) Advance to the COUNT next columns.
|
||||||
void columns (int count = 1)
|
void columns (counter_type count = 1)
|
||||||
{
|
{
|
||||||
column = add_ (column, count, 1);
|
column = add_ (column, count, 1);
|
||||||
}
|
}
|
||||||
@ -103,22 +105,21 @@ namespace yy {
|
|||||||
/// File name to which this position refers.
|
/// File name to which this position refers.
|
||||||
std::string* filename;
|
std::string* filename;
|
||||||
/// Current line number.
|
/// Current line number.
|
||||||
unsigned line;
|
counter_type line;
|
||||||
/// Current column number.
|
/// Current column number.
|
||||||
unsigned column;
|
counter_type column;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Compute max (min, lhs+rhs).
|
/// 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,
|
return lhs + rhs < min ? min : lhs + rhs;
|
||||||
static_cast<int> (lhs) + rhs));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Add \a width columns, in place.
|
/// Add \a width columns, in place.
|
||||||
inline position&
|
inline position&
|
||||||
operator+= (position& res, int width)
|
operator+= (position& res, position::counter_type width)
|
||||||
{
|
{
|
||||||
res.columns (width);
|
res.columns (width);
|
||||||
return res;
|
return res;
|
||||||
@ -126,21 +127,21 @@ namespace yy {
|
|||||||
|
|
||||||
/// Add \a width columns.
|
/// Add \a width columns.
|
||||||
inline position
|
inline position
|
||||||
operator+ (position res, int width)
|
operator+ (position res, position::counter_type width)
|
||||||
{
|
{
|
||||||
return res += width;
|
return res += width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Subtract \a width columns, in place.
|
/// Subtract \a width columns, in place.
|
||||||
inline position&
|
inline position&
|
||||||
operator-= (position& res, int width)
|
operator-= (position& res, position::counter_type width)
|
||||||
{
|
{
|
||||||
return res += -width;
|
return res += -width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Subtract \a width columns.
|
/// Subtract \a width columns.
|
||||||
inline position
|
inline position
|
||||||
operator- (position res, int width)
|
operator- (position res, position::counter_type width)
|
||||||
{
|
{
|
||||||
return res -= width;
|
return res -= width;
|
||||||
}
|
}
|
||||||
@ -180,6 +181,8 @@ namespace yy {
|
|||||||
class location
|
class location
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/// Type for line and column numbers.
|
||||||
|
typedef position::counter_type counter_type;
|
||||||
|
|
||||||
/// Construct a location from \a b to \a e.
|
/// Construct a location from \a b to \a e.
|
||||||
location (const position& b, const position& e)
|
location (const position& b, const position& e)
|
||||||
@ -195,8 +198,8 @@ namespace yy {
|
|||||||
|
|
||||||
/// Construct a 0-width location in \a f, \a l, \a c.
|
/// Construct a 0-width location in \a f, \a l, \a c.
|
||||||
explicit location (std::string* f,
|
explicit location (std::string* f,
|
||||||
unsigned l = 1u,
|
counter_type l = 1,
|
||||||
unsigned c = 1u)
|
counter_type c = 1)
|
||||||
: begin (f, l, c)
|
: begin (f, l, c)
|
||||||
, end (f, l, c)
|
, end (f, l, c)
|
||||||
{}
|
{}
|
||||||
@ -204,8 +207,8 @@ namespace yy {
|
|||||||
|
|
||||||
/// Initialization.
|
/// Initialization.
|
||||||
void initialize (std::string* f = YY_NULLPTR,
|
void initialize (std::string* f = YY_NULLPTR,
|
||||||
unsigned l = 1u,
|
counter_type l = 1,
|
||||||
unsigned c = 1u)
|
counter_type c = 1)
|
||||||
{
|
{
|
||||||
begin.initialize (f, l, c);
|
begin.initialize (f, l, c);
|
||||||
end = begin;
|
end = begin;
|
||||||
@ -221,13 +224,13 @@ namespace yy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Extend the current location to the COUNT next columns.
|
/// Extend the current location to the COUNT next columns.
|
||||||
void columns (int count = 1)
|
void columns (counter_type count = 1)
|
||||||
{
|
{
|
||||||
end += count;
|
end += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extend the current location to the COUNT next lines.
|
/// Extend the current location to the COUNT next lines.
|
||||||
void lines (int count = 1)
|
void lines (counter_type count = 1)
|
||||||
{
|
{
|
||||||
end.lines (count);
|
end.lines (count);
|
||||||
}
|
}
|
||||||
@ -242,39 +245,45 @@ namespace yy {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Join two locations, in place.
|
/// 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;
|
res.end = end.end;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Join two locations.
|
/// Join two locations.
|
||||||
inline location operator+ (location res, const location& end)
|
inline location
|
||||||
|
operator+ (location res, const location& end)
|
||||||
{
|
{
|
||||||
return res += end;
|
return res += end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add \a width columns to the end position, in place.
|
/// 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);
|
res.columns (width);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add \a width columns to the end position.
|
/// 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;
|
return res += width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Subtract \a width columns to the end position, in place.
|
/// 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;
|
return res += -width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Subtract \a width columns to the end position.
|
/// 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;
|
return res -= width;
|
||||||
}
|
}
|
||||||
@ -303,7 +312,8 @@ namespace yy {
|
|||||||
std::basic_ostream<YYChar>&
|
std::basic_ostream<YYChar>&
|
||||||
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
|
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;
|
ostr << loc.begin;
|
||||||
if (loc.end.filename
|
if (loc.end.filename
|
||||||
&& (!loc.begin.filename
|
&& (!loc.begin.filename
|
||||||
@ -316,7 +326,7 @@ namespace yy {
|
|||||||
return ostr;
|
return ostr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // yy
|
} // yy
|
||||||
#line 322 "location.hh" // location.cc:339
|
#line 331 "location.hh"
|
||||||
|
|
||||||
#endif // !YY_YY_LOCATION_HH_INCLUDED
|
#endif // !YY_YY_LOCATION_HH_INCLUDED
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// A Bison parser, made by GNU Bison 3.3.2.
|
// A Bison parser, made by GNU Bison 3.5.1.
|
||||||
|
|
||||||
// Starting with Bison 3.2, this file is useless: the structure it
|
// Starting with Bison 3.2, this file is useless: the structure it
|
||||||
// used to define is now defined in "location.hh".
|
// used to define is now defined in "location.hh".
|
||||||
//
|
//
|
||||||
// To get rid of this file:
|
// 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
|
// 2. remove references to this file from your build system
|
||||||
// 3. if you used to include it, include "location.hh" instead.
|
// 3. if you used to include it, include "location.hh" instead.
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,8 +1,8 @@
|
|||||||
// A Bison parser, made by GNU Bison 3.3.2.
|
// A Bison parser, made by GNU Bison 3.5.1.
|
||||||
|
|
||||||
// Starting with Bison 3.2, this file is useless: the structure it
|
// Starting with Bison 3.2, this file is useless: the structure it
|
||||||
// used to define is now defined with the parser itself.
|
// used to define is now defined with the parser itself.
|
||||||
//
|
//
|
||||||
// To get rid of this file:
|
// 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.
|
// 2. remove references to this file from your build system.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user