1 /// Definition of a cyclic dfa structure such that it can be
\r
2 /// initialized at compile time and have only a single
\r
3 /// runtime function that can deal with all cyclic dfa
\r
4 /// structures and show Java how it is done ;-)
\r
6 #ifndef ANTLR3_CYCLICDFA_H
\r
7 #define ANTLR3_CYCLICDFA_H
\r
9 // [The "BSD licence"]
\r
10 // Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
\r
11 // http://www.temporal-wave.com
\r
12 // http://www.linkedin.com/in/jimidle
\r
14 // All rights reserved.
\r
16 // Redistribution and use in source and binary forms, with or without
\r
17 // modification, are permitted provided that the following conditions
\r
19 // 1. Redistributions of source code must retain the above copyright
\r
20 // notice, this list of conditions and the following disclaimer.
\r
21 // 2. Redistributions in binary form must reproduce the above copyright
\r
22 // notice, this list of conditions and the following disclaimer in the
\r
23 // documentation and/or other materials provided with the distribution.
\r
24 // 3. The name of the author may not be used to endorse or promote products
\r
25 // derived from this software without specific prior written permission.
\r
27 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
\r
28 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
\r
29 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
\r
30 // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
\r
31 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
\r
32 // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
\r
33 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
\r
34 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
\r
35 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
\r
36 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
38 #include <antlr3baserecognizer.h>
\r
39 #include <antlr3intstream.h>
\r
44 // If this header file is included as part of a generated recognizer that
\r
45 // is being compiled as if it were C++, and this is Windows, then the const elements
\r
46 // of the structure cause the C++ compiler to (rightly) point out that
\r
47 // there can be no instantiation of the structure because it needs a constructor
\r
48 // that can initialize the data, however these structures are not
\r
49 // useful for C++ as they are pre-generated and static in the recognizer.
\r
50 // So, we turn off those warnings, which are only at /W4 anyway.
\r
52 #ifdef ANTLR3_WINDOWS
\r
53 #pragma warning (push)
\r
54 #pragma warning (disable : 4510)
\r
55 #pragma warning (disable : 4512)
\r
56 #pragma warning (disable : 4610)
\r
60 typedef struct ANTLR3_CYCLIC_DFA_struct
\r
62 /// Decision number that a particular static structure
\r
65 const ANTLR3_INT32 decisionNumber;
\r
67 /// What this decision represents
\r
69 const pANTLR3_UCHAR description;
\r
71 ANTLR3_INT32 (*specialStateTransition) (void * ctx, pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_INT_STREAM is, struct ANTLR3_CYCLIC_DFA_struct * dfa, ANTLR3_INT32 s);
\r
73 ANTLR3_INT32 (*specialTransition) (void * ctx, pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_INT_STREAM is, struct ANTLR3_CYCLIC_DFA_struct * dfa, ANTLR3_INT32 s);
\r
75 ANTLR3_INT32 (*predict) (void * ctx, pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_INT_STREAM is, struct ANTLR3_CYCLIC_DFA_struct * dfa);
\r
77 const ANTLR3_INT32 * const eot;
\r
78 const ANTLR3_INT32 * const eof;
\r
79 const ANTLR3_INT32 * const min;
\r
80 const ANTLR3_INT32 * const max;
\r
81 const ANTLR3_INT32 * const accept;
\r
82 const ANTLR3_INT32 * const special;
\r
83 const ANTLR3_INT32 * const * const transition;
\r
88 typedef ANTLR3_INT32 (*CDFA_SPECIAL_FUNC) (void * , pANTLR3_BASE_RECOGNIZER , pANTLR3_INT_STREAM , struct ANTLR3_CYCLIC_DFA_struct * , ANTLR3_INT32);
\r
92 #ifdef ANTLR3_WINDOWS
\r
93 #pragma warning (pop)
\r