1 #ifndef	ANTLR3TREEPARSER_H
2 #define	ANTLR3TREEPARSER_H
3 
4 // [The "BSD licence"]
5 // Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
6 // http://www.temporal-wave.com
7 // http://www.linkedin.com/in/jimidle
8 //
9 // All rights reserved.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions
13 // are met:
14 // 1. Redistributions of source code must retain the above copyright
15 //    notice, this list of conditions and the following disclaimer.
16 // 2. Redistributions in binary form must reproduce the above copyright
17 //    notice, this list of conditions and the following disclaimer in the
18 //    documentation and/or other materials provided with the distribution.
19 // 3. The name of the author may not be used to endorse or promote products
20 //    derived from this software without specific prior written permission.
21 //
22 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33 #include    <antlr3defs.h>
34 #include    <antlr3baserecognizer.h>
35 #include    <antlr3commontreenodestream.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /** Internal structure representing an element in a hash bucket.
42  *  Stores the original key so that duplicate keys can be rejected
43  *  if necessary, and contains function can be supported If the hash key
44  *  could be unique I would have invented the perfect compression algorithm ;-)
45  */
46 typedef	struct	ANTLR3_TREE_PARSER_struct
47 {
48     /** Pointer to any super class
49      */
50     void    * super;
51 
52     /** A pointer to the base recognizer, where most of the parser functions actually
53      *  live because they are shared between parser and tree parser and this is the
54      *  easier way than copying the interface all over the place. Macros hide this
55      *  for the generated code so it is easier on the eye (though not the debugger ;-).
56      */
57     pANTLR3_BASE_RECOGNIZER		rec;
58 
59     /** Pointer to the common tree node stream for the parser
60      */
61     pANTLR3_COMMON_TREE_NODE_STREAM	ctnstream;
62 
63     /** Set the input stream and reset the parser
64      */
65     void			    (*setTreeNodeStream)    (struct ANTLR3_TREE_PARSER_struct * parser, pANTLR3_COMMON_TREE_NODE_STREAM input);
66 
67     /** Return a pointer to the input stream
68      */
69     pANTLR3_COMMON_TREE_NODE_STREAM (*getTreeNodeStream)    (struct ANTLR3_TREE_PARSER_struct * parser);
70 
71     /** Pointer to a function that knows how to free resources of an ANTLR3 tree parser.
72      */
73     void			    (*free)		    (struct ANTLR3_TREE_PARSER_struct * parser);
74 }
75     ANTLR3_TREE_PARSER;
76 
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif
82