mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
@@ -1,8 +1,8 @@
|
||||
// A Bison parser, made by GNU Bison 3.0.4.
|
||||
// A Bison parser, made by GNU Bison 3.0.5.
|
||||
|
||||
// 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
|
||||
@@ -42,7 +42,8 @@
|
||||
|
||||
|
||||
namespace yy {
|
||||
#line 46 "stack.hh" // stack.hh:132
|
||||
#line 46 "stack.hh" // stack.hh:131
|
||||
/// A stack with random access from its top.
|
||||
template <class T, class S = std::vector<T> >
|
||||
class stack
|
||||
{
|
||||
@@ -57,20 +58,24 @@ namespace yy {
|
||||
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];
|
||||
}
|
||||
@@ -78,7 +83,6 @@ namespace yy {
|
||||
/// Steal the contents of \a t.
|
||||
///
|
||||
/// Close to move-semantics.
|
||||
inline
|
||||
void
|
||||
push (T& t)
|
||||
{
|
||||
@@ -86,9 +90,8 @@ namespace yy {
|
||||
operator[](0).move (t);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
pop (unsigned int n = 1)
|
||||
pop (unsigned n = 1)
|
||||
{
|
||||
for (; n; --n)
|
||||
seq_.pop_back ();
|
||||
@@ -100,21 +103,18 @@ namespace yy {
|
||||
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
|
||||
{
|
||||
@@ -133,25 +133,24 @@ namespace yy {
|
||||
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_;
|
||||
};
|
||||
|
||||
|
||||
} // yy
|
||||
#line 156 "stack.hh" // stack.hh:132
|
||||
#line 155 "stack.hh" // stack.hh:131
|
||||
|
||||
#endif // !YY_YY_STACK_HH_INCLUDED
|
||||
|
Reference in New Issue
Block a user