ct_common
1.0.1
Common library for combinatorial testing
|
00001 /* A Bison parser, made by GNU Bison 2.5. */ 00002 00003 /* Stack handling for Bison parsers in C++ 00004 00005 Copyright (C) 2002-2011 Free Software Foundation, Inc. 00006 00007 This program is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00019 00020 /* As a special exception, you may create a larger work that contains 00021 part or all of the Bison parser skeleton and distribute that work 00022 under terms of your choice, so long as that work isn't itself a 00023 parser generator using the skeleton or a modified version thereof 00024 as a parser skeleton. Alternatively, if you modify or redistribute 00025 the parser skeleton itself, you may (at your option) remove this 00026 special exception, which will cause the skeleton and the resulting 00027 Bison output files to be licensed under the GNU General Public 00028 License without this special exception. 00029 00030 This special exception was added by the Free Software Foundation in 00031 version 2.2 of Bison. */ 00032 00033 #ifndef BISON_STACK_HH 00034 # define BISON_STACK_HH 00035 00036 #include <deque> 00037 00038 00039 namespace yy { 00040 00041 /* Line 1149 of lalr1.cc */ 00042 #line 43 "stack.hh" 00043 template <class T, class S = std::deque<T> > 00044 class stack 00045 { 00046 public: 00047 00048 // Hide our reversed order. 00049 typedef typename S::reverse_iterator iterator; 00050 typedef typename S::const_reverse_iterator const_iterator; 00051 00052 stack () : seq_ () 00053 { 00054 } 00055 00056 stack (unsigned int n) : seq_ (n) 00057 { 00058 } 00059 00060 inline 00061 T& 00062 operator [] (unsigned int i) 00063 { 00064 return seq_[i]; 00065 } 00066 00067 inline 00068 const T& 00069 operator [] (unsigned int i) const 00070 { 00071 return seq_[i]; 00072 } 00073 00074 inline 00075 void 00076 push (const T& t) 00077 { 00078 seq_.push_front (t); 00079 } 00080 00081 inline 00082 void 00083 pop (unsigned int n = 1) 00084 { 00085 for (; n; --n) 00086 seq_.pop_front (); 00087 } 00088 00089 inline 00090 unsigned int 00091 height () const 00092 { 00093 return seq_.size (); 00094 } 00095 00096 inline const_iterator begin () const { return seq_.rbegin (); } 00097 inline const_iterator end () const { return seq_.rend (); } 00098 00099 private: 00100 00101 S seq_; 00102 }; 00103 00105 template <class T, class S = stack<T> > 00106 class slice 00107 { 00108 public: 00109 00110 slice (const S& stack, 00111 unsigned int range) : stack_ (stack), 00112 range_ (range) 00113 { 00114 } 00115 00116 inline 00117 const T& 00118 operator [] (unsigned int i) const 00119 { 00120 return stack_[range_ - i]; 00121 } 00122 00123 private: 00124 00125 const S& stack_; 00126 unsigned int range_; 00127 }; 00128 00129 } // yy 00130 00131 /* Line 1235 of lalr1.cc */ 00132 #line 133 "stack.hh" 00133 00134 #endif // not BISON_STACK_HH[]dnl 00135