1
/* A Bison parser, made by GNU Bison 2.3. */
3
/* Stack handling for Bison parsers in C++
5
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2, or (at your option)
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
Boston, MA 02110-1301, USA. */
22
/* As a special exception, you may create a larger work that contains
23
part or all of the Bison parser skeleton and distribute that work
24
under terms of your choice, so long as that work isn't itself a
25
parser generator using the skeleton or a modified version thereof
26
as a parser skeleton. Alternatively, if you modify or redistribute
27
the parser skeleton itself, you may (at your option) remove this
28
special exception, which will cause the skeleton and the resulting
29
Bison output files to be licensed under the GNU General Public
30
License without this special exception.
32
This special exception was added by the Free Software Foundation in
33
version 2.2 of Bison. */
35
#ifndef BISON_STACK_HH
36
# define BISON_STACK_HH
42
template <class T, class S = std::deque<T> >
47
// Hide our reversed order.
48
typedef typename S::reverse_iterator iterator;
49
typedef typename S::const_reverse_iterator const_iterator;
55
stack (unsigned int n) : seq_ (n)
61
operator [] (unsigned int i)
68
operator [] (unsigned int i) const
82
pop (unsigned int n = 1)
95
inline const_iterator begin () const { return seq_.rbegin (); }
96
inline const_iterator end () const { return seq_.rend (); }
103
/// Present a slice of the top of a stack.
104
template <class T, class S = stack<T> >
109
slice (const S& stack,
110
unsigned int range) : stack_ (stack),
117
operator [] (unsigned int i) const
119
return stack_[range_ - i];
129
#endif // not BISON_STACK_HH