• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** \file
2  * Declarations for all the antlr3 C runtime interfaces/classes. This
3  * allows the structures that define the interfaces to contain pointers to
4  * each other without trying to sort out the cyclic interdependencies that
5  * would otherwise result.
6  */
7 #ifndef	_ANTLR3_INTERFACES_HPP
8 #define	_ANTLR3_INTERFACES_HPP
9 
10 // [The "BSD licence"]
11 // Copyright (c) 2005-2009 Gokulakannan Somasundaram, ElectronDB
12 //
13 // All rights reserved.
14 //
15 // Redistribution and use in source and binary forms, with or without
16 // modification, are permitted provided that the following conditions
17 // are met:
18 // 1. Redistributions of source code must retain the above copyright
19 //    notice, this list of conditions and the following disclaimer.
20 // 2. Redistributions in binary form must reproduce the above copyright
21 //    notice, this list of conditions and the following disclaimer in the
22 //    documentation and/or other materials provided with the distribution.
23 // 3. The name of the author may not be used to endorse or promote products
24 //    derived from this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29 // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
30 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
31 // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 
37 ANTLR_BEGIN_NAMESPACE()
38 
39 template<class ImplTraits, class SuperType>
40 class IntStream;
41 
42 /// Pointer to an instantiation of 'class' #ANTLR3_RECOGNIZER_SHARED_STATE
43 /// \ingroup ANTLR3_RECOGNIZER_SHARED_STATE
44 ///
45 template<class ImplTraits, class SuperType>
46 class RecognizerSharedState;
47 
48 /// Pointer to an instantiation of 'class' #ANTLR3_BITSET_LIST
49 /// \ingroup ANTLR3_BITSET_LIST
50 ///
51 template<class AllocatorType>
52 class BitsetList;
53 
54 /// Pointer to an instantiation of 'class' #ANTLR3_BITSET
55 /// \ingroup ANTLR3_BITSET
56 ///
57 template<class AllocatorType>
58 class Bitset;
59 
60 /// Pointer to an instantiation of 'class' #ANTLR3_COMMON_TOKEN
61 /// \ingroup ANTLR3_COMMON_TOKEN
62 ///
63 template<class ImplTraits>
64 class CommonToken;
65 
66 template<class ImplTraits>
67 class CommonTokenFunctions;
68 
69 /// Pointer to an instantiation of 'class' #ANTLR3_EXCEPTION
70 /// \ingroup ANTLR3_EXCEPTION
71 ///
72 enum ExceptionType
73 {
74 	/** Indicates that the recognizer received a token
75 	 *  in the input that was not predicted.
76 	 */
77 	RECOGNITION_EXCEPTION = 0
78 	/** Indicates that the recognizer was expecting one token and found a
79 	 *  a different one.
80 	 */
81 	, MISMATCHED_TOKEN_EXCEPTION
82 
83 	/** Recognizer could not find a valid alternative from the input
84 	 */
85 	, NO_VIABLE_ALT_EXCEPTION
86 
87 	/* Character in a set was not found
88 	 */
89 	, MISMATCHED_SET_EXCEPTION
90 
91 	/* A rule predicting at least n elements found less than that,
92 	 * such as: WS: " "+;
93 	 */
94 	, EARLY_EXIT_EXCEPTION
95 
96 	, FAILED_PREDICATE_EXCEPTION
97 
98 	, MISMATCHED_TREE_NODE_EXCEPTION
99 
100 	, REWRITE_EARLY_EXCEPTION
101 
102 	, UNWANTED_TOKEN_EXCEPTION
103 
104 	, MISSING_TOKEN_EXCEPTION
105 };
106 
107 template<class ImplTraits, ExceptionType Ex, class StreamType>
108 class ANTLR_Exception;
109 
110 /// Pointer to an instantiation of 'class' #ANTLR3_TOPO
111 /// \ingroup ANTLR3_TOPO
112 ///
113 template<class AllocPolicyType>
114 class Topo;
115 
116 /// Pointer to an instantiation of 'class' #ANTLR3_INPUT_STREAM
117 /// \ingroup ANTLR3_INPUT_STREAM
118 ///
119 template<class ImplTraits>
120 class InputStream;
121 
122 /// Pointer to an instantiation of 'class' #ANTLR3_LEX_STATE
123 /// \ingroup ANTLR3_LEX_STATE
124 ///
125 template<class ImplTraits>
126 class LexState;
127 
128 /// Pointer to an instantiation of 'class' #ANTLR3_TOKEN_SOURCE
129 /// \ingroup ANTLR3_TOKEN_SOURCE
130 ///
131 template<class ImplTraits>
132 class TokenSource;
133 template<class ImplTraits, class SuperType>
134 class TokenSourceFunctions;
135 
136 /// Pointer to an instantiation of 'class' #ANTLR3_TOKEN_STREAM
137 /// \ingroup ANTLR3_TOKEN_STREAM
138 ///
139 template<class ImplTraits>
140 class TokenStream;
141 template<class ImplTraits>
142 class TokenStreamFunctions;
143 
144 /// Pointer to an instantiation of 'class' #ANTLR3_COMMON_TOKEN_STREAM
145 /// \ingroup ANTLR3_COMMON_TOKEN_STREAM
146 ///
147 template<class ImplTraits>
148 class CommonTokenStream;
149 template<class ImplTraits>
150 class CommonTokenStreamFunctions;
151 
152 
153 /// Pointer to an instantiation of 'class' #ANTLR3_CYCLIC_DFA
154 /// \ingroup ANTLR3_CYCLIC_DFA
155 ///
156 template<class ImplTraits, class ComponentType>
157 class CyclicDFA;
158 
159 /// Pointer to an instantiation of 'class' #ANTLR3_LEXER
160 /// \ingroup ANTLR3_LEXER
161 ///
162 template<class ImplTraits>
163 class Lexer;
164 
165 /// Pointer to an instantiation of 'class' #ANTLR3_PARSER
166 /// \ingroup ANTLR3_PARSER
167 ///
168 template<class ImplTraits>
169 class Parser;
170 
171 /// Pointer to an instantiation of 'class' #ANTLR3_BASE_TREE
172 /// \ingroup ANTLR3_BASE_TREE
173 ///
174 template<class ImplTraits>
175 class BaseTree;
176 template<class ImplTraits>
177 class BaseTreeFunctions;
178 
179 
180 /// Pointer to an instantiation of 'class' #ANTLR3_COMMON_TREE
181 /// \ingroup ANTLR3_COMMON_TREE
182 ///
183 template<class ImplTraits>
184 class CommonTree;
185 template<class ImplTraits>
186 class CommonTreeFunctions;
187 
188 /// Pointer to an instantiation of 'class' #ANTLR3_PARSE_TREE
189 /// \ingroup ANTLR3_PARSE_TREE
190 ///
191 template<class ImplTraits>
192 class ParseTree;
193 
194 /// Pointer to an instantiation of 'class' #ANTLR3_TREE_NODE_STREAM
195 /// \ingroup ANTLR3_TREE_NODE_STREAM
196 ///
197 template<class ImplTraits>
198 class TreeNodeStream;
199 
200 /// Pointer to an instantiation of 'class' #ANTLR3_COMMON_TREE_NODE_STREAM
201 /// \ingroup ANTLR3_COMMON_TREE_NODE_STREAM
202 ///
203 template<class ImplTraits>
204 class CommonTreeNodeStream;
205 
206 /// Pointer to an instantiation of 'class' #ANTLR3_TREE_WALK_STATE
207 /// \ingroup ANTLR3_TREE_WALK_STATE
208 ///
209 template<class ImplTraits>
210 class TreeWalkState;
211 
212 /// Pointer to an instantiation of 'class' #ANTLR3_BASE_TREE_ADAPTOR
213 /// \ingroup ANTLR3_BASE_TREE_ADAPTOR
214 ///
215 template<class ImplTraits>
216 class BaseTreeAdaptor;
217 template<class ImplTraits>
218 class BaseTreeAdaptorFunctions;
219 
220 
221 /// Pointer to an instantiation of 'class' #ANTLR3_COMMON_TREE_ADAPTOR
222 /// \ingroup ANTLR3_COMMON_TREE_ADAPTOR
223 ///
224 template<class ImplTraits>
225 class CommonTreeAdaptor;
226 template<class ImplTraits>
227 class CommonTreeAdaptorFunctions;
228 
229 
230 /// Pointer to an instantiation of 'class' #ANTLR3_TREE_PARSER
231 /// \ingroup ANTLR3_TREE_PARSER
232 ///
233 template<class ImplTraits>
234 class TreeParser;
235 
236 /// Pointer to an instantiation of 'class' #ANTLR3_INT_TRIE
237 /// \ingroup ANTLR3_INT_TRIE
238 ///
239 template< class DataType, class AllocPolicyType >
240 class IntTrie;
241 
242 /// Pointer to an instantiation of 'class' #ANTLR3_REWRITE_RULE_ELEMENT_STREAM
243 /// \ingroup ANTLR3_REWRITE_RULE_ELEMENT_STREAM
244 ///
245 template<class ImplTraits, class SuperType>
246 class RewriteRuleElementStream;
247 
248 template<class ImplTraits>
249 class RewriteRuleTokenStream;
250 
251 template<class ImplTraits>
252 class RewriteRuleSubtreeStream;
253 
254 template<class ImplTraits>
255 class RewriteRuleNodeStream;
256 
257 /// Pointer to an instantiation of 'class' #ANTLR3_DEBUG_EVENT_LISTENER
258 /// \ingroup ANTLR3_DEBUG_EVENT_LISTENER
259 ///
260 template<class ImplTraits>
261 class  DebugEventListener;
262 
263 //A Class just used for forwarding other classes for simplifying class forwarding
264 //Logic: constructor is made simple
265 template<class A>
266 class ClassForwarder {};
267 
268 template<bool b>
269 class BoolForwarder {};
270 class Empty {};
271 
272 template<class ImplTraits, class StreamType>
273 class ComponentTypeFinder
274 {
275 };
276 
277 template<class ImplTraits>
278 class ComponentTypeFinder< ImplTraits, typename ImplTraits::InputStreamType>
279 {
280 public:
281 	typedef typename ImplTraits::LexerType ComponentType;
282 };
283 
284 template<class ImplTraits>
285 class ComponentTypeFinder< ImplTraits, typename ImplTraits::TokenStreamType>
286 {
287 public:
288 	typedef typename ImplTraits::ParserType ComponentType;
289 };
290 
291 template<class ImplTraits>
292 class ComponentTypeFinder< ImplTraits, typename ImplTraits::TreeNodeStreamType>
293 {
294 public:
295 	typedef typename ImplTraits::TreeParserType ComponentType;
296 };
297 
298 
299 ANTLR_END_NAMESPACE()
300 
301 #endif
302