Bridge++
Ver. 1.1.x
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
stack.hh
Go to the documentation of this file.
1
/* A Bison parser, made by GNU Bison 2.7. */
2
3
/* Stack handling for Bison parsers in C++
4
5
Copyright (C) 2002-2012 Free Software Foundation, Inc.
6
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 3 of the License, or
10
(at your option) any later version.
11
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.
16
17
You should have received a copy of the GNU General Public License
18
along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20
/* As a special exception, you may create a larger work that contains
21
part or all of the Bison parser skeleton and distribute that work
22
under terms of your choice, so long as that work isn't itself a
23
parser generator using the skeleton or a modified version thereof
24
as a parser skeleton. Alternatively, if you modify or redistribute
25
the parser skeleton itself, you may (at your option) remove this
26
special exception, which will cause the skeleton and the resulting
27
Bison output files to be licensed under the GNU General Public
28
License without this special exception.
29
30
This special exception was added by the Free Software Foundation in
31
version 2.2 of Bison. */
32
38
#ifndef YY_YY_STACK_HH_INCLUDED
39
# define YY_YY_STACK_HH_INCLUDED
40
41
# include <deque>
42
43
/* Line 34 of stack.hh */
44
#line 4 "evalexpr_parser.yy"
45
namespace
yy {
46
/* Line 34 of stack.hh */
47
#line 48 "stack.hh"
48
template
<
class
T,
class
S = std::deque<T> >
49
class
stack
50
{
51
public
:
52
// Hide our reversed order.
53
typedef
typename
S::reverse_iterator
iterator
;
54
typedef
typename
S::const_reverse_iterator
const_iterator
;
55
56
stack
() :
seq_
()
57
{
58
}
59
60
stack
(
unsigned
int
n) :
seq_
(n)
61
{
62
}
63
64
inline
65
T&
66
operator []
(
unsigned
int
i)
67
{
68
return
seq_
[i];
69
}
70
71
inline
72
const
T&
73
operator []
(
unsigned
int
i)
const
74
{
75
return
seq_
[i];
76
}
77
78
inline
79
void
80
push
(
const
T& t)
81
{
82
seq_
.push_front (t);
83
}
84
85
inline
86
void
87
pop
(
unsigned
int
n = 1)
88
{
89
for
(; n; --n)
90
seq_
.pop_front ();
91
}
92
93
inline
94
unsigned
int
95
height
()
const
96
{
97
return
seq_
.size ();
98
}
99
100
inline
const_iterator
begin
()
const
{
return
seq_
.rbegin (); }
101
inline
const_iterator
end
()
const
{
return
seq_
.rend (); }
102
103
private
:
104
S
seq_
;
105
};
106
108
template
<
class
T,
class
S = stack<T> >
109
class
slice
110
{
111
public
:
112
slice
(
const
S&
stack
,
unsigned
int
range)
113
:
stack_
(stack)
114
,
range_
(range)
115
{
116
}
117
118
inline
119
const
T&
120
operator []
(
unsigned
int
i)
const
121
{
122
return
stack_
[
range_
- i];
123
}
124
125
private
:
126
const
S&
stack_
;
127
unsigned
int
range_
;
128
};
129
/* Line 116 of stack.hh */
130
#line 4 "evalexpr_parser.yy"
131
}
// yy
132
/* Line 116 of stack.hh */
133
#line 134 "stack.hh"
134
135
#endif
/* !YY_YY_STACK_HH_INCLUDED */
src
Tools
stack.hh
Generated on Tue Jul 23 2013 10:48:50 for Bridge++ by
1.8.3.1