1324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver#ifndef	ANTLR3TREEPARSER_H
2324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver#define	ANTLR3TREEPARSER_H
3324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
4324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// [The "BSD licence"]
5324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
6324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// http://www.temporal-wave.com
7324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// http://www.linkedin.com/in/jimidle
8324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver//
9324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// All rights reserved.
10324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver//
11324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// Redistribution and use in source and binary forms, with or without
12324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// modification, are permitted provided that the following conditions
13324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// are met:
14324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// 1. Redistributions of source code must retain the above copyright
15324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver//    notice, this list of conditions and the following disclaimer.
16324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// 2. Redistributions in binary form must reproduce the above copyright
17324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver//    notice, this list of conditions and the following disclaimer in the
18324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver//    documentation and/or other materials provided with the distribution.
19324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// 3. The name of the author may not be used to endorse or promote products
20324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver//    derived from this software without specific prior written permission.
21324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver//
22324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
33324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver#include    <antlr3defs.h>
34324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver#include    <antlr3baserecognizer.h>
35324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver#include    <antlr3commontreenodestream.h>
36324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
37324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver#ifdef __cplusplus
38324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruverextern "C" {
39324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver#endif
40324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
41324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver/** Internal structure representing an element in a hash bucket.
42324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver *  Stores the original key so that duplicate keys can be rejected
43324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver *  if necessary, and contains function can be supported If the hash key
44324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver *  could be unique I would have invented the perfect compression algorithm ;-)
45324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver */
46324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruvertypedef	struct	ANTLR3_TREE_PARSER_struct
47324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver{
48324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    /** Pointer to any super class
49324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver     */
50324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    void    * super;
51324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
52324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    /** A pointer to the base recognizer, where most of the parser functions actually
53324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver     *  live because they are shared between parser and tree parser and this is the
54324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver     *  easier way than copying the interface all over the place. Macros hide this
55324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver     *  for the generated code so it is easier on the eye (though not the debugger ;-).
56324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver     */
57324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    pANTLR3_BASE_RECOGNIZER		rec;
58324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
59324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    /** Pointer to the common tree node stream for the parser
60324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver     */
61324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    pANTLR3_COMMON_TREE_NODE_STREAM	ctnstream;
62324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
63324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    /** Set the input stream and reset the parser
64324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver     */
65324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    void			    (*setTreeNodeStream)    (struct ANTLR3_TREE_PARSER_struct * parser, pANTLR3_COMMON_TREE_NODE_STREAM input);
66324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
67324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    /** Return a pointer to the input stream
68324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver     */
69324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    pANTLR3_COMMON_TREE_NODE_STREAM (*getTreeNodeStream)    (struct ANTLR3_TREE_PARSER_struct * parser);
70324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
71324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    /** Pointer to a function that knows how to free resources of an ANTLR3 tree parser.
72324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver     */
73324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    void			    (*free)		    (struct ANTLR3_TREE_PARSER_struct * parser);
74324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver}
75324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver    ANTLR3_TREE_PARSER;
76324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
77324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver#ifdef __cplusplus
78324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver}
79324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver#endif
80324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver
81324c4644fee44b9898524c09511bd33c3f12e2dfBen Gruver#endif
82