00001 00002 /* 00003 | Author: Michael Schmidt; 00004 | Gunnar Jehl 00005 | 00006 | ************************* SOFTWARE LICENSE AGREEMENT *********************** 00007 | This source code is published under the BSD License. 00008 | 00009 | See file 'LICENSE.txt' that comes with this distribution or 00010 | http://dbis.informatik.uni-freiburg.de/index.php?project=GCX/license.php 00011 | for the full license agreement. 00012 | 00013 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00014 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00015 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00016 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00017 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00018 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00019 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00020 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00021 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00022 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00023 | POSSIBILITY OF SUCH DAMAGE. 00024 | **************************************************************************** 00025 */ 00026 00035 #ifndef PROJECTIONDFATRANSITIONS_H 00036 #define PROJECTIONDFATRANSITIONS_H 00037 00038 #include "tagmap.h" 00039 #include "tokenconfiguration.h" 00040 00041 #ifdef __GNUC__ 00042 #include <ext/hash_map> 00043 #else 00044 #include <hash_map> 00045 #endif 00046 00052 #define TRANSITION_UNKNOWN 0 00053 00059 #define TRANSITION_REGULAR 1 00060 00066 #define TRANSITION_SKIP_SUBTREE 2 00067 00074 #define TRANSITION_KEEP_SUBTREE 3 00075 00076 using __gnu_cxx::hash_map; 00077 00078 // forward declarations 00079 class ProjectionDFAState; 00080 00092 class ProjectionDFATransitions { 00093 00094 public: 00100 ProjectionDFATransitions(ProjectionDFAState * _parent); 00101 00105 virtual ~ ProjectionDFATransitions(); 00106 00115 void print(OutputStream & dos, unsigned indents); 00116 00133 ProjectionDFAState *takeTransition(TAG t, short &t_type); 00134 00142 ProjectionDFAState *takeTextTransition(bool is_root); 00143 00151 void computeTransition(ProjectionDFAState * parent, TAG t); 00152 00153 private: 00161 virtual void computeTextTransition(bool is_root); 00162 00168 ProjectionDFAState *parent; 00169 00175 hash_map < TAG, 00176 ProjectionDFAState * >transitions; 00177 00182 bool text_transition_computed; 00183 00188 ProjectionDFAState *text_transition; 00189 }; 00190 00191 #endif // PROJECTIONDFATRANSITIONS_H