Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: bison/src/bison/2.4.1/bison-2.4.1-src/examples/calc++/stack.hh

Issue 10807020: Add native Windows binary for bison. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1
2 /* A Bison parser, made by GNU Bison 2.4.1. */
3
4 /* Stack handling for Bison parsers in C++
5
6 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
7 Foundation, Inc.
8
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
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.
31
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
34
35 #ifndef BISON_STACK_HH
36 # define BISON_STACK_HH
37
38 #include <deque>
39
40
41 /* Line 1067 of lalr1.cc */
42 #line 1 "[Bison:b4_percent_define_default]"
43
44 namespace yy {
45
46 /* Line 1067 of lalr1.cc */
47 #line 48 "./stack.hh"
48 template <class T, class S = std::deque<T> >
49 class stack
50 {
51 public:
52
53 // Hide our reversed order.
54 typedef typename S::reverse_iterator iterator;
55 typedef typename S::const_reverse_iterator const_iterator;
56
57 stack () : seq_ ()
58 {
59 }
60
61 stack (unsigned int n) : seq_ (n)
62 {
63 }
64
65 inline
66 T&
67 operator [] (unsigned int i)
68 {
69 return seq_[i];
70 }
71
72 inline
73 const T&
74 operator [] (unsigned int i) const
75 {
76 return seq_[i];
77 }
78
79 inline
80 void
81 push (const T& t)
82 {
83 seq_.push_front (t);
84 }
85
86 inline
87 void
88 pop (unsigned int n = 1)
89 {
90 for (; n; --n)
91 seq_.pop_front ();
92 }
93
94 inline
95 unsigned int
96 height () const
97 {
98 return seq_.size ();
99 }
100
101 inline const_iterator begin () const { return seq_.rbegin (); }
102 inline const_iterator end () const { return seq_.rend (); }
103
104 private:
105
106 S seq_;
107 };
108
109 /// Present a slice of the top of a stack.
110 template <class T, class S = stack<T> >
111 class slice
112 {
113 public:
114
115 slice (const S& stack,
116 unsigned int range) : stack_ (stack),
117 range_ (range)
118 {
119 }
120
121 inline
122 const T&
123 operator [] (unsigned int i) const
124 {
125 return stack_[range_ - i];
126 }
127
128 private:
129
130 const S& stack_;
131 unsigned int range_;
132 };
133
134 /* Line 1153 of lalr1.cc */
135 #line 1 "[Bison:b4_percent_define_default]"
136
137 } // yy
138
139 /* Line 1153 of lalr1.cc */
140 #line 141 "./stack.hh"
141
142 #endif // not BISON_STACK_HH[]dnl
143
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698