1 diff --git a/src/pregen/DAAP.u b/src/pregen/DAAP.u
5 +++ b/src/pregen/DAAP.u
8 +./DAAP.tokens : DAAP.g
12 +ANTLR_PRODUCTS += DAAPParser.c ./DAAP.tokens DAAPParser.h DAAPLexer.c DAAPLexer.h
13 \ No newline at end of file
14 diff --git a/src/pregen/DAAP2SQL.c b/src/pregen/DAAP2SQL.c
16 index 0000000..3f94589
18 +++ b/src/pregen/DAAP2SQL.c
21 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
23 + * - From the grammar source file : DAAP2SQL.g
24 + * - On : 2014-09-30 21:42:43
25 + * - for the tree parser : DAAP2SQLTreeParser *
26 + * Editing it, at least manually, is not wise.
28 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
32 +// [The "BSD licence"]
33 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
34 +// http://www.temporal-wave.com
35 +// http://www.linkedin.com/in/jimidle
37 +// All rights reserved.
39 +// Redistribution and use in source and binary forms, with or without
40 +// modification, are permitted provided that the following conditions
42 +// 1. Redistributions of source code must retain the above copyright
43 +// notice, this list of conditions and the following disclaimer.
44 +// 2. Redistributions in binary form must reproduce the above copyright
45 +// notice, this list of conditions and the following disclaimer in the
46 +// documentation and/or other materials provided with the distribution.
47 +// 3. The name of the author may not be used to endorse or promote products
48 +// derived from this software without specific prior written permission.
50 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
51 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
54 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
55 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
57 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
59 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 +/* =============================================================================
63 + * This is what the grammar programmer asked us to put at the top of every file.
74 + #include "daap_query.h"
76 +/* End of Header action.
77 + * =============================================================================
79 +/* -----------------------------------------
80 + * Include the ANTLR3 generated header file.
82 +#include "DAAP2SQL.h"
83 +/* ----------------------------------------- */
89 +/* MACROS that hide the C interface implementations from the
90 + * generated code, which makes it a little more understandable to the human eye.
91 + * I am very much against using C pre-processor macros for function calls and bits
92 + * of code as you cannot see what is happening when single stepping in debuggers
93 + * and so on. The exception (in my book at least) is for generated code, where you are
94 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
95 + * hides some indirect calls, but is always referring to the input stream. This is
96 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
97 + * the runtime interfaces without changing the generated code too often, without
98 + * confusing the reader of the generated output, who may not wish to know the gory
99 + * details of the interface inheritance.
104 +/* Aids in accessing scopes for grammar programmers
109 +#define SCOPE_TYPE(scope) pDAAP2SQL_##scope##_SCOPE
110 +#define SCOPE_STACK(scope) pDAAP2SQL_##scope##Stack
111 +#define SCOPE_TOP(scope) ctx->pDAAP2SQL_##scope##Top
112 +#define SCOPE_SIZE(scope) ctx->pDAAP2SQL_##scope##Stack_limit
113 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
115 +/* Macros for accessing things in the parser
120 +#undef HAVEPARSEDRULE
139 +#undef PERRORRECOVERY
142 +#undef RECOVERFROMMISMATCHEDSET
143 +#undef RECOVERFROMMISMATCHEDELEMENT
151 +#define PARSER ctx->pTreeParser
152 +#define RECOGNIZER PARSER->rec
153 +#define PSRSTATE RECOGNIZER->state
154 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
155 +#define INPUT PARSER->ctnstream
156 +#define ISTREAM INPUT->tnstream->istream
157 +#define STRSTREAM INPUT->tnstream
158 +#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE)
159 +#define EXCEPTION PSRSTATE->exception
160 +#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs)
161 +#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER)
162 +#define FOLLOWSTACK PSRSTATE->following
163 +#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
164 +#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK)
165 +#define PRECOVER() RECOGNIZER->recover(RECOGNIZER)
166 +#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER)
167 +#define LA(n) ISTREAM->_LA(ISTREAM, n)
168 +#define LT(n) INPUT->tnstream->_LT(INPUT->tnstream, n)
169 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
170 +#define CONSUME() ISTREAM->consume(ISTREAM)
171 +#define MARK() ISTREAM->mark(ISTREAM)
172 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
173 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
174 +#define PERRORRECOVERY PSRSTATE->errorRecovery
175 +#define FAILEDFLAG PSRSTATE->failed
176 +#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE)
177 +#define BACKTRACKING PSRSTATE->backtracking
178 +#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
179 +#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
180 +#define ADAPTOR INPUT->adaptor
181 +#define RULEMEMO PSRSTATE->ruleMemo
182 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
183 +#define INDEX() ISTREAM->index(ISTREAM)
184 +#define DBG RECOGNIZER->debugger
187 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
189 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
190 + * then for the present you must use different names for your defines as these are hard coded
191 + * in the code generator. It would be better not to use such names internally, and maybe
192 + * we can change this in a forthcoming release. I deliberately do not #undef these
193 + * here as this will at least give you a redefined error somewhere if they clash.
195 +#define UP ANTLR3_TOKEN_UP
196 +#define DOWN ANTLR3_TOKEN_DOWN
197 +#define EOR ANTLR3_TOKEN_EOR
198 +#define INVALID ANTLR3_TOKEN_INVALID
201 +/* =============================================================================
202 + * Functions to create and destroy scopes. First come the rule scopes, followed
203 + * by the global declared scopes.
208 +/* ============================================================================= */
210 +/* =============================================================================
211 + * Start of recognizer
216 +/** \brief Table of all token names in symbolic order, mainly used for
219 +pANTLR3_UINT8 DAAP2SQLTokenNames[8+4]
221 + (pANTLR3_UINT8) "<invalid>", /* String to print to indicate an invalid token */
222 + (pANTLR3_UINT8) "<EOR>",
223 + (pANTLR3_UINT8) "<DOWN>",
224 + (pANTLR3_UINT8) "<UP>",
225 + (pANTLR3_UINT8) "NEWLINE",
226 + (pANTLR3_UINT8) "OPOR",
227 + (pANTLR3_UINT8) "OPAND",
228 + (pANTLR3_UINT8) "LPAR",
229 + (pANTLR3_UINT8) "RPAR",
230 + (pANTLR3_UINT8) "STR",
231 + (pANTLR3_UINT8) "QUOTE",
232 + (pANTLR3_UINT8) "ESCAPED"
237 +// Forward declare the locally static matching functions we have generated.
239 +static pANTLR3_STRING query (pDAAP2SQL ctx);
240 +static DAAP2SQL_expr_return expr (pDAAP2SQL ctx);
241 +static void DAAP2SQLFree(pDAAP2SQL ctx);
242 +/* For use in tree output where we are accumulating rule labels via label += ruleRef
243 + * we need a function that knows how to free a return scope when the list is destroyed.
244 + * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
246 +static void ANTLR3_CDECL freeScope(void * scope)
248 + ANTLR3_FREE(scope);
251 +/** \brief Name of the grammar file that generated this code
253 +static const char fileName[] = "DAAP2SQL.g";
255 +/** \brief Return the name of the grammar file that generated this code.
257 +static const char * getGrammarFileName()
261 +/** \brief Create a new DAAP2SQL parser and return a context for it.
263 + * \param[in] instream Pointer to an input stream interface.
265 + * \return Pointer to new parser context upon success.
267 +ANTLR3_API pDAAP2SQL
268 +DAAP2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream)
270 + // See if we can create a new parser with the standard constructor
272 + return DAAP2SQLNewSSD(instream, NULL);
275 +/** \brief Create a new DAAP2SQL parser and return a context for it.
277 + * \param[in] instream Pointer to an input stream interface.
279 + * \return Pointer to new parser context upon success.
281 +ANTLR3_API pDAAP2SQL
282 +DAAP2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
284 + pDAAP2SQL ctx; /* Context structure we will build and return */
286 + ctx = (pDAAP2SQL) ANTLR3_CALLOC(1, sizeof(DAAP2SQL));
290 + // Failed to allocate memory for parser context
295 + /* -------------------------------------------------------------------
296 + * Memory for basic structure is allocated, now to fill in
297 + * the base ANTLR3 structures. We initialize the function pointers
298 + * for the standard ANTLR3 parser function set, but upon return
299 + * from here, the programmer may set the pointers to provide custom
300 + * implementations of each function.
302 + * We don't use the macros defined in DAAP2SQL.h here, in order that you can get a sense
303 + * of what goes where.
306 + /* Create a base Tree parser/recognizer, using the supplied tree node stream
308 + ctx->pTreeParser = antlr3TreeParserNewStream(ANTLR3_SIZE_HINT, instream, state);
309 + /* Install the implementation of our DAAP2SQL interface
311 + ctx->query = query;
313 + ctx->free = DAAP2SQLFree;
314 + ctx->getGrammarFileName = getGrammarFileName;
316 + /* Install the scope pushing methods.
323 + /* Install the token table
325 + PSRSTATE->tokenNames = DAAP2SQLTokenNames;
328 + /* Return the newly built parser to the caller
333 +/** Free the parser resources
336 + DAAP2SQLFree(pDAAP2SQL ctx)
338 + /* Free any scope memory
342 + // Free this parser
344 + ctx->pTreeParser->free(ctx->pTreeParser);
347 + /* Everything is released, so we can return
352 +/** Return token names used by this tree parser
354 + * The returned pointer is used as an index into the token names table (using the token
355 + * number as the index).
357 + * \return Pointer to first char * in the table.
359 +static pANTLR3_UINT8 *getTokenNames()
361 + return DAAP2SQLTokenNames;
365 + struct dmap_query_field_map {
371 + /* gperf static hash, daap_query.gperf */
372 + #include "daap_query_hash.c"
375 +/* Declare the bitsets
378 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_query70 */
379 +static ANTLR3_BITWORD FOLLOW_expr_in_query70_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
380 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_query70 = { FOLLOW_expr_in_query70_bits, 1 };
381 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OPAND_in_expr95 */
382 +static ANTLR3_BITWORD FOLLOW_OPAND_in_expr95_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
383 +static ANTLR3_BITSET_LIST FOLLOW_OPAND_in_expr95 = { FOLLOW_OPAND_in_expr95_bits, 1 };
384 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr101 */
385 +static ANTLR3_BITWORD FOLLOW_expr_in_expr101_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000260) };
386 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr101 = { FOLLOW_expr_in_expr101_bits, 1 };
387 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr107 */
388 +static ANTLR3_BITWORD FOLLOW_expr_in_expr107_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
389 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr107 = { FOLLOW_expr_in_expr107_bits, 1 };
390 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OPOR_in_expr118 */
391 +static ANTLR3_BITWORD FOLLOW_OPOR_in_expr118_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
392 +static ANTLR3_BITSET_LIST FOLLOW_OPOR_in_expr118 = { FOLLOW_OPOR_in_expr118_bits, 1 };
393 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr124 */
394 +static ANTLR3_BITWORD FOLLOW_expr_in_expr124_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000260) };
395 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr124 = { FOLLOW_expr_in_expr124_bits, 1 };
396 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr130 */
397 +static ANTLR3_BITWORD FOLLOW_expr_in_expr130_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
398 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr130 = { FOLLOW_expr_in_expr130_bits, 1 };
399 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_expr140 */
400 +static ANTLR3_BITWORD FOLLOW_STR_in_expr140_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
401 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_expr140 = { FOLLOW_STR_in_expr140_bits, 1 };
406 +/* ==============================================
410 + * $ANTLR start query
411 + * DAAP2SQL.g:50:1: query returns [ pANTLR3_STRING result ] : e= expr ;
413 +static pANTLR3_STRING
414 +query(pDAAP2SQL ctx)
416 + pANTLR3_STRING result = NULL;
418 + DAAP2SQL_expr_return e;
419 + #undef RETURN_TYPE_e
420 + #define RETURN_TYPE_e DAAP2SQL_expr_return
422 + /* Initialize rule variables
428 + // DAAP2SQL.g:52:2: (e= expr )
429 + // DAAP2SQL.g:52:4: e= expr
431 + FOLLOWPUSH(FOLLOW_expr_in_query70);
435 + if (HASEXCEPTION())
448 + result= e.result->factory->newRaw(e.result->factory);
449 + result->append8(result, "(");
450 + result->appendS(result, e.result);
451 + result->append8(result, ")");
461 + // This is where rules clean up and exit
463 + goto rulequeryEx; /* Prevent compiler warnings */
466 + if (HASEXCEPTION())
475 +/* $ANTLR end query */
478 + * $ANTLR start expr
479 + * DAAP2SQL.g:68:1: expr returns [ pANTLR3_STRING result, int valid ] : ( ^( OPAND a= expr b= expr ) | ^( OPOR a= expr b= expr ) | STR );
481 +static DAAP2SQL_expr_return
484 + DAAP2SQL_expr_return retval;
486 + pANTLR3_BASE_TREE STR1;
487 + DAAP2SQL_expr_return a;
488 + #undef RETURN_TYPE_a
489 + #define RETURN_TYPE_a DAAP2SQL_expr_return
491 + DAAP2SQL_expr_return b;
492 + #undef RETURN_TYPE_b
493 + #define RETURN_TYPE_b DAAP2SQL_expr_return
495 + /* Initialize rule variables
499 + retval.result= NULL; retval.valid= 1;
501 + retval.start = LT(1); retval.stop = retval.start;
505 + // DAAP2SQL.g:70:2: ( ^( OPAND a= expr b= expr ) | ^( OPOR a= expr b= expr ) | STR )
507 + ANTLR3_UINT32 alt1;
531 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
532 + EXCEPTION->message = (void *)"";
533 + EXCEPTION->decisionNum = 1;
534 + EXCEPTION->state = 0;
543 + // DAAP2SQL.g:70:4: ^( OPAND a= expr b= expr )
545 + MATCHT(OPAND, &FOLLOW_OPAND_in_expr95);
546 + if (HASEXCEPTION())
552 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
553 + if (HASEXCEPTION())
558 + FOLLOWPUSH(FOLLOW_expr_in_expr101);
562 + if (HASEXCEPTION())
567 + FOLLOWPUSH(FOLLOW_expr_in_expr107);
571 + if (HASEXCEPTION())
577 + MATCHT(ANTLR3_TOKEN_UP, NULL);
578 + if (HASEXCEPTION())
585 + if (!a.valid || !b.valid)
591 + retval.result= a.result->factory->newRaw(a.result->factory);
592 + retval.result->append8(retval.result, "(");
593 + retval.result->appendS(retval.result, a.result);
594 + retval.result->append8(retval.result, " AND ");
595 + retval.result->appendS(retval.result, b.result);
596 + retval.result->append8(retval.result, ")");
604 + // DAAP2SQL.g:86:4: ^( OPOR a= expr b= expr )
606 + MATCHT(OPOR, &FOLLOW_OPOR_in_expr118);
607 + if (HASEXCEPTION())
613 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
614 + if (HASEXCEPTION())
619 + FOLLOWPUSH(FOLLOW_expr_in_expr124);
623 + if (HASEXCEPTION())
628 + FOLLOWPUSH(FOLLOW_expr_in_expr130);
632 + if (HASEXCEPTION())
638 + MATCHT(ANTLR3_TOKEN_UP, NULL);
639 + if (HASEXCEPTION())
646 + if (!a.valid || !b.valid)
652 + retval.result= a.result->factory->newRaw(a.result->factory);
653 + retval.result->append8(retval.result, "(");
654 + retval.result->appendS(retval.result, a.result);
655 + retval.result->append8(retval.result, " OR ");
656 + retval.result->appendS(retval.result, b.result);
657 + retval.result->append8(retval.result, ")");
665 + // DAAP2SQL.g:102:4: STR
667 + STR1 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expr140);
668 + if (HASEXCEPTION())
675 + pANTLR3_STRING str;
676 + pANTLR3_UINT8 field;
678 + pANTLR3_UINT8 escaped;
681 + const struct dmap_query_field_map *dqfm;
687 + retval.result= (STR1->getText(STR1))->factory->newRaw((STR1->getText(STR1))->factory);
689 + str = (STR1->getText(STR1))->toUTF8((STR1->getText(STR1)));
691 + /* NOTE: the lexer delivers the string without quotes
692 + which may not be obvious from the grammar due to embedded code
695 + /* Make daap.songalbumid:0 a no-op */
696 + if (strcmp((char *)str->chars, "daap.songalbumid:0") == 0)
698 + retval.result->append8(retval.result, "1 = 1");
703 + field = str->chars;
706 + while ((*val != '\0') && ((*val == '.')
708 + || ((*val >= 'a') && (*val <= 'z'))
709 + || ((*val >= 'A') && (*val <= 'Z'))
710 + || ((*val >= '0') && (*val <= '9'))))
715 + if (*field == '\0')
717 + DPRINTF(E_LOG, L_DAAP, "No field name found in clause '%s'\n", field);
719 + goto STR_result_valid_0; /* ABORT */
724 + DPRINTF(E_LOG, L_DAAP, "No operator found in clause '%s'\n", field);
726 + goto STR_result_valid_0; /* ABORT */
737 + DPRINTF(E_LOG, L_DAAP, "Negation found but operator missing in clause '%s%c'\n", field, op);
739 + goto STR_result_valid_0; /* ABORT */
749 + /* Lookup DMAP field in the query field map */
750 + dqfm = daap_query_field_lookup((char *)field, strlen((char *)field));
753 + DPRINTF(E_LOG, L_DAAP, "DMAP field '%s' is not a valid field in queries\n", field);
755 + goto STR_result_valid_0; /* ABORT */
758 + /* Empty values OK for string fields, NOK for integer */
763 + DPRINTF(E_LOG, L_DAAP, "No value given in clause '%s%s%c'\n", field, (neg_op) ? "!" : "", op);
765 + goto STR_result_valid_0; /* ABORT */
768 + /* Need to check against NULL too */
770 + retval.result->append8(retval.result, "(");
773 + retval.result->append8(retval.result, dqfm->db_col);
775 + /* Int field: check integer conversion */
779 + llval = strtoll((const char *)val, &end, 10);
781 + if (((errno == ERANGE) && ((llval == LLONG_MAX) || (llval == LLONG_MIN)))
782 + || ((errno != 0) && (llval == 0)))
784 + DPRINTF(E_LOG, L_DAAP, "Value '%s' in clause '%s%s%c%s' does not convert to an integer type\n",
785 + val, field, (neg_op) ? "!" : "", op, val);
787 + goto STR_result_valid_0; /* ABORT */
790 + if (end == (char *)val)
792 + DPRINTF(E_LOG, L_DAAP, "Value '%s' in clause '%s%s%c%s' does not represent an integer value\n",
793 + val, field, (neg_op) ? "!" : "", op, val);
795 + goto STR_result_valid_0; /* ABORT */
798 + *end = '\0'; /* Cut out potential garbage - we're being kind */
800 + /* String field: escape string, check for '*' */
805 + DPRINTF(E_LOG, L_DAAP, "Operation '%c' not valid for string values\n", op);
807 + goto STR_result_valid_0; /* ABORT */
810 + escaped = (pANTLR3_UINT8)db_escape_string((char *)val);
813 + DPRINTF(E_LOG, L_DAAP, "Could not escape value\n");
815 + goto STR_result_valid_0; /* ABORT */
826 + if (val[strlen((char *)val) - 1] == '*')
829 + val[strlen((char *)val) - 1] = '%';
837 + retval.result->append8(retval.result, " <> ");
839 + retval.result->append8(retval.result, " = ");
844 + retval.result->append8(retval.result, " <= ");
846 + retval.result->append8(retval.result, " > ");
851 + retval.result->append8(retval.result, " >= ");
853 + retval.result->append8(retval.result, " < ");
857 + retval.result->append8(retval.result, " LIKE ");
862 + DPRINTF(E_LOG, L_DAAP, "Missing or unknown operator '%c' in clause '%s!%c%s'\n", op, field, op, val);
864 + DPRINTF(E_LOG, L_DAAP, "Unknown operator '%c' in clause '%s%c%s'\n", op, field, op, val);
866 + goto STR_result_valid_0; /* ABORT */
871 + retval.result->append8(retval.result, "'");
873 + retval.result->append8(retval.result, (const char *)val);
876 + retval.result->append8(retval.result, "'");
878 + /* For empty string value, we need to check against NULL too */
879 + if ((*val == '\0') && (op == ':'))
882 + retval.result->append8(retval.result, " AND ");
884 + retval.result->append8(retval.result, " OR ");
886 + retval.result->append8(retval.result, dqfm->db_col);
889 + retval.result->append8(retval.result, " IS NOT NULL");
891 + retval.result->append8(retval.result, " IS NULL");
893 + retval.result->append8(retval.result, ")");
896 + STR_result_valid_0: /* bail out label */
902 + STR_out: /* get out of here */
915 + // This is where rules clean up and exit
917 + goto ruleexprEx; /* Prevent compiler warnings */
920 + if (HASEXCEPTION())
929 +/* $ANTLR end expr */
930 +/* End of parsing rules
931 + * ==============================================
934 +/* ==============================================
935 + * Syntactic predicates
937 +/* End of syntactic predicates
938 + * ==============================================
947 + * =============================================================================
949 diff --git a/src/pregen/DAAP2SQL.h b/src/pregen/DAAP2SQL.h
951 index 0000000..e170f6c
953 +++ b/src/pregen/DAAP2SQL.h
956 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
958 + * - From the grammar source file : DAAP2SQL.g
959 + * - On : 2014-09-30 21:42:43
960 + * - for the tree parser : DAAP2SQLTreeParser *
961 + * Editing it, at least manually, is not wise.
963 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
966 + * The tree parser DAAP2SQL has the callable functions (rules) shown below,
967 + * which will invoke the code for the associated rule in the source grammar
968 + * assuming that the input stream is pointing to a token/text stream that could begin
971 + * For instance if you call the first (topmost) rule in a parser grammar, you will
972 + * get the results of a full parse, but calling a rule half way through the grammar will
973 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
974 + * in editors and so on.
976 + * The parser entry points are called indirectly (by function pointer to function) via
977 + * a parser context typedef pDAAP2SQL, which is returned from a call to DAAP2SQLNew().
979 + * The methods in pDAAP2SQL are as follows:
981 + * - pANTLR3_STRING pDAAP2SQL->query(pDAAP2SQL)
982 + * - DAAP2SQL_expr_return pDAAP2SQL->expr(pDAAP2SQL)
984 + * The return type for any particular rule is of course determined by the source
987 +// [The "BSD licence"]
988 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
989 +// http://www.temporal-wave.com
990 +// http://www.linkedin.com/in/jimidle
992 +// All rights reserved.
994 +// Redistribution and use in source and binary forms, with or without
995 +// modification, are permitted provided that the following conditions
997 +// 1. Redistributions of source code must retain the above copyright
998 +// notice, this list of conditions and the following disclaimer.
999 +// 2. Redistributions in binary form must reproduce the above copyright
1000 +// notice, this list of conditions and the following disclaimer in the
1001 +// documentation and/or other materials provided with the distribution.
1002 +// 3. The name of the author may not be used to endorse or promote products
1003 +// derived from this software without specific prior written permission.
1005 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1006 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1007 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1008 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1009 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1010 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1011 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1012 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1013 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1014 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1016 +#ifndef _DAAP2SQL_H
1017 +#define _DAAP2SQL_H
1018 +/* =============================================================================
1019 + * Standard antlr3 C runtime definitions
1021 +#include <antlr3.h>
1023 +/* End of standard antlr 3 runtime definitions
1024 + * =============================================================================
1031 +// Forward declare the context typedef so that we can use it before it is
1032 +// properly defined. Delegators and delegates (from import statements) are
1033 +// interdependent and their context structures contain pointers to each other
1034 +// C only allows such things to be declared if you pre-declare the typedef.
1036 +typedef struct DAAP2SQL_Ctx_struct DAAP2SQL, * pDAAP2SQL;
1040 + #include <stdio.h>
1041 + #include <stdlib.h>
1042 + #include <string.h>
1043 + #include <limits.h>
1044 + #include <errno.h>
1046 + #include "logger.h"
1048 + #include "daap_query.h"
1051 +#ifdef ANTLR3_WINDOWS
1052 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
1053 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
1054 +// initialized but unused variable - tree rewrite variables declared but not needed
1055 +// Unreferenced local variable - lexer rule declares but does not always use _type
1056 +// potentially unitialized variable used - retval always returned from a rule
1057 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
1059 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
1060 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
1061 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
1062 +// this is a matter of orthogonality hence I disable that one.
1064 +#pragma warning( disable : 4100 )
1065 +#pragma warning( disable : 4101 )
1066 +#pragma warning( disable : 4127 )
1067 +#pragma warning( disable : 4189 )
1068 +#pragma warning( disable : 4505 )
1069 +#pragma warning( disable : 4701 )
1071 +typedef struct DAAP2SQL_expr_return_struct
1073 + pANTLR3_BASE_TREE start;
1074 + pANTLR3_BASE_TREE stop;
1075 + pANTLR3_STRING result;
1078 + DAAP2SQL_expr_return;
1082 +/** Context tracking structure for DAAP2SQL
1084 +struct DAAP2SQL_Ctx_struct
1086 + /** Built in ANTLR3 context tracker contains all the generic elements
1087 + * required for context tracking.
1089 + pANTLR3_TREE_PARSER pTreeParser;
1092 + pANTLR3_STRING (*query) (struct DAAP2SQL_Ctx_struct * ctx);
1093 + DAAP2SQL_expr_return (*expr) (struct DAAP2SQL_Ctx_struct * ctx);
1094 + // Delegated rules
1095 + const char * (*getGrammarFileName)();
1096 + void (*free) (struct DAAP2SQL_Ctx_struct * ctx);
1100 +// Function protoypes for the constructor functions that external translation units
1101 +// such as delegators and delegates may wish to call.
1103 +ANTLR3_API pDAAP2SQL DAAP2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream);
1104 +ANTLR3_API pDAAP2SQL DAAP2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
1106 +/** Symbolic definitions of all the tokens that the tree parser will work with.
1109 + * Antlr will define EOF, but we can't use that as it it is too common in
1110 + * in C header files and that would be confusing. There is no way to filter this out at the moment
1111 + * so we just undef it here for now. That isn't the value we get back from C recognizers
1112 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
1131 +#define EOF ANTLR3_TOKEN_EOF
1134 +#ifndef TOKENSOURCE
1135 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
1138 +/* End of token definitions for DAAP2SQL
1139 + * =============================================================================
1149 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
1150 diff --git a/src/pregen/DAAP2SQL.u b/src/pregen/DAAP2SQL.u
1151 new file mode 100644
1152 index 0000000..385d80b
1154 +++ b/src/pregen/DAAP2SQL.u
1156 +DAAP2SQL.g: DAAP.tokens
1157 +DAAP2SQL.c : DAAP2SQL.g
1158 +./DAAP2SQL.tokens : DAAP2SQL.g
1159 +DAAP2SQL.h : DAAP2SQL.g
1160 +ANTLR_PRODUCTS += DAAP2SQL.c ./DAAP2SQL.tokens DAAP2SQL.h
1161 \ No newline at end of file
1162 diff --git a/src/pregen/DAAPLexer.c b/src/pregen/DAAPLexer.c
1163 new file mode 100644
1164 index 0000000..12e7ef3
1166 +++ b/src/pregen/DAAPLexer.c
1169 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
1171 + * - From the grammar source file : DAAP.g
1172 + * - On : 2014-09-30 21:42:40
1173 + * - for the lexer : DAAPLexerLexer *
1174 + * Editing it, at least manually, is not wise.
1176 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
1180 +// [The "BSD licence"]
1181 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
1182 +// http://www.temporal-wave.com
1183 +// http://www.linkedin.com/in/jimidle
1185 +// All rights reserved.
1187 +// Redistribution and use in source and binary forms, with or without
1188 +// modification, are permitted provided that the following conditions
1190 +// 1. Redistributions of source code must retain the above copyright
1191 +// notice, this list of conditions and the following disclaimer.
1192 +// 2. Redistributions in binary form must reproduce the above copyright
1193 +// notice, this list of conditions and the following disclaimer in the
1194 +// documentation and/or other materials provided with the distribution.
1195 +// 3. The name of the author may not be used to endorse or promote products
1196 +// derived from this software without specific prior written permission.
1198 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1199 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1200 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1201 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1202 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1203 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1204 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1205 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1206 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1207 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1209 +/* -----------------------------------------
1210 + * Include the ANTLR3 generated header file.
1212 +#include "DAAPLexer.h"
1213 +/* ----------------------------------------- */
1219 +/* MACROS that hide the C interface implementations from the
1220 + * generated code, which makes it a little more understandable to the human eye.
1221 + * I am very much against using C pre-processor macros for function calls and bits
1222 + * of code as you cannot see what is happening when single stepping in debuggers
1223 + * and so on. The exception (in my book at least) is for generated code, where you are
1224 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
1225 + * hides some indirect calls, but is always referring to the input stream. This is
1226 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
1227 + * the runtime interfaces without changing the generated code too often, without
1228 + * confusing the reader of the generated output, who may not wish to know the gory
1229 + * details of the interface inheritance.
1234 +/* Aids in accessing scopes for grammar programmers
1239 +#define SCOPE_TYPE(scope) pDAAPLexer_##scope##_SCOPE
1240 +#define SCOPE_STACK(scope) pDAAPLexer_##scope##Stack
1241 +#define SCOPE_TOP(scope) ctx->pDAAPLexer_##scope##Top
1242 +#define SCOPE_SIZE(scope) ctx->pDAAPLexer_##scope##Stack_limit
1243 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
1246 +/* Macros for accessing things in a lexer
1251 +#undef GETCHARINDEX
1253 +#undef GETCHARPOSITIONINLINE
1265 +#undef HASEXCEPTION
1273 +#undef BACKTRACKING
1276 +#undef HAVEPARSEDRULE
1285 +#define LEXER ctx->pLexer
1286 +#define RECOGNIZER LEXER->rec
1287 +#define LEXSTATE RECOGNIZER->state
1288 +#define TOKSOURCE LEXSTATE->tokSource
1289 +#define GETCHARINDEX() LEXER->getCharIndex(LEXER)
1290 +#define GETLINE() LEXER->getLine(LEXER)
1291 +#define GETTEXT() LEXER->getText(LEXER)
1292 +#define GETCHARPOSITIONINLINE() LEXER->getCharPositionInLine(LEXER)
1293 +#define EMIT() LEXSTATE->type = _type; LEXER->emit(LEXER)
1294 +#define EMITNEW(t) LEXER->emitNew(LEXER, t)
1295 +#define MATCHC(c) LEXER->matchc(LEXER, c)
1296 +#define MATCHS(s) LEXER->matchs(LEXER, s)
1297 +#define MATCHRANGE(c1,c2) LEXER->matchRange(LEXER, c1, c2)
1298 +#define MATCHANY() LEXER->matchAny(LEXER)
1299 +#define LTOKEN LEXSTATE->token
1300 +#define HASFAILED() (LEXSTATE->failed == ANTLR3_TRUE)
1301 +#define BACKTRACKING LEXSTATE->backtracking
1302 +#define FAILEDFLAG LEXSTATE->failed
1303 +#define INPUT LEXER->input
1304 +#define STRSTREAM INPUT
1305 +#define ISTREAM INPUT->istream
1306 +#define INDEX() ISTREAM->index(ISTREAM)
1307 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
1308 +#define EOF_TOKEN &(LEXSTATE->tokSource->eofToken)
1309 +#define HASEXCEPTION() (LEXSTATE->error == ANTLR3_TRUE)
1310 +#define EXCEPTION LEXSTATE->exception
1311 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
1312 +#define LRECOVER() LEXER->recover(LEXER)
1313 +#define MARK() ISTREAM->mark(ISTREAM)
1314 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
1315 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
1316 +#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si)
1317 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
1318 +#define PUSHSTREAM(str) LEXER->pushCharStream(LEXER, str)
1319 +#define POPSTREAM() LEXER->popCharStream(LEXER)
1320 +#define SETTEXT(str) LEXSTATE->text = str
1321 +#define SKIP() LEXSTATE->token = &(TOKSOURCE->skipToken)
1322 +#define USER1 LEXSTATE->user1
1323 +#define USER2 LEXSTATE->user2
1324 +#define USER3 LEXSTATE->user3
1325 +#define CUSTOM LEXSTATE->custom
1326 +#define RULEMEMO LEXSTATE->ruleMemo
1327 +#define DBG RECOGNIZER->debugger
1329 +/* If we have been told we can rely on the standard 8 bit or 16 bit input
1330 + * stream, then we can define our macros to use the direct pointers
1331 + * in the input object, which is much faster than indirect calls. This
1332 + * is really only significant to lexers with a lot of fragment rules (which
1333 + * do not place LA(1) in a temporary at the moment) and even then
1334 + * only if there is a lot of input (order of say 1M or so).
1336 +#if defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16)
1338 +# ifdef ANTLR3_INLINE_INPUT_ASCII
1340 +/* 8 bit "ASCII" (actually any 8 bit character set) */
1342 +# define NEXTCHAR ((pANTLR3_UINT8)(INPUT->nextChar))
1343 +# define DATAP ((pANTLR3_UINT8)(INPUT->data))
1347 +# define NEXTCHAR ((pANTLR3_UINT16)(INPUT->nextChar))
1348 +# define DATAP ((pANTLR3_UINT16)(INPUT->data))
1352 +# define LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1)))
1353 +# define CONSUME() \
1355 + if (NEXTCHAR < (DATAP + INPUT->sizeBuf)) \
1357 + INPUT->charPositionInLine++; \
1358 + if ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar) \
1361 + INPUT->charPositionInLine = 0; \
1362 + INPUT->currentLine = (void *)(NEXTCHAR + 1); \
1364 + INPUT->nextChar = (void *)(NEXTCHAR + 1); \
1370 +// Pick up the input character by calling the input stream implementation.
1372 +#define CONSUME() INPUT->istream->consume(INPUT->istream)
1373 +#define LA(n) INPUT->istream->_LA(INPUT->istream, n)
1376 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
1378 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
1379 + * then for the present you must use different names for your defines as these are hard coded
1380 + * in the code generator. It would be better not to use such names internally, and maybe
1381 + * we can change this in a forthcoming release. I deliberately do not #undef these
1382 + * here as this will at least give you a redefined error somewhere if they clash.
1384 +#define UP ANTLR3_TOKEN_UP
1385 +#define DOWN ANTLR3_TOKEN_DOWN
1386 +#define EOR ANTLR3_TOKEN_EOR
1387 +#define INVALID ANTLR3_TOKEN_INVALID
1390 +/* =============================================================================
1391 + * Functions to create and destroy scopes. First come the rule scopes, followed
1392 + * by the global declared scopes.
1397 +/* ============================================================================= */
1399 +/* =============================================================================
1400 + * Start of recognizer
1404 +/* Forward declare the locally static matching functions we have generated and any predicate functions.
1406 +static ANTLR3_INLINE void mQUOTE (pDAAPLexer ctx);
1407 +static ANTLR3_INLINE void mLPAR (pDAAPLexer ctx);
1408 +static ANTLR3_INLINE void mRPAR (pDAAPLexer ctx);
1409 +static ANTLR3_INLINE void mOPAND (pDAAPLexer ctx);
1410 +static ANTLR3_INLINE void mOPOR (pDAAPLexer ctx);
1411 +static ANTLR3_INLINE void mNEWLINE (pDAAPLexer ctx);
1412 +static ANTLR3_INLINE void mSTR (pDAAPLexer ctx);
1413 +static ANTLR3_INLINE void mESCAPED (pDAAPLexer ctx);
1414 +static ANTLR3_INLINE void mTokens (pDAAPLexer ctx);
1415 +static void DAAPLexerFree(pDAAPLexer ctx);
1417 +/* =========================================================================
1418 + * Lexer matching rules end.
1419 + * =========================================================================
1425 +DAAPLexerFree (pDAAPLexer ctx)
1427 + LEXER->free(LEXER);
1432 +/** \brief Name of the grammar file that generated this code
1434 +static const char fileName[] = "DAAP.g";
1436 +/** \brief Return the name of the grammar file that generated this code.
1438 +static const char * getGrammarFileName()
1443 +/** \brief Create a new lexer called DAAPLexer
1445 + * \param[in] instream Pointer to an initialized input stream
1447 + * - Success pDAAPLexer initialized for the lex start
1450 +ANTLR3_API pDAAPLexer DAAPLexerNew
1451 +(pANTLR3_INPUT_STREAM instream)
1453 + // See if we can create a new lexer with the standard constructor
1455 + return DAAPLexerNewSSD(instream, NULL);
1458 +/** \brief Create a new lexer called DAAPLexer
1460 + * \param[in] instream Pointer to an initialized input stream
1461 + * \param[state] state Previously created shared recognizer stat
1463 + * - Success pDAAPLexer initialized for the lex start
1466 +ANTLR3_API pDAAPLexer DAAPLexerNewSSD
1467 +(pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
1469 + pDAAPLexer ctx; // Context structure we will build and return
1471 + ctx = (pDAAPLexer) ANTLR3_CALLOC(1, sizeof(DAAPLexer));
1475 + // Failed to allocate memory for lexer context
1479 + /* -------------------------------------------------------------------
1480 + * Memory for basic structure is allocated, now to fill in
1481 + * in base ANTLR3 structures. We initialize the function pointers
1482 + * for the standard ANTLR3 lexer function set, but upon return
1483 + * from here, the programmer may set the pointers to provide custom
1484 + * implementations of each function.
1486 + * We don't use the macros defined in DAAPLexer.h here so you can get a sense
1487 + * of what goes where.
1490 + /* Create a base lexer, using the supplied input stream
1492 + ctx->pLexer = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state);
1494 + /* Check that we allocated the memory correctly
1496 + if (ctx->pLexer == NULL)
1501 + /* Install the implementation of our DAAPLexer interface
1503 + ctx->mQUOTE = mQUOTE;
1504 + ctx->mLPAR = mLPAR;
1505 + ctx->mRPAR = mRPAR;
1506 + ctx->mOPAND = mOPAND;
1507 + ctx->mOPOR = mOPOR;
1508 + ctx->mNEWLINE = mNEWLINE;
1510 + ctx->mESCAPED = mESCAPED;
1511 + ctx->mTokens = mTokens;
1513 + /** When the nextToken() call is made to this lexer's pANTLR3_TOKEN_SOURCE
1514 + * it will call mTokens() in this generated code, and will pass it the ctx
1515 + * pointer of this lexer, not the context of the base lexer, so store that now.
1517 + ctx->pLexer->ctx = ctx;
1519 + /**Install the token matching function
1521 + ctx->pLexer->mTokens = (void (*) (void *))(mTokens);
1523 + ctx->getGrammarFileName = getGrammarFileName;
1524 + ctx->free = DAAPLexerFree;
1530 + /* Return the newly built lexer to the caller
1536 +/* =========================================================================
1537 + * Functions to match the lexer grammar defined tokens from the input stream
1540 +// Comes from: 40:7: ( '\\'' )
1541 +/** \brief Lexer rule generated by ANTLR3
1543 + * $ANTLR start QUOTE
1545 + * Looks to match the characters the constitute the token QUOTE
1546 + * from the attached input stream.
1550 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1552 +static ANTLR3_INLINE
1553 +void mQUOTE(pDAAPLexer ctx)
1555 + ANTLR3_UINT32 _type;
1560 + // DAAP.g:40:7: ( '\\'' )
1561 + // DAAP.g:40:9: '\\''
1564 + if (HASEXCEPTION())
1572 + LEXSTATE->type = _type;
1574 + // This is where rules clean up and exit
1576 + goto ruleQUOTEEx; /* Prevent compiler warnings */
1580 +// $ANTLR end QUOTE
1582 +// Comes from: 41:6: ( '(' )
1583 +/** \brief Lexer rule generated by ANTLR3
1585 + * $ANTLR start LPAR
1587 + * Looks to match the characters the constitute the token LPAR
1588 + * from the attached input stream.
1592 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1594 +static ANTLR3_INLINE
1595 +void mLPAR(pDAAPLexer ctx)
1597 + ANTLR3_UINT32 _type;
1602 + // DAAP.g:41:6: ( '(' )
1603 + // DAAP.g:41:8: '('
1606 + if (HASEXCEPTION())
1614 + LEXSTATE->type = _type;
1616 + // This is where rules clean up and exit
1618 + goto ruleLPAREx; /* Prevent compiler warnings */
1624 +// Comes from: 42:6: ( ')' )
1625 +/** \brief Lexer rule generated by ANTLR3
1627 + * $ANTLR start RPAR
1629 + * Looks to match the characters the constitute the token RPAR
1630 + * from the attached input stream.
1634 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1636 +static ANTLR3_INLINE
1637 +void mRPAR(pDAAPLexer ctx)
1639 + ANTLR3_UINT32 _type;
1644 + // DAAP.g:42:6: ( ')' )
1645 + // DAAP.g:42:8: ')'
1648 + if (HASEXCEPTION())
1656 + LEXSTATE->type = _type;
1658 + // This is where rules clean up and exit
1660 + goto ruleRPAREx; /* Prevent compiler warnings */
1666 +// Comes from: 44:7: ( '+' | ' ' )
1667 +/** \brief Lexer rule generated by ANTLR3
1669 + * $ANTLR start OPAND
1671 + * Looks to match the characters the constitute the token OPAND
1672 + * from the attached input stream.
1676 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1678 +static ANTLR3_INLINE
1679 +void mOPAND(pDAAPLexer ctx)
1681 + ANTLR3_UINT32 _type;
1686 + // DAAP.g:44:7: ( '+' | ' ' )
1689 + if ( LA(1) == ' ' || LA(1) == '+' )
1697 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
1698 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
1700 + LRECOVER(); goto ruleOPANDEx;
1706 + LEXSTATE->type = _type;
1708 + // This is where rules clean up and exit
1710 + goto ruleOPANDEx; /* Prevent compiler warnings */
1714 +// $ANTLR end OPAND
1716 +// Comes from: 45:6: ( ',' )
1717 +/** \brief Lexer rule generated by ANTLR3
1719 + * $ANTLR start OPOR
1721 + * Looks to match the characters the constitute the token OPOR
1722 + * from the attached input stream.
1726 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1728 +static ANTLR3_INLINE
1729 +void mOPOR(pDAAPLexer ctx)
1731 + ANTLR3_UINT32 _type;
1736 + // DAAP.g:45:6: ( ',' )
1737 + // DAAP.g:45:8: ','
1740 + if (HASEXCEPTION())
1748 + LEXSTATE->type = _type;
1750 + // This is where rules clean up and exit
1752 + goto ruleOPOREx; /* Prevent compiler warnings */
1758 +// Comes from: 47:9: ( ( '\\r' )? '\\n' )
1759 +/** \brief Lexer rule generated by ANTLR3
1761 + * $ANTLR start NEWLINE
1763 + * Looks to match the characters the constitute the token NEWLINE
1764 + * from the attached input stream.
1768 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1770 +static ANTLR3_INLINE
1771 +void mNEWLINE(pDAAPLexer ctx)
1773 + ANTLR3_UINT32 _type;
1778 + // DAAP.g:47:9: ( ( '\\r' )? '\\n' )
1779 + // DAAP.g:47:11: ( '\\r' )? '\\n'
1782 + // DAAP.g:47:11: ( '\\r' )?
1797 + // DAAP.g:47:11: '\\r'
1800 + if (HASEXCEPTION())
1802 + goto ruleNEWLINEEx;
1812 + if (HASEXCEPTION())
1814 + goto ruleNEWLINEEx;
1820 + LEXSTATE->type = _type;
1822 + // This is where rules clean up and exit
1824 + goto ruleNEWLINEEx; /* Prevent compiler warnings */
1828 +// $ANTLR end NEWLINE
1830 +// Comes from: 55:2: ( QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE )
1831 +/** \brief Lexer rule generated by ANTLR3
1833 + * $ANTLR start STR
1835 + * Looks to match the characters the constitute the token STR
1836 + * from the attached input stream.
1840 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1842 +static ANTLR3_INLINE
1843 +void mSTR(pDAAPLexer ctx)
1845 + ANTLR3_UINT32 _type;
1846 + pANTLR3_COMMON_TOKEN esc;
1847 + ANTLR3_UINT32 reg;
1854 + pANTLR3_STRING unesc = GETTEXT()->factory->newRaw(GETTEXT()->factory);
1856 + // DAAP.g:55:2: ( QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE )
1857 + // DAAP.g:55:4: QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE
1859 + /* 55:4: QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE */
1861 + if (HASEXCEPTION())
1866 + // DAAP.g:55:10: (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+
1874 + /* dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState)
1876 + int LA2_0 = LA(1);
1877 + if ( (((LA2_0 >= 0x0000) && (LA2_0 <= '&')) || ((LA2_0 >= '(') && (LA2_0 <= '[')) || ((LA2_0 >= ']') && (LA2_0 <= 0xFFFF))) )
1881 + else if ( (LA2_0 == '\\') )
1890 + // DAAP.g:55:12: reg=~ ( '\\\\' | '\\'' )
1893 + if ( ((LA(1) >= 0x0000) && (LA(1) <= '&')) || ((LA(1) >= '(') && (LA(1) <= '[')) || ((LA(1) >= ']') && (LA(1) <= 0xFFFF)) )
1901 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
1902 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
1904 + LRECOVER(); goto ruleSTREx;
1908 + unesc->addc(unesc, reg);
1914 + // DAAP.g:56:6: esc= ESCAPED
1916 + /* 56:6: esc= ESCAPED */
1918 + ANTLR3_MARKER escStart118 = GETCHARINDEX();
1920 + if (HASEXCEPTION())
1925 + esc = LEXSTATE->tokFactory->newToken(LEXSTATE->tokFactory);
1926 + esc->setType(esc, ANTLR3_TOKEN_INVALID);
1927 + esc->setStartIndex(esc, escStart118);
1928 + esc->setStopIndex(esc, GETCHARINDEX()-1);
1929 + esc->input = INPUT;
1932 + unesc->appendS(unesc, GETTEXT());
1944 + /* mismatchedSetEx()
1947 + EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
1948 + EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
1955 + loop2: ; /* Jump to here if this rule does not match */
1957 + /* 55:4: QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE */
1959 + if (HASEXCEPTION())
1970 + LEXSTATE->type = _type;
1972 + // This is where rules clean up and exit
1974 + goto ruleSTREx; /* Prevent compiler warnings */
1982 +// Comes from: 59:9: ( '\\\\' ( '\\\\' | '\\'' ) )
1983 +/** \brief Lexer rule generated by ANTLR3
1985 + * $ANTLR start ESCAPED
1987 + * Looks to match the characters the constitute the token ESCAPED
1988 + * from the attached input stream.
1992 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1994 +static ANTLR3_INLINE
1995 +void mESCAPED(pDAAPLexer ctx)
1997 + ANTLR3_UINT32 _type;
2000 + // DAAP.g:59:9: ( '\\\\' ( '\\\\' | '\\'' ) )
2001 + // DAAP.g:59:11: '\\\\' ( '\\\\' | '\\'' )
2004 + if (HASEXCEPTION())
2006 + goto ruleESCAPEDEx;
2010 + // DAAP.g:60:3: ( '\\\\' | '\\'' )
2028 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
2029 + EXCEPTION->message = (void *)"";
2030 + EXCEPTION->decisionNum = 3;
2031 + EXCEPTION->state = 0;
2034 + goto ruleESCAPEDEx;
2040 + // DAAP.g:60:5: '\\\\'
2043 + if (HASEXCEPTION())
2045 + goto ruleESCAPEDEx;
2049 + SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\\"));
2055 + // DAAP.g:61:5: '\\''
2058 + if (HASEXCEPTION())
2060 + goto ruleESCAPEDEx;
2064 + SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\'"));
2077 + // This is where rules clean up and exit
2079 + goto ruleESCAPEDEx; /* Prevent compiler warnings */
2083 +// $ANTLR end ESCAPED
2085 +/** This is the entry point in to the lexer from an object that
2086 + * wants to generate the next token, such as a pCOMMON_TOKEN_STREAM
2089 +mTokens(pDAAPLexer ctx)
2092 + // DAAP.g:1:8: ( QUOTE | LPAR | RPAR | OPAND | OPOR | NEWLINE | STR )
2094 + ANTLR3_UINT32 alt4;
2104 + int LA4_1 = LA(2);
2105 + if ( (((LA4_1 >= 0x0000) && (LA4_1 <= '&')) || ((LA4_1 >= '(') && (LA4_1 <= 0xFFFF))) )
2145 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
2146 + EXCEPTION->message = (void *)"";
2147 + EXCEPTION->decisionNum = 4;
2148 + EXCEPTION->state = 0;
2151 + goto ruleTokensEx;
2157 + // DAAP.g:1:10: QUOTE
2161 + if (HASEXCEPTION())
2163 + goto ruleTokensEx;
2170 + // DAAP.g:1:16: LPAR
2174 + if (HASEXCEPTION())
2176 + goto ruleTokensEx;
2183 + // DAAP.g:1:21: RPAR
2187 + if (HASEXCEPTION())
2189 + goto ruleTokensEx;
2196 + // DAAP.g:1:26: OPAND
2200 + if (HASEXCEPTION())
2202 + goto ruleTokensEx;
2209 + // DAAP.g:1:32: OPOR
2213 + if (HASEXCEPTION())
2215 + goto ruleTokensEx;
2222 + // DAAP.g:1:37: NEWLINE
2224 + /* 1:37: NEWLINE */
2226 + if (HASEXCEPTION())
2228 + goto ruleTokensEx;
2235 + // DAAP.g:1:45: STR
2239 + if (HASEXCEPTION())
2241 + goto ruleTokensEx;
2252 + goto ruleTokensEx; /* Prevent compiler warnings */
2256 +/* =========================================================================
2257 + * Lexer matching rules end.
2258 + * =========================================================================
2260 +/* End of Lexer code
2261 + * ================================================
2262 + * ================================================
2267 + * =============================================================================
2269 diff --git a/src/pregen/DAAPLexer.h b/src/pregen/DAAPLexer.h
2270 new file mode 100644
2271 index 0000000..ba8f58b
2273 +++ b/src/pregen/DAAPLexer.h
2276 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
2278 + * - From the grammar source file : DAAP.g
2279 + * - On : 2014-09-30 21:42:40
2280 + * - for the lexer : DAAPLexerLexer *
2281 + * Editing it, at least manually, is not wise.
2283 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
2286 + * The lexer DAAPLexer has the callable functions (rules) shown below,
2287 + * which will invoke the code for the associated rule in the source grammar
2288 + * assuming that the input stream is pointing to a token/text stream that could begin
2291 + * For instance if you call the first (topmost) rule in a parser grammar, you will
2292 + * get the results of a full parse, but calling a rule half way through the grammar will
2293 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
2294 + * in editors and so on.
2296 + * The parser entry points are called indirectly (by function pointer to function) via
2297 + * a parser context typedef pDAAPLexer, which is returned from a call to DAAPLexerNew().
2299 + * As this is a generated lexer, it is unlikely you will call it 'manually'. However
2300 + * the methods are provided anyway.
2301 + * * The methods in pDAAPLexer are as follows:
2303 + * - void pDAAPLexer->QUOTE(pDAAPLexer)
2304 + * - void pDAAPLexer->LPAR(pDAAPLexer)
2305 + * - void pDAAPLexer->RPAR(pDAAPLexer)
2306 + * - void pDAAPLexer->OPAND(pDAAPLexer)
2307 + * - void pDAAPLexer->OPOR(pDAAPLexer)
2308 + * - void pDAAPLexer->NEWLINE(pDAAPLexer)
2309 + * - void pDAAPLexer->STR(pDAAPLexer)
2310 + * - void pDAAPLexer->ESCAPED(pDAAPLexer)
2311 + * - void pDAAPLexer->Tokens(pDAAPLexer)
2313 + * The return type for any particular rule is of course determined by the source
2316 +// [The "BSD licence"]
2317 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
2318 +// http://www.temporal-wave.com
2319 +// http://www.linkedin.com/in/jimidle
2321 +// All rights reserved.
2323 +// Redistribution and use in source and binary forms, with or without
2324 +// modification, are permitted provided that the following conditions
2326 +// 1. Redistributions of source code must retain the above copyright
2327 +// notice, this list of conditions and the following disclaimer.
2328 +// 2. Redistributions in binary form must reproduce the above copyright
2329 +// notice, this list of conditions and the following disclaimer in the
2330 +// documentation and/or other materials provided with the distribution.
2331 +// 3. The name of the author may not be used to endorse or promote products
2332 +// derived from this software without specific prior written permission.
2334 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2335 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2336 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2337 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2338 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2339 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2340 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2341 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2342 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2343 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2345 +#ifndef _DAAPLexer_H
2346 +#define _DAAPLexer_H
2347 +/* =============================================================================
2348 + * Standard antlr3 C runtime definitions
2350 +#include <antlr3.h>
2352 +/* End of standard antlr 3 runtime definitions
2353 + * =============================================================================
2360 +// Forward declare the context typedef so that we can use it before it is
2361 +// properly defined. Delegators and delegates (from import statements) are
2362 +// interdependent and their context structures contain pointers to each other
2363 +// C only allows such things to be declared if you pre-declare the typedef.
2365 +typedef struct DAAPLexer_Ctx_struct DAAPLexer, * pDAAPLexer;
2369 +#ifdef ANTLR3_WINDOWS
2370 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
2371 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
2372 +// initialized but unused variable - tree rewrite variables declared but not needed
2373 +// Unreferenced local variable - lexer rule declares but does not always use _type
2374 +// potentially unitialized variable used - retval always returned from a rule
2375 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
2377 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
2378 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
2379 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
2380 +// this is a matter of orthogonality hence I disable that one.
2382 +#pragma warning( disable : 4100 )
2383 +#pragma warning( disable : 4101 )
2384 +#pragma warning( disable : 4127 )
2385 +#pragma warning( disable : 4189 )
2386 +#pragma warning( disable : 4505 )
2387 +#pragma warning( disable : 4701 )
2390 +/** Context tracking structure for DAAPLexer
2392 +struct DAAPLexer_Ctx_struct
2394 + /** Built in ANTLR3 context tracker contains all the generic elements
2395 + * required for context tracking.
2397 + pANTLR3_LEXER pLexer;
2400 + void (*mQUOTE) (struct DAAPLexer_Ctx_struct * ctx);
2401 + void (*mLPAR) (struct DAAPLexer_Ctx_struct * ctx);
2402 + void (*mRPAR) (struct DAAPLexer_Ctx_struct * ctx);
2403 + void (*mOPAND) (struct DAAPLexer_Ctx_struct * ctx);
2404 + void (*mOPOR) (struct DAAPLexer_Ctx_struct * ctx);
2405 + void (*mNEWLINE) (struct DAAPLexer_Ctx_struct * ctx);
2406 + void (*mSTR) (struct DAAPLexer_Ctx_struct * ctx);
2407 + void (*mESCAPED) (struct DAAPLexer_Ctx_struct * ctx);
2408 + void (*mTokens) (struct DAAPLexer_Ctx_struct * ctx); const char * (*getGrammarFileName)();
2409 + void (*free) (struct DAAPLexer_Ctx_struct * ctx);
2413 +// Function protoypes for the constructor functions that external translation units
2414 +// such as delegators and delegates may wish to call.
2416 +ANTLR3_API pDAAPLexer DAAPLexerNew (pANTLR3_INPUT_STREAM instream);
2417 +ANTLR3_API pDAAPLexer DAAPLexerNewSSD (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
2419 +/** Symbolic definitions of all the tokens that the lexer will work with.
2422 + * Antlr will define EOF, but we can't use that as it it is too common in
2423 + * in C header files and that would be confusing. There is no way to filter this out at the moment
2424 + * so we just undef it here for now. That isn't the value we get back from C recognizers
2425 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
2444 +#define EOF ANTLR3_TOKEN_EOF
2447 +#ifndef TOKENSOURCE
2448 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
2451 +/* End of token definitions for DAAPLexer
2452 + * =============================================================================
2462 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
2463 diff --git a/src/pregen/DAAPParser.c b/src/pregen/DAAPParser.c
2464 new file mode 100644
2465 index 0000000..6d0239d
2467 +++ b/src/pregen/DAAPParser.c
2470 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
2472 + * - From the grammar source file : DAAP.g
2473 + * - On : 2014-09-30 21:42:39
2474 + * - for the parser : DAAPParserParser *
2475 + * Editing it, at least manually, is not wise.
2477 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
2481 +// [The "BSD licence"]
2482 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
2483 +// http://www.temporal-wave.com
2484 +// http://www.linkedin.com/in/jimidle
2486 +// All rights reserved.
2488 +// Redistribution and use in source and binary forms, with or without
2489 +// modification, are permitted provided that the following conditions
2491 +// 1. Redistributions of source code must retain the above copyright
2492 +// notice, this list of conditions and the following disclaimer.
2493 +// 2. Redistributions in binary form must reproduce the above copyright
2494 +// notice, this list of conditions and the following disclaimer in the
2495 +// documentation and/or other materials provided with the distribution.
2496 +// 3. The name of the author may not be used to endorse or promote products
2497 +// derived from this software without specific prior written permission.
2499 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2500 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2501 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2502 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2503 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2504 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2505 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2506 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2507 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2508 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2510 +/* -----------------------------------------
2511 + * Include the ANTLR3 generated header file.
2513 +#include "DAAPParser.h"
2514 +/* ----------------------------------------- */
2520 +/* MACROS that hide the C interface implementations from the
2521 + * generated code, which makes it a little more understandable to the human eye.
2522 + * I am very much against using C pre-processor macros for function calls and bits
2523 + * of code as you cannot see what is happening when single stepping in debuggers
2524 + * and so on. The exception (in my book at least) is for generated code, where you are
2525 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
2526 + * hides some indirect calls, but is always referring to the input stream. This is
2527 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
2528 + * the runtime interfaces without changing the generated code too often, without
2529 + * confusing the reader of the generated output, who may not wish to know the gory
2530 + * details of the interface inheritance.
2535 +/* Aids in accessing scopes for grammar programmers
2540 +#define SCOPE_TYPE(scope) pDAAPParser_##scope##_SCOPE
2541 +#define SCOPE_STACK(scope) pDAAPParser_##scope##Stack
2542 +#define SCOPE_TOP(scope) ctx->pDAAPParser_##scope##Top
2543 +#define SCOPE_SIZE(scope) ctx->pDAAPParser_##scope##Stack_limit
2544 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
2546 +/* Macros for accessing things in the parser
2551 +#undef HAVEPARSEDRULE
2555 +#undef HASEXCEPTION
2563 +#undef PREPORTERROR
2571 +#undef PERRORRECOVERY
2574 +#undef RECOVERFROMMISMATCHEDSET
2575 +#undef RECOVERFROMMISMATCHEDELEMENT
2582 +#define PARSER ctx->pParser
2583 +#define RECOGNIZER PARSER->rec
2584 +#define PSRSTATE RECOGNIZER->state
2585 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
2586 +#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si)
2587 +#define INPUT PARSER->tstream
2588 +#define STRSTREAM INPUT
2589 +#define ISTREAM INPUT->istream
2590 +#define INDEX() ISTREAM->index(INPUT->istream)
2591 +#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE)
2592 +#define EXCEPTION PSRSTATE->exception
2593 +#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs)
2594 +#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER)
2595 +#define FOLLOWSTACK PSRSTATE->following
2596 +#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
2597 +#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK)
2598 +#define PRECOVER() RECOGNIZER->recover(RECOGNIZER)
2599 +#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER)
2600 +#define LA(n) INPUT->istream->_LA(ISTREAM, n)
2601 +#define LT(n) INPUT->_LT(INPUT, n)
2602 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
2603 +#define CONSUME() ISTREAM->consume(ISTREAM)
2604 +#define MARK() ISTREAM->mark(ISTREAM)
2605 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
2606 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
2607 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
2608 +#define PERRORRECOVERY PSRSTATE->errorRecovery
2609 +#define FAILEDFLAG PSRSTATE->failed
2610 +#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE)
2611 +#define BACKTRACKING PSRSTATE->backtracking
2612 +#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
2613 +#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
2614 +#define ADAPTOR ctx->adaptor
2615 +#define RULEMEMO PSRSTATE->ruleMemo
2616 +#define DBG RECOGNIZER->debugger
2618 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
2620 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
2621 + * then for the present you must use different names for your defines as these are hard coded
2622 + * in the code generator. It would be better not to use such names internally, and maybe
2623 + * we can change this in a forthcoming release. I deliberately do not #undef these
2624 + * here as this will at least give you a redefined error somewhere if they clash.
2626 +#define UP ANTLR3_TOKEN_UP
2627 +#define DOWN ANTLR3_TOKEN_DOWN
2628 +#define EOR ANTLR3_TOKEN_EOR
2629 +#define INVALID ANTLR3_TOKEN_INVALID
2632 +/* =============================================================================
2633 + * Functions to create and destroy scopes. First come the rule scopes, followed
2634 + * by the global declared scopes.
2639 +/* ============================================================================= */
2641 +/* =============================================================================
2642 + * Start of recognizer
2647 +/** \brief Table of all token names in symbolic order, mainly used for
2648 + * error reporting.
2650 +pANTLR3_UINT8 DAAPParserTokenNames[8+4]
2652 + (pANTLR3_UINT8) "<invalid>", /* String to print to indicate an invalid token */
2653 + (pANTLR3_UINT8) "<EOR>",
2654 + (pANTLR3_UINT8) "<DOWN>",
2655 + (pANTLR3_UINT8) "<UP>",
2656 + (pANTLR3_UINT8) "NEWLINE",
2657 + (pANTLR3_UINT8) "OPOR",
2658 + (pANTLR3_UINT8) "OPAND",
2659 + (pANTLR3_UINT8) "LPAR",
2660 + (pANTLR3_UINT8) "RPAR",
2661 + (pANTLR3_UINT8) "STR",
2662 + (pANTLR3_UINT8) "QUOTE",
2663 + (pANTLR3_UINT8) "ESCAPED"
2668 +// Forward declare the locally static matching functions we have generated.
2670 +static DAAPParser_query_return query (pDAAPParser ctx);
2671 +static DAAPParser_expr_return expr (pDAAPParser ctx);
2672 +static DAAPParser_aexpr_return aexpr (pDAAPParser ctx);
2673 +static DAAPParser_crit_return crit (pDAAPParser ctx);
2674 +static void DAAPParserFree(pDAAPParser ctx);
2675 +/* For use in tree output where we are accumulating rule labels via label += ruleRef
2676 + * we need a function that knows how to free a return scope when the list is destroyed.
2677 + * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
2679 +static void ANTLR3_CDECL freeScope(void * scope)
2681 + ANTLR3_FREE(scope);
2684 +/** \brief Name of the grammar file that generated this code
2686 +static const char fileName[] = "DAAP.g";
2688 +/** \brief Return the name of the grammar file that generated this code.
2690 +static const char * getGrammarFileName()
2694 +/** \brief Create a new DAAPParser parser and return a context for it.
2696 + * \param[in] instream Pointer to an input stream interface.
2698 + * \return Pointer to new parser context upon success.
2700 +ANTLR3_API pDAAPParser
2701 +DAAPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream)
2703 + // See if we can create a new parser with the standard constructor
2705 + return DAAPParserNewSSD(instream, NULL);
2708 +/** \brief Create a new DAAPParser parser and return a context for it.
2710 + * \param[in] instream Pointer to an input stream interface.
2712 + * \return Pointer to new parser context upon success.
2714 +ANTLR3_API pDAAPParser
2715 +DAAPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
2717 + pDAAPParser ctx; /* Context structure we will build and return */
2719 + ctx = (pDAAPParser) ANTLR3_CALLOC(1, sizeof(DAAPParser));
2723 + // Failed to allocate memory for parser context
2728 + /* -------------------------------------------------------------------
2729 + * Memory for basic structure is allocated, now to fill in
2730 + * the base ANTLR3 structures. We initialize the function pointers
2731 + * for the standard ANTLR3 parser function set, but upon return
2732 + * from here, the programmer may set the pointers to provide custom
2733 + * implementations of each function.
2735 + * We don't use the macros defined in DAAPParser.h here, in order that you can get a sense
2736 + * of what goes where.
2739 + /* Create a base parser/recognizer, using the supplied token stream
2741 + ctx->pParser = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state);
2742 + /* Install the implementation of our DAAPParser interface
2744 + ctx->query = query;
2746 + ctx->aexpr = aexpr;
2748 + ctx->free = DAAPParserFree;
2749 + ctx->getGrammarFileName = getGrammarFileName;
2751 + /* Install the scope pushing methods.
2753 + ADAPTOR = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory);
2754 + ctx->vectors = antlr3VectorFactoryNew(0);
2758 + /* Install the token table
2760 + PSRSTATE->tokenNames = DAAPParserTokenNames;
2763 + /* Return the newly built parser to the caller
2768 +/** Free the parser resources
2771 + DAAPParserFree(pDAAPParser ctx)
2773 + /* Free any scope memory
2776 + ctx->vectors->close(ctx->vectors);
2777 + /* We created the adaptor so we must free it
2779 + ADAPTOR->free(ADAPTOR);
2780 + // Free this parser
2782 + ctx->pParser->free(ctx->pParser);
2785 + /* Everything is released, so we can return
2790 +/** Return token names used by this parser
2792 + * The returned pointer is used as an index into the token names table (using the token
2793 + * number as the index).
2795 + * \return Pointer to first char * in the table.
2797 +static pANTLR3_UINT8 *getTokenNames()
2799 + return DAAPParserTokenNames;
2803 +/* Declare the bitsets
2806 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_query42 */
2807 +static ANTLR3_BITWORD FOLLOW_expr_in_query42_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) };
2808 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_query42 = { FOLLOW_expr_in_query42_bits, 1 };
2809 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NEWLINE_in_query44 */
2810 +static ANTLR3_BITWORD FOLLOW_NEWLINE_in_query44_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000000) };
2811 +static ANTLR3_BITSET_LIST FOLLOW_NEWLINE_in_query44 = { FOLLOW_NEWLINE_in_query44_bits, 1 };
2812 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_EOF_in_query47 */
2813 +static ANTLR3_BITWORD FOLLOW_EOF_in_query47_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
2814 +static ANTLR3_BITSET_LIST FOLLOW_EOF_in_query47 = { FOLLOW_EOF_in_query47_bits, 1 };
2815 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expr62 */
2816 +static ANTLR3_BITWORD FOLLOW_aexpr_in_expr62_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) };
2817 +static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expr62 = { FOLLOW_aexpr_in_expr62_bits, 1 };
2818 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OPOR_in_expr65 */
2819 +static ANTLR3_BITWORD FOLLOW_OPOR_in_expr65_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) };
2820 +static ANTLR3_BITSET_LIST FOLLOW_OPOR_in_expr65 = { FOLLOW_OPOR_in_expr65_bits, 1 };
2821 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expr68 */
2822 +static ANTLR3_BITWORD FOLLOW_aexpr_in_expr68_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) };
2823 +static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expr68 = { FOLLOW_aexpr_in_expr68_bits, 1 };
2824 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_aexpr80 */
2825 +static ANTLR3_BITWORD FOLLOW_crit_in_aexpr80_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) };
2826 +static ANTLR3_BITSET_LIST FOLLOW_crit_in_aexpr80 = { FOLLOW_crit_in_aexpr80_bits, 1 };
2827 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OPAND_in_aexpr83 */
2828 +static ANTLR3_BITWORD FOLLOW_OPAND_in_aexpr83_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) };
2829 +static ANTLR3_BITSET_LIST FOLLOW_OPAND_in_aexpr83 = { FOLLOW_OPAND_in_aexpr83_bits, 1 };
2830 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_aexpr86 */
2831 +static ANTLR3_BITWORD FOLLOW_crit_in_aexpr86_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) };
2832 +static ANTLR3_BITSET_LIST FOLLOW_crit_in_aexpr86 = { FOLLOW_crit_in_aexpr86_bits, 1 };
2833 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_LPAR_in_crit98 */
2834 +static ANTLR3_BITWORD FOLLOW_LPAR_in_crit98_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) };
2835 +static ANTLR3_BITSET_LIST FOLLOW_LPAR_in_crit98 = { FOLLOW_LPAR_in_crit98_bits, 1 };
2836 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_crit100 */
2837 +static ANTLR3_BITWORD FOLLOW_expr_in_crit100_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000100) };
2838 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_crit100 = { FOLLOW_expr_in_crit100_bits, 1 };
2839 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_RPAR_in_crit102 */
2840 +static ANTLR3_BITWORD FOLLOW_RPAR_in_crit102_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
2841 +static ANTLR3_BITSET_LIST FOLLOW_RPAR_in_crit102 = { FOLLOW_RPAR_in_crit102_bits, 1 };
2842 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_crit112 */
2843 +static ANTLR3_BITWORD FOLLOW_STR_in_crit112_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
2844 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_crit112 = { FOLLOW_STR_in_crit112_bits, 1 };
2849 +/* ==============================================
2853 + * $ANTLR start query
2854 + * DAAP.g:27:1: query : expr ( NEWLINE )? EOF -> expr ;
2856 +static DAAPParser_query_return
2857 +query(pDAAPParser ctx)
2859 + DAAPParser_query_return retval;
2861 + pANTLR3_BASE_TREE root_0;
2863 + pANTLR3_COMMON_TOKEN NEWLINE2;
2864 + pANTLR3_COMMON_TOKEN EOF3;
2865 + DAAPParser_expr_return expr1;
2866 + #undef RETURN_TYPE_expr1
2867 + #define RETURN_TYPE_expr1 DAAPParser_expr_return
2869 + pANTLR3_BASE_TREE NEWLINE2_tree;
2870 + pANTLR3_BASE_TREE EOF3_tree;
2871 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NEWLINE;
2872 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_EOF;
2873 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr;
2874 + /* Initialize rule variables
2882 + expr1.tree = NULL;
2884 + retval.start = LT(1); retval.stop = retval.start;
2886 + NEWLINE2_tree = NULL;
2889 + stream_NEWLINE = NULL;
2890 + #define CREATE_stream_NEWLINE if (stream_NEWLINE == NULL) {stream_NEWLINE = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NEWLINE"); }
2891 + stream_EOF = NULL;
2892 + #define CREATE_stream_EOF if (stream_EOF == NULL) {stream_EOF = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token EOF"); }
2893 + stream_expr = NULL;
2894 + #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); }
2896 + retval.tree = NULL;
2898 + // DAAP.g:27:7: ( expr ( NEWLINE )? EOF -> expr )
2899 + // DAAP.g:27:9: expr ( NEWLINE )? EOF
2901 + FOLLOWPUSH(FOLLOW_expr_in_query42);
2905 + if (HASEXCEPTION())
2910 + CREATE_stream_expr; stream_expr->add(stream_expr, expr1.tree, NULL);
2912 + // DAAP.g:27:14: ( NEWLINE )?
2927 + // DAAP.g:27:14: NEWLINE
2929 + NEWLINE2 = (pANTLR3_COMMON_TOKEN) MATCHT(NEWLINE, &FOLLOW_NEWLINE_in_query44);
2930 + if (HASEXCEPTION())
2935 + CREATE_stream_NEWLINE; stream_NEWLINE->add(stream_NEWLINE, NEWLINE2, NULL);
2943 + EOF3 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_query47);
2944 + if (HASEXCEPTION())
2949 + CREATE_stream_EOF; stream_EOF->add(stream_EOF, EOF3, NULL);
2956 + * rule labels : retval
2957 + * token list labels :
2958 + * rule list labels :
2961 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
2963 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
2965 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
2966 + retval.tree = root_0;
2969 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
2973 + retval.tree = root_0; // set result root
2974 + if (stream_retval != NULL) stream_retval->free(stream_retval);
2983 + // This is where rules clean up and exit
2985 + goto rulequeryEx; /* Prevent compiler warnings */
2987 + retval.stop = LT(-1);
2989 + retval.stop = LT(-1);
2990 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
2991 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
2992 + if (stream_NEWLINE != NULL) stream_NEWLINE->free(stream_NEWLINE);
2993 + if (stream_EOF != NULL) stream_EOF->free(stream_EOF);
2994 + if (stream_expr != NULL) stream_expr->free(stream_expr);
2996 + if (HASEXCEPTION())
3000 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
3006 +/* $ANTLR end query */
3009 + * $ANTLR start expr
3010 + * DAAP.g:30:1: expr : aexpr ( OPOR aexpr )* ;
3012 +static DAAPParser_expr_return
3013 +expr(pDAAPParser ctx)
3015 + DAAPParser_expr_return retval;
3017 + pANTLR3_BASE_TREE root_0;
3019 + pANTLR3_COMMON_TOKEN OPOR5;
3020 + DAAPParser_aexpr_return aexpr4;
3021 + #undef RETURN_TYPE_aexpr4
3022 + #define RETURN_TYPE_aexpr4 DAAPParser_aexpr_return
3024 + DAAPParser_aexpr_return aexpr6;
3025 + #undef RETURN_TYPE_aexpr6
3026 + #define RETURN_TYPE_aexpr6 DAAPParser_aexpr_return
3028 + pANTLR3_BASE_TREE OPOR5_tree;
3030 + /* Initialize rule variables
3037 + aexpr4.tree = NULL;
3039 + aexpr6.tree = NULL;
3041 + retval.start = LT(1); retval.stop = retval.start;
3043 + OPOR5_tree = NULL;
3046 + retval.tree = NULL;
3048 + // DAAP.g:30:6: ( aexpr ( OPOR aexpr )* )
3049 + // DAAP.g:30:8: aexpr ( OPOR aexpr )*
3051 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
3053 + FOLLOWPUSH(FOLLOW_aexpr_in_expr62);
3054 + aexpr4=aexpr(ctx);
3057 + if (HASEXCEPTION())
3062 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr4.tree);
3064 + // DAAP.g:30:14: ( OPOR aexpr )*
3082 + // DAAP.g:30:15: OPOR aexpr
3084 + OPOR5 = (pANTLR3_COMMON_TOKEN) MATCHT(OPOR, &FOLLOW_OPOR_in_expr65);
3085 + if (HASEXCEPTION())
3090 + OPOR5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OPOR5));
3091 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OPOR5_tree, root_0));
3093 + FOLLOWPUSH(FOLLOW_aexpr_in_expr68);
3094 + aexpr6=aexpr(ctx);
3097 + if (HASEXCEPTION())
3102 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree);
3108 + goto loop2; /* break out of the loop */
3112 + loop2: ; /* Jump out to here if this rule does not match */
3120 + // This is where rules clean up and exit
3122 + goto ruleexprEx; /* Prevent compiler warnings */
3124 + retval.stop = LT(-1);
3126 + retval.stop = LT(-1);
3127 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
3128 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
3130 + if (HASEXCEPTION())
3134 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
3140 +/* $ANTLR end expr */
3143 + * $ANTLR start aexpr
3144 + * DAAP.g:33:1: aexpr : crit ( OPAND crit )* ;
3146 +static DAAPParser_aexpr_return
3147 +aexpr(pDAAPParser ctx)
3149 + DAAPParser_aexpr_return retval;
3151 + pANTLR3_BASE_TREE root_0;
3153 + pANTLR3_COMMON_TOKEN OPAND8;
3154 + DAAPParser_crit_return crit7;
3155 + #undef RETURN_TYPE_crit7
3156 + #define RETURN_TYPE_crit7 DAAPParser_crit_return
3158 + DAAPParser_crit_return crit9;
3159 + #undef RETURN_TYPE_crit9
3160 + #define RETURN_TYPE_crit9 DAAPParser_crit_return
3162 + pANTLR3_BASE_TREE OPAND8_tree;
3164 + /* Initialize rule variables
3171 + crit7.tree = NULL;
3173 + crit9.tree = NULL;
3175 + retval.start = LT(1); retval.stop = retval.start;
3177 + OPAND8_tree = NULL;
3180 + retval.tree = NULL;
3182 + // DAAP.g:33:7: ( crit ( OPAND crit )* )
3183 + // DAAP.g:33:9: crit ( OPAND crit )*
3185 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
3187 + FOLLOWPUSH(FOLLOW_crit_in_aexpr80);
3191 + if (HASEXCEPTION())
3196 + ADAPTOR->addChild(ADAPTOR, root_0, crit7.tree);
3198 + // DAAP.g:33:14: ( OPAND crit )*
3216 + // DAAP.g:33:15: OPAND crit
3218 + OPAND8 = (pANTLR3_COMMON_TOKEN) MATCHT(OPAND, &FOLLOW_OPAND_in_aexpr83);
3219 + if (HASEXCEPTION())
3224 + OPAND8_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OPAND8));
3225 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OPAND8_tree, root_0));
3227 + FOLLOWPUSH(FOLLOW_crit_in_aexpr86);
3231 + if (HASEXCEPTION())
3236 + ADAPTOR->addChild(ADAPTOR, root_0, crit9.tree);
3242 + goto loop3; /* break out of the loop */
3246 + loop3: ; /* Jump out to here if this rule does not match */
3254 + // This is where rules clean up and exit
3256 + goto ruleaexprEx; /* Prevent compiler warnings */
3258 + retval.stop = LT(-1);
3260 + retval.stop = LT(-1);
3261 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
3262 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
3264 + if (HASEXCEPTION())
3268 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
3274 +/* $ANTLR end aexpr */
3277 + * $ANTLR start crit
3278 + * DAAP.g:36:1: crit : ( LPAR expr RPAR -> expr | STR );
3280 +static DAAPParser_crit_return
3281 +crit(pDAAPParser ctx)
3283 + DAAPParser_crit_return retval;
3285 + pANTLR3_BASE_TREE root_0;
3287 + pANTLR3_COMMON_TOKEN LPAR10;
3288 + pANTLR3_COMMON_TOKEN RPAR12;
3289 + pANTLR3_COMMON_TOKEN STR13;
3290 + DAAPParser_expr_return expr11;
3291 + #undef RETURN_TYPE_expr11
3292 + #define RETURN_TYPE_expr11 DAAPParser_expr_return
3294 + pANTLR3_BASE_TREE LPAR10_tree;
3295 + pANTLR3_BASE_TREE RPAR12_tree;
3296 + pANTLR3_BASE_TREE STR13_tree;
3297 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_RPAR;
3298 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_LPAR;
3299 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr;
3300 + /* Initialize rule variables
3309 + expr11.tree = NULL;
3311 + retval.start = LT(1); retval.stop = retval.start;
3313 + LPAR10_tree = NULL;
3314 + RPAR12_tree = NULL;
3315 + STR13_tree = NULL;
3317 + stream_RPAR = NULL;
3318 + #define CREATE_stream_RPAR if (stream_RPAR == NULL) {stream_RPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token RPAR"); }
3319 + stream_LPAR = NULL;
3320 + #define CREATE_stream_LPAR if (stream_LPAR == NULL) {stream_LPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token LPAR"); }
3321 + stream_expr = NULL;
3322 + #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); }
3324 + retval.tree = NULL;
3327 + // DAAP.g:36:6: ( LPAR expr RPAR -> expr | STR )
3329 + ANTLR3_UINT32 alt4;
3348 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
3349 + EXCEPTION->message = (void *)"";
3350 + EXCEPTION->decisionNum = 4;
3351 + EXCEPTION->state = 0;
3360 + // DAAP.g:36:8: LPAR expr RPAR
3362 + LPAR10 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit98);
3363 + if (HASEXCEPTION())
3368 + CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR10, NULL);
3370 + FOLLOWPUSH(FOLLOW_expr_in_crit100);
3374 + if (HASEXCEPTION())
3379 + CREATE_stream_expr; stream_expr->add(stream_expr, expr11.tree, NULL);
3380 + RPAR12 = (pANTLR3_COMMON_TOKEN) MATCHT(RPAR, &FOLLOW_RPAR_in_crit102);
3381 + if (HASEXCEPTION())
3386 + CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR12, NULL);
3393 + * rule labels : retval
3394 + * token list labels :
3395 + * rule list labels :
3398 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
3400 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
3402 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
3403 + retval.tree = root_0;
3406 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
3410 + retval.tree = root_0; // set result root
3411 + if (stream_retval != NULL) stream_retval->free(stream_retval);
3418 + // DAAP.g:37:4: STR
3420 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
3422 + STR13 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_crit112);
3423 + if (HASEXCEPTION())
3428 + STR13_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR13));
3429 + ADAPTOR->addChild(ADAPTOR, root_0, STR13_tree);
3440 + // This is where rules clean up and exit
3442 + goto rulecritEx; /* Prevent compiler warnings */
3444 + retval.stop = LT(-1);
3446 + retval.stop = LT(-1);
3447 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
3448 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
3449 + if (stream_RPAR != NULL) stream_RPAR->free(stream_RPAR);
3450 + if (stream_LPAR != NULL) stream_LPAR->free(stream_LPAR);
3451 + if (stream_expr != NULL) stream_expr->free(stream_expr);
3453 + if (HASEXCEPTION())
3457 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
3463 +/* $ANTLR end crit */
3464 +/* End of parsing rules
3465 + * ==============================================
3468 +/* ==============================================
3469 + * Syntactic predicates
3471 +/* End of syntactic predicates
3472 + * ==============================================
3481 + * =============================================================================
3483 diff --git a/src/pregen/DAAPParser.h b/src/pregen/DAAPParser.h
3484 new file mode 100644
3485 index 0000000..dcc664f
3487 +++ b/src/pregen/DAAPParser.h
3490 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
3492 + * - From the grammar source file : DAAP.g
3493 + * - On : 2014-09-30 21:42:39
3494 + * - for the parser : DAAPParserParser *
3495 + * Editing it, at least manually, is not wise.
3497 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
3500 + * The parser DAAPParser has the callable functions (rules) shown below,
3501 + * which will invoke the code for the associated rule in the source grammar
3502 + * assuming that the input stream is pointing to a token/text stream that could begin
3505 + * For instance if you call the first (topmost) rule in a parser grammar, you will
3506 + * get the results of a full parse, but calling a rule half way through the grammar will
3507 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
3508 + * in editors and so on.
3510 + * The parser entry points are called indirectly (by function pointer to function) via
3511 + * a parser context typedef pDAAPParser, which is returned from a call to DAAPParserNew().
3513 + * The methods in pDAAPParser are as follows:
3515 + * - DAAPParser_query_return pDAAPParser->query(pDAAPParser)
3516 + * - DAAPParser_expr_return pDAAPParser->expr(pDAAPParser)
3517 + * - DAAPParser_aexpr_return pDAAPParser->aexpr(pDAAPParser)
3518 + * - DAAPParser_crit_return pDAAPParser->crit(pDAAPParser)
3520 + * The return type for any particular rule is of course determined by the source
3523 +// [The "BSD licence"]
3524 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
3525 +// http://www.temporal-wave.com
3526 +// http://www.linkedin.com/in/jimidle
3528 +// All rights reserved.
3530 +// Redistribution and use in source and binary forms, with or without
3531 +// modification, are permitted provided that the following conditions
3533 +// 1. Redistributions of source code must retain the above copyright
3534 +// notice, this list of conditions and the following disclaimer.
3535 +// 2. Redistributions in binary form must reproduce the above copyright
3536 +// notice, this list of conditions and the following disclaimer in the
3537 +// documentation and/or other materials provided with the distribution.
3538 +// 3. The name of the author may not be used to endorse or promote products
3539 +// derived from this software without specific prior written permission.
3541 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
3542 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
3543 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
3544 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
3545 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
3546 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3547 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3548 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3549 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3550 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3552 +#ifndef _DAAPParser_H
3553 +#define _DAAPParser_H
3554 +/* =============================================================================
3555 + * Standard antlr3 C runtime definitions
3557 +#include <antlr3.h>
3559 +/* End of standard antlr 3 runtime definitions
3560 + * =============================================================================
3567 +// Forward declare the context typedef so that we can use it before it is
3568 +// properly defined. Delegators and delegates (from import statements) are
3569 +// interdependent and their context structures contain pointers to each other
3570 +// C only allows such things to be declared if you pre-declare the typedef.
3572 +typedef struct DAAPParser_Ctx_struct DAAPParser, * pDAAPParser;
3576 +#ifdef ANTLR3_WINDOWS
3577 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
3578 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
3579 +// initialized but unused variable - tree rewrite variables declared but not needed
3580 +// Unreferenced local variable - lexer rule declares but does not always use _type
3581 +// potentially unitialized variable used - retval always returned from a rule
3582 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
3584 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
3585 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
3586 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
3587 +// this is a matter of orthogonality hence I disable that one.
3589 +#pragma warning( disable : 4100 )
3590 +#pragma warning( disable : 4101 )
3591 +#pragma warning( disable : 4127 )
3592 +#pragma warning( disable : 4189 )
3593 +#pragma warning( disable : 4505 )
3594 +#pragma warning( disable : 4701 )
3596 +typedef struct DAAPParser_query_return_struct
3598 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
3600 + pANTLR3_COMMON_TOKEN start;
3601 + pANTLR3_COMMON_TOKEN stop;
3602 + pANTLR3_BASE_TREE tree;
3605 + DAAPParser_query_return;
3607 +typedef struct DAAPParser_expr_return_struct
3609 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
3611 + pANTLR3_COMMON_TOKEN start;
3612 + pANTLR3_COMMON_TOKEN stop;
3613 + pANTLR3_BASE_TREE tree;
3616 + DAAPParser_expr_return;
3618 +typedef struct DAAPParser_aexpr_return_struct
3620 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
3622 + pANTLR3_COMMON_TOKEN start;
3623 + pANTLR3_COMMON_TOKEN stop;
3624 + pANTLR3_BASE_TREE tree;
3627 + DAAPParser_aexpr_return;
3629 +typedef struct DAAPParser_crit_return_struct
3631 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
3633 + pANTLR3_COMMON_TOKEN start;
3634 + pANTLR3_COMMON_TOKEN stop;
3635 + pANTLR3_BASE_TREE tree;
3638 + DAAPParser_crit_return;
3642 +/** Context tracking structure for DAAPParser
3644 +struct DAAPParser_Ctx_struct
3646 + /** Built in ANTLR3 context tracker contains all the generic elements
3647 + * required for context tracking.
3649 + pANTLR3_PARSER pParser;
3652 + DAAPParser_query_return (*query) (struct DAAPParser_Ctx_struct * ctx);
3653 + DAAPParser_expr_return (*expr) (struct DAAPParser_Ctx_struct * ctx);
3654 + DAAPParser_aexpr_return (*aexpr) (struct DAAPParser_Ctx_struct * ctx);
3655 + DAAPParser_crit_return (*crit) (struct DAAPParser_Ctx_struct * ctx);
3656 + // Delegated rules
3657 + const char * (*getGrammarFileName)();
3658 + void (*free) (struct DAAPParser_Ctx_struct * ctx);
3659 + /* @headerFile.members() */
3660 + pANTLR3_BASE_TREE_ADAPTOR adaptor;
3661 + pANTLR3_VECTOR_FACTORY vectors;
3662 + /* End @headerFile.members() */
3665 +// Function protoypes for the constructor functions that external translation units
3666 +// such as delegators and delegates may wish to call.
3668 +ANTLR3_API pDAAPParser DAAPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream);
3669 +ANTLR3_API pDAAPParser DAAPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
3671 +/** Symbolic definitions of all the tokens that the parser will work with.
3674 + * Antlr will define EOF, but we can't use that as it it is too common in
3675 + * in C header files and that would be confusing. There is no way to filter this out at the moment
3676 + * so we just undef it here for now. That isn't the value we get back from C recognizers
3677 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
3696 +#define EOF ANTLR3_TOKEN_EOF
3699 +#ifndef TOKENSOURCE
3700 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
3703 +/* End of token definitions for DAAPParser
3704 + * =============================================================================
3714 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
3715 diff --git a/src/pregen/RSP.u b/src/pregen/RSP.u
3716 new file mode 100644
3717 index 0000000..89256ff
3719 +++ b/src/pregen/RSP.u
3721 +RSPParser.c : RSP.g
3722 +./RSP.tokens : RSP.g
3723 +RSPParser.h : RSP.g
3726 +ANTLR_PRODUCTS += RSPParser.c ./RSP.tokens RSPParser.h RSPLexer.c RSPLexer.h
3727 \ No newline at end of file
3728 diff --git a/src/pregen/RSP2SQL.c b/src/pregen/RSP2SQL.c
3729 new file mode 100644
3730 index 0000000..b5c9550
3732 +++ b/src/pregen/RSP2SQL.c
3735 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
3737 + * - From the grammar source file : RSP2SQL.g
3738 + * - On : 2014-09-30 21:42:42
3739 + * - for the tree parser : RSP2SQLTreeParser *
3740 + * Editing it, at least manually, is not wise.
3742 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
3746 +// [The "BSD licence"]
3747 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
3748 +// http://www.temporal-wave.com
3749 +// http://www.linkedin.com/in/jimidle
3751 +// All rights reserved.
3753 +// Redistribution and use in source and binary forms, with or without
3754 +// modification, are permitted provided that the following conditions
3756 +// 1. Redistributions of source code must retain the above copyright
3757 +// notice, this list of conditions and the following disclaimer.
3758 +// 2. Redistributions in binary form must reproduce the above copyright
3759 +// notice, this list of conditions and the following disclaimer in the
3760 +// documentation and/or other materials provided with the distribution.
3761 +// 3. The name of the author may not be used to endorse or promote products
3762 +// derived from this software without specific prior written permission.
3764 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
3765 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
3766 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
3767 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
3768 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
3769 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3770 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3771 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3772 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3773 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3776 +/* =============================================================================
3777 + * This is what the grammar programmer asked us to put at the top of every file.
3780 + /* Needs #define _GNU_SOURCE for strptime() */
3782 + #include <stdio.h>
3783 + #include <string.h>
3785 + #include <stdint.h>
3787 + #include "logger.h"
3790 + #include "rsp_query.h"
3792 +/* End of Header action.
3793 + * =============================================================================
3795 +/* -----------------------------------------
3796 + * Include the ANTLR3 generated header file.
3798 +#include "RSP2SQL.h"
3799 +/* ----------------------------------------- */
3805 +/* MACROS that hide the C interface implementations from the
3806 + * generated code, which makes it a little more understandable to the human eye.
3807 + * I am very much against using C pre-processor macros for function calls and bits
3808 + * of code as you cannot see what is happening when single stepping in debuggers
3809 + * and so on. The exception (in my book at least) is for generated code, where you are
3810 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
3811 + * hides some indirect calls, but is always referring to the input stream. This is
3812 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
3813 + * the runtime interfaces without changing the generated code too often, without
3814 + * confusing the reader of the generated output, who may not wish to know the gory
3815 + * details of the interface inheritance.
3820 +/* Aids in accessing scopes for grammar programmers
3825 +#define SCOPE_TYPE(scope) pRSP2SQL_##scope##_SCOPE
3826 +#define SCOPE_STACK(scope) pRSP2SQL_##scope##Stack
3827 +#define SCOPE_TOP(scope) ctx->pRSP2SQL_##scope##Top
3828 +#define SCOPE_SIZE(scope) ctx->pRSP2SQL_##scope##Stack_limit
3829 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
3831 +/* Macros for accessing things in the parser
3836 +#undef HAVEPARSEDRULE
3839 +#undef HASEXCEPTION
3847 +#undef PREPORTERROR
3855 +#undef PERRORRECOVERY
3858 +#undef RECOVERFROMMISMATCHEDSET
3859 +#undef RECOVERFROMMISMATCHEDELEMENT
3860 +#undef BACKTRACKING
3867 +#define PARSER ctx->pTreeParser
3868 +#define RECOGNIZER PARSER->rec
3869 +#define PSRSTATE RECOGNIZER->state
3870 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
3871 +#define INPUT PARSER->ctnstream
3872 +#define ISTREAM INPUT->tnstream->istream
3873 +#define STRSTREAM INPUT->tnstream
3874 +#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE)
3875 +#define EXCEPTION PSRSTATE->exception
3876 +#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs)
3877 +#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER)
3878 +#define FOLLOWSTACK PSRSTATE->following
3879 +#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
3880 +#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK)
3881 +#define PRECOVER() RECOGNIZER->recover(RECOGNIZER)
3882 +#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER)
3883 +#define LA(n) ISTREAM->_LA(ISTREAM, n)
3884 +#define LT(n) INPUT->tnstream->_LT(INPUT->tnstream, n)
3885 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
3886 +#define CONSUME() ISTREAM->consume(ISTREAM)
3887 +#define MARK() ISTREAM->mark(ISTREAM)
3888 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
3889 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
3890 +#define PERRORRECOVERY PSRSTATE->errorRecovery
3891 +#define FAILEDFLAG PSRSTATE->failed
3892 +#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE)
3893 +#define BACKTRACKING PSRSTATE->backtracking
3894 +#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
3895 +#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
3896 +#define ADAPTOR INPUT->adaptor
3897 +#define RULEMEMO PSRSTATE->ruleMemo
3898 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
3899 +#define INDEX() ISTREAM->index(ISTREAM)
3900 +#define DBG RECOGNIZER->debugger
3903 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
3905 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
3906 + * then for the present you must use different names for your defines as these are hard coded
3907 + * in the code generator. It would be better not to use such names internally, and maybe
3908 + * we can change this in a forthcoming release. I deliberately do not #undef these
3909 + * here as this will at least give you a redefined error somewhere if they clash.
3911 +#define UP ANTLR3_TOKEN_UP
3912 +#define DOWN ANTLR3_TOKEN_DOWN
3913 +#define EOR ANTLR3_TOKEN_EOR
3914 +#define INVALID ANTLR3_TOKEN_INVALID
3917 +/* =============================================================================
3918 + * Functions to create and destroy scopes. First come the rule scopes, followed
3919 + * by the global declared scopes.
3924 +/* ============================================================================= */
3926 +/* =============================================================================
3927 + * Start of recognizer
3932 +/** \brief Table of all token names in symbolic order, mainly used for
3933 + * error reporting.
3935 +pANTLR3_UINT8 RSP2SQLTokenNames[30+4]
3937 + (pANTLR3_UINT8) "<invalid>", /* String to print to indicate an invalid token */
3938 + (pANTLR3_UINT8) "<EOR>",
3939 + (pANTLR3_UINT8) "<DOWN>",
3940 + (pANTLR3_UINT8) "<UP>",
3941 + (pANTLR3_UINT8) "NEWLINE",
3942 + (pANTLR3_UINT8) "OR",
3943 + (pANTLR3_UINT8) "AND",
3944 + (pANTLR3_UINT8) "LPAR",
3945 + (pANTLR3_UINT8) "RPAR",
3946 + (pANTLR3_UINT8) "FIELD",
3947 + (pANTLR3_UINT8) "STR",
3948 + (pANTLR3_UINT8) "NOT",
3949 + (pANTLR3_UINT8) "EQUAL",
3950 + (pANTLR3_UINT8) "INCLUDES",
3951 + (pANTLR3_UINT8) "STARTSW",
3952 + (pANTLR3_UINT8) "ENDSW",
3953 + (pANTLR3_UINT8) "INT",
3954 + (pANTLR3_UINT8) "LESS",
3955 + (pANTLR3_UINT8) "GREATER",
3956 + (pANTLR3_UINT8) "LTE",
3957 + (pANTLR3_UINT8) "GTE",
3958 + (pANTLR3_UINT8) "BEFORE",
3959 + (pANTLR3_UINT8) "AFTER",
3960 + (pANTLR3_UINT8) "DATE",
3961 + (pANTLR3_UINT8) "TODAY",
3962 + (pANTLR3_UINT8) "DAY",
3963 + (pANTLR3_UINT8) "WEEK",
3964 + (pANTLR3_UINT8) "MONTH",
3965 + (pANTLR3_UINT8) "YEAR",
3966 + (pANTLR3_UINT8) "QUOTE",
3967 + (pANTLR3_UINT8) "WS",
3968 + (pANTLR3_UINT8) "DIGIT19",
3969 + (pANTLR3_UINT8) "DIGIT09",
3970 + (pANTLR3_UINT8) "ESCAPED"
3975 +// Forward declare the locally static matching functions we have generated.
3977 +static pANTLR3_STRING query (pRSP2SQL ctx);
3978 +static RSP2SQL_expr_return expr (pRSP2SQL ctx);
3979 +static RSP2SQL_strcrit_return strcrit (pRSP2SQL ctx);
3980 +static pANTLR3_COMMON_TOKEN strop (pRSP2SQL ctx);
3981 +static RSP2SQL_intcrit_return intcrit (pRSP2SQL ctx);
3982 +static pANTLR3_COMMON_TOKEN intop (pRSP2SQL ctx);
3983 +static RSP2SQL_datecrit_return datecrit (pRSP2SQL ctx);
3984 +static pANTLR3_COMMON_TOKEN dateop (pRSP2SQL ctx);
3985 +static RSP2SQL_datespec_return datespec (pRSP2SQL ctx);
3986 +static RSP2SQL_dateref_return dateref (pRSP2SQL ctx);
3987 +static RSP2SQL_dateintval_return dateintval (pRSP2SQL ctx);
3988 +static void RSP2SQLFree(pRSP2SQL ctx);
3989 +/* For use in tree output where we are accumulating rule labels via label += ruleRef
3990 + * we need a function that knows how to free a return scope when the list is destroyed.
3991 + * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
3993 +static void ANTLR3_CDECL freeScope(void * scope)
3995 + ANTLR3_FREE(scope);
3998 +/** \brief Name of the grammar file that generated this code
4000 +static const char fileName[] = "RSP2SQL.g";
4002 +/** \brief Return the name of the grammar file that generated this code.
4004 +static const char * getGrammarFileName()
4008 +/** \brief Create a new RSP2SQL parser and return a context for it.
4010 + * \param[in] instream Pointer to an input stream interface.
4012 + * \return Pointer to new parser context upon success.
4014 +ANTLR3_API pRSP2SQL
4015 +RSP2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream)
4017 + // See if we can create a new parser with the standard constructor
4019 + return RSP2SQLNewSSD(instream, NULL);
4022 +/** \brief Create a new RSP2SQL parser and return a context for it.
4024 + * \param[in] instream Pointer to an input stream interface.
4026 + * \return Pointer to new parser context upon success.
4028 +ANTLR3_API pRSP2SQL
4029 +RSP2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
4031 + pRSP2SQL ctx; /* Context structure we will build and return */
4033 + ctx = (pRSP2SQL) ANTLR3_CALLOC(1, sizeof(RSP2SQL));
4037 + // Failed to allocate memory for parser context
4042 + /* -------------------------------------------------------------------
4043 + * Memory for basic structure is allocated, now to fill in
4044 + * the base ANTLR3 structures. We initialize the function pointers
4045 + * for the standard ANTLR3 parser function set, but upon return
4046 + * from here, the programmer may set the pointers to provide custom
4047 + * implementations of each function.
4049 + * We don't use the macros defined in RSP2SQL.h here, in order that you can get a sense
4050 + * of what goes where.
4053 + /* Create a base Tree parser/recognizer, using the supplied tree node stream
4055 + ctx->pTreeParser = antlr3TreeParserNewStream(ANTLR3_SIZE_HINT, instream, state);
4056 + /* Install the implementation of our RSP2SQL interface
4058 + ctx->query = query;
4060 + ctx->strcrit = strcrit;
4061 + ctx->strop = strop;
4062 + ctx->intcrit = intcrit;
4063 + ctx->intop = intop;
4064 + ctx->datecrit = datecrit;
4065 + ctx->dateop = dateop;
4066 + ctx->datespec = datespec;
4067 + ctx->dateref = dateref;
4068 + ctx->dateintval = dateintval;
4069 + ctx->free = RSP2SQLFree;
4070 + ctx->getGrammarFileName = getGrammarFileName;
4072 + /* Install the scope pushing methods.
4079 + /* Install the token table
4081 + PSRSTATE->tokenNames = RSP2SQLTokenNames;
4084 + /* Return the newly built parser to the caller
4089 +/** Free the parser resources
4092 + RSP2SQLFree(pRSP2SQL ctx)
4094 + /* Free any scope memory
4098 + // Free this parser
4100 + ctx->pTreeParser->free(ctx->pTreeParser);
4103 + /* Everything is released, so we can return
4108 +/** Return token names used by this tree parser
4110 + * The returned pointer is used as an index into the token names table (using the token
4111 + * number as the index).
4113 + * \return Pointer to first char * in the table.
4115 +static pANTLR3_UINT8 *getTokenNames()
4117 + return RSP2SQLTokenNames;
4121 + #define RSP_TYPE_STRING 0
4122 + #define RSP_TYPE_INT 1
4123 + #define RSP_TYPE_DATE 2
4125 + struct rsp_query_field_map {
4128 + /* RSP fields are named after the DB columns - or vice versa */
4131 + /* gperf static hash, rsp_query.gperf */
4132 + #include "rsp_query_hash.c"
4135 +/* Declare the bitsets
4138 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_query70 */
4139 +static ANTLR3_BITWORD FOLLOW_expr_in_query70_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4140 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_query70 = { FOLLOW_expr_in_query70_bits, 1 };
4141 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_expr95 */
4142 +static ANTLR3_BITWORD FOLLOW_AND_in_expr95_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4143 +static ANTLR3_BITSET_LIST FOLLOW_AND_in_expr95 = { FOLLOW_AND_in_expr95_bits, 1 };
4144 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr101 */
4145 +static ANTLR3_BITWORD FOLLOW_expr_in_expr101_bits[] = { ANTLR3_UINT64_LIT(0x00000000007EF860) };
4146 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr101 = { FOLLOW_expr_in_expr101_bits, 1 };
4147 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr107 */
4148 +static ANTLR3_BITWORD FOLLOW_expr_in_expr107_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4149 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr107 = { FOLLOW_expr_in_expr107_bits, 1 };
4150 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expr118 */
4151 +static ANTLR3_BITWORD FOLLOW_OR_in_expr118_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4152 +static ANTLR3_BITSET_LIST FOLLOW_OR_in_expr118 = { FOLLOW_OR_in_expr118_bits, 1 };
4153 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr124 */
4154 +static ANTLR3_BITWORD FOLLOW_expr_in_expr124_bits[] = { ANTLR3_UINT64_LIT(0x00000000007EF860) };
4155 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr124 = { FOLLOW_expr_in_expr124_bits, 1 };
4156 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr130 */
4157 +static ANTLR3_BITWORD FOLLOW_expr_in_expr130_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4158 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr130 = { FOLLOW_expr_in_expr130_bits, 1 };
4159 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_strcrit_in_expr144 */
4160 +static ANTLR3_BITWORD FOLLOW_strcrit_in_expr144_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4161 +static ANTLR3_BITSET_LIST FOLLOW_strcrit_in_expr144 = { FOLLOW_strcrit_in_expr144_bits, 1 };
4162 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_expr154 */
4163 +static ANTLR3_BITWORD FOLLOW_NOT_in_expr154_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4164 +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_expr154 = { FOLLOW_NOT_in_expr154_bits, 1 };
4165 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_strcrit_in_expr160 */
4166 +static ANTLR3_BITWORD FOLLOW_strcrit_in_expr160_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4167 +static ANTLR3_BITSET_LIST FOLLOW_strcrit_in_expr160 = { FOLLOW_strcrit_in_expr160_bits, 1 };
4168 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intcrit_in_expr174 */
4169 +static ANTLR3_BITWORD FOLLOW_intcrit_in_expr174_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4170 +static ANTLR3_BITSET_LIST FOLLOW_intcrit_in_expr174 = { FOLLOW_intcrit_in_expr174_bits, 1 };
4171 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_expr184 */
4172 +static ANTLR3_BITWORD FOLLOW_NOT_in_expr184_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4173 +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_expr184 = { FOLLOW_NOT_in_expr184_bits, 1 };
4174 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intcrit_in_expr190 */
4175 +static ANTLR3_BITWORD FOLLOW_intcrit_in_expr190_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4176 +static ANTLR3_BITSET_LIST FOLLOW_intcrit_in_expr190 = { FOLLOW_intcrit_in_expr190_bits, 1 };
4177 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_datecrit_in_expr204 */
4178 +static ANTLR3_BITWORD FOLLOW_datecrit_in_expr204_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4179 +static ANTLR3_BITSET_LIST FOLLOW_datecrit_in_expr204 = { FOLLOW_datecrit_in_expr204_bits, 1 };
4180 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_strop_in_strcrit233 */
4181 +static ANTLR3_BITWORD FOLLOW_strop_in_strcrit233_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4182 +static ANTLR3_BITSET_LIST FOLLOW_strop_in_strcrit233 = { FOLLOW_strop_in_strcrit233_bits, 1 };
4183 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_strcrit239 */
4184 +static ANTLR3_BITWORD FOLLOW_FIELD_in_strcrit239_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000400) };
4185 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_strcrit239 = { FOLLOW_FIELD_in_strcrit239_bits, 1 };
4186 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_strcrit245 */
4187 +static ANTLR3_BITWORD FOLLOW_STR_in_strcrit245_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4188 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_strcrit245 = { FOLLOW_STR_in_strcrit245_bits, 1 };
4189 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_EQUAL_in_strop274 */
4190 +static ANTLR3_BITWORD FOLLOW_EQUAL_in_strop274_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4191 +static ANTLR3_BITSET_LIST FOLLOW_EQUAL_in_strop274 = { FOLLOW_EQUAL_in_strop274_bits, 1 };
4192 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INCLUDES_in_strop287 */
4193 +static ANTLR3_BITWORD FOLLOW_INCLUDES_in_strop287_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4194 +static ANTLR3_BITSET_LIST FOLLOW_INCLUDES_in_strop287 = { FOLLOW_INCLUDES_in_strop287_bits, 1 };
4195 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STARTSW_in_strop300 */
4196 +static ANTLR3_BITWORD FOLLOW_STARTSW_in_strop300_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4197 +static ANTLR3_BITSET_LIST FOLLOW_STARTSW_in_strop300 = { FOLLOW_STARTSW_in_strop300_bits, 1 };
4198 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENDSW_in_strop313 */
4199 +static ANTLR3_BITWORD FOLLOW_ENDSW_in_strop313_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4200 +static ANTLR3_BITSET_LIST FOLLOW_ENDSW_in_strop313 = { FOLLOW_ENDSW_in_strop313_bits, 1 };
4201 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intop_in_intcrit342 */
4202 +static ANTLR3_BITWORD FOLLOW_intop_in_intcrit342_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4203 +static ANTLR3_BITSET_LIST FOLLOW_intop_in_intcrit342 = { FOLLOW_intop_in_intcrit342_bits, 1 };
4204 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_intcrit348 */
4205 +static ANTLR3_BITWORD FOLLOW_FIELD_in_intcrit348_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) };
4206 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_intcrit348 = { FOLLOW_FIELD_in_intcrit348_bits, 1 };
4207 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_intcrit354 */
4208 +static ANTLR3_BITWORD FOLLOW_INT_in_intcrit354_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4209 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_intcrit354 = { FOLLOW_INT_in_intcrit354_bits, 1 };
4210 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_EQUAL_in_intop383 */
4211 +static ANTLR3_BITWORD FOLLOW_EQUAL_in_intop383_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4212 +static ANTLR3_BITSET_LIST FOLLOW_EQUAL_in_intop383 = { FOLLOW_EQUAL_in_intop383_bits, 1 };
4213 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_LESS_in_intop396 */
4214 +static ANTLR3_BITWORD FOLLOW_LESS_in_intop396_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4215 +static ANTLR3_BITSET_LIST FOLLOW_LESS_in_intop396 = { FOLLOW_LESS_in_intop396_bits, 1 };
4216 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_GREATER_in_intop409 */
4217 +static ANTLR3_BITWORD FOLLOW_GREATER_in_intop409_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4218 +static ANTLR3_BITSET_LIST FOLLOW_GREATER_in_intop409 = { FOLLOW_GREATER_in_intop409_bits, 1 };
4219 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_LTE_in_intop422 */
4220 +static ANTLR3_BITWORD FOLLOW_LTE_in_intop422_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4221 +static ANTLR3_BITSET_LIST FOLLOW_LTE_in_intop422 = { FOLLOW_LTE_in_intop422_bits, 1 };
4222 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_GTE_in_intop435 */
4223 +static ANTLR3_BITWORD FOLLOW_GTE_in_intop435_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4224 +static ANTLR3_BITSET_LIST FOLLOW_GTE_in_intop435 = { FOLLOW_GTE_in_intop435_bits, 1 };
4225 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datecrit464 */
4226 +static ANTLR3_BITWORD FOLLOW_dateop_in_datecrit464_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4227 +static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datecrit464 = { FOLLOW_dateop_in_datecrit464_bits, 1 };
4228 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_datecrit470 */
4229 +static ANTLR3_BITWORD FOLLOW_FIELD_in_datecrit470_bits[] = { ANTLR3_UINT64_LIT(0x0000000001FEF860) };
4230 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_datecrit470 = { FOLLOW_FIELD_in_datecrit470_bits, 1 };
4231 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_datespec_in_datecrit476 */
4232 +static ANTLR3_BITWORD FOLLOW_datespec_in_datecrit476_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4233 +static ANTLR3_BITSET_LIST FOLLOW_datespec_in_datecrit476 = { FOLLOW_datespec_in_datecrit476_bits, 1 };
4234 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateop505 */
4235 +static ANTLR3_BITWORD FOLLOW_BEFORE_in_dateop505_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4236 +static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateop505 = { FOLLOW_BEFORE_in_dateop505_bits, 1 };
4237 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateop518 */
4238 +static ANTLR3_BITWORD FOLLOW_AFTER_in_dateop518_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4239 +static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateop518 = { FOLLOW_AFTER_in_dateop518_bits, 1 };
4240 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec546 */
4241 +static ANTLR3_BITWORD FOLLOW_dateref_in_datespec546_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4242 +static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec546 = { FOLLOW_dateref_in_datespec546_bits, 1 };
4243 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datespec560 */
4244 +static ANTLR3_BITWORD FOLLOW_dateop_in_datespec560_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4245 +static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datespec560 = { FOLLOW_dateop_in_datespec560_bits, 1 };
4246 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec566 */
4247 +static ANTLR3_BITWORD FOLLOW_dateref_in_datespec566_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) };
4248 +static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec566 = { FOLLOW_dateref_in_datespec566_bits, 1 };
4249 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_datespec572 */
4250 +static ANTLR3_BITWORD FOLLOW_INT_in_datespec572_bits[] = { ANTLR3_UINT64_LIT(0x000000001E000000) };
4251 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_datespec572 = { FOLLOW_INT_in_datespec572_bits, 1 };
4252 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateintval_in_datespec578 */
4253 +static ANTLR3_BITWORD FOLLOW_dateintval_in_datespec578_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4254 +static ANTLR3_BITSET_LIST FOLLOW_dateintval_in_datespec578 = { FOLLOW_dateintval_in_datespec578_bits, 1 };
4255 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateref607 */
4256 +static ANTLR3_BITWORD FOLLOW_DATE_in_dateref607_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4257 +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateref607 = { FOLLOW_DATE_in_dateref607_bits, 1 };
4258 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_TODAY_in_dateref616 */
4259 +static ANTLR3_BITWORD FOLLOW_TODAY_in_dateref616_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4260 +static ANTLR3_BITSET_LIST FOLLOW_TODAY_in_dateref616 = { FOLLOW_TODAY_in_dateref616_bits, 1 };
4261 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DAY_in_dateintval640 */
4262 +static ANTLR3_BITWORD FOLLOW_DAY_in_dateintval640_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4263 +static ANTLR3_BITSET_LIST FOLLOW_DAY_in_dateintval640 = { FOLLOW_DAY_in_dateintval640_bits, 1 };
4264 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_WEEK_in_dateintval649 */
4265 +static ANTLR3_BITWORD FOLLOW_WEEK_in_dateintval649_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4266 +static ANTLR3_BITSET_LIST FOLLOW_WEEK_in_dateintval649 = { FOLLOW_WEEK_in_dateintval649_bits, 1 };
4267 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_MONTH_in_dateintval658 */
4268 +static ANTLR3_BITWORD FOLLOW_MONTH_in_dateintval658_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4269 +static ANTLR3_BITSET_LIST FOLLOW_MONTH_in_dateintval658 = { FOLLOW_MONTH_in_dateintval658_bits, 1 };
4270 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_YEAR_in_dateintval667 */
4271 +static ANTLR3_BITWORD FOLLOW_YEAR_in_dateintval667_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4272 +static ANTLR3_BITSET_LIST FOLLOW_YEAR_in_dateintval667 = { FOLLOW_YEAR_in_dateintval667_bits, 1 };
4277 +/* ==============================================
4281 + * $ANTLR start query
4282 + * RSP2SQL.g:56:1: query returns [ pANTLR3_STRING result ] : e= expr ;
4284 +static pANTLR3_STRING
4285 +query(pRSP2SQL ctx)
4287 + pANTLR3_STRING result = NULL;
4289 + RSP2SQL_expr_return e;
4290 + #undef RETURN_TYPE_e
4291 + #define RETURN_TYPE_e RSP2SQL_expr_return
4293 + /* Initialize rule variables
4299 + // RSP2SQL.g:58:2: (e= expr )
4300 + // RSP2SQL.g:58:4: e= expr
4302 + FOLLOWPUSH(FOLLOW_expr_in_query70);
4306 + if (HASEXCEPTION())
4319 + result= e.result->factory->newRaw(e.result->factory);
4320 + result->append8(result, "(");
4321 + result->appendS(result, e.result);
4322 + result->append8(result, ")");
4332 + // This is where rules clean up and exit
4334 + goto rulequeryEx; /* Prevent compiler warnings */
4337 + if (HASEXCEPTION())
4346 +/* $ANTLR end query */
4349 + * $ANTLR start expr
4350 + * RSP2SQL.g:74:1: expr returns [ pANTLR3_STRING result, int valid ] : ( ^( AND a= expr b= expr ) | ^( OR a= expr b= expr ) | c= strcrit | ^( NOT c= strcrit ) | i= intcrit | ^( NOT i= intcrit ) | d= datecrit );
4352 +static RSP2SQL_expr_return
4355 + RSP2SQL_expr_return retval;
4357 + RSP2SQL_expr_return a;
4358 + #undef RETURN_TYPE_a
4359 + #define RETURN_TYPE_a RSP2SQL_expr_return
4361 + RSP2SQL_expr_return b;
4362 + #undef RETURN_TYPE_b
4363 + #define RETURN_TYPE_b RSP2SQL_expr_return
4365 + RSP2SQL_strcrit_return c;
4366 + #undef RETURN_TYPE_c
4367 + #define RETURN_TYPE_c RSP2SQL_strcrit_return
4369 + RSP2SQL_intcrit_return i;
4370 + #undef RETURN_TYPE_i
4371 + #define RETURN_TYPE_i RSP2SQL_intcrit_return
4373 + RSP2SQL_datecrit_return d;
4374 + #undef RETURN_TYPE_d
4375 + #define RETURN_TYPE_d RSP2SQL_datecrit_return
4377 + /* Initialize rule variables
4381 + retval.result= NULL; retval.valid= 1;
4382 + retval.start = LT(1); retval.stop = retval.start;
4386 + // RSP2SQL.g:76:2: ( ^( AND a= expr b= expr ) | ^( OR a= expr b= expr ) | c= strcrit | ^( NOT c= strcrit ) | i= intcrit | ^( NOT i= intcrit ) | d= datecrit )
4388 + ANTLR3_UINT32 alt1;
4429 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4430 + EXCEPTION->message = (void *)"";
4431 + EXCEPTION->decisionNum = 1;
4432 + EXCEPTION->state = 10;
4443 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4444 + EXCEPTION->message = (void *)"";
4445 + EXCEPTION->decisionNum = 1;
4446 + EXCEPTION->state = 8;
4457 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4458 + EXCEPTION->message = (void *)"";
4459 + EXCEPTION->decisionNum = 1;
4460 + EXCEPTION->state = 3;
4508 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4509 + EXCEPTION->message = (void *)"";
4510 + EXCEPTION->decisionNum = 1;
4511 + EXCEPTION->state = 15;
4522 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4523 + EXCEPTION->message = (void *)"";
4524 + EXCEPTION->decisionNum = 1;
4525 + EXCEPTION->state = 14;
4536 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4537 + EXCEPTION->message = (void *)"";
4538 + EXCEPTION->decisionNum = 1;
4539 + EXCEPTION->state = 11;
4565 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4566 + EXCEPTION->message = (void *)"";
4567 + EXCEPTION->decisionNum = 1;
4568 + EXCEPTION->state = 9;
4579 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4580 + EXCEPTION->message = (void *)"";
4581 + EXCEPTION->decisionNum = 1;
4582 + EXCEPTION->state = 5;
4607 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4608 + EXCEPTION->message = (void *)"";
4609 + EXCEPTION->decisionNum = 1;
4610 + EXCEPTION->state = 0;
4619 + // RSP2SQL.g:76:4: ^( AND a= expr b= expr )
4621 + MATCHT(AND, &FOLLOW_AND_in_expr95);
4622 + if (HASEXCEPTION())
4628 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
4629 + if (HASEXCEPTION())
4634 + FOLLOWPUSH(FOLLOW_expr_in_expr101);
4638 + if (HASEXCEPTION())
4643 + FOLLOWPUSH(FOLLOW_expr_in_expr107);
4647 + if (HASEXCEPTION())
4653 + MATCHT(ANTLR3_TOKEN_UP, NULL);
4654 + if (HASEXCEPTION())
4661 + if (!a.valid || !b.valid)
4667 + retval.result= a.result->factory->newRaw(a.result->factory);
4668 + retval.result->append8(retval.result, "(");
4669 + retval.result->appendS(retval.result, a.result);
4670 + retval.result->append8(retval.result, " AND ");
4671 + retval.result->appendS(retval.result, b.result);
4672 + retval.result->append8(retval.result, ")");
4680 + // RSP2SQL.g:92:4: ^( OR a= expr b= expr )
4682 + MATCHT(OR, &FOLLOW_OR_in_expr118);
4683 + if (HASEXCEPTION())
4689 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
4690 + if (HASEXCEPTION())
4695 + FOLLOWPUSH(FOLLOW_expr_in_expr124);
4699 + if (HASEXCEPTION())
4704 + FOLLOWPUSH(FOLLOW_expr_in_expr130);
4708 + if (HASEXCEPTION())
4714 + MATCHT(ANTLR3_TOKEN_UP, NULL);
4715 + if (HASEXCEPTION())
4722 + if (!a.valid || !b.valid)
4728 + retval.result= a.result->factory->newRaw(a.result->factory);
4729 + retval.result->append8(retval.result, "(");
4730 + retval.result->appendS(retval.result, a.result);
4731 + retval.result->append8(retval.result, " OR ");
4732 + retval.result->appendS(retval.result, b.result);
4733 + retval.result->append8(retval.result, ")");
4741 + // RSP2SQL.g:108:4: c= strcrit
4743 + FOLLOWPUSH(FOLLOW_strcrit_in_expr144);
4747 + if (HASEXCEPTION())
4754 + retval.valid= c.valid;
4755 + retval.result= c.result;
4762 + // RSP2SQL.g:113:4: ^( NOT c= strcrit )
4764 + MATCHT(NOT, &FOLLOW_NOT_in_expr154);
4765 + if (HASEXCEPTION())
4771 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
4772 + if (HASEXCEPTION())
4777 + FOLLOWPUSH(FOLLOW_strcrit_in_expr160);
4781 + if (HASEXCEPTION())
4787 + MATCHT(ANTLR3_TOKEN_UP, NULL);
4788 + if (HASEXCEPTION())
4801 + retval.result= c.result->factory->newRaw(c.result->factory);
4802 + retval.result->append8(retval.result, "(NOT ");
4803 + retval.result->appendS(retval.result, c.result);
4804 + retval.result->append8(retval.result, ")");
4812 + // RSP2SQL.g:127:4: i= intcrit
4814 + FOLLOWPUSH(FOLLOW_intcrit_in_expr174);
4818 + if (HASEXCEPTION())
4825 + retval.valid= i.valid;
4826 + retval.result= i.result;
4833 + // RSP2SQL.g:132:4: ^( NOT i= intcrit )
4835 + MATCHT(NOT, &FOLLOW_NOT_in_expr184);
4836 + if (HASEXCEPTION())
4842 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
4843 + if (HASEXCEPTION())
4848 + FOLLOWPUSH(FOLLOW_intcrit_in_expr190);
4852 + if (HASEXCEPTION())
4858 + MATCHT(ANTLR3_TOKEN_UP, NULL);
4859 + if (HASEXCEPTION())
4872 + retval.result= i.result->factory->newRaw(i.result->factory);
4873 + retval.result->append8(retval.result, "(NOT ");
4874 + retval.result->appendS(retval.result, i.result);
4875 + retval.result->append8(retval.result, ")");
4883 + // RSP2SQL.g:146:4: d= datecrit
4885 + FOLLOWPUSH(FOLLOW_datecrit_in_expr204);
4889 + if (HASEXCEPTION())
4896 + retval.valid= d.valid;
4897 + retval.result= d.result;
4909 + // This is where rules clean up and exit
4911 + goto ruleexprEx; /* Prevent compiler warnings */
4914 + if (HASEXCEPTION())
4923 +/* $ANTLR end expr */
4926 + * $ANTLR start strcrit
4927 + * RSP2SQL.g:153:1: strcrit returns [ pANTLR3_STRING result, int valid ] : ^(o= strop f= FIELD s= STR ) ;
4929 +static RSP2SQL_strcrit_return
4930 +strcrit(pRSP2SQL ctx)
4932 + RSP2SQL_strcrit_return retval;
4934 + pANTLR3_BASE_TREE f;
4935 + pANTLR3_BASE_TREE s;
4936 + pANTLR3_COMMON_TOKEN o;
4937 + #undef RETURN_TYPE_o
4938 + #define RETURN_TYPE_o pANTLR3_COMMON_TOKEN
4940 + /* Initialize rule variables
4944 + retval.result= NULL; retval.valid= 1;
4948 + retval.start = LT(1); retval.stop = retval.start;
4951 + // RSP2SQL.g:155:2: ( ^(o= strop f= FIELD s= STR ) )
4952 + // RSP2SQL.g:155:4: ^(o= strop f= FIELD s= STR )
4954 + FOLLOWPUSH(FOLLOW_strop_in_strcrit233);
4958 + if (HASEXCEPTION())
4960 + goto rulestrcritEx;
4964 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
4965 + if (HASEXCEPTION())
4967 + goto rulestrcritEx;
4970 + f = (pANTLR3_BASE_TREE) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit239);
4971 + if (HASEXCEPTION())
4973 + goto rulestrcritEx;
4976 + s = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_strcrit245);
4977 + if (HASEXCEPTION())
4979 + goto rulestrcritEx;
4983 + MATCHT(ANTLR3_TOKEN_UP, NULL);
4984 + if (HASEXCEPTION())
4986 + goto rulestrcritEx;
4992 + const struct rsp_query_field_map *rqfp;
4993 + pANTLR3_STRING field;
4995 + ANTLR3_UINT32 optok;
5000 + optok = o->getType(o);
5014 + field = f->getText(f);
5016 + /* Field lookup */
5017 + rqfp = rsp_query_field_lookup((char *)field->chars, strlen((char *)field->chars));
5020 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not a valid field in queries\n", field->chars);
5022 + goto strcrit_valid_0; /* ABORT */
5025 + /* Check field type */
5026 + if (rqfp->field_type != RSP_TYPE_STRING)
5028 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not a string field\n", field->chars);
5030 + goto strcrit_valid_0; /* ABORT */
5033 + escaped = db_escape_string((char *)s->getText(s)->chars);
5036 + DPRINTF(E_LOG, L_RSP, "Could not escape value\n");
5038 + goto strcrit_valid_0; /* ABORT */
5041 + retval.result= field->factory->newRaw(field->factory);
5042 + retval.result->append8(retval.result, "f.");
5043 + retval.result->appendS(retval.result, field);
5044 + retval.result->append8(retval.result, op);
5045 + retval.result->append8(retval.result, "'");
5046 + if ((optok == INCLUDES) || (optok == STARTSW))
5047 + retval.result->append8(retval.result, "%");
5049 + retval.result->append8(retval.result, escaped);
5051 + if ((optok == INCLUDES) || (optok == ENDSW))
5052 + retval.result->append8(retval.result, "%");
5053 + retval.result->append8(retval.result, "'");
5068 + // This is where rules clean up and exit
5070 + goto rulestrcritEx; /* Prevent compiler warnings */
5073 + if (HASEXCEPTION())
5082 +/* $ANTLR end strcrit */
5085 + * $ANTLR start strop
5086 + * RSP2SQL.g:229:1: strop returns [ pANTLR3_COMMON_TOKEN op ] : (n= EQUAL | n= INCLUDES | n= STARTSW | n= ENDSW );
5088 +static pANTLR3_COMMON_TOKEN
5089 +strop(pRSP2SQL ctx)
5091 + pANTLR3_COMMON_TOKEN op = NULL;
5093 + pANTLR3_BASE_TREE n;
5095 + /* Initialize rule variables
5104 + // RSP2SQL.g:231:2: (n= EQUAL | n= INCLUDES | n= STARTSW | n= ENDSW )
5106 + ANTLR3_UINT32 alt2;
5135 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
5136 + EXCEPTION->message = (void *)"";
5137 + EXCEPTION->decisionNum = 2;
5138 + EXCEPTION->state = 0;
5147 + // RSP2SQL.g:231:4: n= EQUAL
5149 + n = (pANTLR3_BASE_TREE) MATCHT(EQUAL, &FOLLOW_EQUAL_in_strop274);
5150 + if (HASEXCEPTION())
5156 + op= n->getToken(n);
5162 + // RSP2SQL.g:233:4: n= INCLUDES
5164 + n = (pANTLR3_BASE_TREE) MATCHT(INCLUDES, &FOLLOW_INCLUDES_in_strop287);
5165 + if (HASEXCEPTION())
5171 + op= n->getToken(n);
5177 + // RSP2SQL.g:235:4: n= STARTSW
5179 + n = (pANTLR3_BASE_TREE) MATCHT(STARTSW, &FOLLOW_STARTSW_in_strop300);
5180 + if (HASEXCEPTION())
5186 + op= n->getToken(n);
5192 + // RSP2SQL.g:237:4: n= ENDSW
5194 + n = (pANTLR3_BASE_TREE) MATCHT(ENDSW, &FOLLOW_ENDSW_in_strop313);
5195 + if (HASEXCEPTION())
5201 + op= n->getToken(n);
5212 + // This is where rules clean up and exit
5214 + goto rulestropEx; /* Prevent compiler warnings */
5217 + if (HASEXCEPTION())
5226 +/* $ANTLR end strop */
5229 + * $ANTLR start intcrit
5230 + * RSP2SQL.g:241:1: intcrit returns [ pANTLR3_STRING result, int valid ] : ^(o= intop f= FIELD i= INT ) ;
5232 +static RSP2SQL_intcrit_return
5233 +intcrit(pRSP2SQL ctx)
5235 + RSP2SQL_intcrit_return retval;
5237 + pANTLR3_BASE_TREE f;
5238 + pANTLR3_BASE_TREE i;
5239 + pANTLR3_COMMON_TOKEN o;
5240 + #undef RETURN_TYPE_o
5241 + #define RETURN_TYPE_o pANTLR3_COMMON_TOKEN
5243 + /* Initialize rule variables
5247 + retval.result= NULL; retval.valid= 1;
5251 + retval.start = LT(1); retval.stop = retval.start;
5254 + // RSP2SQL.g:243:2: ( ^(o= intop f= FIELD i= INT ) )
5255 + // RSP2SQL.g:243:4: ^(o= intop f= FIELD i= INT )
5257 + FOLLOWPUSH(FOLLOW_intop_in_intcrit342);
5261 + if (HASEXCEPTION())
5263 + goto ruleintcritEx;
5267 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
5268 + if (HASEXCEPTION())
5270 + goto ruleintcritEx;
5273 + f = (pANTLR3_BASE_TREE) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit348);
5274 + if (HASEXCEPTION())
5276 + goto ruleintcritEx;
5279 + i = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_intcrit354);
5280 + if (HASEXCEPTION())
5282 + goto ruleintcritEx;
5286 + MATCHT(ANTLR3_TOKEN_UP, NULL);
5287 + if (HASEXCEPTION())
5289 + goto ruleintcritEx;
5295 + const struct rsp_query_field_map *rqfp;
5296 + pANTLR3_STRING field;
5299 + switch (o->getType(o))
5322 + field = f->getText(f);
5324 + /* Field lookup */
5325 + rqfp = rsp_query_field_lookup((char *)field->chars, strlen((char *)field->chars));
5328 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not a valid field in queries\n", field->chars);
5330 + goto intcrit_valid_0; /* ABORT */
5333 + /* Check field type */
5334 + if (rqfp->field_type != RSP_TYPE_INT)
5336 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not an integer field\n", field->chars);
5338 + goto intcrit_valid_0; /* ABORT */
5341 + retval.result= field->factory->newRaw(field->factory);
5342 + retval.result->append8(retval.result, "f.");
5343 + retval.result->appendS(retval.result, field);
5344 + retval.result->append8(retval.result, op);
5345 + retval.result->appendS(retval.result, i->getText(i));
5357 + // This is where rules clean up and exit
5359 + goto ruleintcritEx; /* Prevent compiler warnings */
5362 + if (HASEXCEPTION())
5371 +/* $ANTLR end intcrit */
5374 + * $ANTLR start intop
5375 + * RSP2SQL.g:303:1: intop returns [ pANTLR3_COMMON_TOKEN op ] : (n= EQUAL | n= LESS | n= GREATER | n= LTE | n= GTE );
5377 +static pANTLR3_COMMON_TOKEN
5378 +intop(pRSP2SQL ctx)
5380 + pANTLR3_COMMON_TOKEN op = NULL;
5382 + pANTLR3_BASE_TREE n;
5384 + /* Initialize rule variables
5393 + // RSP2SQL.g:305:2: (n= EQUAL | n= LESS | n= GREATER | n= LTE | n= GTE )
5395 + ANTLR3_UINT32 alt3;
5429 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
5430 + EXCEPTION->message = (void *)"";
5431 + EXCEPTION->decisionNum = 3;
5432 + EXCEPTION->state = 0;
5441 + // RSP2SQL.g:305:4: n= EQUAL
5443 + n = (pANTLR3_BASE_TREE) MATCHT(EQUAL, &FOLLOW_EQUAL_in_intop383);
5444 + if (HASEXCEPTION())
5450 + op= n->getToken(n);
5456 + // RSP2SQL.g:307:4: n= LESS
5458 + n = (pANTLR3_BASE_TREE) MATCHT(LESS, &FOLLOW_LESS_in_intop396);
5459 + if (HASEXCEPTION())
5465 + op= n->getToken(n);
5471 + // RSP2SQL.g:309:4: n= GREATER
5473 + n = (pANTLR3_BASE_TREE) MATCHT(GREATER, &FOLLOW_GREATER_in_intop409);
5474 + if (HASEXCEPTION())
5480 + op= n->getToken(n);
5486 + // RSP2SQL.g:311:4: n= LTE
5488 + n = (pANTLR3_BASE_TREE) MATCHT(LTE, &FOLLOW_LTE_in_intop422);
5489 + if (HASEXCEPTION())
5495 + op= n->getToken(n);
5501 + // RSP2SQL.g:313:4: n= GTE
5503 + n = (pANTLR3_BASE_TREE) MATCHT(GTE, &FOLLOW_GTE_in_intop435);
5504 + if (HASEXCEPTION())
5510 + op= n->getToken(n);
5521 + // This is where rules clean up and exit
5523 + goto ruleintopEx; /* Prevent compiler warnings */
5526 + if (HASEXCEPTION())
5535 +/* $ANTLR end intop */
5538 + * $ANTLR start datecrit
5539 + * RSP2SQL.g:317:1: datecrit returns [ pANTLR3_STRING result, int valid ] : ^(o= dateop f= FIELD d= datespec ) ;
5541 +static RSP2SQL_datecrit_return
5542 +datecrit(pRSP2SQL ctx)
5544 + RSP2SQL_datecrit_return retval;
5546 + pANTLR3_BASE_TREE f;
5547 + pANTLR3_COMMON_TOKEN o;
5548 + #undef RETURN_TYPE_o
5549 + #define RETURN_TYPE_o pANTLR3_COMMON_TOKEN
5551 + RSP2SQL_datespec_return d;
5552 + #undef RETURN_TYPE_d
5553 + #define RETURN_TYPE_d RSP2SQL_datespec_return
5555 + /* Initialize rule variables
5559 + retval.result= NULL; retval.valid= 1;
5562 + retval.start = LT(1); retval.stop = retval.start;
5565 + // RSP2SQL.g:319:2: ( ^(o= dateop f= FIELD d= datespec ) )
5566 + // RSP2SQL.g:319:4: ^(o= dateop f= FIELD d= datespec )
5568 + FOLLOWPUSH(FOLLOW_dateop_in_datecrit464);
5572 + if (HASEXCEPTION())
5574 + goto ruledatecritEx;
5578 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
5579 + if (HASEXCEPTION())
5581 + goto ruledatecritEx;
5584 + f = (pANTLR3_BASE_TREE) MATCHT(FIELD, &FOLLOW_FIELD_in_datecrit470);
5585 + if (HASEXCEPTION())
5587 + goto ruledatecritEx;
5590 + FOLLOWPUSH(FOLLOW_datespec_in_datecrit476);
5594 + if (HASEXCEPTION())
5596 + goto ruledatecritEx;
5600 + MATCHT(ANTLR3_TOKEN_UP, NULL);
5601 + if (HASEXCEPTION())
5603 + goto ruledatecritEx;
5609 + const struct rsp_query_field_map *rqfp;
5610 + pANTLR3_STRING field;
5615 + switch (o->getType(o))
5626 + field = f->getText(f);
5628 + /* Field lookup */
5629 + rqfp = rsp_query_field_lookup((char *)field->chars, strlen((char *)field->chars));
5632 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not a valid field in queries\n", field->chars);
5634 + goto datecrit_valid_0; /* ABORT */
5637 + /* Check field type */
5638 + if (rqfp->field_type != RSP_TYPE_DATE)
5640 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not a date field\n", field->chars);
5642 + goto datecrit_valid_0; /* ABORT */
5645 + ret = snprintf(buf, sizeof(buf), "%ld", d.date);
5646 + if ((ret < 0) || (ret >= sizeof(buf)))
5648 + DPRINTF(E_LOG, L_RSP, "Date %ld too large for buffer, oops!\n", d.date);
5650 + goto datecrit_valid_0; /* ABORT */
5653 + retval.result= field->factory->newRaw(field->factory);
5654 + retval.result->append8(retval.result, "f.");
5655 + retval.result->appendS(retval.result, field);
5656 + retval.result->append8(retval.result, op);
5657 + retval.result->append8(retval.result, buf);
5669 + // This is where rules clean up and exit
5671 + goto ruledatecritEx; /* Prevent compiler warnings */
5674 + if (HASEXCEPTION())
5683 +/* $ANTLR end datecrit */
5686 + * $ANTLR start dateop
5687 + * RSP2SQL.g:377:1: dateop returns [ pANTLR3_COMMON_TOKEN op ] : (n= BEFORE | n= AFTER );
5689 +static pANTLR3_COMMON_TOKEN
5690 +dateop(pRSP2SQL ctx)
5692 + pANTLR3_COMMON_TOKEN op = NULL;
5694 + pANTLR3_BASE_TREE n;
5696 + /* Initialize rule variables
5705 + // RSP2SQL.g:379:2: (n= BEFORE | n= AFTER )
5707 + ANTLR3_UINT32 alt4;
5726 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
5727 + EXCEPTION->message = (void *)"";
5728 + EXCEPTION->decisionNum = 4;
5729 + EXCEPTION->state = 0;
5732 + goto ruledateopEx;
5738 + // RSP2SQL.g:379:4: n= BEFORE
5740 + n = (pANTLR3_BASE_TREE) MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateop505);
5741 + if (HASEXCEPTION())
5743 + goto ruledateopEx;
5747 + op= n->getToken(n);
5753 + // RSP2SQL.g:381:4: n= AFTER
5755 + n = (pANTLR3_BASE_TREE) MATCHT(AFTER, &FOLLOW_AFTER_in_dateop518);
5756 + if (HASEXCEPTION())
5758 + goto ruledateopEx;
5762 + op= n->getToken(n);
5773 + // This is where rules clean up and exit
5775 + goto ruledateopEx; /* Prevent compiler warnings */
5778 + if (HASEXCEPTION())
5787 +/* $ANTLR end dateop */
5790 + * $ANTLR start datespec
5791 + * RSP2SQL.g:385:1: datespec returns [ time_t date, int valid ] : (r= dateref | ^(o= dateop r= dateref m= INT i= dateintval ) );
5793 +static RSP2SQL_datespec_return
5794 +datespec(pRSP2SQL ctx)
5796 + RSP2SQL_datespec_return retval;
5798 + pANTLR3_BASE_TREE m;
5799 + RSP2SQL_dateref_return r;
5800 + #undef RETURN_TYPE_r
5801 + #define RETURN_TYPE_r RSP2SQL_dateref_return
5803 + pANTLR3_COMMON_TOKEN o;
5804 + #undef RETURN_TYPE_o
5805 + #define RETURN_TYPE_o pANTLR3_COMMON_TOKEN
5807 + RSP2SQL_dateintval_return i;
5808 + #undef RETURN_TYPE_i
5809 + #define RETURN_TYPE_i RSP2SQL_dateintval_return
5811 + /* Initialize rule variables
5815 + retval.date= 0; retval.valid= 1;
5818 + retval.start = LT(1); retval.stop = retval.start;
5822 + // RSP2SQL.g:387:2: (r= dateref | ^(o= dateop r= dateref m= INT i= dateintval ) )
5824 + ANTLR3_UINT32 alt5;
5845 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
5846 + EXCEPTION->message = (void *)"";
5847 + EXCEPTION->decisionNum = 5;
5848 + EXCEPTION->state = 0;
5851 + goto ruledatespecEx;
5857 + // RSP2SQL.g:387:4: r= dateref
5859 + FOLLOWPUSH(FOLLOW_dateref_in_datespec546);
5863 + if (HASEXCEPTION())
5865 + goto ruledatespecEx;
5873 + retval.date= r.date;
5880 + // RSP2SQL.g:394:4: ^(o= dateop r= dateref m= INT i= dateintval )
5882 + FOLLOWPUSH(FOLLOW_dateop_in_datespec560);
5886 + if (HASEXCEPTION())
5888 + goto ruledatespecEx;
5892 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
5893 + if (HASEXCEPTION())
5895 + goto ruledatespecEx;
5898 + FOLLOWPUSH(FOLLOW_dateref_in_datespec566);
5902 + if (HASEXCEPTION())
5904 + goto ruledatespecEx;
5907 + m = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_datespec572);
5908 + if (HASEXCEPTION())
5910 + goto ruledatespecEx;
5913 + FOLLOWPUSH(FOLLOW_dateintval_in_datespec578);
5914 + i=dateintval(ctx);
5917 + if (HASEXCEPTION())
5919 + goto ruledatespecEx;
5923 + MATCHT(ANTLR3_TOKEN_UP, NULL);
5924 + if (HASEXCEPTION())
5926 + goto ruledatespecEx;
5934 + if (!r.valid || !i.valid)
5937 + goto datespec_valid_0; /* ABORT */
5940 + ret = safe_atoi32((char *)m->getText(m)->chars, &val);
5943 + DPRINTF(E_LOG, L_RSP, "Could not convert '%s' to integer\n", (char *)m->getText(m));
5945 + goto datespec_valid_0; /* ABORT */
5948 + switch (o->getType(o))
5951 + retval.date= r.date - (val * i.period);
5955 + retval.date= r.date + (val * i.period);
5972 + // This is where rules clean up and exit
5974 + goto ruledatespecEx; /* Prevent compiler warnings */
5977 + if (HASEXCEPTION())
5986 +/* $ANTLR end datespec */
5989 + * $ANTLR start dateref
5990 + * RSP2SQL.g:429:1: dateref returns [ time_t date, int valid ] : (n= DATE | TODAY );
5992 +static RSP2SQL_dateref_return
5993 +dateref(pRSP2SQL ctx)
5995 + RSP2SQL_dateref_return retval;
5997 + pANTLR3_BASE_TREE n;
5999 + /* Initialize rule variables
6003 + retval.date= 0; retval.valid= 1;
6005 + retval.start = LT(1); retval.stop = retval.start;
6009 + // RSP2SQL.g:431:2: (n= DATE | TODAY )
6011 + ANTLR3_UINT32 alt6;
6030 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
6031 + EXCEPTION->message = (void *)"";
6032 + EXCEPTION->decisionNum = 6;
6033 + EXCEPTION->state = 0;
6036 + goto ruledaterefEx;
6042 + // RSP2SQL.g:431:4: n= DATE
6044 + n = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateref607);
6045 + if (HASEXCEPTION())
6047 + goto ruledaterefEx;
6055 + ret = strptime((char *)n->getText(n), "%Y-%m-%d", &tm);
6058 + DPRINTF(E_LOG, L_RSP, "Date '%s' could not be interpreted\n", (char *)n->getText(n));
6060 + goto dateref_valid_0; /* ABORT */
6065 + DPRINTF(E_LOG, L_RSP, "Garbage at end of date '%s' ?!\n", (char *)n->getText(n));
6067 + retval.date= mktime(&tm);
6068 + if (retval.date == (time_t) -1)
6070 + DPRINTF(E_LOG, L_RSP, "Date '%s' could not be converted to an epoch\n", (char *)n->getText(n));
6072 + goto dateref_valid_0; /* ABORT */
6084 + // RSP2SQL.g:460:4: TODAY
6086 + MATCHT(TODAY, &FOLLOW_TODAY_in_dateref616);
6087 + if (HASEXCEPTION())
6089 + goto ruledaterefEx;
6093 + retval.date= time(NULL);
6104 + // This is where rules clean up and exit
6106 + goto ruledaterefEx; /* Prevent compiler warnings */
6109 + if (HASEXCEPTION())
6118 +/* $ANTLR end dateref */
6121 + * $ANTLR start dateintval
6122 + * RSP2SQL.g:464:1: dateintval returns [ time_t period, int valid ] : ( DAY | WEEK | MONTH | YEAR );
6124 +static RSP2SQL_dateintval_return
6125 +dateintval(pRSP2SQL ctx)
6127 + RSP2SQL_dateintval_return retval;
6129 + /* Initialize rule variables
6133 + retval.period= 0; retval.valid= 1;
6134 + retval.start = LT(1); retval.stop = retval.start;
6138 + // RSP2SQL.g:466:2: ( DAY | WEEK | MONTH | YEAR )
6140 + ANTLR3_UINT32 alt7;
6169 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
6170 + EXCEPTION->message = (void *)"";
6171 + EXCEPTION->decisionNum = 7;
6172 + EXCEPTION->state = 0;
6175 + goto ruledateintvalEx;
6181 + // RSP2SQL.g:466:4: DAY
6183 + MATCHT(DAY, &FOLLOW_DAY_in_dateintval640);
6184 + if (HASEXCEPTION())
6186 + goto ruledateintvalEx;
6190 + retval.period= 24 * 60 * 60;
6196 + // RSP2SQL.g:468:4: WEEK
6198 + MATCHT(WEEK, &FOLLOW_WEEK_in_dateintval649);
6199 + if (HASEXCEPTION())
6201 + goto ruledateintvalEx;
6205 + retval.period= 7 * 24 * 60 * 60;
6211 + // RSP2SQL.g:470:4: MONTH
6213 + MATCHT(MONTH, &FOLLOW_MONTH_in_dateintval658);
6214 + if (HASEXCEPTION())
6216 + goto ruledateintvalEx;
6220 + retval.period= 30 * 24 * 60 * 60;
6226 + // RSP2SQL.g:472:4: YEAR
6228 + MATCHT(YEAR, &FOLLOW_YEAR_in_dateintval667);
6229 + if (HASEXCEPTION())
6231 + goto ruledateintvalEx;
6235 + retval.period= 365 * 24 * 60 * 60;
6246 + // This is where rules clean up and exit
6248 + goto ruledateintvalEx; /* Prevent compiler warnings */
6249 + ruledateintvalEx: ;
6251 + if (HASEXCEPTION())
6260 +/* $ANTLR end dateintval */
6261 +/* End of parsing rules
6262 + * ==============================================
6265 +/* ==============================================
6266 + * Syntactic predicates
6268 +/* End of syntactic predicates
6269 + * ==============================================
6278 + * =============================================================================
6280 diff --git a/src/pregen/RSP2SQL.h b/src/pregen/RSP2SQL.h
6281 new file mode 100644
6282 index 0000000..2789fc7
6284 +++ b/src/pregen/RSP2SQL.h
6287 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
6289 + * - From the grammar source file : RSP2SQL.g
6290 + * - On : 2014-09-30 21:42:42
6291 + * - for the tree parser : RSP2SQLTreeParser *
6292 + * Editing it, at least manually, is not wise.
6294 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
6297 + * The tree parser RSP2SQL has the callable functions (rules) shown below,
6298 + * which will invoke the code for the associated rule in the source grammar
6299 + * assuming that the input stream is pointing to a token/text stream that could begin
6302 + * For instance if you call the first (topmost) rule in a parser grammar, you will
6303 + * get the results of a full parse, but calling a rule half way through the grammar will
6304 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
6305 + * in editors and so on.
6307 + * The parser entry points are called indirectly (by function pointer to function) via
6308 + * a parser context typedef pRSP2SQL, which is returned from a call to RSP2SQLNew().
6310 + * The methods in pRSP2SQL are as follows:
6312 + * - pANTLR3_STRING pRSP2SQL->query(pRSP2SQL)
6313 + * - RSP2SQL_expr_return pRSP2SQL->expr(pRSP2SQL)
6314 + * - RSP2SQL_strcrit_return pRSP2SQL->strcrit(pRSP2SQL)
6315 + * - pANTLR3_COMMON_TOKEN pRSP2SQL->strop(pRSP2SQL)
6316 + * - RSP2SQL_intcrit_return pRSP2SQL->intcrit(pRSP2SQL)
6317 + * - pANTLR3_COMMON_TOKEN pRSP2SQL->intop(pRSP2SQL)
6318 + * - RSP2SQL_datecrit_return pRSP2SQL->datecrit(pRSP2SQL)
6319 + * - pANTLR3_COMMON_TOKEN pRSP2SQL->dateop(pRSP2SQL)
6320 + * - RSP2SQL_datespec_return pRSP2SQL->datespec(pRSP2SQL)
6321 + * - RSP2SQL_dateref_return pRSP2SQL->dateref(pRSP2SQL)
6322 + * - RSP2SQL_dateintval_return pRSP2SQL->dateintval(pRSP2SQL)
6324 + * The return type for any particular rule is of course determined by the source
6327 +// [The "BSD licence"]
6328 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
6329 +// http://www.temporal-wave.com
6330 +// http://www.linkedin.com/in/jimidle
6332 +// All rights reserved.
6334 +// Redistribution and use in source and binary forms, with or without
6335 +// modification, are permitted provided that the following conditions
6337 +// 1. Redistributions of source code must retain the above copyright
6338 +// notice, this list of conditions and the following disclaimer.
6339 +// 2. Redistributions in binary form must reproduce the above copyright
6340 +// notice, this list of conditions and the following disclaimer in the
6341 +// documentation and/or other materials provided with the distribution.
6342 +// 3. The name of the author may not be used to endorse or promote products
6343 +// derived from this software without specific prior written permission.
6345 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
6346 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
6347 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
6348 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
6349 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
6350 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
6351 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
6352 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
6353 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
6354 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6358 +/* =============================================================================
6359 + * Standard antlr3 C runtime definitions
6361 +#include <antlr3.h>
6363 +/* End of standard antlr 3 runtime definitions
6364 + * =============================================================================
6371 +// Forward declare the context typedef so that we can use it before it is
6372 +// properly defined. Delegators and delegates (from import statements) are
6373 +// interdependent and their context structures contain pointers to each other
6374 +// C only allows such things to be declared if you pre-declare the typedef.
6376 +typedef struct RSP2SQL_Ctx_struct RSP2SQL, * pRSP2SQL;
6380 + /* Needs #define _GNU_SOURCE for strptime() */
6382 + #include <stdio.h>
6383 + #include <string.h>
6385 + #include <stdint.h>
6387 + #include "logger.h"
6390 + #include "rsp_query.h"
6393 +#ifdef ANTLR3_WINDOWS
6394 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
6395 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
6396 +// initialized but unused variable - tree rewrite variables declared but not needed
6397 +// Unreferenced local variable - lexer rule declares but does not always use _type
6398 +// potentially unitialized variable used - retval always returned from a rule
6399 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
6401 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
6402 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
6403 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
6404 +// this is a matter of orthogonality hence I disable that one.
6406 +#pragma warning( disable : 4100 )
6407 +#pragma warning( disable : 4101 )
6408 +#pragma warning( disable : 4127 )
6409 +#pragma warning( disable : 4189 )
6410 +#pragma warning( disable : 4505 )
6411 +#pragma warning( disable : 4701 )
6413 +typedef struct RSP2SQL_expr_return_struct
6415 + pANTLR3_BASE_TREE start;
6416 + pANTLR3_BASE_TREE stop;
6417 + pANTLR3_STRING result;
6420 + RSP2SQL_expr_return;
6422 +typedef struct RSP2SQL_strcrit_return_struct
6424 + pANTLR3_BASE_TREE start;
6425 + pANTLR3_BASE_TREE stop;
6426 + pANTLR3_STRING result;
6429 + RSP2SQL_strcrit_return;
6431 +typedef struct RSP2SQL_intcrit_return_struct
6433 + pANTLR3_BASE_TREE start;
6434 + pANTLR3_BASE_TREE stop;
6435 + pANTLR3_STRING result;
6438 + RSP2SQL_intcrit_return;
6440 +typedef struct RSP2SQL_datecrit_return_struct
6442 + pANTLR3_BASE_TREE start;
6443 + pANTLR3_BASE_TREE stop;
6444 + pANTLR3_STRING result;
6447 + RSP2SQL_datecrit_return;
6449 +typedef struct RSP2SQL_datespec_return_struct
6451 + pANTLR3_BASE_TREE start;
6452 + pANTLR3_BASE_TREE stop;
6456 + RSP2SQL_datespec_return;
6458 +typedef struct RSP2SQL_dateref_return_struct
6460 + pANTLR3_BASE_TREE start;
6461 + pANTLR3_BASE_TREE stop;
6465 + RSP2SQL_dateref_return;
6467 +typedef struct RSP2SQL_dateintval_return_struct
6469 + pANTLR3_BASE_TREE start;
6470 + pANTLR3_BASE_TREE stop;
6474 + RSP2SQL_dateintval_return;
6478 +/** Context tracking structure for RSP2SQL
6480 +struct RSP2SQL_Ctx_struct
6482 + /** Built in ANTLR3 context tracker contains all the generic elements
6483 + * required for context tracking.
6485 + pANTLR3_TREE_PARSER pTreeParser;
6488 + pANTLR3_STRING (*query) (struct RSP2SQL_Ctx_struct * ctx);
6489 + RSP2SQL_expr_return (*expr) (struct RSP2SQL_Ctx_struct * ctx);
6490 + RSP2SQL_strcrit_return (*strcrit) (struct RSP2SQL_Ctx_struct * ctx);
6491 + pANTLR3_COMMON_TOKEN (*strop) (struct RSP2SQL_Ctx_struct * ctx);
6492 + RSP2SQL_intcrit_return (*intcrit) (struct RSP2SQL_Ctx_struct * ctx);
6493 + pANTLR3_COMMON_TOKEN (*intop) (struct RSP2SQL_Ctx_struct * ctx);
6494 + RSP2SQL_datecrit_return (*datecrit) (struct RSP2SQL_Ctx_struct * ctx);
6495 + pANTLR3_COMMON_TOKEN (*dateop) (struct RSP2SQL_Ctx_struct * ctx);
6496 + RSP2SQL_datespec_return (*datespec) (struct RSP2SQL_Ctx_struct * ctx);
6497 + RSP2SQL_dateref_return (*dateref) (struct RSP2SQL_Ctx_struct * ctx);
6498 + RSP2SQL_dateintval_return (*dateintval) (struct RSP2SQL_Ctx_struct * ctx);
6499 + // Delegated rules
6500 + const char * (*getGrammarFileName)();
6501 + void (*free) (struct RSP2SQL_Ctx_struct * ctx);
6505 +// Function protoypes for the constructor functions that external translation units
6506 +// such as delegators and delegates may wish to call.
6508 +ANTLR3_API pRSP2SQL RSP2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream);
6509 +ANTLR3_API pRSP2SQL RSP2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
6511 +/** Symbolic definitions of all the tokens that the tree parser will work with.
6514 + * Antlr will define EOF, but we can't use that as it it is too common in
6515 + * in C header files and that would be confusing. There is no way to filter this out at the moment
6516 + * so we just undef it here for now. That isn't the value we get back from C recognizers
6517 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
6541 +#define INCLUDES 13
6558 +#define EOF ANTLR3_TOKEN_EOF
6561 +#ifndef TOKENSOURCE
6562 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
6565 +/* End of token definitions for RSP2SQL
6566 + * =============================================================================
6576 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
6577 diff --git a/src/pregen/RSP2SQL.u b/src/pregen/RSP2SQL.u
6578 new file mode 100644
6579 index 0000000..53d8cda
6581 +++ b/src/pregen/RSP2SQL.u
6583 +RSP2SQL.g: RSP.tokens
6584 +RSP2SQL.c : RSP2SQL.g
6585 +./RSP2SQL.tokens : RSP2SQL.g
6586 +RSP2SQL.h : RSP2SQL.g
6587 +ANTLR_PRODUCTS += RSP2SQL.c ./RSP2SQL.tokens RSP2SQL.h
6588 \ No newline at end of file
6589 diff --git a/src/pregen/RSPLexer.c b/src/pregen/RSPLexer.c
6590 new file mode 100644
6591 index 0000000..ee23c08
6593 +++ b/src/pregen/RSPLexer.c
6596 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
6598 + * - From the grammar source file : RSP.g
6599 + * - On : 2014-09-30 21:42:41
6600 + * - for the lexer : RSPLexerLexer *
6601 + * Editing it, at least manually, is not wise.
6603 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
6607 +// [The "BSD licence"]
6608 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
6609 +// http://www.temporal-wave.com
6610 +// http://www.linkedin.com/in/jimidle
6612 +// All rights reserved.
6614 +// Redistribution and use in source and binary forms, with or without
6615 +// modification, are permitted provided that the following conditions
6617 +// 1. Redistributions of source code must retain the above copyright
6618 +// notice, this list of conditions and the following disclaimer.
6619 +// 2. Redistributions in binary form must reproduce the above copyright
6620 +// notice, this list of conditions and the following disclaimer in the
6621 +// documentation and/or other materials provided with the distribution.
6622 +// 3. The name of the author may not be used to endorse or promote products
6623 +// derived from this software without specific prior written permission.
6625 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
6626 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
6627 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
6628 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
6629 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
6630 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
6631 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
6632 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
6633 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
6634 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6636 +/* -----------------------------------------
6637 + * Include the ANTLR3 generated header file.
6639 +#include "RSPLexer.h"
6640 +/* ----------------------------------------- */
6643 +/** String literals used by RSPLexer that we must do things like MATCHS() with.
6644 + * C will normally just lay down 8 bit characters, and you can use L"xxx" to
6645 + * get wchar_t, but wchar_t is 16 bits on Windows, which is not UTF32 and so
6646 + * we perform this little trick of defining the literals as arrays of UINT32
6647 + * and passing in the address of these.
6649 +static ANTLR3_UCHAR lit_1[] = { 0x61, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR};
6650 +static ANTLR3_UCHAR lit_2[] = { 0x6F, 0x72, ANTLR3_STRING_TERMINATOR};
6651 +static ANTLR3_UCHAR lit_3[] = { 0x69, 0x6E, 0x63, 0x6C, 0x75, 0x64, 0x65, 0x73, ANTLR3_STRING_TERMINATOR};
6652 +static ANTLR3_UCHAR lit_4[] = { 0x73, 0x74, 0x61, 0x72, 0x74, 0x73, 0x77, 0x69, 0x74, 0x68, ANTLR3_STRING_TERMINATOR};
6653 +static ANTLR3_UCHAR lit_5[] = { 0x65, 0x6E, 0x64, 0x73, 0x77, 0x69, 0x74, 0x68, ANTLR3_STRING_TERMINATOR};
6654 +static ANTLR3_UCHAR lit_6[] = { 0x3E, 0x3D, ANTLR3_STRING_TERMINATOR};
6655 +static ANTLR3_UCHAR lit_7[] = { 0x3C, 0x3D, ANTLR3_STRING_TERMINATOR};
6656 +static ANTLR3_UCHAR lit_8[] = { 0x62, 0x65, 0x66, 0x6F, 0x72, 0x65, ANTLR3_STRING_TERMINATOR};
6657 +static ANTLR3_UCHAR lit_9[] = { 0x61, 0x66, 0x74, 0x65, 0x72, ANTLR3_STRING_TERMINATOR};
6658 +static ANTLR3_UCHAR lit_10[] = { 0x64, 0x61, 0x79, ANTLR3_STRING_TERMINATOR};
6659 +static ANTLR3_UCHAR lit_11[] = { 0x64, 0x61, 0x79, 0x73, ANTLR3_STRING_TERMINATOR};
6660 +static ANTLR3_UCHAR lit_12[] = { 0x77, 0x65, 0x65, 0x6B, ANTLR3_STRING_TERMINATOR};
6661 +static ANTLR3_UCHAR lit_13[] = { 0x77, 0x65, 0x65, 0x6B, 0x73, ANTLR3_STRING_TERMINATOR};
6662 +static ANTLR3_UCHAR lit_14[] = { 0x6D, 0x6F, 0x6E, 0x74, 0x68, ANTLR3_STRING_TERMINATOR};
6663 +static ANTLR3_UCHAR lit_15[] = { 0x6D, 0x6F, 0x6E, 0x74, 0x68, 0x73, ANTLR3_STRING_TERMINATOR};
6664 +static ANTLR3_UCHAR lit_16[] = { 0x79, 0x65, 0x61, 0x72, ANTLR3_STRING_TERMINATOR};
6665 +static ANTLR3_UCHAR lit_17[] = { 0x79, 0x65, 0x61, 0x72, 0x73, ANTLR3_STRING_TERMINATOR};
6666 +static ANTLR3_UCHAR lit_18[] = { 0x74, 0x6F, 0x64, 0x61, 0x79, ANTLR3_STRING_TERMINATOR};
6671 +/* MACROS that hide the C interface implementations from the
6672 + * generated code, which makes it a little more understandable to the human eye.
6673 + * I am very much against using C pre-processor macros for function calls and bits
6674 + * of code as you cannot see what is happening when single stepping in debuggers
6675 + * and so on. The exception (in my book at least) is for generated code, where you are
6676 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
6677 + * hides some indirect calls, but is always referring to the input stream. This is
6678 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
6679 + * the runtime interfaces without changing the generated code too often, without
6680 + * confusing the reader of the generated output, who may not wish to know the gory
6681 + * details of the interface inheritance.
6686 +/* Aids in accessing scopes for grammar programmers
6691 +#define SCOPE_TYPE(scope) pRSPLexer_##scope##_SCOPE
6692 +#define SCOPE_STACK(scope) pRSPLexer_##scope##Stack
6693 +#define SCOPE_TOP(scope) ctx->pRSPLexer_##scope##Top
6694 +#define SCOPE_SIZE(scope) ctx->pRSPLexer_##scope##Stack_limit
6695 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
6698 +/* Macros for accessing things in a lexer
6703 +#undef GETCHARINDEX
6705 +#undef GETCHARPOSITIONINLINE
6717 +#undef HASEXCEPTION
6725 +#undef BACKTRACKING
6728 +#undef HAVEPARSEDRULE
6737 +#define LEXER ctx->pLexer
6738 +#define RECOGNIZER LEXER->rec
6739 +#define LEXSTATE RECOGNIZER->state
6740 +#define TOKSOURCE LEXSTATE->tokSource
6741 +#define GETCHARINDEX() LEXER->getCharIndex(LEXER)
6742 +#define GETLINE() LEXER->getLine(LEXER)
6743 +#define GETTEXT() LEXER->getText(LEXER)
6744 +#define GETCHARPOSITIONINLINE() LEXER->getCharPositionInLine(LEXER)
6745 +#define EMIT() LEXSTATE->type = _type; LEXER->emit(LEXER)
6746 +#define EMITNEW(t) LEXER->emitNew(LEXER, t)
6747 +#define MATCHC(c) LEXER->matchc(LEXER, c)
6748 +#define MATCHS(s) LEXER->matchs(LEXER, s)
6749 +#define MATCHRANGE(c1,c2) LEXER->matchRange(LEXER, c1, c2)
6750 +#define MATCHANY() LEXER->matchAny(LEXER)
6751 +#define LTOKEN LEXSTATE->token
6752 +#define HASFAILED() (LEXSTATE->failed == ANTLR3_TRUE)
6753 +#define BACKTRACKING LEXSTATE->backtracking
6754 +#define FAILEDFLAG LEXSTATE->failed
6755 +#define INPUT LEXER->input
6756 +#define STRSTREAM INPUT
6757 +#define ISTREAM INPUT->istream
6758 +#define INDEX() ISTREAM->index(ISTREAM)
6759 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
6760 +#define EOF_TOKEN &(LEXSTATE->tokSource->eofToken)
6761 +#define HASEXCEPTION() (LEXSTATE->error == ANTLR3_TRUE)
6762 +#define EXCEPTION LEXSTATE->exception
6763 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
6764 +#define LRECOVER() LEXER->recover(LEXER)
6765 +#define MARK() ISTREAM->mark(ISTREAM)
6766 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
6767 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
6768 +#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si)
6769 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
6770 +#define PUSHSTREAM(str) LEXER->pushCharStream(LEXER, str)
6771 +#define POPSTREAM() LEXER->popCharStream(LEXER)
6772 +#define SETTEXT(str) LEXSTATE->text = str
6773 +#define SKIP() LEXSTATE->token = &(TOKSOURCE->skipToken)
6774 +#define USER1 LEXSTATE->user1
6775 +#define USER2 LEXSTATE->user2
6776 +#define USER3 LEXSTATE->user3
6777 +#define CUSTOM LEXSTATE->custom
6778 +#define RULEMEMO LEXSTATE->ruleMemo
6779 +#define DBG RECOGNIZER->debugger
6781 +/* If we have been told we can rely on the standard 8 bit or 16 bit input
6782 + * stream, then we can define our macros to use the direct pointers
6783 + * in the input object, which is much faster than indirect calls. This
6784 + * is really only significant to lexers with a lot of fragment rules (which
6785 + * do not place LA(1) in a temporary at the moment) and even then
6786 + * only if there is a lot of input (order of say 1M or so).
6788 +#if defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16)
6790 +# ifdef ANTLR3_INLINE_INPUT_ASCII
6792 +/* 8 bit "ASCII" (actually any 8 bit character set) */
6794 +# define NEXTCHAR ((pANTLR3_UINT8)(INPUT->nextChar))
6795 +# define DATAP ((pANTLR3_UINT8)(INPUT->data))
6799 +# define NEXTCHAR ((pANTLR3_UINT16)(INPUT->nextChar))
6800 +# define DATAP ((pANTLR3_UINT16)(INPUT->data))
6804 +# define LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1)))
6805 +# define CONSUME() \
6807 + if (NEXTCHAR < (DATAP + INPUT->sizeBuf)) \
6809 + INPUT->charPositionInLine++; \
6810 + if ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar) \
6813 + INPUT->charPositionInLine = 0; \
6814 + INPUT->currentLine = (void *)(NEXTCHAR + 1); \
6816 + INPUT->nextChar = (void *)(NEXTCHAR + 1); \
6822 +// Pick up the input character by calling the input stream implementation.
6824 +#define CONSUME() INPUT->istream->consume(INPUT->istream)
6825 +#define LA(n) INPUT->istream->_LA(INPUT->istream, n)
6828 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
6830 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
6831 + * then for the present you must use different names for your defines as these are hard coded
6832 + * in the code generator. It would be better not to use such names internally, and maybe
6833 + * we can change this in a forthcoming release. I deliberately do not #undef these
6834 + * here as this will at least give you a redefined error somewhere if they clash.
6836 +#define UP ANTLR3_TOKEN_UP
6837 +#define DOWN ANTLR3_TOKEN_DOWN
6838 +#define EOR ANTLR3_TOKEN_EOR
6839 +#define INVALID ANTLR3_TOKEN_INVALID
6842 +/* =============================================================================
6843 + * Functions to create and destroy scopes. First come the rule scopes, followed
6844 + * by the global declared scopes.
6849 +/* ============================================================================= */
6851 +/* =============================================================================
6852 + * Start of recognizer
6856 +/* Forward declare the locally static matching functions we have generated and any predicate functions.
6858 +static ANTLR3_INLINE void mQUOTE (pRSPLexer ctx);
6859 +static ANTLR3_INLINE void mLPAR (pRSPLexer ctx);
6860 +static ANTLR3_INLINE void mRPAR (pRSPLexer ctx);
6861 +static ANTLR3_INLINE void mAND (pRSPLexer ctx);
6862 +static ANTLR3_INLINE void mOR (pRSPLexer ctx);
6863 +static ANTLR3_INLINE void mNOT (pRSPLexer ctx);
6864 +static ANTLR3_INLINE void mEQUAL (pRSPLexer ctx);
6865 +static ANTLR3_INLINE void mINCLUDES (pRSPLexer ctx);
6866 +static ANTLR3_INLINE void mSTARTSW (pRSPLexer ctx);
6867 +static ANTLR3_INLINE void mENDSW (pRSPLexer ctx);
6868 +static ANTLR3_INLINE void mGREATER (pRSPLexer ctx);
6869 +static ANTLR3_INLINE void mLESS (pRSPLexer ctx);
6870 +static ANTLR3_INLINE void mGTE (pRSPLexer ctx);
6871 +static ANTLR3_INLINE void mLTE (pRSPLexer ctx);
6872 +static ANTLR3_INLINE void mBEFORE (pRSPLexer ctx);
6873 +static ANTLR3_INLINE void mAFTER (pRSPLexer ctx);
6874 +static ANTLR3_INLINE void mDAY (pRSPLexer ctx);
6875 +static ANTLR3_INLINE void mWEEK (pRSPLexer ctx);
6876 +static ANTLR3_INLINE void mMONTH (pRSPLexer ctx);
6877 +static ANTLR3_INLINE void mYEAR (pRSPLexer ctx);
6878 +static ANTLR3_INLINE void mTODAY (pRSPLexer ctx);
6879 +static ANTLR3_INLINE void mNEWLINE (pRSPLexer ctx);
6880 +static ANTLR3_INLINE void mWS (pRSPLexer ctx);
6881 +static ANTLR3_INLINE void mFIELD (pRSPLexer ctx);
6882 +static ANTLR3_INLINE void mINT (pRSPLexer ctx);
6883 +static ANTLR3_INLINE void mDATE (pRSPLexer ctx);
6884 +static ANTLR3_INLINE void mSTR (pRSPLexer ctx);
6885 +static ANTLR3_INLINE void mESCAPED (pRSPLexer ctx);
6886 +static ANTLR3_INLINE void mDIGIT09 (pRSPLexer ctx);
6887 +static ANTLR3_INLINE void mDIGIT19 (pRSPLexer ctx);
6888 +static ANTLR3_INLINE void mTokens (pRSPLexer ctx);
6889 +static void RSPLexerFree(pRSPLexer ctx);
6891 +/* =========================================================================
6892 + * Lexer matching rules end.
6893 + * =========================================================================
6899 +RSPLexerFree (pRSPLexer ctx)
6901 + LEXER->free(LEXER);
6906 +/** \brief Name of the grammar file that generated this code
6908 +static const char fileName[] = "RSP.g";
6910 +/** \brief Return the name of the grammar file that generated this code.
6912 +static const char * getGrammarFileName()
6917 +/** \brief Create a new lexer called RSPLexer
6919 + * \param[in] instream Pointer to an initialized input stream
6921 + * - Success pRSPLexer initialized for the lex start
6924 +ANTLR3_API pRSPLexer RSPLexerNew
6925 +(pANTLR3_INPUT_STREAM instream)
6927 + // See if we can create a new lexer with the standard constructor
6929 + return RSPLexerNewSSD(instream, NULL);
6932 +/** \brief Create a new lexer called RSPLexer
6934 + * \param[in] instream Pointer to an initialized input stream
6935 + * \param[state] state Previously created shared recognizer stat
6937 + * - Success pRSPLexer initialized for the lex start
6940 +ANTLR3_API pRSPLexer RSPLexerNewSSD
6941 +(pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
6943 + pRSPLexer ctx; // Context structure we will build and return
6945 + ctx = (pRSPLexer) ANTLR3_CALLOC(1, sizeof(RSPLexer));
6949 + // Failed to allocate memory for lexer context
6953 + /* -------------------------------------------------------------------
6954 + * Memory for basic structure is allocated, now to fill in
6955 + * in base ANTLR3 structures. We initialize the function pointers
6956 + * for the standard ANTLR3 lexer function set, but upon return
6957 + * from here, the programmer may set the pointers to provide custom
6958 + * implementations of each function.
6960 + * We don't use the macros defined in RSPLexer.h here so you can get a sense
6961 + * of what goes where.
6964 + /* Create a base lexer, using the supplied input stream
6966 + ctx->pLexer = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state);
6968 + /* Check that we allocated the memory correctly
6970 + if (ctx->pLexer == NULL)
6975 + /* Install the implementation of our RSPLexer interface
6977 + ctx->mQUOTE = mQUOTE;
6978 + ctx->mLPAR = mLPAR;
6979 + ctx->mRPAR = mRPAR;
6983 + ctx->mEQUAL = mEQUAL;
6984 + ctx->mINCLUDES = mINCLUDES;
6985 + ctx->mSTARTSW = mSTARTSW;
6986 + ctx->mENDSW = mENDSW;
6987 + ctx->mGREATER = mGREATER;
6988 + ctx->mLESS = mLESS;
6991 + ctx->mBEFORE = mBEFORE;
6992 + ctx->mAFTER = mAFTER;
6994 + ctx->mWEEK = mWEEK;
6995 + ctx->mMONTH = mMONTH;
6996 + ctx->mYEAR = mYEAR;
6997 + ctx->mTODAY = mTODAY;
6998 + ctx->mNEWLINE = mNEWLINE;
7000 + ctx->mFIELD = mFIELD;
7002 + ctx->mDATE = mDATE;
7004 + ctx->mESCAPED = mESCAPED;
7005 + ctx->mDIGIT09 = mDIGIT09;
7006 + ctx->mDIGIT19 = mDIGIT19;
7007 + ctx->mTokens = mTokens;
7009 + /** When the nextToken() call is made to this lexer's pANTLR3_TOKEN_SOURCE
7010 + * it will call mTokens() in this generated code, and will pass it the ctx
7011 + * pointer of this lexer, not the context of the base lexer, so store that now.
7013 + ctx->pLexer->ctx = ctx;
7015 + /**Install the token matching function
7017 + ctx->pLexer->mTokens = (void (*) (void *))(mTokens);
7019 + ctx->getGrammarFileName = getGrammarFileName;
7020 + ctx->free = RSPLexerFree;
7026 + /* Return the newly built lexer to the caller
7032 +/* =========================================================================
7033 + * Functions to match the lexer grammar defined tokens from the input stream
7036 +// Comes from: 85:7: ( '\"' )
7037 +/** \brief Lexer rule generated by ANTLR3
7039 + * $ANTLR start QUOTE
7041 + * Looks to match the characters the constitute the token QUOTE
7042 + * from the attached input stream.
7046 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7048 +static ANTLR3_INLINE
7049 +void mQUOTE(pRSPLexer ctx)
7051 + ANTLR3_UINT32 _type;
7056 + // RSP.g:85:7: ( '\"' )
7057 + // RSP.g:85:9: '\"'
7060 + if (HASEXCEPTION())
7068 + LEXSTATE->type = _type;
7070 + // This is where rules clean up and exit
7072 + goto ruleQUOTEEx; /* Prevent compiler warnings */
7076 +// $ANTLR end QUOTE
7078 +// Comes from: 86:6: ( '(' )
7079 +/** \brief Lexer rule generated by ANTLR3
7081 + * $ANTLR start LPAR
7083 + * Looks to match the characters the constitute the token LPAR
7084 + * from the attached input stream.
7088 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7090 +static ANTLR3_INLINE
7091 +void mLPAR(pRSPLexer ctx)
7093 + ANTLR3_UINT32 _type;
7098 + // RSP.g:86:6: ( '(' )
7099 + // RSP.g:86:8: '('
7102 + if (HASEXCEPTION())
7110 + LEXSTATE->type = _type;
7112 + // This is where rules clean up and exit
7114 + goto ruleLPAREx; /* Prevent compiler warnings */
7120 +// Comes from: 87:6: ( ')' )
7121 +/** \brief Lexer rule generated by ANTLR3
7123 + * $ANTLR start RPAR
7125 + * Looks to match the characters the constitute the token RPAR
7126 + * from the attached input stream.
7130 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7132 +static ANTLR3_INLINE
7133 +void mRPAR(pRSPLexer ctx)
7135 + ANTLR3_UINT32 _type;
7140 + // RSP.g:87:6: ( ')' )
7141 + // RSP.g:87:8: ')'
7144 + if (HASEXCEPTION())
7152 + LEXSTATE->type = _type;
7154 + // This is where rules clean up and exit
7156 + goto ruleRPAREx; /* Prevent compiler warnings */
7162 +// Comes from: 89:5: ( 'and' )
7163 +/** \brief Lexer rule generated by ANTLR3
7165 + * $ANTLR start AND
7167 + * Looks to match the characters the constitute the token AND
7168 + * from the attached input stream.
7172 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7174 +static ANTLR3_INLINE
7175 +void mAND(pRSPLexer ctx)
7177 + ANTLR3_UINT32 _type;
7182 + // RSP.g:89:5: ( 'and' )
7183 + // RSP.g:89:7: 'and'
7186 + if (HASEXCEPTION())
7195 + LEXSTATE->type = _type;
7197 + // This is where rules clean up and exit
7199 + goto ruleANDEx; /* Prevent compiler warnings */
7205 +// Comes from: 90:4: ( 'or' )
7206 +/** \brief Lexer rule generated by ANTLR3
7210 + * Looks to match the characters the constitute the token OR
7211 + * from the attached input stream.
7215 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7217 +static ANTLR3_INLINE
7218 +void mOR(pRSPLexer ctx)
7220 + ANTLR3_UINT32 _type;
7225 + // RSP.g:90:4: ( 'or' )
7226 + // RSP.g:90:6: 'or'
7229 + if (HASEXCEPTION())
7238 + LEXSTATE->type = _type;
7240 + // This is where rules clean up and exit
7242 + goto ruleOREx; /* Prevent compiler warnings */
7248 +// Comes from: 91:5: ( '!' )
7249 +/** \brief Lexer rule generated by ANTLR3
7251 + * $ANTLR start NOT
7253 + * Looks to match the characters the constitute the token NOT
7254 + * from the attached input stream.
7258 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7260 +static ANTLR3_INLINE
7261 +void mNOT(pRSPLexer ctx)
7263 + ANTLR3_UINT32 _type;
7268 + // RSP.g:91:5: ( '!' )
7269 + // RSP.g:91:7: '!'
7272 + if (HASEXCEPTION())
7280 + LEXSTATE->type = _type;
7282 + // This is where rules clean up and exit
7284 + goto ruleNOTEx; /* Prevent compiler warnings */
7290 +// Comes from: 94:7: ( '=' )
7291 +/** \brief Lexer rule generated by ANTLR3
7293 + * $ANTLR start EQUAL
7295 + * Looks to match the characters the constitute the token EQUAL
7296 + * from the attached input stream.
7300 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7302 +static ANTLR3_INLINE
7303 +void mEQUAL(pRSPLexer ctx)
7305 + ANTLR3_UINT32 _type;
7310 + // RSP.g:94:7: ( '=' )
7311 + // RSP.g:94:9: '='
7314 + if (HASEXCEPTION())
7322 + LEXSTATE->type = _type;
7324 + // This is where rules clean up and exit
7326 + goto ruleEQUALEx; /* Prevent compiler warnings */
7330 +// $ANTLR end EQUAL
7332 +// Comes from: 97:9: ( 'includes' )
7333 +/** \brief Lexer rule generated by ANTLR3
7335 + * $ANTLR start INCLUDES
7337 + * Looks to match the characters the constitute the token INCLUDES
7338 + * from the attached input stream.
7342 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7344 +static ANTLR3_INLINE
7345 +void mINCLUDES(pRSPLexer ctx)
7347 + ANTLR3_UINT32 _type;
7352 + // RSP.g:97:9: ( 'includes' )
7353 + // RSP.g:97:11: 'includes'
7356 + if (HASEXCEPTION())
7358 + goto ruleINCLUDESEx;
7365 + LEXSTATE->type = _type;
7367 + // This is where rules clean up and exit
7369 + goto ruleINCLUDESEx; /* Prevent compiler warnings */
7373 +// $ANTLR end INCLUDES
7375 +// Comes from: 98:9: ( 'startswith' )
7376 +/** \brief Lexer rule generated by ANTLR3
7378 + * $ANTLR start STARTSW
7380 + * Looks to match the characters the constitute the token STARTSW
7381 + * from the attached input stream.
7385 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7387 +static ANTLR3_INLINE
7388 +void mSTARTSW(pRSPLexer ctx)
7390 + ANTLR3_UINT32 _type;
7395 + // RSP.g:98:9: ( 'startswith' )
7396 + // RSP.g:98:11: 'startswith'
7399 + if (HASEXCEPTION())
7401 + goto ruleSTARTSWEx;
7408 + LEXSTATE->type = _type;
7410 + // This is where rules clean up and exit
7412 + goto ruleSTARTSWEx; /* Prevent compiler warnings */
7416 +// $ANTLR end STARTSW
7418 +// Comes from: 99:7: ( 'endswith' )
7419 +/** \brief Lexer rule generated by ANTLR3
7421 + * $ANTLR start ENDSW
7423 + * Looks to match the characters the constitute the token ENDSW
7424 + * from the attached input stream.
7428 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7430 +static ANTLR3_INLINE
7431 +void mENDSW(pRSPLexer ctx)
7433 + ANTLR3_UINT32 _type;
7438 + // RSP.g:99:7: ( 'endswith' )
7439 + // RSP.g:99:9: 'endswith'
7442 + if (HASEXCEPTION())
7451 + LEXSTATE->type = _type;
7453 + // This is where rules clean up and exit
7455 + goto ruleENDSWEx; /* Prevent compiler warnings */
7459 +// $ANTLR end ENDSW
7461 +// Comes from: 102:9: ( '>' )
7462 +/** \brief Lexer rule generated by ANTLR3
7464 + * $ANTLR start GREATER
7466 + * Looks to match the characters the constitute the token GREATER
7467 + * from the attached input stream.
7471 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7473 +static ANTLR3_INLINE
7474 +void mGREATER(pRSPLexer ctx)
7476 + ANTLR3_UINT32 _type;
7481 + // RSP.g:102:9: ( '>' )
7482 + // RSP.g:102:11: '>'
7485 + if (HASEXCEPTION())
7487 + goto ruleGREATEREx;
7493 + LEXSTATE->type = _type;
7495 + // This is where rules clean up and exit
7497 + goto ruleGREATEREx; /* Prevent compiler warnings */
7501 +// $ANTLR end GREATER
7503 +// Comes from: 103:6: ( '<' )
7504 +/** \brief Lexer rule generated by ANTLR3
7506 + * $ANTLR start LESS
7508 + * Looks to match the characters the constitute the token LESS
7509 + * from the attached input stream.
7513 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7515 +static ANTLR3_INLINE
7516 +void mLESS(pRSPLexer ctx)
7518 + ANTLR3_UINT32 _type;
7523 + // RSP.g:103:6: ( '<' )
7524 + // RSP.g:103:8: '<'
7527 + if (HASEXCEPTION())
7535 + LEXSTATE->type = _type;
7537 + // This is where rules clean up and exit
7539 + goto ruleLESSEx; /* Prevent compiler warnings */
7545 +// Comes from: 104:5: ( '>=' )
7546 +/** \brief Lexer rule generated by ANTLR3
7548 + * $ANTLR start GTE
7550 + * Looks to match the characters the constitute the token GTE
7551 + * from the attached input stream.
7555 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7557 +static ANTLR3_INLINE
7558 +void mGTE(pRSPLexer ctx)
7560 + ANTLR3_UINT32 _type;
7565 + // RSP.g:104:5: ( '>=' )
7566 + // RSP.g:104:7: '>='
7569 + if (HASEXCEPTION())
7578 + LEXSTATE->type = _type;
7580 + // This is where rules clean up and exit
7582 + goto ruleGTEEx; /* Prevent compiler warnings */
7588 +// Comes from: 105:5: ( '<=' )
7589 +/** \brief Lexer rule generated by ANTLR3
7591 + * $ANTLR start LTE
7593 + * Looks to match the characters the constitute the token LTE
7594 + * from the attached input stream.
7598 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7600 +static ANTLR3_INLINE
7601 +void mLTE(pRSPLexer ctx)
7603 + ANTLR3_UINT32 _type;
7608 + // RSP.g:105:5: ( '<=' )
7609 + // RSP.g:105:7: '<='
7612 + if (HASEXCEPTION())
7621 + LEXSTATE->type = _type;
7623 + // This is where rules clean up and exit
7625 + goto ruleLTEEx; /* Prevent compiler warnings */
7631 +// Comes from: 108:8: ( 'before' )
7632 +/** \brief Lexer rule generated by ANTLR3
7634 + * $ANTLR start BEFORE
7636 + * Looks to match the characters the constitute the token BEFORE
7637 + * from the attached input stream.
7641 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7643 +static ANTLR3_INLINE
7644 +void mBEFORE(pRSPLexer ctx)
7646 + ANTLR3_UINT32 _type;
7651 + // RSP.g:108:8: ( 'before' )
7652 + // RSP.g:108:10: 'before'
7655 + if (HASEXCEPTION())
7657 + goto ruleBEFOREEx;
7664 + LEXSTATE->type = _type;
7666 + // This is where rules clean up and exit
7668 + goto ruleBEFOREEx; /* Prevent compiler warnings */
7672 +// $ANTLR end BEFORE
7674 +// Comes from: 109:7: ( 'after' )
7675 +/** \brief Lexer rule generated by ANTLR3
7677 + * $ANTLR start AFTER
7679 + * Looks to match the characters the constitute the token AFTER
7680 + * from the attached input stream.
7684 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7686 +static ANTLR3_INLINE
7687 +void mAFTER(pRSPLexer ctx)
7689 + ANTLR3_UINT32 _type;
7694 + // RSP.g:109:7: ( 'after' )
7695 + // RSP.g:109:9: 'after'
7698 + if (HASEXCEPTION())
7707 + LEXSTATE->type = _type;
7709 + // This is where rules clean up and exit
7711 + goto ruleAFTEREx; /* Prevent compiler warnings */
7715 +// $ANTLR end AFTER
7717 +// Comes from: 110:5: ( 'day' | 'days' )
7718 +/** \brief Lexer rule generated by ANTLR3
7720 + * $ANTLR start DAY
7722 + * Looks to match the characters the constitute the token DAY
7723 + * from the attached input stream.
7727 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7729 +static ANTLR3_INLINE
7730 +void mDAY(pRSPLexer ctx)
7732 + ANTLR3_UINT32 _type;
7738 + // RSP.g:110:5: ( 'day' | 'days' )
7740 + ANTLR3_UINT32 alt1;
7772 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7773 + EXCEPTION->message = (void *)"";
7774 + EXCEPTION->decisionNum = 1;
7775 + EXCEPTION->state = 2;
7786 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7787 + EXCEPTION->message = (void *)"";
7788 + EXCEPTION->decisionNum = 1;
7789 + EXCEPTION->state = 1;
7800 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7801 + EXCEPTION->message = (void *)"";
7802 + EXCEPTION->decisionNum = 1;
7803 + EXCEPTION->state = 0;
7812 + // RSP.g:110:7: 'day'
7815 + if (HASEXCEPTION())
7825 + // RSP.g:110:15: 'days'
7828 + if (HASEXCEPTION())
7840 + LEXSTATE->type = _type;
7842 + // This is where rules clean up and exit
7844 + goto ruleDAYEx; /* Prevent compiler warnings */
7850 +// Comes from: 111:6: ( 'week' | 'weeks' )
7851 +/** \brief Lexer rule generated by ANTLR3
7853 + * $ANTLR start WEEK
7855 + * Looks to match the characters the constitute the token WEEK
7856 + * from the attached input stream.
7860 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7862 +static ANTLR3_INLINE
7863 +void mWEEK(pRSPLexer ctx)
7865 + ANTLR3_UINT32 _type;
7871 + // RSP.g:111:6: ( 'week' | 'weeks' )
7873 + ANTLR3_UINT32 alt2;
7909 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7910 + EXCEPTION->message = (void *)"";
7911 + EXCEPTION->decisionNum = 2;
7912 + EXCEPTION->state = 3;
7923 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7924 + EXCEPTION->message = (void *)"";
7925 + EXCEPTION->decisionNum = 2;
7926 + EXCEPTION->state = 2;
7937 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7938 + EXCEPTION->message = (void *)"";
7939 + EXCEPTION->decisionNum = 2;
7940 + EXCEPTION->state = 1;
7951 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7952 + EXCEPTION->message = (void *)"";
7953 + EXCEPTION->decisionNum = 2;
7954 + EXCEPTION->state = 0;
7963 + // RSP.g:111:8: 'week'
7966 + if (HASEXCEPTION())
7976 + // RSP.g:111:17: 'weeks'
7979 + if (HASEXCEPTION())
7991 + LEXSTATE->type = _type;
7993 + // This is where rules clean up and exit
7995 + goto ruleWEEKEx; /* Prevent compiler warnings */
8001 +// Comes from: 112:7: ( 'month' | 'months' )
8002 +/** \brief Lexer rule generated by ANTLR3
8004 + * $ANTLR start MONTH
8006 + * Looks to match the characters the constitute the token MONTH
8007 + * from the attached input stream.
8011 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8013 +static ANTLR3_INLINE
8014 +void mMONTH(pRSPLexer ctx)
8016 + ANTLR3_UINT32 _type;
8022 + // RSP.g:112:7: ( 'month' | 'months' )
8024 + ANTLR3_UINT32 alt3;
8064 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8065 + EXCEPTION->message = (void *)"";
8066 + EXCEPTION->decisionNum = 3;
8067 + EXCEPTION->state = 4;
8078 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8079 + EXCEPTION->message = (void *)"";
8080 + EXCEPTION->decisionNum = 3;
8081 + EXCEPTION->state = 3;
8092 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8093 + EXCEPTION->message = (void *)"";
8094 + EXCEPTION->decisionNum = 3;
8095 + EXCEPTION->state = 2;
8106 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8107 + EXCEPTION->message = (void *)"";
8108 + EXCEPTION->decisionNum = 3;
8109 + EXCEPTION->state = 1;
8120 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8121 + EXCEPTION->message = (void *)"";
8122 + EXCEPTION->decisionNum = 3;
8123 + EXCEPTION->state = 0;
8132 + // RSP.g:112:9: 'month'
8135 + if (HASEXCEPTION())
8145 + // RSP.g:112:19: 'months'
8148 + if (HASEXCEPTION())
8160 + LEXSTATE->type = _type;
8162 + // This is where rules clean up and exit
8164 + goto ruleMONTHEx; /* Prevent compiler warnings */
8168 +// $ANTLR end MONTH
8170 +// Comes from: 113:6: ( 'year' | 'years' )
8171 +/** \brief Lexer rule generated by ANTLR3
8173 + * $ANTLR start YEAR
8175 + * Looks to match the characters the constitute the token YEAR
8176 + * from the attached input stream.
8180 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8182 +static ANTLR3_INLINE
8183 +void mYEAR(pRSPLexer ctx)
8185 + ANTLR3_UINT32 _type;
8191 + // RSP.g:113:6: ( 'year' | 'years' )
8193 + ANTLR3_UINT32 alt4;
8229 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8230 + EXCEPTION->message = (void *)"";
8231 + EXCEPTION->decisionNum = 4;
8232 + EXCEPTION->state = 3;
8243 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8244 + EXCEPTION->message = (void *)"";
8245 + EXCEPTION->decisionNum = 4;
8246 + EXCEPTION->state = 2;
8257 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8258 + EXCEPTION->message = (void *)"";
8259 + EXCEPTION->decisionNum = 4;
8260 + EXCEPTION->state = 1;
8271 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8272 + EXCEPTION->message = (void *)"";
8273 + EXCEPTION->decisionNum = 4;
8274 + EXCEPTION->state = 0;
8283 + // RSP.g:113:8: 'year'
8286 + if (HASEXCEPTION())
8296 + // RSP.g:113:17: 'years'
8299 + if (HASEXCEPTION())
8311 + LEXSTATE->type = _type;
8313 + // This is where rules clean up and exit
8315 + goto ruleYEAREx; /* Prevent compiler warnings */
8321 +// Comes from: 114:7: ( 'today' )
8322 +/** \brief Lexer rule generated by ANTLR3
8324 + * $ANTLR start TODAY
8326 + * Looks to match the characters the constitute the token TODAY
8327 + * from the attached input stream.
8331 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8333 +static ANTLR3_INLINE
8334 +void mTODAY(pRSPLexer ctx)
8336 + ANTLR3_UINT32 _type;
8341 + // RSP.g:114:7: ( 'today' )
8342 + // RSP.g:114:9: 'today'
8345 + if (HASEXCEPTION())
8354 + LEXSTATE->type = _type;
8356 + // This is where rules clean up and exit
8358 + goto ruleTODAYEx; /* Prevent compiler warnings */
8362 +// $ANTLR end TODAY
8364 +// Comes from: 116:9: ( ( '\\r' )? '\\n' )
8365 +/** \brief Lexer rule generated by ANTLR3
8367 + * $ANTLR start NEWLINE
8369 + * Looks to match the characters the constitute the token NEWLINE
8370 + * from the attached input stream.
8374 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8376 +static ANTLR3_INLINE
8377 +void mNEWLINE(pRSPLexer ctx)
8379 + ANTLR3_UINT32 _type;
8384 + // RSP.g:116:9: ( ( '\\r' )? '\\n' )
8385 + // RSP.g:116:11: ( '\\r' )? '\\n'
8388 + // RSP.g:116:11: ( '\\r' )?
8403 + // RSP.g:116:11: '\\r'
8406 + if (HASEXCEPTION())
8408 + goto ruleNEWLINEEx;
8418 + if (HASEXCEPTION())
8420 + goto ruleNEWLINEEx;
8426 + LEXSTATE->type = _type;
8428 + // This is where rules clean up and exit
8430 + goto ruleNEWLINEEx; /* Prevent compiler warnings */
8434 +// $ANTLR end NEWLINE
8436 +// Comes from: 118:4: ( ( ' ' | '\\t' ) )
8437 +/** \brief Lexer rule generated by ANTLR3
8441 + * Looks to match the characters the constitute the token WS
8442 + * from the attached input stream.
8446 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8448 +static ANTLR3_INLINE
8449 +void mWS(pRSPLexer ctx)
8451 + ANTLR3_UINT32 _type;
8456 + // RSP.g:118:4: ( ( ' ' | '\\t' ) )
8457 + // RSP.g:118:6: ( ' ' | '\\t' )
8459 + if ( LA(1) == '\t' || LA(1) == ' ' )
8467 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
8468 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
8470 + LRECOVER(); goto ruleWSEx;
8474 + LEXSTATE->channel = HIDDEN;
8479 + LEXSTATE->type = _type;
8481 + // This is where rules clean up and exit
8483 + goto ruleWSEx; /* Prevent compiler warnings */
8489 +// Comes from: 120:7: ( 'a' .. 'z' ( 'a' .. 'z' | '_' )* 'a' .. 'z' )
8490 +/** \brief Lexer rule generated by ANTLR3
8492 + * $ANTLR start FIELD
8494 + * Looks to match the characters the constitute the token FIELD
8495 + * from the attached input stream.
8499 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8501 +static ANTLR3_INLINE
8502 +void mFIELD(pRSPLexer ctx)
8504 + ANTLR3_UINT32 _type;
8509 + // RSP.g:120:7: ( 'a' .. 'z' ( 'a' .. 'z' | '_' )* 'a' .. 'z' )
8510 + // RSP.g:120:9: 'a' .. 'z' ( 'a' .. 'z' | '_' )* 'a' .. 'z'
8512 + MATCHRANGE('a', 'z');
8513 + if (HASEXCEPTION())
8519 + // RSP.g:120:18: ( 'a' .. 'z' | '_' )*
8604 + if ( LA(1) == '_' || ((LA(1) >= 'a') && (LA(1) <= 'z')) )
8612 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
8613 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
8615 + LRECOVER(); goto ruleFIELDEx;
8623 + goto loop6; /* break out of the loop */
8627 + loop6: ; /* Jump out to here if this rule does not match */
8629 + MATCHRANGE('a', 'z');
8630 + if (HASEXCEPTION())
8638 + LEXSTATE->type = _type;
8640 + // This is where rules clean up and exit
8642 + goto ruleFIELDEx; /* Prevent compiler warnings */
8646 +// $ANTLR end FIELD
8648 +// Comes from: 122:5: ( DIGIT19 ( DIGIT09 )* )
8649 +/** \brief Lexer rule generated by ANTLR3
8651 + * $ANTLR start INT
8653 + * Looks to match the characters the constitute the token INT
8654 + * from the attached input stream.
8658 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8660 +static ANTLR3_INLINE
8661 +void mINT(pRSPLexer ctx)
8663 + ANTLR3_UINT32 _type;
8668 + // RSP.g:122:5: ( DIGIT19 ( DIGIT09 )* )
8669 + // RSP.g:122:7: DIGIT19 ( DIGIT09 )*
8671 + /* 122:7: DIGIT19 ( DIGIT09 )* */
8673 + if (HASEXCEPTION())
8679 + // RSP.g:122:15: ( DIGIT09 )*
8706 + // RSP.g:122:15: DIGIT09
8708 + /* 122:15: DIGIT09 */
8710 + if (HASEXCEPTION())
8720 + goto loop7; /* break out of the loop */
8724 + loop7: ; /* Jump out to here if this rule does not match */
8729 + LEXSTATE->type = _type;
8731 + // This is where rules clean up and exit
8733 + goto ruleINTEx; /* Prevent compiler warnings */
8739 +// Comes from: 125:6: ( DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) )
8740 +/** \brief Lexer rule generated by ANTLR3
8742 + * $ANTLR start DATE
8744 + * Looks to match the characters the constitute the token DATE
8745 + * from the attached input stream.
8749 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8751 +static ANTLR3_INLINE
8752 +void mDATE(pRSPLexer ctx)
8754 + ANTLR3_UINT32 _type;
8759 + // RSP.g:125:6: ( DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) )
8760 + // RSP.g:125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' )
8762 + /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */
8764 + if (HASEXCEPTION())
8769 + /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */
8771 + if (HASEXCEPTION())
8776 + /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */
8778 + if (HASEXCEPTION())
8783 + /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */
8785 + if (HASEXCEPTION())
8791 + if (HASEXCEPTION())
8797 + // RSP.g:125:44: ( '0' DIGIT19 | '1' '0' .. '2' )
8815 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8816 + EXCEPTION->message = (void *)"";
8817 + EXCEPTION->decisionNum = 8;
8818 + EXCEPTION->state = 0;
8827 + // RSP.g:125:45: '0' DIGIT19
8830 + if (HASEXCEPTION())
8835 + /* 125:45: '0' DIGIT19 */
8837 + if (HASEXCEPTION())
8846 + // RSP.g:125:59: '1' '0' .. '2'
8849 + if (HASEXCEPTION())
8854 + MATCHRANGE('0', '2');
8855 + if (HASEXCEPTION())
8867 + if (HASEXCEPTION())
8873 + // RSP.g:125:77: ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' )
8897 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8898 + EXCEPTION->message = (void *)"";
8899 + EXCEPTION->decisionNum = 9;
8900 + EXCEPTION->state = 0;
8909 + // RSP.g:125:78: '0' DIGIT19
8912 + if (HASEXCEPTION())
8917 + /* 125:78: '0' DIGIT19 */
8919 + if (HASEXCEPTION())
8928 + // RSP.g:125:92: '1' .. '2' DIGIT09
8930 + MATCHRANGE('1', '2');
8931 + if (HASEXCEPTION())
8936 + /* 125:92: '1' .. '2' DIGIT09 */
8938 + if (HASEXCEPTION())
8947 + // RSP.g:125:111: '3' '0' .. '1'
8950 + if (HASEXCEPTION())
8955 + MATCHRANGE('0', '1');
8956 + if (HASEXCEPTION())
8970 + LEXSTATE->type = _type;
8972 + // This is where rules clean up and exit
8974 + goto ruleDATEEx; /* Prevent compiler warnings */
8980 +// Comes from: 133:2: ( QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE )
8981 +/** \brief Lexer rule generated by ANTLR3
8983 + * $ANTLR start STR
8985 + * Looks to match the characters the constitute the token STR
8986 + * from the attached input stream.
8990 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8992 +static ANTLR3_INLINE
8993 +void mSTR(pRSPLexer ctx)
8995 + ANTLR3_UINT32 _type;
8996 + pANTLR3_COMMON_TOKEN esc;
8997 + ANTLR3_UINT32 reg;
9004 + pANTLR3_STRING unesc = GETTEXT()->factory->newRaw(GETTEXT()->factory);
9006 + // RSP.g:133:2: ( QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE )
9007 + // RSP.g:133:4: QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE
9009 + /* 133:4: QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE */
9011 + if (HASEXCEPTION())
9016 + // RSP.g:133:10: (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+
9024 + /* dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState)
9026 + int LA10_0 = LA(1);
9027 + if ( (((LA10_0 >= 0x0000) && (LA10_0 <= '!')) || ((LA10_0 >= '#') && (LA10_0 <= '[')) || ((LA10_0 >= ']') && (LA10_0 <= 0xFFFF))) )
9031 + else if ( (LA10_0 == '\\') )
9040 + // RSP.g:133:12: reg=~ ( '\\\\' | '\"' )
9043 + if ( ((LA(1) >= 0x0000) && (LA(1) <= '!')) || ((LA(1) >= '#') && (LA(1) <= '[')) || ((LA(1) >= ']') && (LA(1) <= 0xFFFF)) )
9051 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
9052 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
9054 + LRECOVER(); goto ruleSTREx;
9058 + unesc->addc(unesc, reg);
9064 + // RSP.g:134:6: esc= ESCAPED
9066 + /* 134:6: esc= ESCAPED */
9068 + ANTLR3_MARKER escStart381 = GETCHARINDEX();
9070 + if (HASEXCEPTION())
9075 + esc = LEXSTATE->tokFactory->newToken(LEXSTATE->tokFactory);
9076 + esc->setType(esc, ANTLR3_TOKEN_INVALID);
9077 + esc->setStartIndex(esc, escStart381);
9078 + esc->setStopIndex(esc, GETCHARINDEX()-1);
9079 + esc->input = INPUT;
9082 + unesc->appendS(unesc, GETTEXT());
9094 + /* mismatchedSetEx()
9097 + EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
9098 + EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
9105 + loop10: ; /* Jump to here if this rule does not match */
9107 + /* 133:4: QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE */
9109 + if (HASEXCEPTION())
9120 + LEXSTATE->type = _type;
9122 + // This is where rules clean up and exit
9124 + goto ruleSTREx; /* Prevent compiler warnings */
9132 +// Comes from: 138:9: ( '\\\\' ( '\\\\' | '\"' ) )
9133 +/** \brief Lexer rule generated by ANTLR3
9135 + * $ANTLR start ESCAPED
9137 + * Looks to match the characters the constitute the token ESCAPED
9138 + * from the attached input stream.
9142 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
9144 +static ANTLR3_INLINE
9145 +void mESCAPED(pRSPLexer ctx)
9147 + ANTLR3_UINT32 _type;
9150 + // RSP.g:138:9: ( '\\\\' ( '\\\\' | '\"' ) )
9151 + // RSP.g:138:11: '\\\\' ( '\\\\' | '\"' )
9154 + if (HASEXCEPTION())
9156 + goto ruleESCAPEDEx;
9160 + // RSP.g:139:3: ( '\\\\' | '\"' )
9178 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
9179 + EXCEPTION->message = (void *)"";
9180 + EXCEPTION->decisionNum = 11;
9181 + EXCEPTION->state = 0;
9184 + goto ruleESCAPEDEx;
9190 + // RSP.g:139:5: '\\\\'
9193 + if (HASEXCEPTION())
9195 + goto ruleESCAPEDEx;
9199 + SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\\"));
9205 + // RSP.g:140:5: '\"'
9208 + if (HASEXCEPTION())
9210 + goto ruleESCAPEDEx;
9214 + SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\""));
9227 + // This is where rules clean up and exit
9229 + goto ruleESCAPEDEx; /* Prevent compiler warnings */
9233 +// $ANTLR end ESCAPED
9235 +// Comes from: 145:9: ( '0' .. '9' )
9236 +/** \brief Lexer rule generated by ANTLR3
9238 + * $ANTLR start DIGIT09
9240 + * Looks to match the characters the constitute the token DIGIT09
9241 + * from the attached input stream.
9245 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
9247 +static ANTLR3_INLINE
9248 +void mDIGIT09(pRSPLexer ctx)
9250 + ANTLR3_UINT32 _type;
9253 + // RSP.g:145:9: ( '0' .. '9' )
9254 + // RSP.g:145:11: '0' .. '9'
9256 + MATCHRANGE('0', '9');
9257 + if (HASEXCEPTION())
9259 + goto ruleDIGIT09Ex;
9267 + // This is where rules clean up and exit
9269 + goto ruleDIGIT09Ex; /* Prevent compiler warnings */
9273 +// $ANTLR end DIGIT09
9275 +// Comes from: 148:9: ( '1' .. '9' )
9276 +/** \brief Lexer rule generated by ANTLR3
9278 + * $ANTLR start DIGIT19
9280 + * Looks to match the characters the constitute the token DIGIT19
9281 + * from the attached input stream.
9285 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
9287 +static ANTLR3_INLINE
9288 +void mDIGIT19(pRSPLexer ctx)
9290 + ANTLR3_UINT32 _type;
9293 + // RSP.g:148:9: ( '1' .. '9' )
9294 + // RSP.g:148:11: '1' .. '9'
9296 + MATCHRANGE('1', '9');
9297 + if (HASEXCEPTION())
9299 + goto ruleDIGIT19Ex;
9307 + // This is where rules clean up and exit
9309 + goto ruleDIGIT19Ex; /* Prevent compiler warnings */
9313 +// $ANTLR end DIGIT19
9315 +/** This is the entry point in to the lexer from an object that
9316 + * wants to generate the next token, such as a pCOMMON_TOKEN_STREAM
9319 +mTokens(pRSPLexer ctx)
9322 + // RSP.g:1:8: ( QUOTE | LPAR | RPAR | AND | OR | NOT | EQUAL | INCLUDES | STARTSW | ENDSW | GREATER | LESS | GTE | LTE | BEFORE | AFTER | DAY | WEEK | MONTH | YEAR | TODAY | NEWLINE | WS | FIELD | INT | DATE | STR )
9324 + ANTLR3_UINT32 alt12;
9334 + int LA12_1 = LA(2);
9335 + if ( (((LA12_1 >= 0x0000) && (LA12_1 <= '!')) || ((LA12_1 >= '#') && (LA12_1 <= 0xFFFF))) )
9513 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
9514 + EXCEPTION->message = (void *)"";
9515 + EXCEPTION->decisionNum = 12;
9516 + EXCEPTION->state = 4;
9519 + goto ruleTokensEx;
9602 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
9603 + EXCEPTION->message = (void *)"";
9604 + EXCEPTION->decisionNum = 12;
9605 + EXCEPTION->state = 5;
9608 + goto ruleTokensEx;
9761 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
9762 + EXCEPTION->message = (void *)"";
9763 + EXCEPTION->decisionNum = 12;
9764 + EXCEPTION->state = 8;
9767 + goto ruleTokensEx;
9930 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
9931 + EXCEPTION->message = (void *)"";
9932 + EXCEPTION->decisionNum = 12;
9933 + EXCEPTION->state = 9;
9936 + goto ruleTokensEx;
10079 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10080 + EXCEPTION->message = (void *)"";
10081 + EXCEPTION->decisionNum = 12;
10082 + EXCEPTION->state = 10;
10085 + goto ruleTokensEx;
10238 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10239 + EXCEPTION->message = (void *)"";
10240 + EXCEPTION->decisionNum = 12;
10241 + EXCEPTION->state = 13;
10244 + goto ruleTokensEx;
10377 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10378 + EXCEPTION->message = (void *)"";
10379 + EXCEPTION->decisionNum = 12;
10380 + EXCEPTION->state = 14;
10383 + goto ruleTokensEx;
10526 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10527 + EXCEPTION->message = (void *)"";
10528 + EXCEPTION->decisionNum = 12;
10529 + EXCEPTION->state = 15;
10532 + goto ruleTokensEx;
10685 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10686 + EXCEPTION->message = (void *)"";
10687 + EXCEPTION->decisionNum = 12;
10688 + EXCEPTION->state = 16;
10691 + goto ruleTokensEx;
10834 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10835 + EXCEPTION->message = (void *)"";
10836 + EXCEPTION->decisionNum = 12;
10837 + EXCEPTION->state = 17;
10840 + goto ruleTokensEx;
10953 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10954 + EXCEPTION->message = (void *)"";
10955 + EXCEPTION->decisionNum = 12;
10956 + EXCEPTION->state = 18;
10959 + goto ruleTokensEx;
11078 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
11079 + EXCEPTION->message = (void *)"";
11080 + EXCEPTION->decisionNum = 12;
11081 + EXCEPTION->state = 0;
11084 + goto ruleTokensEx;
11090 + // RSP.g:1:10: QUOTE
11092 + /* 1:10: QUOTE */
11094 + if (HASEXCEPTION())
11096 + goto ruleTokensEx;
11103 + // RSP.g:1:16: LPAR
11107 + if (HASEXCEPTION())
11109 + goto ruleTokensEx;
11116 + // RSP.g:1:21: RPAR
11120 + if (HASEXCEPTION())
11122 + goto ruleTokensEx;
11129 + // RSP.g:1:26: AND
11133 + if (HASEXCEPTION())
11135 + goto ruleTokensEx;
11142 + // RSP.g:1:30: OR
11146 + if (HASEXCEPTION())
11148 + goto ruleTokensEx;
11155 + // RSP.g:1:33: NOT
11159 + if (HASEXCEPTION())
11161 + goto ruleTokensEx;
11168 + // RSP.g:1:37: EQUAL
11170 + /* 1:37: EQUAL */
11172 + if (HASEXCEPTION())
11174 + goto ruleTokensEx;
11181 + // RSP.g:1:43: INCLUDES
11183 + /* 1:43: INCLUDES */
11185 + if (HASEXCEPTION())
11187 + goto ruleTokensEx;
11194 + // RSP.g:1:52: STARTSW
11196 + /* 1:52: STARTSW */
11198 + if (HASEXCEPTION())
11200 + goto ruleTokensEx;
11207 + // RSP.g:1:60: ENDSW
11209 + /* 1:60: ENDSW */
11211 + if (HASEXCEPTION())
11213 + goto ruleTokensEx;
11220 + // RSP.g:1:66: GREATER
11222 + /* 1:66: GREATER */
11224 + if (HASEXCEPTION())
11226 + goto ruleTokensEx;
11233 + // RSP.g:1:74: LESS
11237 + if (HASEXCEPTION())
11239 + goto ruleTokensEx;
11246 + // RSP.g:1:79: GTE
11250 + if (HASEXCEPTION())
11252 + goto ruleTokensEx;
11259 + // RSP.g:1:83: LTE
11263 + if (HASEXCEPTION())
11265 + goto ruleTokensEx;
11272 + // RSP.g:1:87: BEFORE
11274 + /* 1:87: BEFORE */
11276 + if (HASEXCEPTION())
11278 + goto ruleTokensEx;
11285 + // RSP.g:1:94: AFTER
11287 + /* 1:94: AFTER */
11289 + if (HASEXCEPTION())
11291 + goto ruleTokensEx;
11298 + // RSP.g:1:100: DAY
11302 + if (HASEXCEPTION())
11304 + goto ruleTokensEx;
11311 + // RSP.g:1:104: WEEK
11313 + /* 1:104: WEEK */
11315 + if (HASEXCEPTION())
11317 + goto ruleTokensEx;
11324 + // RSP.g:1:109: MONTH
11326 + /* 1:109: MONTH */
11328 + if (HASEXCEPTION())
11330 + goto ruleTokensEx;
11337 + // RSP.g:1:115: YEAR
11339 + /* 1:115: YEAR */
11341 + if (HASEXCEPTION())
11343 + goto ruleTokensEx;
11350 + // RSP.g:1:120: TODAY
11352 + /* 1:120: TODAY */
11354 + if (HASEXCEPTION())
11356 + goto ruleTokensEx;
11363 + // RSP.g:1:126: NEWLINE
11365 + /* 1:126: NEWLINE */
11367 + if (HASEXCEPTION())
11369 + goto ruleTokensEx;
11376 + // RSP.g:1:134: WS
11380 + if (HASEXCEPTION())
11382 + goto ruleTokensEx;
11389 + // RSP.g:1:137: FIELD
11391 + /* 1:137: FIELD */
11393 + if (HASEXCEPTION())
11395 + goto ruleTokensEx;
11402 + // RSP.g:1:143: INT
11406 + if (HASEXCEPTION())
11408 + goto ruleTokensEx;
11415 + // RSP.g:1:147: DATE
11417 + /* 1:147: DATE */
11419 + if (HASEXCEPTION())
11421 + goto ruleTokensEx;
11428 + // RSP.g:1:152: STR
11432 + if (HASEXCEPTION())
11434 + goto ruleTokensEx;
11445 + goto ruleTokensEx; /* Prevent compiler warnings */
11449 +/* =========================================================================
11450 + * Lexer matching rules end.
11451 + * =========================================================================
11453 +/* End of Lexer code
11454 + * ================================================
11455 + * ================================================
11460 + * =============================================================================
11462 diff --git a/src/pregen/RSPLexer.h b/src/pregen/RSPLexer.h
11463 new file mode 100644
11464 index 0000000..4f4d06b
11466 +++ b/src/pregen/RSPLexer.h
11469 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
11471 + * - From the grammar source file : RSP.g
11472 + * - On : 2014-09-30 21:42:41
11473 + * - for the lexer : RSPLexerLexer *
11474 + * Editing it, at least manually, is not wise.
11476 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
11479 + * The lexer RSPLexer has the callable functions (rules) shown below,
11480 + * which will invoke the code for the associated rule in the source grammar
11481 + * assuming that the input stream is pointing to a token/text stream that could begin
11484 + * For instance if you call the first (topmost) rule in a parser grammar, you will
11485 + * get the results of a full parse, but calling a rule half way through the grammar will
11486 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
11487 + * in editors and so on.
11489 + * The parser entry points are called indirectly (by function pointer to function) via
11490 + * a parser context typedef pRSPLexer, which is returned from a call to RSPLexerNew().
11492 + * As this is a generated lexer, it is unlikely you will call it 'manually'. However
11493 + * the methods are provided anyway.
11494 + * * The methods in pRSPLexer are as follows:
11496 + * - void pRSPLexer->QUOTE(pRSPLexer)
11497 + * - void pRSPLexer->LPAR(pRSPLexer)
11498 + * - void pRSPLexer->RPAR(pRSPLexer)
11499 + * - void pRSPLexer->AND(pRSPLexer)
11500 + * - void pRSPLexer->OR(pRSPLexer)
11501 + * - void pRSPLexer->NOT(pRSPLexer)
11502 + * - void pRSPLexer->EQUAL(pRSPLexer)
11503 + * - void pRSPLexer->INCLUDES(pRSPLexer)
11504 + * - void pRSPLexer->STARTSW(pRSPLexer)
11505 + * - void pRSPLexer->ENDSW(pRSPLexer)
11506 + * - void pRSPLexer->GREATER(pRSPLexer)
11507 + * - void pRSPLexer->LESS(pRSPLexer)
11508 + * - void pRSPLexer->GTE(pRSPLexer)
11509 + * - void pRSPLexer->LTE(pRSPLexer)
11510 + * - void pRSPLexer->BEFORE(pRSPLexer)
11511 + * - void pRSPLexer->AFTER(pRSPLexer)
11512 + * - void pRSPLexer->DAY(pRSPLexer)
11513 + * - void pRSPLexer->WEEK(pRSPLexer)
11514 + * - void pRSPLexer->MONTH(pRSPLexer)
11515 + * - void pRSPLexer->YEAR(pRSPLexer)
11516 + * - void pRSPLexer->TODAY(pRSPLexer)
11517 + * - void pRSPLexer->NEWLINE(pRSPLexer)
11518 + * - void pRSPLexer->WS(pRSPLexer)
11519 + * - void pRSPLexer->FIELD(pRSPLexer)
11520 + * - void pRSPLexer->INT(pRSPLexer)
11521 + * - void pRSPLexer->DATE(pRSPLexer)
11522 + * - void pRSPLexer->STR(pRSPLexer)
11523 + * - void pRSPLexer->ESCAPED(pRSPLexer)
11524 + * - void pRSPLexer->DIGIT09(pRSPLexer)
11525 + * - void pRSPLexer->DIGIT19(pRSPLexer)
11526 + * - void pRSPLexer->Tokens(pRSPLexer)
11528 + * The return type for any particular rule is of course determined by the source
11531 +// [The "BSD licence"]
11532 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
11533 +// http://www.temporal-wave.com
11534 +// http://www.linkedin.com/in/jimidle
11536 +// All rights reserved.
11538 +// Redistribution and use in source and binary forms, with or without
11539 +// modification, are permitted provided that the following conditions
11541 +// 1. Redistributions of source code must retain the above copyright
11542 +// notice, this list of conditions and the following disclaimer.
11543 +// 2. Redistributions in binary form must reproduce the above copyright
11544 +// notice, this list of conditions and the following disclaimer in the
11545 +// documentation and/or other materials provided with the distribution.
11546 +// 3. The name of the author may not be used to endorse or promote products
11547 +// derived from this software without specific prior written permission.
11549 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
11550 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
11551 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11552 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
11553 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
11554 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11555 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11556 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11557 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
11558 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11560 +#ifndef _RSPLexer_H
11561 +#define _RSPLexer_H
11562 +/* =============================================================================
11563 + * Standard antlr3 C runtime definitions
11565 +#include <antlr3.h>
11567 +/* End of standard antlr 3 runtime definitions
11568 + * =============================================================================
11571 +#ifdef __cplusplus
11575 +// Forward declare the context typedef so that we can use it before it is
11576 +// properly defined. Delegators and delegates (from import statements) are
11577 +// interdependent and their context structures contain pointers to each other
11578 +// C only allows such things to be declared if you pre-declare the typedef.
11580 +typedef struct RSPLexer_Ctx_struct RSPLexer, * pRSPLexer;
11584 +#ifdef ANTLR3_WINDOWS
11585 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
11586 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
11587 +// initialized but unused variable - tree rewrite variables declared but not needed
11588 +// Unreferenced local variable - lexer rule declares but does not always use _type
11589 +// potentially unitialized variable used - retval always returned from a rule
11590 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
11592 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
11593 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
11594 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
11595 +// this is a matter of orthogonality hence I disable that one.
11597 +#pragma warning( disable : 4100 )
11598 +#pragma warning( disable : 4101 )
11599 +#pragma warning( disable : 4127 )
11600 +#pragma warning( disable : 4189 )
11601 +#pragma warning( disable : 4505 )
11602 +#pragma warning( disable : 4701 )
11605 +/** Context tracking structure for RSPLexer
11607 +struct RSPLexer_Ctx_struct
11609 + /** Built in ANTLR3 context tracker contains all the generic elements
11610 + * required for context tracking.
11612 + pANTLR3_LEXER pLexer;
11615 + void (*mQUOTE) (struct RSPLexer_Ctx_struct * ctx);
11616 + void (*mLPAR) (struct RSPLexer_Ctx_struct * ctx);
11617 + void (*mRPAR) (struct RSPLexer_Ctx_struct * ctx);
11618 + void (*mAND) (struct RSPLexer_Ctx_struct * ctx);
11619 + void (*mOR) (struct RSPLexer_Ctx_struct * ctx);
11620 + void (*mNOT) (struct RSPLexer_Ctx_struct * ctx);
11621 + void (*mEQUAL) (struct RSPLexer_Ctx_struct * ctx);
11622 + void (*mINCLUDES) (struct RSPLexer_Ctx_struct * ctx);
11623 + void (*mSTARTSW) (struct RSPLexer_Ctx_struct * ctx);
11624 + void (*mENDSW) (struct RSPLexer_Ctx_struct * ctx);
11625 + void (*mGREATER) (struct RSPLexer_Ctx_struct * ctx);
11626 + void (*mLESS) (struct RSPLexer_Ctx_struct * ctx);
11627 + void (*mGTE) (struct RSPLexer_Ctx_struct * ctx);
11628 + void (*mLTE) (struct RSPLexer_Ctx_struct * ctx);
11629 + void (*mBEFORE) (struct RSPLexer_Ctx_struct * ctx);
11630 + void (*mAFTER) (struct RSPLexer_Ctx_struct * ctx);
11631 + void (*mDAY) (struct RSPLexer_Ctx_struct * ctx);
11632 + void (*mWEEK) (struct RSPLexer_Ctx_struct * ctx);
11633 + void (*mMONTH) (struct RSPLexer_Ctx_struct * ctx);
11634 + void (*mYEAR) (struct RSPLexer_Ctx_struct * ctx);
11635 + void (*mTODAY) (struct RSPLexer_Ctx_struct * ctx);
11636 + void (*mNEWLINE) (struct RSPLexer_Ctx_struct * ctx);
11637 + void (*mWS) (struct RSPLexer_Ctx_struct * ctx);
11638 + void (*mFIELD) (struct RSPLexer_Ctx_struct * ctx);
11639 + void (*mINT) (struct RSPLexer_Ctx_struct * ctx);
11640 + void (*mDATE) (struct RSPLexer_Ctx_struct * ctx);
11641 + void (*mSTR) (struct RSPLexer_Ctx_struct * ctx);
11642 + void (*mESCAPED) (struct RSPLexer_Ctx_struct * ctx);
11643 + void (*mDIGIT09) (struct RSPLexer_Ctx_struct * ctx);
11644 + void (*mDIGIT19) (struct RSPLexer_Ctx_struct * ctx);
11645 + void (*mTokens) (struct RSPLexer_Ctx_struct * ctx); const char * (*getGrammarFileName)();
11646 + void (*free) (struct RSPLexer_Ctx_struct * ctx);
11650 +// Function protoypes for the constructor functions that external translation units
11651 +// such as delegators and delegates may wish to call.
11653 +ANTLR3_API pRSPLexer RSPLexerNew (pANTLR3_INPUT_STREAM instream);
11654 +ANTLR3_API pRSPLexer RSPLexerNewSSD (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
11656 +/** Symbolic definitions of all the tokens that the lexer will work with.
11659 + * Antlr will define EOF, but we can't use that as it it is too common in
11660 + * in C header files and that would be confusing. There is no way to filter this out at the moment
11661 + * so we just undef it here for now. That isn't the value we get back from C recognizers
11662 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
11670 +#define STARTSW 14
11685 +#define DIGIT19 31
11686 +#define INCLUDES 13
11689 +#define GREATER 18
11698 +#define ESCAPED 33
11700 +#define DIGIT09 32
11703 +#define EOF ANTLR3_TOKEN_EOF
11706 +#ifndef TOKENSOURCE
11707 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
11710 +/* End of token definitions for RSPLexer
11711 + * =============================================================================
11715 +#ifdef __cplusplus
11721 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
11722 diff --git a/src/pregen/RSPParser.c b/src/pregen/RSPParser.c
11723 new file mode 100644
11724 index 0000000..c538e49
11726 +++ b/src/pregen/RSPParser.c
11729 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
11731 + * - From the grammar source file : RSP.g
11732 + * - On : 2014-09-30 21:42:40
11733 + * - for the parser : RSPParserParser *
11734 + * Editing it, at least manually, is not wise.
11736 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
11740 +// [The "BSD licence"]
11741 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
11742 +// http://www.temporal-wave.com
11743 +// http://www.linkedin.com/in/jimidle
11745 +// All rights reserved.
11747 +// Redistribution and use in source and binary forms, with or without
11748 +// modification, are permitted provided that the following conditions
11750 +// 1. Redistributions of source code must retain the above copyright
11751 +// notice, this list of conditions and the following disclaimer.
11752 +// 2. Redistributions in binary form must reproduce the above copyright
11753 +// notice, this list of conditions and the following disclaimer in the
11754 +// documentation and/or other materials provided with the distribution.
11755 +// 3. The name of the author may not be used to endorse or promote products
11756 +// derived from this software without specific prior written permission.
11758 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
11759 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
11760 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11761 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
11762 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
11763 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11764 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11765 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11766 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
11767 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11769 +/* -----------------------------------------
11770 + * Include the ANTLR3 generated header file.
11772 +#include "RSPParser.h"
11773 +/* ----------------------------------------- */
11779 +/* MACROS that hide the C interface implementations from the
11780 + * generated code, which makes it a little more understandable to the human eye.
11781 + * I am very much against using C pre-processor macros for function calls and bits
11782 + * of code as you cannot see what is happening when single stepping in debuggers
11783 + * and so on. The exception (in my book at least) is for generated code, where you are
11784 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
11785 + * hides some indirect calls, but is always referring to the input stream. This is
11786 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
11787 + * the runtime interfaces without changing the generated code too often, without
11788 + * confusing the reader of the generated output, who may not wish to know the gory
11789 + * details of the interface inheritance.
11794 +/* Aids in accessing scopes for grammar programmers
11797 +#undef SCOPE_STACK
11799 +#define SCOPE_TYPE(scope) pRSPParser_##scope##_SCOPE
11800 +#define SCOPE_STACK(scope) pRSPParser_##scope##Stack
11801 +#define SCOPE_TOP(scope) ctx->pRSPParser_##scope##Top
11802 +#define SCOPE_SIZE(scope) ctx->pRSPParser_##scope##Stack_limit
11803 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
11805 +/* Macros for accessing things in the parser
11810 +#undef HAVEPARSEDRULE
11814 +#undef HASEXCEPTION
11818 +#undef FOLLOWSTACK
11822 +#undef PREPORTERROR
11825 +#undef CONSTRUCTEX
11830 +#undef PERRORRECOVERY
11833 +#undef RECOVERFROMMISMATCHEDSET
11834 +#undef RECOVERFROMMISMATCHEDELEMENT
11841 +#define PARSER ctx->pParser
11842 +#define RECOGNIZER PARSER->rec
11843 +#define PSRSTATE RECOGNIZER->state
11844 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
11845 +#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si)
11846 +#define INPUT PARSER->tstream
11847 +#define STRSTREAM INPUT
11848 +#define ISTREAM INPUT->istream
11849 +#define INDEX() ISTREAM->index(INPUT->istream)
11850 +#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE)
11851 +#define EXCEPTION PSRSTATE->exception
11852 +#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs)
11853 +#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER)
11854 +#define FOLLOWSTACK PSRSTATE->following
11855 +#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
11856 +#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK)
11857 +#define PRECOVER() RECOGNIZER->recover(RECOGNIZER)
11858 +#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER)
11859 +#define LA(n) INPUT->istream->_LA(ISTREAM, n)
11860 +#define LT(n) INPUT->_LT(INPUT, n)
11861 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
11862 +#define CONSUME() ISTREAM->consume(ISTREAM)
11863 +#define MARK() ISTREAM->mark(ISTREAM)
11864 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
11865 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
11866 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
11867 +#define PERRORRECOVERY PSRSTATE->errorRecovery
11868 +#define FAILEDFLAG PSRSTATE->failed
11869 +#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE)
11870 +#define BACKTRACKING PSRSTATE->backtracking
11871 +#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
11872 +#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
11873 +#define ADAPTOR ctx->adaptor
11874 +#define RULEMEMO PSRSTATE->ruleMemo
11875 +#define DBG RECOGNIZER->debugger
11877 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
11879 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
11880 + * then for the present you must use different names for your defines as these are hard coded
11881 + * in the code generator. It would be better not to use such names internally, and maybe
11882 + * we can change this in a forthcoming release. I deliberately do not #undef these
11883 + * here as this will at least give you a redefined error somewhere if they clash.
11885 +#define UP ANTLR3_TOKEN_UP
11886 +#define DOWN ANTLR3_TOKEN_DOWN
11887 +#define EOR ANTLR3_TOKEN_EOR
11888 +#define INVALID ANTLR3_TOKEN_INVALID
11891 +/* =============================================================================
11892 + * Functions to create and destroy scopes. First come the rule scopes, followed
11893 + * by the global declared scopes.
11898 +/* ============================================================================= */
11900 +/* =============================================================================
11901 + * Start of recognizer
11906 +/** \brief Table of all token names in symbolic order, mainly used for
11907 + * error reporting.
11909 +pANTLR3_UINT8 RSPParserTokenNames[30+4]
11911 + (pANTLR3_UINT8) "<invalid>", /* String to print to indicate an invalid token */
11912 + (pANTLR3_UINT8) "<EOR>",
11913 + (pANTLR3_UINT8) "<DOWN>",
11914 + (pANTLR3_UINT8) "<UP>",
11915 + (pANTLR3_UINT8) "NEWLINE",
11916 + (pANTLR3_UINT8) "OR",
11917 + (pANTLR3_UINT8) "AND",
11918 + (pANTLR3_UINT8) "LPAR",
11919 + (pANTLR3_UINT8) "RPAR",
11920 + (pANTLR3_UINT8) "FIELD",
11921 + (pANTLR3_UINT8) "STR",
11922 + (pANTLR3_UINT8) "NOT",
11923 + (pANTLR3_UINT8) "EQUAL",
11924 + (pANTLR3_UINT8) "INCLUDES",
11925 + (pANTLR3_UINT8) "STARTSW",
11926 + (pANTLR3_UINT8) "ENDSW",
11927 + (pANTLR3_UINT8) "INT",
11928 + (pANTLR3_UINT8) "LESS",
11929 + (pANTLR3_UINT8) "GREATER",
11930 + (pANTLR3_UINT8) "LTE",
11931 + (pANTLR3_UINT8) "GTE",
11932 + (pANTLR3_UINT8) "BEFORE",
11933 + (pANTLR3_UINT8) "AFTER",
11934 + (pANTLR3_UINT8) "DATE",
11935 + (pANTLR3_UINT8) "TODAY",
11936 + (pANTLR3_UINT8) "DAY",
11937 + (pANTLR3_UINT8) "WEEK",
11938 + (pANTLR3_UINT8) "MONTH",
11939 + (pANTLR3_UINT8) "YEAR",
11940 + (pANTLR3_UINT8) "QUOTE",
11941 + (pANTLR3_UINT8) "WS",
11942 + (pANTLR3_UINT8) "DIGIT19",
11943 + (pANTLR3_UINT8) "DIGIT09",
11944 + (pANTLR3_UINT8) "ESCAPED"
11949 +// Forward declare the locally static matching functions we have generated.
11951 +static RSPParser_query_return query (pRSPParser ctx);
11952 +static RSPParser_expr_return expr (pRSPParser ctx);
11953 +static RSPParser_aexpr_return aexpr (pRSPParser ctx);
11954 +static RSPParser_crit_return crit (pRSPParser ctx);
11955 +static RSPParser_strcrit_return strcrit (pRSPParser ctx);
11956 +static RSPParser_strop_return strop (pRSPParser ctx);
11957 +static RSPParser_intcrit_return intcrit (pRSPParser ctx);
11958 +static RSPParser_intop_return intop (pRSPParser ctx);
11959 +static RSPParser_datecrit_return datecrit (pRSPParser ctx);
11960 +static RSPParser_dateop_return dateop (pRSPParser ctx);
11961 +static RSPParser_datespec_return datespec (pRSPParser ctx);
11962 +static RSPParser_dateref_return dateref (pRSPParser ctx);
11963 +static RSPParser_dateintval_return dateintval (pRSPParser ctx);
11964 +static void RSPParserFree(pRSPParser ctx);
11965 +/* For use in tree output where we are accumulating rule labels via label += ruleRef
11966 + * we need a function that knows how to free a return scope when the list is destroyed.
11967 + * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
11969 +static void ANTLR3_CDECL freeScope(void * scope)
11971 + ANTLR3_FREE(scope);
11974 +/** \brief Name of the grammar file that generated this code
11976 +static const char fileName[] = "RSP.g";
11978 +/** \brief Return the name of the grammar file that generated this code.
11980 +static const char * getGrammarFileName()
11984 +/** \brief Create a new RSPParser parser and return a context for it.
11986 + * \param[in] instream Pointer to an input stream interface.
11988 + * \return Pointer to new parser context upon success.
11990 +ANTLR3_API pRSPParser
11991 +RSPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream)
11993 + // See if we can create a new parser with the standard constructor
11995 + return RSPParserNewSSD(instream, NULL);
11998 +/** \brief Create a new RSPParser parser and return a context for it.
12000 + * \param[in] instream Pointer to an input stream interface.
12002 + * \return Pointer to new parser context upon success.
12004 +ANTLR3_API pRSPParser
12005 +RSPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
12007 + pRSPParser ctx; /* Context structure we will build and return */
12009 + ctx = (pRSPParser) ANTLR3_CALLOC(1, sizeof(RSPParser));
12013 + // Failed to allocate memory for parser context
12018 + /* -------------------------------------------------------------------
12019 + * Memory for basic structure is allocated, now to fill in
12020 + * the base ANTLR3 structures. We initialize the function pointers
12021 + * for the standard ANTLR3 parser function set, but upon return
12022 + * from here, the programmer may set the pointers to provide custom
12023 + * implementations of each function.
12025 + * We don't use the macros defined in RSPParser.h here, in order that you can get a sense
12026 + * of what goes where.
12029 + /* Create a base parser/recognizer, using the supplied token stream
12031 + ctx->pParser = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state);
12032 + /* Install the implementation of our RSPParser interface
12034 + ctx->query = query;
12035 + ctx->expr = expr;
12036 + ctx->aexpr = aexpr;
12037 + ctx->crit = crit;
12038 + ctx->strcrit = strcrit;
12039 + ctx->strop = strop;
12040 + ctx->intcrit = intcrit;
12041 + ctx->intop = intop;
12042 + ctx->datecrit = datecrit;
12043 + ctx->dateop = dateop;
12044 + ctx->datespec = datespec;
12045 + ctx->dateref = dateref;
12046 + ctx->dateintval = dateintval;
12047 + ctx->free = RSPParserFree;
12048 + ctx->getGrammarFileName = getGrammarFileName;
12050 + /* Install the scope pushing methods.
12052 + ADAPTOR = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory);
12053 + ctx->vectors = antlr3VectorFactoryNew(0);
12057 + /* Install the token table
12059 + PSRSTATE->tokenNames = RSPParserTokenNames;
12062 + /* Return the newly built parser to the caller
12067 +/** Free the parser resources
12070 + RSPParserFree(pRSPParser ctx)
12072 + /* Free any scope memory
12075 + ctx->vectors->close(ctx->vectors);
12076 + /* We created the adaptor so we must free it
12078 + ADAPTOR->free(ADAPTOR);
12079 + // Free this parser
12081 + ctx->pParser->free(ctx->pParser);
12082 + ANTLR3_FREE(ctx);
12084 + /* Everything is released, so we can return
12089 +/** Return token names used by this parser
12091 + * The returned pointer is used as an index into the token names table (using the token
12092 + * number as the index).
12094 + * \return Pointer to first char * in the table.
12096 +static pANTLR3_UINT8 *getTokenNames()
12098 + return RSPParserTokenNames;
12102 +/* Declare the bitsets
12105 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_query42 */
12106 +static ANTLR3_BITWORD FOLLOW_expr_in_query42_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) };
12107 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_query42 = { FOLLOW_expr_in_query42_bits, 1 };
12108 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NEWLINE_in_query44 */
12109 +static ANTLR3_BITWORD FOLLOW_NEWLINE_in_query44_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000000) };
12110 +static ANTLR3_BITSET_LIST FOLLOW_NEWLINE_in_query44 = { FOLLOW_NEWLINE_in_query44_bits, 1 };
12111 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_EOF_in_query47 */
12112 +static ANTLR3_BITWORD FOLLOW_EOF_in_query47_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12113 +static ANTLR3_BITSET_LIST FOLLOW_EOF_in_query47 = { FOLLOW_EOF_in_query47_bits, 1 };
12114 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expr63 */
12115 +static ANTLR3_BITWORD FOLLOW_aexpr_in_expr63_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) };
12116 +static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expr63 = { FOLLOW_aexpr_in_expr63_bits, 1 };
12117 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expr66 */
12118 +static ANTLR3_BITWORD FOLLOW_OR_in_expr66_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) };
12119 +static ANTLR3_BITSET_LIST FOLLOW_OR_in_expr66 = { FOLLOW_OR_in_expr66_bits, 1 };
12120 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expr69 */
12121 +static ANTLR3_BITWORD FOLLOW_aexpr_in_expr69_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) };
12122 +static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expr69 = { FOLLOW_aexpr_in_expr69_bits, 1 };
12123 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_aexpr81 */
12124 +static ANTLR3_BITWORD FOLLOW_crit_in_aexpr81_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) };
12125 +static ANTLR3_BITSET_LIST FOLLOW_crit_in_aexpr81 = { FOLLOW_crit_in_aexpr81_bits, 1 };
12126 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_aexpr84 */
12127 +static ANTLR3_BITWORD FOLLOW_AND_in_aexpr84_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) };
12128 +static ANTLR3_BITSET_LIST FOLLOW_AND_in_aexpr84 = { FOLLOW_AND_in_aexpr84_bits, 1 };
12129 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_aexpr87 */
12130 +static ANTLR3_BITWORD FOLLOW_crit_in_aexpr87_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) };
12131 +static ANTLR3_BITSET_LIST FOLLOW_crit_in_aexpr87 = { FOLLOW_crit_in_aexpr87_bits, 1 };
12132 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_LPAR_in_crit99 */
12133 +static ANTLR3_BITWORD FOLLOW_LPAR_in_crit99_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) };
12134 +static ANTLR3_BITSET_LIST FOLLOW_LPAR_in_crit99 = { FOLLOW_LPAR_in_crit99_bits, 1 };
12135 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_crit101 */
12136 +static ANTLR3_BITWORD FOLLOW_expr_in_crit101_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000100) };
12137 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_crit101 = { FOLLOW_expr_in_crit101_bits, 1 };
12138 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_RPAR_in_crit103 */
12139 +static ANTLR3_BITWORD FOLLOW_RPAR_in_crit103_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12140 +static ANTLR3_BITSET_LIST FOLLOW_RPAR_in_crit103 = { FOLLOW_RPAR_in_crit103_bits, 1 };
12141 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_strcrit_in_crit114 */
12142 +static ANTLR3_BITWORD FOLLOW_strcrit_in_crit114_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12143 +static ANTLR3_BITSET_LIST FOLLOW_strcrit_in_crit114 = { FOLLOW_strcrit_in_crit114_bits, 1 };
12144 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intcrit_in_crit119 */
12145 +static ANTLR3_BITWORD FOLLOW_intcrit_in_crit119_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12146 +static ANTLR3_BITSET_LIST FOLLOW_intcrit_in_crit119 = { FOLLOW_intcrit_in_crit119_bits, 1 };
12147 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_datecrit_in_crit124 */
12148 +static ANTLR3_BITWORD FOLLOW_datecrit_in_crit124_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12149 +static ANTLR3_BITSET_LIST FOLLOW_datecrit_in_crit124 = { FOLLOW_datecrit_in_crit124_bits, 1 };
12150 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_strcrit134 */
12151 +static ANTLR3_BITWORD FOLLOW_FIELD_in_strcrit134_bits[] = { ANTLR3_UINT64_LIT(0x000000000000F000) };
12152 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_strcrit134 = { FOLLOW_FIELD_in_strcrit134_bits, 1 };
12153 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_strop_in_strcrit136 */
12154 +static ANTLR3_BITWORD FOLLOW_strop_in_strcrit136_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000400) };
12155 +static ANTLR3_BITSET_LIST FOLLOW_strop_in_strcrit136 = { FOLLOW_strop_in_strcrit136_bits, 1 };
12156 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_strcrit138 */
12157 +static ANTLR3_BITWORD FOLLOW_STR_in_strcrit138_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12158 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_strcrit138 = { FOLLOW_STR_in_strcrit138_bits, 1 };
12159 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_strcrit155 */
12160 +static ANTLR3_BITWORD FOLLOW_FIELD_in_strcrit155_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000800) };
12161 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_strcrit155 = { FOLLOW_FIELD_in_strcrit155_bits, 1 };
12162 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_strcrit157 */
12163 +static ANTLR3_BITWORD FOLLOW_NOT_in_strcrit157_bits[] = { ANTLR3_UINT64_LIT(0x000000000000F000) };
12164 +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_strcrit157 = { FOLLOW_NOT_in_strcrit157_bits, 1 };
12165 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_strop_in_strcrit159 */
12166 +static ANTLR3_BITWORD FOLLOW_strop_in_strcrit159_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000400) };
12167 +static ANTLR3_BITSET_LIST FOLLOW_strop_in_strcrit159 = { FOLLOW_strop_in_strcrit159_bits, 1 };
12168 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_strcrit161 */
12169 +static ANTLR3_BITWORD FOLLOW_STR_in_strcrit161_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12170 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_strcrit161 = { FOLLOW_STR_in_strcrit161_bits, 1 };
12171 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_strop0 */
12172 +static ANTLR3_BITWORD FOLLOW_set_in_strop0_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12173 +static ANTLR3_BITSET_LIST FOLLOW_set_in_strop0 = { FOLLOW_set_in_strop0_bits, 1 };
12174 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_intcrit211 */
12175 +static ANTLR3_BITWORD FOLLOW_FIELD_in_intcrit211_bits[] = { ANTLR3_UINT64_LIT(0x00000000001E1000) };
12176 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_intcrit211 = { FOLLOW_FIELD_in_intcrit211_bits, 1 };
12177 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intop_in_intcrit213 */
12178 +static ANTLR3_BITWORD FOLLOW_intop_in_intcrit213_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) };
12179 +static ANTLR3_BITSET_LIST FOLLOW_intop_in_intcrit213 = { FOLLOW_intop_in_intcrit213_bits, 1 };
12180 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_intcrit215 */
12181 +static ANTLR3_BITWORD FOLLOW_INT_in_intcrit215_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12182 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_intcrit215 = { FOLLOW_INT_in_intcrit215_bits, 1 };
12183 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_intcrit232 */
12184 +static ANTLR3_BITWORD FOLLOW_FIELD_in_intcrit232_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000800) };
12185 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_intcrit232 = { FOLLOW_FIELD_in_intcrit232_bits, 1 };
12186 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_intcrit234 */
12187 +static ANTLR3_BITWORD FOLLOW_NOT_in_intcrit234_bits[] = { ANTLR3_UINT64_LIT(0x00000000001E1000) };
12188 +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_intcrit234 = { FOLLOW_NOT_in_intcrit234_bits, 1 };
12189 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intop_in_intcrit236 */
12190 +static ANTLR3_BITWORD FOLLOW_intop_in_intcrit236_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) };
12191 +static ANTLR3_BITSET_LIST FOLLOW_intop_in_intcrit236 = { FOLLOW_intop_in_intcrit236_bits, 1 };
12192 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_intcrit238 */
12193 +static ANTLR3_BITWORD FOLLOW_INT_in_intcrit238_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12194 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_intcrit238 = { FOLLOW_INT_in_intcrit238_bits, 1 };
12195 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_intop0 */
12196 +static ANTLR3_BITWORD FOLLOW_set_in_intop0_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12197 +static ANTLR3_BITSET_LIST FOLLOW_set_in_intop0 = { FOLLOW_set_in_intop0_bits, 1 };
12198 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_datecrit292 */
12199 +static ANTLR3_BITWORD FOLLOW_FIELD_in_datecrit292_bits[] = { ANTLR3_UINT64_LIT(0x0000000000600000) };
12200 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_datecrit292 = { FOLLOW_FIELD_in_datecrit292_bits, 1 };
12201 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datecrit294 */
12202 +static ANTLR3_BITWORD FOLLOW_dateop_in_datecrit294_bits[] = { ANTLR3_UINT64_LIT(0x0000000001810000) };
12203 +static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datecrit294 = { FOLLOW_dateop_in_datecrit294_bits, 1 };
12204 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_datespec_in_datecrit296 */
12205 +static ANTLR3_BITWORD FOLLOW_datespec_in_datecrit296_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12206 +static ANTLR3_BITSET_LIST FOLLOW_datespec_in_datecrit296 = { FOLLOW_datespec_in_datecrit296_bits, 1 };
12207 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_dateop0 */
12208 +static ANTLR3_BITWORD FOLLOW_set_in_dateop0_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12209 +static ANTLR3_BITSET_LIST FOLLOW_set_in_dateop0 = { FOLLOW_set_in_dateop0_bits, 1 };
12210 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec331 */
12211 +static ANTLR3_BITWORD FOLLOW_dateref_in_datespec331_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12212 +static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec331 = { FOLLOW_dateref_in_datespec331_bits, 1 };
12213 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_datespec336 */
12214 +static ANTLR3_BITWORD FOLLOW_INT_in_datespec336_bits[] = { ANTLR3_UINT64_LIT(0x000000001E000000) };
12215 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_datespec336 = { FOLLOW_INT_in_datespec336_bits, 1 };
12216 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateintval_in_datespec338 */
12217 +static ANTLR3_BITWORD FOLLOW_dateintval_in_datespec338_bits[] = { ANTLR3_UINT64_LIT(0x0000000000600000) };
12218 +static ANTLR3_BITSET_LIST FOLLOW_dateintval_in_datespec338 = { FOLLOW_dateintval_in_datespec338_bits, 1 };
12219 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datespec340 */
12220 +static ANTLR3_BITWORD FOLLOW_dateop_in_datespec340_bits[] = { ANTLR3_UINT64_LIT(0x0000000001800000) };
12221 +static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datespec340 = { FOLLOW_dateop_in_datespec340_bits, 1 };
12222 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec342 */
12223 +static ANTLR3_BITWORD FOLLOW_dateref_in_datespec342_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12224 +static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec342 = { FOLLOW_dateref_in_datespec342_bits, 1 };
12225 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_dateref0 */
12226 +static ANTLR3_BITWORD FOLLOW_set_in_dateref0_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12227 +static ANTLR3_BITSET_LIST FOLLOW_set_in_dateref0 = { FOLLOW_set_in_dateref0_bits, 1 };
12228 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_dateintval0 */
12229 +static ANTLR3_BITWORD FOLLOW_set_in_dateintval0_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12230 +static ANTLR3_BITSET_LIST FOLLOW_set_in_dateintval0 = { FOLLOW_set_in_dateintval0_bits, 1 };
12235 +/* ==============================================
12239 + * $ANTLR start query
12240 + * RSP.g:27:1: query : expr ( NEWLINE )? EOF -> expr ;
12242 +static RSPParser_query_return
12243 +query(pRSPParser ctx)
12245 + RSPParser_query_return retval;
12247 + pANTLR3_BASE_TREE root_0;
12249 + pANTLR3_COMMON_TOKEN NEWLINE2;
12250 + pANTLR3_COMMON_TOKEN EOF3;
12251 + RSPParser_expr_return expr1;
12252 + #undef RETURN_TYPE_expr1
12253 + #define RETURN_TYPE_expr1 RSPParser_expr_return
12255 + pANTLR3_BASE_TREE NEWLINE2_tree;
12256 + pANTLR3_BASE_TREE EOF3_tree;
12257 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NEWLINE;
12258 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_EOF;
12259 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr;
12260 + /* Initialize rule variables
12268 + expr1.tree = NULL;
12270 + retval.start = LT(1); retval.stop = retval.start;
12272 + NEWLINE2_tree = NULL;
12273 + EOF3_tree = NULL;
12275 + stream_NEWLINE = NULL;
12276 + #define CREATE_stream_NEWLINE if (stream_NEWLINE == NULL) {stream_NEWLINE = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NEWLINE"); }
12277 + stream_EOF = NULL;
12278 + #define CREATE_stream_EOF if (stream_EOF == NULL) {stream_EOF = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token EOF"); }
12279 + stream_expr = NULL;
12280 + #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); }
12282 + retval.tree = NULL;
12284 + // RSP.g:27:7: ( expr ( NEWLINE )? EOF -> expr )
12285 + // RSP.g:27:9: expr ( NEWLINE )? EOF
12287 + FOLLOWPUSH(FOLLOW_expr_in_query42);
12291 + if (HASEXCEPTION())
12293 + goto rulequeryEx;
12296 + CREATE_stream_expr; stream_expr->add(stream_expr, expr1.tree, NULL);
12298 + // RSP.g:27:14: ( NEWLINE )?
12313 + // RSP.g:27:14: NEWLINE
12315 + NEWLINE2 = (pANTLR3_COMMON_TOKEN) MATCHT(NEWLINE, &FOLLOW_NEWLINE_in_query44);
12316 + if (HASEXCEPTION())
12318 + goto rulequeryEx;
12321 + CREATE_stream_NEWLINE; stream_NEWLINE->add(stream_NEWLINE, NEWLINE2, NULL);
12329 + EOF3 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_query47);
12330 + if (HASEXCEPTION())
12332 + goto rulequeryEx;
12335 + CREATE_stream_EOF; stream_EOF->add(stream_EOF, EOF3, NULL);
12340 + * elements : expr
12342 + * rule labels : retval
12343 + * token list labels :
12344 + * rule list labels :
12347 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
12349 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
12351 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12352 + retval.tree = root_0;
12353 + // 27:28: -> expr
12355 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
12359 + retval.tree = root_0; // set result root
12360 + if (stream_retval != NULL) stream_retval->free(stream_retval);
12369 + // This is where rules clean up and exit
12371 + goto rulequeryEx; /* Prevent compiler warnings */
12373 + retval.stop = LT(-1);
12375 + retval.stop = LT(-1);
12376 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
12377 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
12378 + if (stream_NEWLINE != NULL) stream_NEWLINE->free(stream_NEWLINE);
12379 + if (stream_EOF != NULL) stream_EOF->free(stream_EOF);
12380 + if (stream_expr != NULL) stream_expr->free(stream_expr);
12382 + if (HASEXCEPTION())
12386 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
12392 +/* $ANTLR end query */
12395 + * $ANTLR start expr
12396 + * RSP.g:30:1: expr : aexpr ( OR aexpr )* ;
12398 +static RSPParser_expr_return
12399 +expr(pRSPParser ctx)
12401 + RSPParser_expr_return retval;
12403 + pANTLR3_BASE_TREE root_0;
12405 + pANTLR3_COMMON_TOKEN OR5;
12406 + RSPParser_aexpr_return aexpr4;
12407 + #undef RETURN_TYPE_aexpr4
12408 + #define RETURN_TYPE_aexpr4 RSPParser_aexpr_return
12410 + RSPParser_aexpr_return aexpr6;
12411 + #undef RETURN_TYPE_aexpr6
12412 + #define RETURN_TYPE_aexpr6 RSPParser_aexpr_return
12414 + pANTLR3_BASE_TREE OR5_tree;
12416 + /* Initialize rule variables
12423 + aexpr4.tree = NULL;
12425 + aexpr6.tree = NULL;
12427 + retval.start = LT(1); retval.stop = retval.start;
12432 + retval.tree = NULL;
12434 + // RSP.g:30:6: ( aexpr ( OR aexpr )* )
12435 + // RSP.g:30:8: aexpr ( OR aexpr )*
12437 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12439 + FOLLOWPUSH(FOLLOW_aexpr_in_expr63);
12440 + aexpr4=aexpr(ctx);
12443 + if (HASEXCEPTION())
12448 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr4.tree);
12450 + // RSP.g:30:14: ( OR aexpr )*
12468 + // RSP.g:30:15: OR aexpr
12470 + OR5 = (pANTLR3_COMMON_TOKEN) MATCHT(OR, &FOLLOW_OR_in_expr66);
12471 + if (HASEXCEPTION())
12476 + OR5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OR5));
12477 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OR5_tree, root_0));
12479 + FOLLOWPUSH(FOLLOW_aexpr_in_expr69);
12480 + aexpr6=aexpr(ctx);
12483 + if (HASEXCEPTION())
12488 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree);
12494 + goto loop2; /* break out of the loop */
12498 + loop2: ; /* Jump out to here if this rule does not match */
12506 + // This is where rules clean up and exit
12508 + goto ruleexprEx; /* Prevent compiler warnings */
12510 + retval.stop = LT(-1);
12512 + retval.stop = LT(-1);
12513 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
12514 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
12516 + if (HASEXCEPTION())
12520 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
12526 +/* $ANTLR end expr */
12529 + * $ANTLR start aexpr
12530 + * RSP.g:33:1: aexpr : crit ( AND crit )* ;
12532 +static RSPParser_aexpr_return
12533 +aexpr(pRSPParser ctx)
12535 + RSPParser_aexpr_return retval;
12537 + pANTLR3_BASE_TREE root_0;
12539 + pANTLR3_COMMON_TOKEN AND8;
12540 + RSPParser_crit_return crit7;
12541 + #undef RETURN_TYPE_crit7
12542 + #define RETURN_TYPE_crit7 RSPParser_crit_return
12544 + RSPParser_crit_return crit9;
12545 + #undef RETURN_TYPE_crit9
12546 + #define RETURN_TYPE_crit9 RSPParser_crit_return
12548 + pANTLR3_BASE_TREE AND8_tree;
12550 + /* Initialize rule variables
12557 + crit7.tree = NULL;
12559 + crit9.tree = NULL;
12561 + retval.start = LT(1); retval.stop = retval.start;
12563 + AND8_tree = NULL;
12566 + retval.tree = NULL;
12568 + // RSP.g:33:7: ( crit ( AND crit )* )
12569 + // RSP.g:33:9: crit ( AND crit )*
12571 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12573 + FOLLOWPUSH(FOLLOW_crit_in_aexpr81);
12577 + if (HASEXCEPTION())
12579 + goto ruleaexprEx;
12582 + ADAPTOR->addChild(ADAPTOR, root_0, crit7.tree);
12584 + // RSP.g:33:14: ( AND crit )*
12602 + // RSP.g:33:15: AND crit
12604 + AND8 = (pANTLR3_COMMON_TOKEN) MATCHT(AND, &FOLLOW_AND_in_aexpr84);
12605 + if (HASEXCEPTION())
12607 + goto ruleaexprEx;
12610 + AND8_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AND8));
12611 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, AND8_tree, root_0));
12613 + FOLLOWPUSH(FOLLOW_crit_in_aexpr87);
12617 + if (HASEXCEPTION())
12619 + goto ruleaexprEx;
12622 + ADAPTOR->addChild(ADAPTOR, root_0, crit9.tree);
12628 + goto loop3; /* break out of the loop */
12632 + loop3: ; /* Jump out to here if this rule does not match */
12640 + // This is where rules clean up and exit
12642 + goto ruleaexprEx; /* Prevent compiler warnings */
12644 + retval.stop = LT(-1);
12646 + retval.stop = LT(-1);
12647 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
12648 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
12650 + if (HASEXCEPTION())
12654 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
12660 +/* $ANTLR end aexpr */
12663 + * $ANTLR start crit
12664 + * RSP.g:36:1: crit : ( LPAR expr RPAR -> expr | strcrit | intcrit | datecrit );
12666 +static RSPParser_crit_return
12667 +crit(pRSPParser ctx)
12669 + RSPParser_crit_return retval;
12671 + pANTLR3_BASE_TREE root_0;
12673 + pANTLR3_COMMON_TOKEN LPAR10;
12674 + pANTLR3_COMMON_TOKEN RPAR12;
12675 + RSPParser_expr_return expr11;
12676 + #undef RETURN_TYPE_expr11
12677 + #define RETURN_TYPE_expr11 RSPParser_expr_return
12679 + RSPParser_strcrit_return strcrit13;
12680 + #undef RETURN_TYPE_strcrit13
12681 + #define RETURN_TYPE_strcrit13 RSPParser_strcrit_return
12683 + RSPParser_intcrit_return intcrit14;
12684 + #undef RETURN_TYPE_intcrit14
12685 + #define RETURN_TYPE_intcrit14 RSPParser_intcrit_return
12687 + RSPParser_datecrit_return datecrit15;
12688 + #undef RETURN_TYPE_datecrit15
12689 + #define RETURN_TYPE_datecrit15 RSPParser_datecrit_return
12691 + pANTLR3_BASE_TREE LPAR10_tree;
12692 + pANTLR3_BASE_TREE RPAR12_tree;
12693 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_RPAR;
12694 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_LPAR;
12695 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr;
12696 + /* Initialize rule variables
12704 + expr11.tree = NULL;
12706 + strcrit13.tree = NULL;
12708 + intcrit14.tree = NULL;
12710 + datecrit15.tree = NULL;
12712 + retval.start = LT(1); retval.stop = retval.start;
12714 + LPAR10_tree = NULL;
12715 + RPAR12_tree = NULL;
12717 + stream_RPAR = NULL;
12718 + #define CREATE_stream_RPAR if (stream_RPAR == NULL) {stream_RPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token RPAR"); }
12719 + stream_LPAR = NULL;
12720 + #define CREATE_stream_LPAR if (stream_LPAR == NULL) {stream_LPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token LPAR"); }
12721 + stream_expr = NULL;
12722 + #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); }
12724 + retval.tree = NULL;
12727 + // RSP.g:36:6: ( LPAR expr RPAR -> expr | strcrit | intcrit | datecrit )
12729 + ANTLR3_UINT32 alt4;
12765 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12766 + EXCEPTION->message = (void *)"";
12767 + EXCEPTION->decisionNum = 4;
12768 + EXCEPTION->state = 8;
12794 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12795 + EXCEPTION->message = (void *)"";
12796 + EXCEPTION->decisionNum = 4;
12797 + EXCEPTION->state = 3;
12822 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12823 + EXCEPTION->message = (void *)"";
12824 + EXCEPTION->decisionNum = 4;
12825 + EXCEPTION->state = 4;
12857 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12858 + EXCEPTION->message = (void *)"";
12859 + EXCEPTION->decisionNum = 4;
12860 + EXCEPTION->state = 2;
12871 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12872 + EXCEPTION->message = (void *)"";
12873 + EXCEPTION->decisionNum = 4;
12874 + EXCEPTION->state = 0;
12883 + // RSP.g:36:8: LPAR expr RPAR
12885 + LPAR10 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit99);
12886 + if (HASEXCEPTION())
12891 + CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR10, NULL);
12893 + FOLLOWPUSH(FOLLOW_expr_in_crit101);
12894 + expr11=expr(ctx);
12897 + if (HASEXCEPTION())
12902 + CREATE_stream_expr; stream_expr->add(stream_expr, expr11.tree, NULL);
12903 + RPAR12 = (pANTLR3_COMMON_TOKEN) MATCHT(RPAR, &FOLLOW_RPAR_in_crit103);
12904 + if (HASEXCEPTION())
12909 + CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR12, NULL);
12914 + * elements : expr
12916 + * rule labels : retval
12917 + * token list labels :
12918 + * rule list labels :
12921 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
12923 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
12925 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12926 + retval.tree = root_0;
12927 + // 36:25: -> expr
12929 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
12933 + retval.tree = root_0; // set result root
12934 + if (stream_retval != NULL) stream_retval->free(stream_retval);
12941 + // RSP.g:37:4: strcrit
12943 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12945 + FOLLOWPUSH(FOLLOW_strcrit_in_crit114);
12946 + strcrit13=strcrit(ctx);
12949 + if (HASEXCEPTION())
12954 + ADAPTOR->addChild(ADAPTOR, root_0, strcrit13.tree);
12959 + // RSP.g:38:4: intcrit
12961 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12963 + FOLLOWPUSH(FOLLOW_intcrit_in_crit119);
12964 + intcrit14=intcrit(ctx);
12967 + if (HASEXCEPTION())
12972 + ADAPTOR->addChild(ADAPTOR, root_0, intcrit14.tree);
12977 + // RSP.g:39:4: datecrit
12979 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12981 + FOLLOWPUSH(FOLLOW_datecrit_in_crit124);
12982 + datecrit15=datecrit(ctx);
12985 + if (HASEXCEPTION())
12990 + ADAPTOR->addChild(ADAPTOR, root_0, datecrit15.tree);
13000 + // This is where rules clean up and exit
13002 + goto rulecritEx; /* Prevent compiler warnings */
13004 + retval.stop = LT(-1);
13006 + retval.stop = LT(-1);
13007 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13008 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13009 + if (stream_RPAR != NULL) stream_RPAR->free(stream_RPAR);
13010 + if (stream_LPAR != NULL) stream_LPAR->free(stream_LPAR);
13011 + if (stream_expr != NULL) stream_expr->free(stream_expr);
13013 + if (HASEXCEPTION())
13017 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13023 +/* $ANTLR end crit */
13026 + * $ANTLR start strcrit
13027 + * RSP.g:42:1: strcrit : ( FIELD strop STR -> ^( strop FIELD STR ) | FIELD NOT strop STR -> ^( NOT ^( strop FIELD STR ) ) );
13029 +static RSPParser_strcrit_return
13030 +strcrit(pRSPParser ctx)
13032 + RSPParser_strcrit_return retval;
13034 + pANTLR3_BASE_TREE root_0;
13036 + pANTLR3_COMMON_TOKEN FIELD16;
13037 + pANTLR3_COMMON_TOKEN STR18;
13038 + pANTLR3_COMMON_TOKEN FIELD19;
13039 + pANTLR3_COMMON_TOKEN NOT20;
13040 + pANTLR3_COMMON_TOKEN STR22;
13041 + RSPParser_strop_return strop17;
13042 + #undef RETURN_TYPE_strop17
13043 + #define RETURN_TYPE_strop17 RSPParser_strop_return
13045 + RSPParser_strop_return strop21;
13046 + #undef RETURN_TYPE_strop21
13047 + #define RETURN_TYPE_strop21 RSPParser_strop_return
13049 + pANTLR3_BASE_TREE FIELD16_tree;
13050 + pANTLR3_BASE_TREE STR18_tree;
13051 + pANTLR3_BASE_TREE FIELD19_tree;
13052 + pANTLR3_BASE_TREE NOT20_tree;
13053 + pANTLR3_BASE_TREE STR22_tree;
13054 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_STR;
13055 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_FIELD;
13056 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NOT;
13057 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_strop;
13058 + /* Initialize rule variables
13069 + strop17.tree = NULL;
13071 + strop21.tree = NULL;
13073 + retval.start = LT(1); retval.stop = retval.start;
13075 + FIELD16_tree = NULL;
13076 + STR18_tree = NULL;
13077 + FIELD19_tree = NULL;
13078 + NOT20_tree = NULL;
13079 + STR22_tree = NULL;
13081 + stream_STR = NULL;
13082 + #define CREATE_stream_STR if (stream_STR == NULL) {stream_STR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token STR"); }
13083 + stream_FIELD = NULL;
13084 + #define CREATE_stream_FIELD if (stream_FIELD == NULL) {stream_FIELD = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token FIELD"); }
13085 + stream_NOT = NULL;
13086 + #define CREATE_stream_NOT if (stream_NOT == NULL) {stream_NOT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NOT"); }
13087 + stream_strop = NULL;
13088 + #define CREATE_stream_strop if (stream_strop == NULL) {stream_strop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule strop"); }
13090 + retval.tree = NULL;
13093 + // RSP.g:42:9: ( FIELD strop STR -> ^( strop FIELD STR ) | FIELD NOT strop STR -> ^( NOT ^( strop FIELD STR ) ) )
13095 + ANTLR3_UINT32 alt5;
13121 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13122 + EXCEPTION->message = (void *)"";
13123 + EXCEPTION->decisionNum = 5;
13124 + EXCEPTION->state = 1;
13127 + goto rulestrcritEx;
13135 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13136 + EXCEPTION->message = (void *)"";
13137 + EXCEPTION->decisionNum = 5;
13138 + EXCEPTION->state = 0;
13141 + goto rulestrcritEx;
13147 + // RSP.g:42:11: FIELD strop STR
13149 + FIELD16 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit134);
13150 + if (HASEXCEPTION())
13152 + goto rulestrcritEx;
13155 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD16, NULL);
13157 + FOLLOWPUSH(FOLLOW_strop_in_strcrit136);
13158 + strop17=strop(ctx);
13161 + if (HASEXCEPTION())
13163 + goto rulestrcritEx;
13166 + CREATE_stream_strop; stream_strop->add(stream_strop, strop17.tree, NULL);
13167 + STR18 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_strcrit138);
13168 + if (HASEXCEPTION())
13170 + goto rulestrcritEx;
13173 + CREATE_stream_STR; stream_STR->add(stream_STR, STR18, NULL);
13178 + * elements : strop, STR, FIELD
13180 + * rule labels : retval
13181 + * token list labels :
13182 + * rule list labels :
13185 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13187 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13189 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13190 + retval.tree = root_0;
13191 + // 42:29: -> ^( strop FIELD STR )
13193 + // RSP.g:42:32: ^( strop FIELD STR )
13195 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13196 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_strop == NULL ? NULL : stream_strop->nextNode(stream_strop), root_1));
13198 + ADAPTOR->addChild(ADAPTOR, root_1, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
13199 + ADAPTOR->addChild(ADAPTOR, root_1, stream_STR == NULL ? NULL : stream_STR->nextNode(stream_STR));
13201 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13206 + retval.tree = root_0; // set result root
13207 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13214 + // RSP.g:43:4: FIELD NOT strop STR
13216 + FIELD19 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit155);
13217 + if (HASEXCEPTION())
13219 + goto rulestrcritEx;
13222 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD19, NULL);
13224 + NOT20 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_strcrit157);
13225 + if (HASEXCEPTION())
13227 + goto rulestrcritEx;
13230 + CREATE_stream_NOT; stream_NOT->add(stream_NOT, NOT20, NULL);
13232 + FOLLOWPUSH(FOLLOW_strop_in_strcrit159);
13233 + strop21=strop(ctx);
13236 + if (HASEXCEPTION())
13238 + goto rulestrcritEx;
13241 + CREATE_stream_strop; stream_strop->add(stream_strop, strop21.tree, NULL);
13242 + STR22 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_strcrit161);
13243 + if (HASEXCEPTION())
13245 + goto rulestrcritEx;
13248 + CREATE_stream_STR; stream_STR->add(stream_STR, STR22, NULL);
13253 + * elements : NOT, FIELD, strop, STR
13255 + * rule labels : retval
13256 + * token list labels :
13257 + * rule list labels :
13260 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13262 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13264 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13265 + retval.tree = root_0;
13266 + // 43:25: -> ^( NOT ^( strop FIELD STR ) )
13268 + // RSP.g:43:28: ^( NOT ^( strop FIELD STR ) )
13270 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13271 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_NOT == NULL ? NULL : stream_NOT->nextNode(stream_NOT), root_1));
13273 + // RSP.g:43:34: ^( strop FIELD STR )
13275 + pANTLR3_BASE_TREE root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13276 + root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_strop == NULL ? NULL : stream_strop->nextNode(stream_strop), root_2));
13278 + ADAPTOR->addChild(ADAPTOR, root_2, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
13279 + ADAPTOR->addChild(ADAPTOR, root_2, stream_STR == NULL ? NULL : stream_STR->nextNode(stream_STR));
13281 + ADAPTOR->addChild(ADAPTOR, root_1, root_2);
13284 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13289 + retval.tree = root_0; // set result root
13290 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13302 + // This is where rules clean up and exit
13304 + goto rulestrcritEx; /* Prevent compiler warnings */
13306 + retval.stop = LT(-1);
13308 + retval.stop = LT(-1);
13309 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13310 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13311 + if (stream_STR != NULL) stream_STR->free(stream_STR);
13312 + if (stream_FIELD != NULL) stream_FIELD->free(stream_FIELD);
13313 + if (stream_NOT != NULL) stream_NOT->free(stream_NOT);
13314 + if (stream_strop != NULL) stream_strop->free(stream_strop);
13316 + if (HASEXCEPTION())
13320 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13326 +/* $ANTLR end strcrit */
13329 + * $ANTLR start strop
13330 + * RSP.g:46:1: strop : ( EQUAL | INCLUDES | STARTSW | ENDSW );
13332 +static RSPParser_strop_return
13333 +strop(pRSPParser ctx)
13335 + RSPParser_strop_return retval;
13337 + pANTLR3_BASE_TREE root_0;
13339 + pANTLR3_COMMON_TOKEN set23;
13341 + pANTLR3_BASE_TREE set23_tree;
13343 + /* Initialize rule variables
13350 + retval.start = LT(1); retval.stop = retval.start;
13352 + set23_tree = NULL;
13355 + retval.tree = NULL;
13357 + // RSP.g:46:7: ( EQUAL | INCLUDES | STARTSW | ENDSW )
13360 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13362 + set23=(pANTLR3_COMMON_TOKEN)LT(1);
13363 + if ( ((LA(1) >= EQUAL) && (LA(1) <= ENDSW)) )
13366 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set23)));
13367 + PERRORRECOVERY=ANTLR3_FALSE;
13372 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
13373 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
13374 + EXCEPTION->expectingSet = &FOLLOW_set_in_strop0;
13375 + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_strop0); goto rulestropEx;
13384 + // This is where rules clean up and exit
13386 + goto rulestropEx; /* Prevent compiler warnings */
13388 + retval.stop = LT(-1);
13390 + retval.stop = LT(-1);
13391 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13392 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13394 + if (HASEXCEPTION())
13398 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13404 +/* $ANTLR end strop */
13407 + * $ANTLR start intcrit
13408 + * RSP.g:52:1: intcrit : ( FIELD intop INT -> ^( intop FIELD INT ) | FIELD NOT intop INT -> ^( NOT ^( intop FIELD INT ) ) );
13410 +static RSPParser_intcrit_return
13411 +intcrit(pRSPParser ctx)
13413 + RSPParser_intcrit_return retval;
13415 + pANTLR3_BASE_TREE root_0;
13417 + pANTLR3_COMMON_TOKEN FIELD24;
13418 + pANTLR3_COMMON_TOKEN INT26;
13419 + pANTLR3_COMMON_TOKEN FIELD27;
13420 + pANTLR3_COMMON_TOKEN NOT28;
13421 + pANTLR3_COMMON_TOKEN INT30;
13422 + RSPParser_intop_return intop25;
13423 + #undef RETURN_TYPE_intop25
13424 + #define RETURN_TYPE_intop25 RSPParser_intop_return
13426 + RSPParser_intop_return intop29;
13427 + #undef RETURN_TYPE_intop29
13428 + #define RETURN_TYPE_intop29 RSPParser_intop_return
13430 + pANTLR3_BASE_TREE FIELD24_tree;
13431 + pANTLR3_BASE_TREE INT26_tree;
13432 + pANTLR3_BASE_TREE FIELD27_tree;
13433 + pANTLR3_BASE_TREE NOT28_tree;
13434 + pANTLR3_BASE_TREE INT30_tree;
13435 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_FIELD;
13436 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_INT;
13437 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NOT;
13438 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_intop;
13439 + /* Initialize rule variables
13450 + intop25.tree = NULL;
13452 + intop29.tree = NULL;
13454 + retval.start = LT(1); retval.stop = retval.start;
13456 + FIELD24_tree = NULL;
13457 + INT26_tree = NULL;
13458 + FIELD27_tree = NULL;
13459 + NOT28_tree = NULL;
13460 + INT30_tree = NULL;
13462 + stream_FIELD = NULL;
13463 + #define CREATE_stream_FIELD if (stream_FIELD == NULL) {stream_FIELD = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token FIELD"); }
13464 + stream_INT = NULL;
13465 + #define CREATE_stream_INT if (stream_INT == NULL) {stream_INT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token INT"); }
13466 + stream_NOT = NULL;
13467 + #define CREATE_stream_NOT if (stream_NOT == NULL) {stream_NOT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NOT"); }
13468 + stream_intop = NULL;
13469 + #define CREATE_stream_intop if (stream_intop == NULL) {stream_intop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule intop"); }
13471 + retval.tree = NULL;
13474 + // RSP.g:52:9: ( FIELD intop INT -> ^( intop FIELD INT ) | FIELD NOT intop INT -> ^( NOT ^( intop FIELD INT ) ) )
13476 + ANTLR3_UINT32 alt6;
13503 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13504 + EXCEPTION->message = (void *)"";
13505 + EXCEPTION->decisionNum = 6;
13506 + EXCEPTION->state = 1;
13509 + goto ruleintcritEx;
13517 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13518 + EXCEPTION->message = (void *)"";
13519 + EXCEPTION->decisionNum = 6;
13520 + EXCEPTION->state = 0;
13523 + goto ruleintcritEx;
13529 + // RSP.g:52:11: FIELD intop INT
13531 + FIELD24 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit211);
13532 + if (HASEXCEPTION())
13534 + goto ruleintcritEx;
13537 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD24, NULL);
13539 + FOLLOWPUSH(FOLLOW_intop_in_intcrit213);
13540 + intop25=intop(ctx);
13543 + if (HASEXCEPTION())
13545 + goto ruleintcritEx;
13548 + CREATE_stream_intop; stream_intop->add(stream_intop, intop25.tree, NULL);
13549 + INT26 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_intcrit215);
13550 + if (HASEXCEPTION())
13552 + goto ruleintcritEx;
13555 + CREATE_stream_INT; stream_INT->add(stream_INT, INT26, NULL);
13560 + * elements : FIELD, intop, INT
13562 + * rule labels : retval
13563 + * token list labels :
13564 + * rule list labels :
13567 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13569 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13571 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13572 + retval.tree = root_0;
13573 + // 52:29: -> ^( intop FIELD INT )
13575 + // RSP.g:52:32: ^( intop FIELD INT )
13577 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13578 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_intop == NULL ? NULL : stream_intop->nextNode(stream_intop), root_1));
13580 + ADAPTOR->addChild(ADAPTOR, root_1, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
13581 + ADAPTOR->addChild(ADAPTOR, root_1, stream_INT == NULL ? NULL : stream_INT->nextNode(stream_INT));
13583 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13588 + retval.tree = root_0; // set result root
13589 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13596 + // RSP.g:53:4: FIELD NOT intop INT
13598 + FIELD27 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit232);
13599 + if (HASEXCEPTION())
13601 + goto ruleintcritEx;
13604 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD27, NULL);
13606 + NOT28 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_intcrit234);
13607 + if (HASEXCEPTION())
13609 + goto ruleintcritEx;
13612 + CREATE_stream_NOT; stream_NOT->add(stream_NOT, NOT28, NULL);
13614 + FOLLOWPUSH(FOLLOW_intop_in_intcrit236);
13615 + intop29=intop(ctx);
13618 + if (HASEXCEPTION())
13620 + goto ruleintcritEx;
13623 + CREATE_stream_intop; stream_intop->add(stream_intop, intop29.tree, NULL);
13624 + INT30 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_intcrit238);
13625 + if (HASEXCEPTION())
13627 + goto ruleintcritEx;
13630 + CREATE_stream_INT; stream_INT->add(stream_INT, INT30, NULL);
13635 + * elements : NOT, INT, FIELD, intop
13637 + * rule labels : retval
13638 + * token list labels :
13639 + * rule list labels :
13642 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13644 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13646 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13647 + retval.tree = root_0;
13648 + // 53:25: -> ^( NOT ^( intop FIELD INT ) )
13650 + // RSP.g:53:28: ^( NOT ^( intop FIELD INT ) )
13652 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13653 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_NOT == NULL ? NULL : stream_NOT->nextNode(stream_NOT), root_1));
13655 + // RSP.g:53:34: ^( intop FIELD INT )
13657 + pANTLR3_BASE_TREE root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13658 + root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_intop == NULL ? NULL : stream_intop->nextNode(stream_intop), root_2));
13660 + ADAPTOR->addChild(ADAPTOR, root_2, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
13661 + ADAPTOR->addChild(ADAPTOR, root_2, stream_INT == NULL ? NULL : stream_INT->nextNode(stream_INT));
13663 + ADAPTOR->addChild(ADAPTOR, root_1, root_2);
13666 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13671 + retval.tree = root_0; // set result root
13672 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13684 + // This is where rules clean up and exit
13686 + goto ruleintcritEx; /* Prevent compiler warnings */
13688 + retval.stop = LT(-1);
13690 + retval.stop = LT(-1);
13691 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13692 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13693 + if (stream_FIELD != NULL) stream_FIELD->free(stream_FIELD);
13694 + if (stream_INT != NULL) stream_INT->free(stream_INT);
13695 + if (stream_NOT != NULL) stream_NOT->free(stream_NOT);
13696 + if (stream_intop != NULL) stream_intop->free(stream_intop);
13698 + if (HASEXCEPTION())
13702 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13708 +/* $ANTLR end intcrit */
13711 + * $ANTLR start intop
13712 + * RSP.g:56:1: intop : ( EQUAL | LESS | GREATER | LTE | GTE );
13714 +static RSPParser_intop_return
13715 +intop(pRSPParser ctx)
13717 + RSPParser_intop_return retval;
13719 + pANTLR3_BASE_TREE root_0;
13721 + pANTLR3_COMMON_TOKEN set31;
13723 + pANTLR3_BASE_TREE set31_tree;
13725 + /* Initialize rule variables
13732 + retval.start = LT(1); retval.stop = retval.start;
13734 + set31_tree = NULL;
13737 + retval.tree = NULL;
13739 + // RSP.g:56:7: ( EQUAL | LESS | GREATER | LTE | GTE )
13742 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13744 + set31=(pANTLR3_COMMON_TOKEN)LT(1);
13745 + if ( LA(1) == EQUAL || ((LA(1) >= LESS) && (LA(1) <= GTE)) )
13748 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set31)));
13749 + PERRORRECOVERY=ANTLR3_FALSE;
13754 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
13755 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
13756 + EXCEPTION->expectingSet = &FOLLOW_set_in_intop0;
13757 + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_intop0); goto ruleintopEx;
13766 + // This is where rules clean up and exit
13768 + goto ruleintopEx; /* Prevent compiler warnings */
13770 + retval.stop = LT(-1);
13772 + retval.stop = LT(-1);
13773 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13774 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13776 + if (HASEXCEPTION())
13780 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13786 +/* $ANTLR end intop */
13789 + * $ANTLR start datecrit
13790 + * RSP.g:63:1: datecrit : FIELD dateop datespec -> ^( dateop FIELD datespec ) ;
13792 +static RSPParser_datecrit_return
13793 +datecrit(pRSPParser ctx)
13795 + RSPParser_datecrit_return retval;
13797 + pANTLR3_BASE_TREE root_0;
13799 + pANTLR3_COMMON_TOKEN FIELD32;
13800 + RSPParser_dateop_return dateop33;
13801 + #undef RETURN_TYPE_dateop33
13802 + #define RETURN_TYPE_dateop33 RSPParser_dateop_return
13804 + RSPParser_datespec_return datespec34;
13805 + #undef RETURN_TYPE_datespec34
13806 + #define RETURN_TYPE_datespec34 RSPParser_datespec_return
13808 + pANTLR3_BASE_TREE FIELD32_tree;
13809 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_FIELD;
13810 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_datespec;
13811 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateop;
13812 + /* Initialize rule variables
13819 + dateop33.tree = NULL;
13821 + datespec34.tree = NULL;
13823 + retval.start = LT(1); retval.stop = retval.start;
13825 + FIELD32_tree = NULL;
13827 + stream_FIELD = NULL;
13828 + #define CREATE_stream_FIELD if (stream_FIELD == NULL) {stream_FIELD = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token FIELD"); }
13829 + stream_datespec = NULL;
13830 + #define CREATE_stream_datespec if (stream_datespec == NULL) {stream_datespec = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule datespec"); }
13831 + stream_dateop = NULL;
13832 + #define CREATE_stream_dateop if (stream_dateop == NULL) {stream_dateop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateop"); }
13834 + retval.tree = NULL;
13836 + // RSP.g:63:9: ( FIELD dateop datespec -> ^( dateop FIELD datespec ) )
13837 + // RSP.g:63:11: FIELD dateop datespec
13839 + FIELD32 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_datecrit292);
13840 + if (HASEXCEPTION())
13842 + goto ruledatecritEx;
13845 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD32, NULL);
13847 + FOLLOWPUSH(FOLLOW_dateop_in_datecrit294);
13848 + dateop33=dateop(ctx);
13851 + if (HASEXCEPTION())
13853 + goto ruledatecritEx;
13856 + CREATE_stream_dateop; stream_dateop->add(stream_dateop, dateop33.tree, NULL);
13857 + FOLLOWPUSH(FOLLOW_datespec_in_datecrit296);
13858 + datespec34=datespec(ctx);
13861 + if (HASEXCEPTION())
13863 + goto ruledatecritEx;
13866 + CREATE_stream_datespec; stream_datespec->add(stream_datespec, datespec34.tree, NULL);
13870 + * elements : FIELD, datespec, dateop
13872 + * rule labels : retval
13873 + * token list labels :
13874 + * rule list labels :
13877 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13879 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13881 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13882 + retval.tree = root_0;
13883 + // 63:34: -> ^( dateop FIELD datespec )
13885 + // RSP.g:63:37: ^( dateop FIELD datespec )
13887 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13888 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_dateop == NULL ? NULL : stream_dateop->nextNode(stream_dateop), root_1));
13890 + ADAPTOR->addChild(ADAPTOR, root_1, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
13891 + ADAPTOR->addChild(ADAPTOR, root_1, stream_datespec == NULL ? NULL : stream_datespec->nextTree(stream_datespec));
13893 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13898 + retval.tree = root_0; // set result root
13899 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13908 + // This is where rules clean up and exit
13910 + goto ruledatecritEx; /* Prevent compiler warnings */
13911 + ruledatecritEx: ;
13912 + retval.stop = LT(-1);
13914 + retval.stop = LT(-1);
13915 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13916 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13917 + if (stream_FIELD != NULL) stream_FIELD->free(stream_FIELD);
13918 + if (stream_datespec != NULL) stream_datespec->free(stream_datespec);
13919 + if (stream_dateop != NULL) stream_dateop->free(stream_dateop);
13921 + if (HASEXCEPTION())
13925 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13931 +/* $ANTLR end datecrit */
13934 + * $ANTLR start dateop
13935 + * RSP.g:66:1: dateop : ( BEFORE | AFTER );
13937 +static RSPParser_dateop_return
13938 +dateop(pRSPParser ctx)
13940 + RSPParser_dateop_return retval;
13942 + pANTLR3_BASE_TREE root_0;
13944 + pANTLR3_COMMON_TOKEN set35;
13946 + pANTLR3_BASE_TREE set35_tree;
13948 + /* Initialize rule variables
13955 + retval.start = LT(1); retval.stop = retval.start;
13957 + set35_tree = NULL;
13960 + retval.tree = NULL;
13962 + // RSP.g:66:8: ( BEFORE | AFTER )
13965 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13967 + set35=(pANTLR3_COMMON_TOKEN)LT(1);
13968 + if ( ((LA(1) >= BEFORE) && (LA(1) <= AFTER)) )
13971 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set35)));
13972 + PERRORRECOVERY=ANTLR3_FALSE;
13977 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
13978 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
13979 + EXCEPTION->expectingSet = &FOLLOW_set_in_dateop0;
13980 + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_dateop0); goto ruledateopEx;
13989 + // This is where rules clean up and exit
13991 + goto ruledateopEx; /* Prevent compiler warnings */
13993 + retval.stop = LT(-1);
13995 + retval.stop = LT(-1);
13996 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13997 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13999 + if (HASEXCEPTION())
14003 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14009 +/* $ANTLR end dateop */
14012 + * $ANTLR start datespec
14013 + * RSP.g:70:1: datespec : ( dateref | INT dateintval dateop dateref -> ^( dateop dateref INT dateintval ) );
14015 +static RSPParser_datespec_return
14016 +datespec(pRSPParser ctx)
14018 + RSPParser_datespec_return retval;
14020 + pANTLR3_BASE_TREE root_0;
14022 + pANTLR3_COMMON_TOKEN INT37;
14023 + RSPParser_dateref_return dateref36;
14024 + #undef RETURN_TYPE_dateref36
14025 + #define RETURN_TYPE_dateref36 RSPParser_dateref_return
14027 + RSPParser_dateintval_return dateintval38;
14028 + #undef RETURN_TYPE_dateintval38
14029 + #define RETURN_TYPE_dateintval38 RSPParser_dateintval_return
14031 + RSPParser_dateop_return dateop39;
14032 + #undef RETURN_TYPE_dateop39
14033 + #define RETURN_TYPE_dateop39 RSPParser_dateop_return
14035 + RSPParser_dateref_return dateref40;
14036 + #undef RETURN_TYPE_dateref40
14037 + #define RETURN_TYPE_dateref40 RSPParser_dateref_return
14039 + pANTLR3_BASE_TREE INT37_tree;
14040 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_INT;
14041 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateintval;
14042 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateref;
14043 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateop;
14044 + /* Initialize rule variables
14051 + dateref36.tree = NULL;
14053 + dateintval38.tree = NULL;
14055 + dateop39.tree = NULL;
14057 + dateref40.tree = NULL;
14059 + retval.start = LT(1); retval.stop = retval.start;
14061 + INT37_tree = NULL;
14063 + stream_INT = NULL;
14064 + #define CREATE_stream_INT if (stream_INT == NULL) {stream_INT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token INT"); }
14065 + stream_dateintval = NULL;
14066 + #define CREATE_stream_dateintval if (stream_dateintval == NULL) {stream_dateintval = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateintval"); }
14067 + stream_dateref = NULL;
14068 + #define CREATE_stream_dateref if (stream_dateref == NULL) {stream_dateref = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateref"); }
14069 + stream_dateop = NULL;
14070 + #define CREATE_stream_dateop if (stream_dateop == NULL) {stream_dateop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateop"); }
14072 + retval.tree = NULL;
14075 + // RSP.g:70:9: ( dateref | INT dateintval dateop dateref -> ^( dateop dateref INT dateintval ) )
14077 + ANTLR3_UINT32 alt7;
14097 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
14098 + EXCEPTION->message = (void *)"";
14099 + EXCEPTION->decisionNum = 7;
14100 + EXCEPTION->state = 0;
14103 + goto ruledatespecEx;
14109 + // RSP.g:70:11: dateref
14111 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14113 + FOLLOWPUSH(FOLLOW_dateref_in_datespec331);
14114 + dateref36=dateref(ctx);
14117 + if (HASEXCEPTION())
14119 + goto ruledatespecEx;
14122 + ADAPTOR->addChild(ADAPTOR, root_0, dateref36.tree);
14127 + // RSP.g:71:4: INT dateintval dateop dateref
14129 + INT37 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_datespec336);
14130 + if (HASEXCEPTION())
14132 + goto ruledatespecEx;
14135 + CREATE_stream_INT; stream_INT->add(stream_INT, INT37, NULL);
14137 + FOLLOWPUSH(FOLLOW_dateintval_in_datespec338);
14138 + dateintval38=dateintval(ctx);
14141 + if (HASEXCEPTION())
14143 + goto ruledatespecEx;
14146 + CREATE_stream_dateintval; stream_dateintval->add(stream_dateintval, dateintval38.tree, NULL);
14147 + FOLLOWPUSH(FOLLOW_dateop_in_datespec340);
14148 + dateop39=dateop(ctx);
14151 + if (HASEXCEPTION())
14153 + goto ruledatespecEx;
14156 + CREATE_stream_dateop; stream_dateop->add(stream_dateop, dateop39.tree, NULL);
14157 + FOLLOWPUSH(FOLLOW_dateref_in_datespec342);
14158 + dateref40=dateref(ctx);
14161 + if (HASEXCEPTION())
14163 + goto ruledatespecEx;
14166 + CREATE_stream_dateref; stream_dateref->add(stream_dateref, dateref40.tree, NULL);
14170 + * elements : dateintval, INT, dateref, dateop
14172 + * rule labels : retval
14173 + * token list labels :
14174 + * rule list labels :
14177 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
14179 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
14181 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14182 + retval.tree = root_0;
14183 + // 71:34: -> ^( dateop dateref INT dateintval )
14185 + // RSP.g:71:37: ^( dateop dateref INT dateintval )
14187 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14188 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_dateop == NULL ? NULL : stream_dateop->nextNode(stream_dateop), root_1));
14190 + ADAPTOR->addChild(ADAPTOR, root_1, stream_dateref == NULL ? NULL : stream_dateref->nextTree(stream_dateref));
14191 + ADAPTOR->addChild(ADAPTOR, root_1, stream_INT == NULL ? NULL : stream_INT->nextNode(stream_INT));
14192 + ADAPTOR->addChild(ADAPTOR, root_1, stream_dateintval == NULL ? NULL : stream_dateintval->nextTree(stream_dateintval));
14194 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
14199 + retval.tree = root_0; // set result root
14200 + if (stream_retval != NULL) stream_retval->free(stream_retval);
14212 + // This is where rules clean up and exit
14214 + goto ruledatespecEx; /* Prevent compiler warnings */
14215 + ruledatespecEx: ;
14216 + retval.stop = LT(-1);
14218 + retval.stop = LT(-1);
14219 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
14220 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
14221 + if (stream_INT != NULL) stream_INT->free(stream_INT);
14222 + if (stream_dateintval != NULL) stream_dateintval->free(stream_dateintval);
14223 + if (stream_dateref != NULL) stream_dateref->free(stream_dateref);
14224 + if (stream_dateop != NULL) stream_dateop->free(stream_dateop);
14226 + if (HASEXCEPTION())
14230 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14236 +/* $ANTLR end datespec */
14239 + * $ANTLR start dateref
14240 + * RSP.g:74:1: dateref : ( DATE | TODAY );
14242 +static RSPParser_dateref_return
14243 +dateref(pRSPParser ctx)
14245 + RSPParser_dateref_return retval;
14247 + pANTLR3_BASE_TREE root_0;
14249 + pANTLR3_COMMON_TOKEN set41;
14251 + pANTLR3_BASE_TREE set41_tree;
14253 + /* Initialize rule variables
14260 + retval.start = LT(1); retval.stop = retval.start;
14262 + set41_tree = NULL;
14265 + retval.tree = NULL;
14267 + // RSP.g:74:9: ( DATE | TODAY )
14270 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14272 + set41=(pANTLR3_COMMON_TOKEN)LT(1);
14273 + if ( ((LA(1) >= DATE) && (LA(1) <= TODAY)) )
14276 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set41)));
14277 + PERRORRECOVERY=ANTLR3_FALSE;
14282 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
14283 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
14284 + EXCEPTION->expectingSet = &FOLLOW_set_in_dateref0;
14285 + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_dateref0); goto ruledaterefEx;
14294 + // This is where rules clean up and exit
14296 + goto ruledaterefEx; /* Prevent compiler warnings */
14298 + retval.stop = LT(-1);
14300 + retval.stop = LT(-1);
14301 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
14302 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
14304 + if (HASEXCEPTION())
14308 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14314 +/* $ANTLR end dateref */
14317 + * $ANTLR start dateintval
14318 + * RSP.g:78:1: dateintval : ( DAY | WEEK | MONTH | YEAR );
14320 +static RSPParser_dateintval_return
14321 +dateintval(pRSPParser ctx)
14323 + RSPParser_dateintval_return retval;
14325 + pANTLR3_BASE_TREE root_0;
14327 + pANTLR3_COMMON_TOKEN set42;
14329 + pANTLR3_BASE_TREE set42_tree;
14331 + /* Initialize rule variables
14338 + retval.start = LT(1); retval.stop = retval.start;
14340 + set42_tree = NULL;
14343 + retval.tree = NULL;
14345 + // RSP.g:79:2: ( DAY | WEEK | MONTH | YEAR )
14348 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14350 + set42=(pANTLR3_COMMON_TOKEN)LT(1);
14351 + if ( ((LA(1) >= DAY) && (LA(1) <= YEAR)) )
14354 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set42)));
14355 + PERRORRECOVERY=ANTLR3_FALSE;
14360 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
14361 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
14362 + EXCEPTION->expectingSet = &FOLLOW_set_in_dateintval0;
14363 + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_dateintval0); goto ruledateintvalEx;
14372 + // This is where rules clean up and exit
14374 + goto ruledateintvalEx; /* Prevent compiler warnings */
14375 + ruledateintvalEx: ;
14376 + retval.stop = LT(-1);
14378 + retval.stop = LT(-1);
14379 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
14380 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
14382 + if (HASEXCEPTION())
14386 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14392 +/* $ANTLR end dateintval */
14393 +/* End of parsing rules
14394 + * ==============================================
14397 +/* ==============================================
14398 + * Syntactic predicates
14400 +/* End of syntactic predicates
14401 + * ==============================================
14410 + * =============================================================================
14412 diff --git a/src/pregen/RSPParser.h b/src/pregen/RSPParser.h
14413 new file mode 100644
14414 index 0000000..d0744a2
14416 +++ b/src/pregen/RSPParser.h
14419 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
14421 + * - From the grammar source file : RSP.g
14422 + * - On : 2014-09-30 21:42:40
14423 + * - for the parser : RSPParserParser *
14424 + * Editing it, at least manually, is not wise.
14426 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
14429 + * The parser RSPParser has the callable functions (rules) shown below,
14430 + * which will invoke the code for the associated rule in the source grammar
14431 + * assuming that the input stream is pointing to a token/text stream that could begin
14434 + * For instance if you call the first (topmost) rule in a parser grammar, you will
14435 + * get the results of a full parse, but calling a rule half way through the grammar will
14436 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
14437 + * in editors and so on.
14439 + * The parser entry points are called indirectly (by function pointer to function) via
14440 + * a parser context typedef pRSPParser, which is returned from a call to RSPParserNew().
14442 + * The methods in pRSPParser are as follows:
14444 + * - RSPParser_query_return pRSPParser->query(pRSPParser)
14445 + * - RSPParser_expr_return pRSPParser->expr(pRSPParser)
14446 + * - RSPParser_aexpr_return pRSPParser->aexpr(pRSPParser)
14447 + * - RSPParser_crit_return pRSPParser->crit(pRSPParser)
14448 + * - RSPParser_strcrit_return pRSPParser->strcrit(pRSPParser)
14449 + * - RSPParser_strop_return pRSPParser->strop(pRSPParser)
14450 + * - RSPParser_intcrit_return pRSPParser->intcrit(pRSPParser)
14451 + * - RSPParser_intop_return pRSPParser->intop(pRSPParser)
14452 + * - RSPParser_datecrit_return pRSPParser->datecrit(pRSPParser)
14453 + * - RSPParser_dateop_return pRSPParser->dateop(pRSPParser)
14454 + * - RSPParser_datespec_return pRSPParser->datespec(pRSPParser)
14455 + * - RSPParser_dateref_return pRSPParser->dateref(pRSPParser)
14456 + * - RSPParser_dateintval_return pRSPParser->dateintval(pRSPParser)
14458 + * The return type for any particular rule is of course determined by the source
14461 +// [The "BSD licence"]
14462 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
14463 +// http://www.temporal-wave.com
14464 +// http://www.linkedin.com/in/jimidle
14466 +// All rights reserved.
14468 +// Redistribution and use in source and binary forms, with or without
14469 +// modification, are permitted provided that the following conditions
14471 +// 1. Redistributions of source code must retain the above copyright
14472 +// notice, this list of conditions and the following disclaimer.
14473 +// 2. Redistributions in binary form must reproduce the above copyright
14474 +// notice, this list of conditions and the following disclaimer in the
14475 +// documentation and/or other materials provided with the distribution.
14476 +// 3. The name of the author may not be used to endorse or promote products
14477 +// derived from this software without specific prior written permission.
14479 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14480 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14481 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14482 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
14483 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
14484 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
14485 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
14486 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14487 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
14488 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14490 +#ifndef _RSPParser_H
14491 +#define _RSPParser_H
14492 +/* =============================================================================
14493 + * Standard antlr3 C runtime definitions
14495 +#include <antlr3.h>
14497 +/* End of standard antlr 3 runtime definitions
14498 + * =============================================================================
14501 +#ifdef __cplusplus
14505 +// Forward declare the context typedef so that we can use it before it is
14506 +// properly defined. Delegators and delegates (from import statements) are
14507 +// interdependent and their context structures contain pointers to each other
14508 +// C only allows such things to be declared if you pre-declare the typedef.
14510 +typedef struct RSPParser_Ctx_struct RSPParser, * pRSPParser;
14514 +#ifdef ANTLR3_WINDOWS
14515 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
14516 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
14517 +// initialized but unused variable - tree rewrite variables declared but not needed
14518 +// Unreferenced local variable - lexer rule declares but does not always use _type
14519 +// potentially unitialized variable used - retval always returned from a rule
14520 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
14522 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
14523 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
14524 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
14525 +// this is a matter of orthogonality hence I disable that one.
14527 +#pragma warning( disable : 4100 )
14528 +#pragma warning( disable : 4101 )
14529 +#pragma warning( disable : 4127 )
14530 +#pragma warning( disable : 4189 )
14531 +#pragma warning( disable : 4505 )
14532 +#pragma warning( disable : 4701 )
14534 +typedef struct RSPParser_query_return_struct
14536 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14538 + pANTLR3_COMMON_TOKEN start;
14539 + pANTLR3_COMMON_TOKEN stop;
14540 + pANTLR3_BASE_TREE tree;
14543 + RSPParser_query_return;
14545 +typedef struct RSPParser_expr_return_struct
14547 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14549 + pANTLR3_COMMON_TOKEN start;
14550 + pANTLR3_COMMON_TOKEN stop;
14551 + pANTLR3_BASE_TREE tree;
14554 + RSPParser_expr_return;
14556 +typedef struct RSPParser_aexpr_return_struct
14558 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14560 + pANTLR3_COMMON_TOKEN start;
14561 + pANTLR3_COMMON_TOKEN stop;
14562 + pANTLR3_BASE_TREE tree;
14565 + RSPParser_aexpr_return;
14567 +typedef struct RSPParser_crit_return_struct
14569 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14571 + pANTLR3_COMMON_TOKEN start;
14572 + pANTLR3_COMMON_TOKEN stop;
14573 + pANTLR3_BASE_TREE tree;
14576 + RSPParser_crit_return;
14578 +typedef struct RSPParser_strcrit_return_struct
14580 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14582 + pANTLR3_COMMON_TOKEN start;
14583 + pANTLR3_COMMON_TOKEN stop;
14584 + pANTLR3_BASE_TREE tree;
14587 + RSPParser_strcrit_return;
14589 +typedef struct RSPParser_strop_return_struct
14591 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14593 + pANTLR3_COMMON_TOKEN start;
14594 + pANTLR3_COMMON_TOKEN stop;
14595 + pANTLR3_BASE_TREE tree;
14598 + RSPParser_strop_return;
14600 +typedef struct RSPParser_intcrit_return_struct
14602 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14604 + pANTLR3_COMMON_TOKEN start;
14605 + pANTLR3_COMMON_TOKEN stop;
14606 + pANTLR3_BASE_TREE tree;
14609 + RSPParser_intcrit_return;
14611 +typedef struct RSPParser_intop_return_struct
14613 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14615 + pANTLR3_COMMON_TOKEN start;
14616 + pANTLR3_COMMON_TOKEN stop;
14617 + pANTLR3_BASE_TREE tree;
14620 + RSPParser_intop_return;
14622 +typedef struct RSPParser_datecrit_return_struct
14624 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14626 + pANTLR3_COMMON_TOKEN start;
14627 + pANTLR3_COMMON_TOKEN stop;
14628 + pANTLR3_BASE_TREE tree;
14631 + RSPParser_datecrit_return;
14633 +typedef struct RSPParser_dateop_return_struct
14635 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14637 + pANTLR3_COMMON_TOKEN start;
14638 + pANTLR3_COMMON_TOKEN stop;
14639 + pANTLR3_BASE_TREE tree;
14642 + RSPParser_dateop_return;
14644 +typedef struct RSPParser_datespec_return_struct
14646 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14648 + pANTLR3_COMMON_TOKEN start;
14649 + pANTLR3_COMMON_TOKEN stop;
14650 + pANTLR3_BASE_TREE tree;
14653 + RSPParser_datespec_return;
14655 +typedef struct RSPParser_dateref_return_struct
14657 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14659 + pANTLR3_COMMON_TOKEN start;
14660 + pANTLR3_COMMON_TOKEN stop;
14661 + pANTLR3_BASE_TREE tree;
14664 + RSPParser_dateref_return;
14666 +typedef struct RSPParser_dateintval_return_struct
14668 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14670 + pANTLR3_COMMON_TOKEN start;
14671 + pANTLR3_COMMON_TOKEN stop;
14672 + pANTLR3_BASE_TREE tree;
14675 + RSPParser_dateintval_return;
14679 +/** Context tracking structure for RSPParser
14681 +struct RSPParser_Ctx_struct
14683 + /** Built in ANTLR3 context tracker contains all the generic elements
14684 + * required for context tracking.
14686 + pANTLR3_PARSER pParser;
14689 + RSPParser_query_return (*query) (struct RSPParser_Ctx_struct * ctx);
14690 + RSPParser_expr_return (*expr) (struct RSPParser_Ctx_struct * ctx);
14691 + RSPParser_aexpr_return (*aexpr) (struct RSPParser_Ctx_struct * ctx);
14692 + RSPParser_crit_return (*crit) (struct RSPParser_Ctx_struct * ctx);
14693 + RSPParser_strcrit_return (*strcrit) (struct RSPParser_Ctx_struct * ctx);
14694 + RSPParser_strop_return (*strop) (struct RSPParser_Ctx_struct * ctx);
14695 + RSPParser_intcrit_return (*intcrit) (struct RSPParser_Ctx_struct * ctx);
14696 + RSPParser_intop_return (*intop) (struct RSPParser_Ctx_struct * ctx);
14697 + RSPParser_datecrit_return (*datecrit) (struct RSPParser_Ctx_struct * ctx);
14698 + RSPParser_dateop_return (*dateop) (struct RSPParser_Ctx_struct * ctx);
14699 + RSPParser_datespec_return (*datespec) (struct RSPParser_Ctx_struct * ctx);
14700 + RSPParser_dateref_return (*dateref) (struct RSPParser_Ctx_struct * ctx);
14701 + RSPParser_dateintval_return (*dateintval) (struct RSPParser_Ctx_struct * ctx);
14702 + // Delegated rules
14703 + const char * (*getGrammarFileName)();
14704 + void (*free) (struct RSPParser_Ctx_struct * ctx);
14705 + /* @headerFile.members() */
14706 + pANTLR3_BASE_TREE_ADAPTOR adaptor;
14707 + pANTLR3_VECTOR_FACTORY vectors;
14708 + /* End @headerFile.members() */
14711 +// Function protoypes for the constructor functions that external translation units
14712 +// such as delegators and delegates may wish to call.
14714 +ANTLR3_API pRSPParser RSPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream);
14715 +ANTLR3_API pRSPParser RSPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
14717 +/** Symbolic definitions of all the tokens that the parser will work with.
14720 + * Antlr will define EOF, but we can't use that as it it is too common in
14721 + * in C header files and that would be confusing. There is no way to filter this out at the moment
14722 + * so we just undef it here for now. That isn't the value we get back from C recognizers
14723 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
14731 +#define STARTSW 14
14746 +#define DIGIT19 31
14747 +#define INCLUDES 13
14751 +#define GREATER 18
14759 +#define ESCAPED 33
14761 +#define DIGIT09 32
14764 +#define EOF ANTLR3_TOKEN_EOF
14767 +#ifndef TOKENSOURCE
14768 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
14771 +/* End of token definitions for RSPParser
14772 + * =============================================================================
14776 +#ifdef __cplusplus
14782 +/* END - Note:Keep extra line feed to satisfy UNIX systems */