1 /* A Bison parser, made by GNU Bison 2.4.3. */
3 /* Stack handling for Bison parsers in C++
5 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
6 Software Foundation, Inc.
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
34 #ifndef BISON_STACK_HH
35 # define BISON_STACK_HH
40 namespace objectbuilder
{
42 /* Line 1067 of lalr1.cc */
44 template <class T
, class S
= std::deque
<T
> >
49 // Hide our reversed order.
50 typedef typename
S::reverse_iterator iterator
;
51 typedef typename
S::const_reverse_iterator const_iterator
;
57 stack (unsigned int n
) : seq_ (n
)
63 operator [] (unsigned int i
)
70 operator [] (unsigned int i
) const
84 pop (unsigned int n
= 1)
97 inline const_iterator
begin () const { return seq_
.rbegin (); }
98 inline const_iterator
end () const { return seq_
.rend (); }
105 /// Present a slice of the top of a stack.
106 template <class T
, class S
= stack
<T
> >
111 slice (const S
& stack
,
112 unsigned int range
) : stack_ (stack
),
119 operator [] (unsigned int i
) const
121 return stack_
[range_
- i
];
132 /* Line 1153 of lalr1.cc */
135 #endif // not BISON_STACK_HH[]dnl