1/** \file 2 * This C header file was generated by $ANTLR version 3.2 debian-5 3 * 4 * - From the grammar source file : DAAP2SQL.g 5 * - On : 2011-09-11 15:48:50 6 * - for the tree parser : DAAP2SQLTreeParser * 7 * Editing it, at least manually, is not wise. 8 * 9 * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. 10 * 11 * 12 * The tree parser DAAP2SQL has the callable functions (rules) shown below, 13 * which will invoke the code for the associated rule in the source grammar 14 * assuming that the input stream is pointing to a token/text stream that could begin 15 * this rule. 16 * 17 * For instance if you call the first (topmost) rule in a parser grammar, you will 18 * get the results of a full parse, but calling a rule half way through the grammar will 19 * allow you to pass part of a full token stream to the parser, such as for syntax checking 20 * in editors and so on. 21 * 22 * The parser entry points are called indirectly (by function pointer to function) via 23 * a parser context typedef pDAAP2SQL, which is returned from a call to DAAP2SQLNew(). 24 * 25 * The methods in pDAAP2SQL are as follows: 26 * 27 * - pANTLR3_STRING pDAAP2SQL->query(pDAAP2SQL) 28 * - DAAP2SQL_expr_return pDAAP2SQL->expr(pDAAP2SQL) 29 * 30 * The return type for any particular rule is of course determined by the source 31 * grammar file. 32 */ 33// [The "BSD licence"] 34// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC 35// http://www.temporal-wave.com 36// http://www.linkedin.com/in/jimidle 37// 38// All rights reserved. 39// 40// Redistribution and use in source and binary forms, with or without 41// modification, are permitted provided that the following conditions 42// are met: 43// 1. Redistributions of source code must retain the above copyright 44// notice, this list of conditions and the following disclaimer. 45// 2. Redistributions in binary form must reproduce the above copyright 46// notice, this list of conditions and the following disclaimer in the 47// documentation and/or other materials provided with the distribution. 48// 3. The name of the author may not be used to endorse or promote products 49// derived from this software without specific prior written permission. 50// 51// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 52// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 53// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 54// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 55// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 56// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 57// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 58// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 59// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 60// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 61 62#ifndef _DAAP2SQL_H 63#define _DAAP2SQL_H 64/* ============================================================================= 65 * Standard antlr3 C runtime definitions 66 */ 67#include <antlr3.h> 68 69/* End of standard antlr 3 runtime definitions 70 * ============================================================================= 71 */ 72 73#ifdef __cplusplus 74extern "C" { 75#endif 76 77// Forward declare the context typedef so that we can use it before it is 78// properly defined. Delegators and delegates (from import statements) are 79// interdependent and their context structures contain pointers to each other 80// C only allows such things to be declared if you pre-declare the typedef. 81// 82typedef struct DAAP2SQL_Ctx_struct DAAP2SQL, * pDAAP2SQL; 83 84 85 86 #include <stdio.h> 87 #include <stdlib.h> 88 #include <string.h> 89 #include <limits.h> 90 #include <errno.h> 91 92 #include "logger.h" 93 #include "db.h" 94 #include "daap_query.h" 95 96 97#ifdef ANTLR3_WINDOWS 98// Disable: Unreferenced parameter, - Rules with parameters that are not used 99// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually) 100// initialized but unused variable - tree rewrite variables declared but not needed 101// Unreferenced local variable - lexer rule declares but does not always use _type 102// potentially unitialized variable used - retval always returned from a rule 103// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns 104// 105// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at 106// and the codegen must generate some of these warnings by necessity, apart from 4100, which is 107// usually generated when a parser rule is given a parameter that it does not use. Mostly though 108// this is a matter of orthogonality hence I disable that one. 109// 110#pragma warning( disable : 4100 ) 111#pragma warning( disable : 4101 ) 112#pragma warning( disable : 4127 ) 113#pragma warning( disable : 4189 ) 114#pragma warning( disable : 4505 ) 115#pragma warning( disable : 4701 ) 116#endif 117typedef struct DAAP2SQL_expr_return_struct 118{ 119 pANTLR3_BASE_TREE start; 120 pANTLR3_BASE_TREE stop; 121 pANTLR3_STRING result; 122 int valid; 123} 124 DAAP2SQL_expr_return; 125 126 127 128/** Context tracking structure for DAAP2SQL 129 */ 130struct DAAP2SQL_Ctx_struct 131{ 132 /** Built in ANTLR3 context tracker contains all the generic elements 133 * required for context tracking. 134 */ 135 pANTLR3_TREE_PARSER pTreeParser; 136 137 138 pANTLR3_STRING (*query) (struct DAAP2SQL_Ctx_struct * ctx); 139 DAAP2SQL_expr_return (*expr) (struct DAAP2SQL_Ctx_struct * ctx); 140 // Delegated rules 141 const char * (*getGrammarFileName)(); 142 void (*free) (struct DAAP2SQL_Ctx_struct * ctx); 143 144}; 145 146// Function protoypes for the constructor functions that external translation units 147// such as delegators and delegates may wish to call. 148// 149ANTLR3_API pDAAP2SQL DAAP2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream); 150ANTLR3_API pDAAP2SQL DAAP2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state); 151 152/** Symbolic definitions of all the tokens that the tree parser will work with. 153 * \{ 154 * 155 * Antlr will define EOF, but we can't use that as it it is too common in 156 * in C header files and that would be confusing. There is no way to filter this out at the moment 157 * so we just undef it here for now. That isn't the value we get back from C recognizers 158 * anyway. We are looking for ANTLR3_TOKEN_EOF. 159 */ 160#ifdef EOF 161#undef EOF 162#endif 163#ifdef Tokens 164#undef Tokens 165#endif 166#define STR 9 167#define QUOTE 10 168#define NEWLINE 4 169#define LPAR 7 170#define OPOR 5 171#define RPAR 8 172#define ESCAPED 11 173#define OPAND 6 174#define EOF -1 175#ifdef EOF 176#undef EOF 177#define EOF ANTLR3_TOKEN_EOF 178#endif 179 180#ifndef TOKENSOURCE 181#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource 182#endif 183 184/* End of token definitions for DAAP2SQL 185 * ============================================================================= 186 */ 187/** \} */ 188 189#ifdef __cplusplus 190} 191#endif 192 193#endif 194 195/* END - Note:Keep extra line feed to satisfy UNIX systems */ 196