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..04d6153
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 : 2016-01-01 12:23: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)
587 + retval.result= a.result->factory->newRaw(a.result->factory);
588 + retval.result->append8(retval.result, "(");
589 + retval.result->appendS(retval.result, a.result);
590 + retval.result->append8(retval.result, " AND ");
591 + retval.result->appendS(retval.result, b.result);
592 + retval.result->append8(retval.result, ")");
596 + retval.result= a.result->factory->newRaw(a.result->factory);
597 + retval.result->appendS(retval.result, a.result);
601 + retval.result= b.result->factory->newRaw(b.result->factory);
602 + retval.result->appendS(retval.result, b.result);
614 + // DAAP2SQL.g:96:4: ^( OPOR a= expr b= expr )
616 + MATCHT(OPOR, &FOLLOW_OPOR_in_expr118);
617 + if (HASEXCEPTION())
623 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
624 + if (HASEXCEPTION())
629 + FOLLOWPUSH(FOLLOW_expr_in_expr124);
633 + if (HASEXCEPTION())
638 + FOLLOWPUSH(FOLLOW_expr_in_expr130);
642 + if (HASEXCEPTION())
648 + MATCHT(ANTLR3_TOKEN_UP, NULL);
649 + if (HASEXCEPTION())
656 + if (a.valid && b.valid)
658 + retval.result= a.result->factory->newRaw(a.result->factory);
659 + retval.result->append8(retval.result, "(");
660 + retval.result->appendS(retval.result, a.result);
661 + retval.result->append8(retval.result, " OR ");
662 + retval.result->appendS(retval.result, b.result);
663 + retval.result->append8(retval.result, ")");
667 + retval.result= a.result->factory->newRaw(a.result->factory);
668 + retval.result->appendS(retval.result, a.result);
672 + retval.result= b.result->factory->newRaw(b.result->factory);
673 + retval.result->appendS(retval.result, b.result);
685 + // DAAP2SQL.g:122:4: STR
687 + STR1 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expr140);
688 + if (HASEXCEPTION())
695 + pANTLR3_STRING str;
696 + pANTLR3_UINT8 field;
698 + pANTLR3_UINT8 escaped;
701 + const struct dmap_query_field_map *dqfm;
707 + retval.result= (STR1->getText(STR1))->factory->newRaw((STR1->getText(STR1))->factory);
709 + str = (STR1->getText(STR1))->toUTF8((STR1->getText(STR1)));
711 + /* NOTE: the lexer delivers the string without quotes
712 + which may not be obvious from the grammar due to embedded code
715 + /* Make daap.songalbumid:0 a no-op */
716 + if (strcmp((char *)str->chars, "daap.songalbumid:0") == 0)
718 + retval.result->append8(retval.result, "1 = 1");
723 + field = str->chars;
726 + while ((*val != '\0') && ((*val == '.')
728 + || ((*val >= 'a') && (*val <= 'z'))
729 + || ((*val >= 'A') && (*val <= 'Z'))
730 + || ((*val >= '0') && (*val <= '9'))))
735 + if (*field == '\0')
737 + DPRINTF(E_LOG, L_DAAP, "No field name found in clause '%s'\n", field);
739 + goto STR_result_valid_0; /* ABORT */
744 + DPRINTF(E_LOG, L_DAAP, "No operator found in clause '%s'\n", field);
746 + goto STR_result_valid_0; /* ABORT */
757 + DPRINTF(E_LOG, L_DAAP, "Negation found but operator missing in clause '%s%c'\n", field, op);
759 + goto STR_result_valid_0; /* ABORT */
769 + /* Lookup DMAP field in the query field map */
770 + dqfm = daap_query_field_lookup((char *)field, strlen((char *)field));
773 + DPRINTF(E_LOG, L_DAAP, "DMAP field '%s' is not a valid field in queries\n", field);
775 + goto STR_result_valid_0; /* ABORT */
778 + /* Empty values OK for string fields, NOK for integer */
783 + DPRINTF(E_LOG, L_DAAP, "No value given in clause '%s%s%c'\n", field, (neg_op) ? "!" : "", op);
785 + goto STR_result_valid_0; /* ABORT */
788 + /* No need to exclude empty artist and album, as forked-daapd makes sure there always exists an artist/album. */
789 + if (neg_op && op == ':'
790 + && (strcmp((char *)field, "daap.songalbumartist") == 0
791 + || strcmp((char *)field, "daap.songartist") == 0
792 + || strcmp((char *)field, "daap.songalbum") == 0))
794 + DPRINTF(E_DBG, L_DAAP, "Ignoring clause '%s%s%c'\n", field, (neg_op) ? "!" : "", op);
796 + goto STR_result_valid_0;
799 + /* Need to check against NULL too */
801 + retval.result->append8(retval.result, "(");
804 + /* Int field: check integer conversion */
808 + llval = strtoll((const char *)val, &end, 10);
810 + if (((errno == ERANGE) && ((llval == LLONG_MAX) || (llval == LLONG_MIN)))
811 + || ((errno != 0) && (llval == 0)))
813 + DPRINTF(E_LOG, L_DAAP, "Value '%s' in clause '%s%s%c%s' does not convert to an integer type\n",
814 + val, field, (neg_op) ? "!" : "", op, val);
816 + goto STR_result_valid_0; /* ABORT */
819 + if (end == (char *)val)
821 + DPRINTF(E_LOG, L_DAAP, "Value '%s' in clause '%s%s%c%s' does not represent an integer value\n",
822 + val, field, (neg_op) ? "!" : "", op, val);
824 + goto STR_result_valid_0; /* ABORT */
827 + *end = '\0'; /* Cut out potential garbage - we're being kind */
829 + /* forked-daapd only has media_kind = 1 for music - so remove media_kind = 32 to imporve select query performance. */
831 + && (strcmp((char *)field, "com.apple.itunes.mediakind") == 0
832 + || strcmp((char *)field, "com.apple.itunes.extended-media-kind") == 0))
834 + DPRINTF(E_DBG, L_DAAP, "Ignoring clause '%s%s%c%s'\n", field, (neg_op) ? "!" : "", op, val);
837 + retval.result->append8(retval.result, "1 = 1");
839 + retval.result->append8(retval.result, "1 = 0");
844 + /* String field: escape string, check for '*' */
849 + DPRINTF(E_LOG, L_DAAP, "Operation '%c' not valid for string values\n", op);
851 + goto STR_result_valid_0; /* ABORT */
854 + escaped = (pANTLR3_UINT8)db_escape_string((char *)val);
857 + DPRINTF(E_LOG, L_DAAP, "Could not escape value\n");
859 + goto STR_result_valid_0; /* ABORT */
870 + if (val[0] && val[1] && val[strlen((char *)val) - 1] == '*')
873 + val[strlen((char *)val) - 1] = '%';
877 + retval.result->append8(retval.result, dqfm->db_col);
883 + retval.result->append8(retval.result, " <> ");
885 + retval.result->append8(retval.result, " = ");
890 + retval.result->append8(retval.result, " <= ");
892 + retval.result->append8(retval.result, " > ");
897 + retval.result->append8(retval.result, " >= ");
899 + retval.result->append8(retval.result, " < ");
903 + retval.result->append8(retval.result, " LIKE ");
908 + DPRINTF(E_LOG, L_DAAP, "Missing or unknown operator '%c' in clause '%s!%c%s'\n", op, field, op, val);
910 + DPRINTF(E_LOG, L_DAAP, "Unknown operator '%c' in clause '%s%c%s'\n", op, field, op, val);
912 + goto STR_result_valid_0; /* ABORT */
917 + retval.result->append8(retval.result, "'");
919 + retval.result->append8(retval.result, (const char *)val);
922 + retval.result->append8(retval.result, "'");
924 + /* For empty string value, we need to check against NULL too */
925 + if ((*val == '\0') && (op == ':'))
928 + retval.result->append8(retval.result, " AND ");
930 + retval.result->append8(retval.result, " OR ");
932 + retval.result->append8(retval.result, dqfm->db_col);
935 + retval.result->append8(retval.result, " IS NOT NULL");
937 + retval.result->append8(retval.result, " IS NULL");
939 + retval.result->append8(retval.result, ")");
942 + STR_result_valid_0: /* bail out label */
948 + STR_out: /* get out of here */
961 + // This is where rules clean up and exit
963 + goto ruleexprEx; /* Prevent compiler warnings */
966 + if (HASEXCEPTION())
975 +/* $ANTLR end expr */
976 +/* End of parsing rules
977 + * ==============================================
980 +/* ==============================================
981 + * Syntactic predicates
983 +/* End of syntactic predicates
984 + * ==============================================
993 + * =============================================================================
995 diff --git a/src/pregen/DAAP2SQL.h b/src/pregen/DAAP2SQL.h
997 index 0000000..e829049
999 +++ b/src/pregen/DAAP2SQL.h
1002 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
1004 + * - From the grammar source file : DAAP2SQL.g
1005 + * - On : 2016-01-01 12:23:43
1006 + * - for the tree parser : DAAP2SQLTreeParser *
1007 + * Editing it, at least manually, is not wise.
1009 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
1012 + * The tree parser DAAP2SQL has the callable functions (rules) shown below,
1013 + * which will invoke the code for the associated rule in the source grammar
1014 + * assuming that the input stream is pointing to a token/text stream that could begin
1017 + * For instance if you call the first (topmost) rule in a parser grammar, you will
1018 + * get the results of a full parse, but calling a rule half way through the grammar will
1019 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
1020 + * in editors and so on.
1022 + * The parser entry points are called indirectly (by function pointer to function) via
1023 + * a parser context typedef pDAAP2SQL, which is returned from a call to DAAP2SQLNew().
1025 + * The methods in pDAAP2SQL are as follows:
1027 + * - pANTLR3_STRING pDAAP2SQL->query(pDAAP2SQL)
1028 + * - DAAP2SQL_expr_return pDAAP2SQL->expr(pDAAP2SQL)
1030 + * The return type for any particular rule is of course determined by the source
1033 +// [The "BSD licence"]
1034 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
1035 +// http://www.temporal-wave.com
1036 +// http://www.linkedin.com/in/jimidle
1038 +// All rights reserved.
1040 +// Redistribution and use in source and binary forms, with or without
1041 +// modification, are permitted provided that the following conditions
1043 +// 1. Redistributions of source code must retain the above copyright
1044 +// notice, this list of conditions and the following disclaimer.
1045 +// 2. Redistributions in binary form must reproduce the above copyright
1046 +// notice, this list of conditions and the following disclaimer in the
1047 +// documentation and/or other materials provided with the distribution.
1048 +// 3. The name of the author may not be used to endorse or promote products
1049 +// derived from this software without specific prior written permission.
1051 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1052 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1053 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1054 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1055 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1056 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1057 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1058 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1059 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1060 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1062 +#ifndef _DAAP2SQL_H
1063 +#define _DAAP2SQL_H
1064 +/* =============================================================================
1065 + * Standard antlr3 C runtime definitions
1067 +#include <antlr3.h>
1069 +/* End of standard antlr 3 runtime definitions
1070 + * =============================================================================
1077 +// Forward declare the context typedef so that we can use it before it is
1078 +// properly defined. Delegators and delegates (from import statements) are
1079 +// interdependent and their context structures contain pointers to each other
1080 +// C only allows such things to be declared if you pre-declare the typedef.
1082 +typedef struct DAAP2SQL_Ctx_struct DAAP2SQL, * pDAAP2SQL;
1086 + #include <stdio.h>
1087 + #include <stdlib.h>
1088 + #include <string.h>
1089 + #include <limits.h>
1090 + #include <errno.h>
1092 + #include "logger.h"
1094 + #include "daap_query.h"
1097 +#ifdef ANTLR3_WINDOWS
1098 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
1099 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
1100 +// initialized but unused variable - tree rewrite variables declared but not needed
1101 +// Unreferenced local variable - lexer rule declares but does not always use _type
1102 +// potentially unitialized variable used - retval always returned from a rule
1103 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
1105 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
1106 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
1107 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
1108 +// this is a matter of orthogonality hence I disable that one.
1110 +#pragma warning( disable : 4100 )
1111 +#pragma warning( disable : 4101 )
1112 +#pragma warning( disable : 4127 )
1113 +#pragma warning( disable : 4189 )
1114 +#pragma warning( disable : 4505 )
1115 +#pragma warning( disable : 4701 )
1117 +typedef struct DAAP2SQL_expr_return_struct
1119 + pANTLR3_BASE_TREE start;
1120 + pANTLR3_BASE_TREE stop;
1121 + pANTLR3_STRING result;
1124 + DAAP2SQL_expr_return;
1128 +/** Context tracking structure for DAAP2SQL
1130 +struct DAAP2SQL_Ctx_struct
1132 + /** Built in ANTLR3 context tracker contains all the generic elements
1133 + * required for context tracking.
1135 + pANTLR3_TREE_PARSER pTreeParser;
1138 + pANTLR3_STRING (*query) (struct DAAP2SQL_Ctx_struct * ctx);
1139 + DAAP2SQL_expr_return (*expr) (struct DAAP2SQL_Ctx_struct * ctx);
1140 + // Delegated rules
1141 + const char * (*getGrammarFileName)();
1142 + void (*free) (struct DAAP2SQL_Ctx_struct * ctx);
1146 +// Function protoypes for the constructor functions that external translation units
1147 +// such as delegators and delegates may wish to call.
1149 +ANTLR3_API pDAAP2SQL DAAP2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream);
1150 +ANTLR3_API pDAAP2SQL DAAP2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
1152 +/** Symbolic definitions of all the tokens that the tree parser will work with.
1155 + * Antlr will define EOF, but we can't use that as it it is too common in
1156 + * in C header files and that would be confusing. There is no way to filter this out at the moment
1157 + * so we just undef it here for now. That isn't the value we get back from C recognizers
1158 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
1177 +#define EOF ANTLR3_TOKEN_EOF
1180 +#ifndef TOKENSOURCE
1181 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
1184 +/* End of token definitions for DAAP2SQL
1185 + * =============================================================================
1195 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
1196 diff --git a/src/pregen/DAAP2SQL.u b/src/pregen/DAAP2SQL.u
1197 new file mode 100644
1198 index 0000000..385d80b
1200 +++ b/src/pregen/DAAP2SQL.u
1202 +DAAP2SQL.g: DAAP.tokens
1203 +DAAP2SQL.c : DAAP2SQL.g
1204 +./DAAP2SQL.tokens : DAAP2SQL.g
1205 +DAAP2SQL.h : DAAP2SQL.g
1206 +ANTLR_PRODUCTS += DAAP2SQL.c ./DAAP2SQL.tokens DAAP2SQL.h
1207 \ No newline at end of file
1208 diff --git a/src/pregen/DAAPLexer.c b/src/pregen/DAAPLexer.c
1209 new file mode 100644
1210 index 0000000..eab3ff4
1212 +++ b/src/pregen/DAAPLexer.c
1215 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
1217 + * - From the grammar source file : DAAP.g
1218 + * - On : 2016-01-01 12:23:41
1219 + * - for the lexer : DAAPLexerLexer *
1220 + * Editing it, at least manually, is not wise.
1222 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
1226 +// [The "BSD licence"]
1227 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
1228 +// http://www.temporal-wave.com
1229 +// http://www.linkedin.com/in/jimidle
1231 +// All rights reserved.
1233 +// Redistribution and use in source and binary forms, with or without
1234 +// modification, are permitted provided that the following conditions
1236 +// 1. Redistributions of source code must retain the above copyright
1237 +// notice, this list of conditions and the following disclaimer.
1238 +// 2. Redistributions in binary form must reproduce the above copyright
1239 +// notice, this list of conditions and the following disclaimer in the
1240 +// documentation and/or other materials provided with the distribution.
1241 +// 3. The name of the author may not be used to endorse or promote products
1242 +// derived from this software without specific prior written permission.
1244 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1245 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1246 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1247 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1248 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1249 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1250 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1251 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1252 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1253 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1255 +/* -----------------------------------------
1256 + * Include the ANTLR3 generated header file.
1258 +#include "DAAPLexer.h"
1259 +/* ----------------------------------------- */
1265 +/* MACROS that hide the C interface implementations from the
1266 + * generated code, which makes it a little more understandable to the human eye.
1267 + * I am very much against using C pre-processor macros for function calls and bits
1268 + * of code as you cannot see what is happening when single stepping in debuggers
1269 + * and so on. The exception (in my book at least) is for generated code, where you are
1270 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
1271 + * hides some indirect calls, but is always referring to the input stream. This is
1272 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
1273 + * the runtime interfaces without changing the generated code too often, without
1274 + * confusing the reader of the generated output, who may not wish to know the gory
1275 + * details of the interface inheritance.
1280 +/* Aids in accessing scopes for grammar programmers
1285 +#define SCOPE_TYPE(scope) pDAAPLexer_##scope##_SCOPE
1286 +#define SCOPE_STACK(scope) pDAAPLexer_##scope##Stack
1287 +#define SCOPE_TOP(scope) ctx->pDAAPLexer_##scope##Top
1288 +#define SCOPE_SIZE(scope) ctx->pDAAPLexer_##scope##Stack_limit
1289 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
1292 +/* Macros for accessing things in a lexer
1297 +#undef GETCHARINDEX
1299 +#undef GETCHARPOSITIONINLINE
1311 +#undef HASEXCEPTION
1319 +#undef BACKTRACKING
1322 +#undef HAVEPARSEDRULE
1331 +#define LEXER ctx->pLexer
1332 +#define RECOGNIZER LEXER->rec
1333 +#define LEXSTATE RECOGNIZER->state
1334 +#define TOKSOURCE LEXSTATE->tokSource
1335 +#define GETCHARINDEX() LEXER->getCharIndex(LEXER)
1336 +#define GETLINE() LEXER->getLine(LEXER)
1337 +#define GETTEXT() LEXER->getText(LEXER)
1338 +#define GETCHARPOSITIONINLINE() LEXER->getCharPositionInLine(LEXER)
1339 +#define EMIT() LEXSTATE->type = _type; LEXER->emit(LEXER)
1340 +#define EMITNEW(t) LEXER->emitNew(LEXER, t)
1341 +#define MATCHC(c) LEXER->matchc(LEXER, c)
1342 +#define MATCHS(s) LEXER->matchs(LEXER, s)
1343 +#define MATCHRANGE(c1,c2) LEXER->matchRange(LEXER, c1, c2)
1344 +#define MATCHANY() LEXER->matchAny(LEXER)
1345 +#define LTOKEN LEXSTATE->token
1346 +#define HASFAILED() (LEXSTATE->failed == ANTLR3_TRUE)
1347 +#define BACKTRACKING LEXSTATE->backtracking
1348 +#define FAILEDFLAG LEXSTATE->failed
1349 +#define INPUT LEXER->input
1350 +#define STRSTREAM INPUT
1351 +#define ISTREAM INPUT->istream
1352 +#define INDEX() ISTREAM->index(ISTREAM)
1353 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
1354 +#define EOF_TOKEN &(LEXSTATE->tokSource->eofToken)
1355 +#define HASEXCEPTION() (LEXSTATE->error == ANTLR3_TRUE)
1356 +#define EXCEPTION LEXSTATE->exception
1357 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
1358 +#define LRECOVER() LEXER->recover(LEXER)
1359 +#define MARK() ISTREAM->mark(ISTREAM)
1360 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
1361 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
1362 +#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si)
1363 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
1364 +#define PUSHSTREAM(str) LEXER->pushCharStream(LEXER, str)
1365 +#define POPSTREAM() LEXER->popCharStream(LEXER)
1366 +#define SETTEXT(str) LEXSTATE->text = str
1367 +#define SKIP() LEXSTATE->token = &(TOKSOURCE->skipToken)
1368 +#define USER1 LEXSTATE->user1
1369 +#define USER2 LEXSTATE->user2
1370 +#define USER3 LEXSTATE->user3
1371 +#define CUSTOM LEXSTATE->custom
1372 +#define RULEMEMO LEXSTATE->ruleMemo
1373 +#define DBG RECOGNIZER->debugger
1375 +/* If we have been told we can rely on the standard 8 bit or 16 bit input
1376 + * stream, then we can define our macros to use the direct pointers
1377 + * in the input object, which is much faster than indirect calls. This
1378 + * is really only significant to lexers with a lot of fragment rules (which
1379 + * do not place LA(1) in a temporary at the moment) and even then
1380 + * only if there is a lot of input (order of say 1M or so).
1382 +#if defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16)
1384 +# ifdef ANTLR3_INLINE_INPUT_ASCII
1386 +/* 8 bit "ASCII" (actually any 8 bit character set) */
1388 +# define NEXTCHAR ((pANTLR3_UINT8)(INPUT->nextChar))
1389 +# define DATAP ((pANTLR3_UINT8)(INPUT->data))
1393 +# define NEXTCHAR ((pANTLR3_UINT16)(INPUT->nextChar))
1394 +# define DATAP ((pANTLR3_UINT16)(INPUT->data))
1398 +# define LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1)))
1399 +# define CONSUME() \
1401 + if (NEXTCHAR < (DATAP + INPUT->sizeBuf)) \
1403 + INPUT->charPositionInLine++; \
1404 + if ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar) \
1407 + INPUT->charPositionInLine = 0; \
1408 + INPUT->currentLine = (void *)(NEXTCHAR + 1); \
1410 + INPUT->nextChar = (void *)(NEXTCHAR + 1); \
1416 +// Pick up the input character by calling the input stream implementation.
1418 +#define CONSUME() INPUT->istream->consume(INPUT->istream)
1419 +#define LA(n) INPUT->istream->_LA(INPUT->istream, n)
1422 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
1424 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
1425 + * then for the present you must use different names for your defines as these are hard coded
1426 + * in the code generator. It would be better not to use such names internally, and maybe
1427 + * we can change this in a forthcoming release. I deliberately do not #undef these
1428 + * here as this will at least give you a redefined error somewhere if they clash.
1430 +#define UP ANTLR3_TOKEN_UP
1431 +#define DOWN ANTLR3_TOKEN_DOWN
1432 +#define EOR ANTLR3_TOKEN_EOR
1433 +#define INVALID ANTLR3_TOKEN_INVALID
1436 +/* =============================================================================
1437 + * Functions to create and destroy scopes. First come the rule scopes, followed
1438 + * by the global declared scopes.
1443 +/* ============================================================================= */
1445 +/* =============================================================================
1446 + * Start of recognizer
1450 +/* Forward declare the locally static matching functions we have generated and any predicate functions.
1452 +static ANTLR3_INLINE void mQUOTE (pDAAPLexer ctx);
1453 +static ANTLR3_INLINE void mLPAR (pDAAPLexer ctx);
1454 +static ANTLR3_INLINE void mRPAR (pDAAPLexer ctx);
1455 +static ANTLR3_INLINE void mOPAND (pDAAPLexer ctx);
1456 +static ANTLR3_INLINE void mOPOR (pDAAPLexer ctx);
1457 +static ANTLR3_INLINE void mNEWLINE (pDAAPLexer ctx);
1458 +static ANTLR3_INLINE void mSTR (pDAAPLexer ctx);
1459 +static ANTLR3_INLINE void mESCAPED (pDAAPLexer ctx);
1460 +static ANTLR3_INLINE void mTokens (pDAAPLexer ctx);
1461 +static void DAAPLexerFree(pDAAPLexer ctx);
1463 +/* =========================================================================
1464 + * Lexer matching rules end.
1465 + * =========================================================================
1471 +DAAPLexerFree (pDAAPLexer ctx)
1473 + LEXER->free(LEXER);
1478 +/** \brief Name of the grammar file that generated this code
1480 +static const char fileName[] = "DAAP.g";
1482 +/** \brief Return the name of the grammar file that generated this code.
1484 +static const char * getGrammarFileName()
1489 +/** \brief Create a new lexer called DAAPLexer
1491 + * \param[in] instream Pointer to an initialized input stream
1493 + * - Success pDAAPLexer initialized for the lex start
1496 +ANTLR3_API pDAAPLexer DAAPLexerNew
1497 +(pANTLR3_INPUT_STREAM instream)
1499 + // See if we can create a new lexer with the standard constructor
1501 + return DAAPLexerNewSSD(instream, NULL);
1504 +/** \brief Create a new lexer called DAAPLexer
1506 + * \param[in] instream Pointer to an initialized input stream
1507 + * \param[state] state Previously created shared recognizer stat
1509 + * - Success pDAAPLexer initialized for the lex start
1512 +ANTLR3_API pDAAPLexer DAAPLexerNewSSD
1513 +(pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
1515 + pDAAPLexer ctx; // Context structure we will build and return
1517 + ctx = (pDAAPLexer) ANTLR3_CALLOC(1, sizeof(DAAPLexer));
1521 + // Failed to allocate memory for lexer context
1525 + /* -------------------------------------------------------------------
1526 + * Memory for basic structure is allocated, now to fill in
1527 + * in base ANTLR3 structures. We initialize the function pointers
1528 + * for the standard ANTLR3 lexer function set, but upon return
1529 + * from here, the programmer may set the pointers to provide custom
1530 + * implementations of each function.
1532 + * We don't use the macros defined in DAAPLexer.h here so you can get a sense
1533 + * of what goes where.
1536 + /* Create a base lexer, using the supplied input stream
1538 + ctx->pLexer = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state);
1540 + /* Check that we allocated the memory correctly
1542 + if (ctx->pLexer == NULL)
1547 + /* Install the implementation of our DAAPLexer interface
1549 + ctx->mQUOTE = mQUOTE;
1550 + ctx->mLPAR = mLPAR;
1551 + ctx->mRPAR = mRPAR;
1552 + ctx->mOPAND = mOPAND;
1553 + ctx->mOPOR = mOPOR;
1554 + ctx->mNEWLINE = mNEWLINE;
1556 + ctx->mESCAPED = mESCAPED;
1557 + ctx->mTokens = mTokens;
1559 + /** When the nextToken() call is made to this lexer's pANTLR3_TOKEN_SOURCE
1560 + * it will call mTokens() in this generated code, and will pass it the ctx
1561 + * pointer of this lexer, not the context of the base lexer, so store that now.
1563 + ctx->pLexer->ctx = ctx;
1565 + /**Install the token matching function
1567 + ctx->pLexer->mTokens = (void (*) (void *))(mTokens);
1569 + ctx->getGrammarFileName = getGrammarFileName;
1570 + ctx->free = DAAPLexerFree;
1576 + /* Return the newly built lexer to the caller
1582 +/* =========================================================================
1583 + * Functions to match the lexer grammar defined tokens from the input stream
1586 +// Comes from: 40:7: ( '\\'' )
1587 +/** \brief Lexer rule generated by ANTLR3
1589 + * $ANTLR start QUOTE
1591 + * Looks to match the characters the constitute the token QUOTE
1592 + * from the attached input stream.
1596 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1598 +static ANTLR3_INLINE
1599 +void mQUOTE(pDAAPLexer ctx)
1601 + ANTLR3_UINT32 _type;
1606 + // DAAP.g:40:7: ( '\\'' )
1607 + // DAAP.g:40:9: '\\''
1610 + if (HASEXCEPTION())
1618 + LEXSTATE->type = _type;
1620 + // This is where rules clean up and exit
1622 + goto ruleQUOTEEx; /* Prevent compiler warnings */
1626 +// $ANTLR end QUOTE
1628 +// Comes from: 41:6: ( '(' )
1629 +/** \brief Lexer rule generated by ANTLR3
1631 + * $ANTLR start LPAR
1633 + * Looks to match the characters the constitute the token LPAR
1634 + * from the attached input stream.
1638 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1640 +static ANTLR3_INLINE
1641 +void mLPAR(pDAAPLexer ctx)
1643 + ANTLR3_UINT32 _type;
1648 + // DAAP.g:41:6: ( '(' )
1649 + // DAAP.g:41:8: '('
1652 + if (HASEXCEPTION())
1660 + LEXSTATE->type = _type;
1662 + // This is where rules clean up and exit
1664 + goto ruleLPAREx; /* Prevent compiler warnings */
1670 +// Comes from: 42:6: ( ')' )
1671 +/** \brief Lexer rule generated by ANTLR3
1673 + * $ANTLR start RPAR
1675 + * Looks to match the characters the constitute the token RPAR
1676 + * from the attached input stream.
1680 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1682 +static ANTLR3_INLINE
1683 +void mRPAR(pDAAPLexer ctx)
1685 + ANTLR3_UINT32 _type;
1690 + // DAAP.g:42:6: ( ')' )
1691 + // DAAP.g:42:8: ')'
1694 + if (HASEXCEPTION())
1702 + LEXSTATE->type = _type;
1704 + // This is where rules clean up and exit
1706 + goto ruleRPAREx; /* Prevent compiler warnings */
1712 +// Comes from: 44:7: ( '+' | ' ' )
1713 +/** \brief Lexer rule generated by ANTLR3
1715 + * $ANTLR start OPAND
1717 + * Looks to match the characters the constitute the token OPAND
1718 + * from the attached input stream.
1722 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1724 +static ANTLR3_INLINE
1725 +void mOPAND(pDAAPLexer ctx)
1727 + ANTLR3_UINT32 _type;
1732 + // DAAP.g:44:7: ( '+' | ' ' )
1735 + if ( LA(1) == ' ' || LA(1) == '+' )
1743 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
1744 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
1746 + LRECOVER(); goto ruleOPANDEx;
1752 + LEXSTATE->type = _type;
1754 + // This is where rules clean up and exit
1756 + goto ruleOPANDEx; /* Prevent compiler warnings */
1760 +// $ANTLR end OPAND
1762 +// Comes from: 45:6: ( ',' )
1763 +/** \brief Lexer rule generated by ANTLR3
1765 + * $ANTLR start OPOR
1767 + * Looks to match the characters the constitute the token OPOR
1768 + * from the attached input stream.
1772 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1774 +static ANTLR3_INLINE
1775 +void mOPOR(pDAAPLexer ctx)
1777 + ANTLR3_UINT32 _type;
1782 + // DAAP.g:45:6: ( ',' )
1783 + // DAAP.g:45:8: ','
1786 + if (HASEXCEPTION())
1794 + LEXSTATE->type = _type;
1796 + // This is where rules clean up and exit
1798 + goto ruleOPOREx; /* Prevent compiler warnings */
1804 +// Comes from: 47:9: ( ( '\\r' )? '\\n' )
1805 +/** \brief Lexer rule generated by ANTLR3
1807 + * $ANTLR start NEWLINE
1809 + * Looks to match the characters the constitute the token NEWLINE
1810 + * from the attached input stream.
1814 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1816 +static ANTLR3_INLINE
1817 +void mNEWLINE(pDAAPLexer ctx)
1819 + ANTLR3_UINT32 _type;
1824 + // DAAP.g:47:9: ( ( '\\r' )? '\\n' )
1825 + // DAAP.g:47:11: ( '\\r' )? '\\n'
1828 + // DAAP.g:47:11: ( '\\r' )?
1843 + // DAAP.g:47:11: '\\r'
1846 + if (HASEXCEPTION())
1848 + goto ruleNEWLINEEx;
1858 + if (HASEXCEPTION())
1860 + goto ruleNEWLINEEx;
1866 + LEXSTATE->type = _type;
1868 + // This is where rules clean up and exit
1870 + goto ruleNEWLINEEx; /* Prevent compiler warnings */
1874 +// $ANTLR end NEWLINE
1876 +// Comes from: 55:2: ( QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE )
1877 +/** \brief Lexer rule generated by ANTLR3
1879 + * $ANTLR start STR
1881 + * Looks to match the characters the constitute the token STR
1882 + * from the attached input stream.
1886 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1888 +static ANTLR3_INLINE
1889 +void mSTR(pDAAPLexer ctx)
1891 + ANTLR3_UINT32 _type;
1892 + pANTLR3_COMMON_TOKEN esc;
1893 + ANTLR3_UINT32 reg;
1900 + pANTLR3_STRING unesc = GETTEXT()->factory->newRaw(GETTEXT()->factory);
1902 + // DAAP.g:55:2: ( QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE )
1903 + // DAAP.g:55:4: QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE
1905 + /* 55:4: QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE */
1907 + if (HASEXCEPTION())
1912 + // DAAP.g:55:10: (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+
1920 + /* dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState)
1922 + int LA2_0 = LA(1);
1923 + if ( (((LA2_0 >= 0x0000) && (LA2_0 <= '&')) || ((LA2_0 >= '(') && (LA2_0 <= '[')) || ((LA2_0 >= ']') && (LA2_0 <= 0xFFFF))) )
1927 + else if ( (LA2_0 == '\\') )
1936 + // DAAP.g:55:12: reg=~ ( '\\\\' | '\\'' )
1939 + if ( ((LA(1) >= 0x0000) && (LA(1) <= '&')) || ((LA(1) >= '(') && (LA(1) <= '[')) || ((LA(1) >= ']') && (LA(1) <= 0xFFFF)) )
1947 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
1948 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
1950 + LRECOVER(); goto ruleSTREx;
1954 + unesc->addc(unesc, reg);
1960 + // DAAP.g:56:6: esc= ESCAPED
1962 + /* 56:6: esc= ESCAPED */
1964 + ANTLR3_MARKER escStart118 = GETCHARINDEX();
1966 + if (HASEXCEPTION())
1971 + esc = LEXSTATE->tokFactory->newToken(LEXSTATE->tokFactory);
1972 + esc->setType(esc, ANTLR3_TOKEN_INVALID);
1973 + esc->setStartIndex(esc, escStart118);
1974 + esc->setStopIndex(esc, GETCHARINDEX()-1);
1975 + esc->input = INPUT;
1978 + unesc->appendS(unesc, GETTEXT());
1990 + /* mismatchedSetEx()
1993 + EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
1994 + EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
2001 + loop2: ; /* Jump to here if this rule does not match */
2003 + /* 55:4: QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE */
2005 + if (HASEXCEPTION())
2016 + LEXSTATE->type = _type;
2018 + // This is where rules clean up and exit
2020 + goto ruleSTREx; /* Prevent compiler warnings */
2028 +// Comes from: 59:9: ( '\\\\' ( '\\\\' | '\\'' ) )
2029 +/** \brief Lexer rule generated by ANTLR3
2031 + * $ANTLR start ESCAPED
2033 + * Looks to match the characters the constitute the token ESCAPED
2034 + * from the attached input stream.
2038 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
2040 +static ANTLR3_INLINE
2041 +void mESCAPED(pDAAPLexer ctx)
2043 + ANTLR3_UINT32 _type;
2046 + // DAAP.g:59:9: ( '\\\\' ( '\\\\' | '\\'' ) )
2047 + // DAAP.g:59:11: '\\\\' ( '\\\\' | '\\'' )
2050 + if (HASEXCEPTION())
2052 + goto ruleESCAPEDEx;
2056 + // DAAP.g:60:3: ( '\\\\' | '\\'' )
2074 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
2075 + EXCEPTION->message = (void *)"";
2076 + EXCEPTION->decisionNum = 3;
2077 + EXCEPTION->state = 0;
2080 + goto ruleESCAPEDEx;
2086 + // DAAP.g:60:5: '\\\\'
2089 + if (HASEXCEPTION())
2091 + goto ruleESCAPEDEx;
2095 + SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\\"));
2101 + // DAAP.g:61:5: '\\''
2104 + if (HASEXCEPTION())
2106 + goto ruleESCAPEDEx;
2110 + SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\'"));
2123 + // This is where rules clean up and exit
2125 + goto ruleESCAPEDEx; /* Prevent compiler warnings */
2129 +// $ANTLR end ESCAPED
2131 +/** This is the entry point in to the lexer from an object that
2132 + * wants to generate the next token, such as a pCOMMON_TOKEN_STREAM
2135 +mTokens(pDAAPLexer ctx)
2138 + // DAAP.g:1:8: ( QUOTE | LPAR | RPAR | OPAND | OPOR | NEWLINE | STR )
2140 + ANTLR3_UINT32 alt4;
2150 + int LA4_1 = LA(2);
2151 + if ( (((LA4_1 >= 0x0000) && (LA4_1 <= '&')) || ((LA4_1 >= '(') && (LA4_1 <= 0xFFFF))) )
2191 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
2192 + EXCEPTION->message = (void *)"";
2193 + EXCEPTION->decisionNum = 4;
2194 + EXCEPTION->state = 0;
2197 + goto ruleTokensEx;
2203 + // DAAP.g:1:10: QUOTE
2207 + if (HASEXCEPTION())
2209 + goto ruleTokensEx;
2216 + // DAAP.g:1:16: LPAR
2220 + if (HASEXCEPTION())
2222 + goto ruleTokensEx;
2229 + // DAAP.g:1:21: RPAR
2233 + if (HASEXCEPTION())
2235 + goto ruleTokensEx;
2242 + // DAAP.g:1:26: OPAND
2246 + if (HASEXCEPTION())
2248 + goto ruleTokensEx;
2255 + // DAAP.g:1:32: OPOR
2259 + if (HASEXCEPTION())
2261 + goto ruleTokensEx;
2268 + // DAAP.g:1:37: NEWLINE
2270 + /* 1:37: NEWLINE */
2272 + if (HASEXCEPTION())
2274 + goto ruleTokensEx;
2281 + // DAAP.g:1:45: STR
2285 + if (HASEXCEPTION())
2287 + goto ruleTokensEx;
2298 + goto ruleTokensEx; /* Prevent compiler warnings */
2302 +/* =========================================================================
2303 + * Lexer matching rules end.
2304 + * =========================================================================
2306 +/* End of Lexer code
2307 + * ================================================
2308 + * ================================================
2313 + * =============================================================================
2315 diff --git a/src/pregen/DAAPLexer.h b/src/pregen/DAAPLexer.h
2316 new file mode 100644
2317 index 0000000..685a0bc
2319 +++ b/src/pregen/DAAPLexer.h
2322 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
2324 + * - From the grammar source file : DAAP.g
2325 + * - On : 2016-01-01 12:23:41
2326 + * - for the lexer : DAAPLexerLexer *
2327 + * Editing it, at least manually, is not wise.
2329 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
2332 + * The lexer DAAPLexer has the callable functions (rules) shown below,
2333 + * which will invoke the code for the associated rule in the source grammar
2334 + * assuming that the input stream is pointing to a token/text stream that could begin
2337 + * For instance if you call the first (topmost) rule in a parser grammar, you will
2338 + * get the results of a full parse, but calling a rule half way through the grammar will
2339 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
2340 + * in editors and so on.
2342 + * The parser entry points are called indirectly (by function pointer to function) via
2343 + * a parser context typedef pDAAPLexer, which is returned from a call to DAAPLexerNew().
2345 + * As this is a generated lexer, it is unlikely you will call it 'manually'. However
2346 + * the methods are provided anyway.
2347 + * * The methods in pDAAPLexer are as follows:
2349 + * - void pDAAPLexer->QUOTE(pDAAPLexer)
2350 + * - void pDAAPLexer->LPAR(pDAAPLexer)
2351 + * - void pDAAPLexer->RPAR(pDAAPLexer)
2352 + * - void pDAAPLexer->OPAND(pDAAPLexer)
2353 + * - void pDAAPLexer->OPOR(pDAAPLexer)
2354 + * - void pDAAPLexer->NEWLINE(pDAAPLexer)
2355 + * - void pDAAPLexer->STR(pDAAPLexer)
2356 + * - void pDAAPLexer->ESCAPED(pDAAPLexer)
2357 + * - void pDAAPLexer->Tokens(pDAAPLexer)
2359 + * The return type for any particular rule is of course determined by the source
2362 +// [The "BSD licence"]
2363 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
2364 +// http://www.temporal-wave.com
2365 +// http://www.linkedin.com/in/jimidle
2367 +// All rights reserved.
2369 +// Redistribution and use in source and binary forms, with or without
2370 +// modification, are permitted provided that the following conditions
2372 +// 1. Redistributions of source code must retain the above copyright
2373 +// notice, this list of conditions and the following disclaimer.
2374 +// 2. Redistributions in binary form must reproduce the above copyright
2375 +// notice, this list of conditions and the following disclaimer in the
2376 +// documentation and/or other materials provided with the distribution.
2377 +// 3. The name of the author may not be used to endorse or promote products
2378 +// derived from this software without specific prior written permission.
2380 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2381 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2382 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2383 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2384 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2385 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2386 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2387 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2388 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2389 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2391 +#ifndef _DAAPLexer_H
2392 +#define _DAAPLexer_H
2393 +/* =============================================================================
2394 + * Standard antlr3 C runtime definitions
2396 +#include <antlr3.h>
2398 +/* End of standard antlr 3 runtime definitions
2399 + * =============================================================================
2406 +// Forward declare the context typedef so that we can use it before it is
2407 +// properly defined. Delegators and delegates (from import statements) are
2408 +// interdependent and their context structures contain pointers to each other
2409 +// C only allows such things to be declared if you pre-declare the typedef.
2411 +typedef struct DAAPLexer_Ctx_struct DAAPLexer, * pDAAPLexer;
2415 +#ifdef ANTLR3_WINDOWS
2416 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
2417 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
2418 +// initialized but unused variable - tree rewrite variables declared but not needed
2419 +// Unreferenced local variable - lexer rule declares but does not always use _type
2420 +// potentially unitialized variable used - retval always returned from a rule
2421 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
2423 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
2424 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
2425 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
2426 +// this is a matter of orthogonality hence I disable that one.
2428 +#pragma warning( disable : 4100 )
2429 +#pragma warning( disable : 4101 )
2430 +#pragma warning( disable : 4127 )
2431 +#pragma warning( disable : 4189 )
2432 +#pragma warning( disable : 4505 )
2433 +#pragma warning( disable : 4701 )
2436 +/** Context tracking structure for DAAPLexer
2438 +struct DAAPLexer_Ctx_struct
2440 + /** Built in ANTLR3 context tracker contains all the generic elements
2441 + * required for context tracking.
2443 + pANTLR3_LEXER pLexer;
2446 + void (*mQUOTE) (struct DAAPLexer_Ctx_struct * ctx);
2447 + void (*mLPAR) (struct DAAPLexer_Ctx_struct * ctx);
2448 + void (*mRPAR) (struct DAAPLexer_Ctx_struct * ctx);
2449 + void (*mOPAND) (struct DAAPLexer_Ctx_struct * ctx);
2450 + void (*mOPOR) (struct DAAPLexer_Ctx_struct * ctx);
2451 + void (*mNEWLINE) (struct DAAPLexer_Ctx_struct * ctx);
2452 + void (*mSTR) (struct DAAPLexer_Ctx_struct * ctx);
2453 + void (*mESCAPED) (struct DAAPLexer_Ctx_struct * ctx);
2454 + void (*mTokens) (struct DAAPLexer_Ctx_struct * ctx); const char * (*getGrammarFileName)();
2455 + void (*free) (struct DAAPLexer_Ctx_struct * ctx);
2459 +// Function protoypes for the constructor functions that external translation units
2460 +// such as delegators and delegates may wish to call.
2462 +ANTLR3_API pDAAPLexer DAAPLexerNew (pANTLR3_INPUT_STREAM instream);
2463 +ANTLR3_API pDAAPLexer DAAPLexerNewSSD (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
2465 +/** Symbolic definitions of all the tokens that the lexer will work with.
2468 + * Antlr will define EOF, but we can't use that as it it is too common in
2469 + * in C header files and that would be confusing. There is no way to filter this out at the moment
2470 + * so we just undef it here for now. That isn't the value we get back from C recognizers
2471 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
2490 +#define EOF ANTLR3_TOKEN_EOF
2493 +#ifndef TOKENSOURCE
2494 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
2497 +/* End of token definitions for DAAPLexer
2498 + * =============================================================================
2508 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
2509 diff --git a/src/pregen/DAAPParser.c b/src/pregen/DAAPParser.c
2510 new file mode 100644
2511 index 0000000..1091f05
2513 +++ b/src/pregen/DAAPParser.c
2516 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
2518 + * - From the grammar source file : DAAP.g
2519 + * - On : 2016-01-01 12:23:41
2520 + * - for the parser : DAAPParserParser *
2521 + * Editing it, at least manually, is not wise.
2523 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
2527 +// [The "BSD licence"]
2528 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
2529 +// http://www.temporal-wave.com
2530 +// http://www.linkedin.com/in/jimidle
2532 +// All rights reserved.
2534 +// Redistribution and use in source and binary forms, with or without
2535 +// modification, are permitted provided that the following conditions
2537 +// 1. Redistributions of source code must retain the above copyright
2538 +// notice, this list of conditions and the following disclaimer.
2539 +// 2. Redistributions in binary form must reproduce the above copyright
2540 +// notice, this list of conditions and the following disclaimer in the
2541 +// documentation and/or other materials provided with the distribution.
2542 +// 3. The name of the author may not be used to endorse or promote products
2543 +// derived from this software without specific prior written permission.
2545 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2546 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2547 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2548 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2549 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2550 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2551 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2552 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2553 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2554 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2556 +/* -----------------------------------------
2557 + * Include the ANTLR3 generated header file.
2559 +#include "DAAPParser.h"
2560 +/* ----------------------------------------- */
2566 +/* MACROS that hide the C interface implementations from the
2567 + * generated code, which makes it a little more understandable to the human eye.
2568 + * I am very much against using C pre-processor macros for function calls and bits
2569 + * of code as you cannot see what is happening when single stepping in debuggers
2570 + * and so on. The exception (in my book at least) is for generated code, where you are
2571 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
2572 + * hides some indirect calls, but is always referring to the input stream. This is
2573 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
2574 + * the runtime interfaces without changing the generated code too often, without
2575 + * confusing the reader of the generated output, who may not wish to know the gory
2576 + * details of the interface inheritance.
2581 +/* Aids in accessing scopes for grammar programmers
2586 +#define SCOPE_TYPE(scope) pDAAPParser_##scope##_SCOPE
2587 +#define SCOPE_STACK(scope) pDAAPParser_##scope##Stack
2588 +#define SCOPE_TOP(scope) ctx->pDAAPParser_##scope##Top
2589 +#define SCOPE_SIZE(scope) ctx->pDAAPParser_##scope##Stack_limit
2590 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
2592 +/* Macros for accessing things in the parser
2597 +#undef HAVEPARSEDRULE
2601 +#undef HASEXCEPTION
2609 +#undef PREPORTERROR
2617 +#undef PERRORRECOVERY
2620 +#undef RECOVERFROMMISMATCHEDSET
2621 +#undef RECOVERFROMMISMATCHEDELEMENT
2628 +#define PARSER ctx->pParser
2629 +#define RECOGNIZER PARSER->rec
2630 +#define PSRSTATE RECOGNIZER->state
2631 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
2632 +#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si)
2633 +#define INPUT PARSER->tstream
2634 +#define STRSTREAM INPUT
2635 +#define ISTREAM INPUT->istream
2636 +#define INDEX() ISTREAM->index(INPUT->istream)
2637 +#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE)
2638 +#define EXCEPTION PSRSTATE->exception
2639 +#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs)
2640 +#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER)
2641 +#define FOLLOWSTACK PSRSTATE->following
2642 +#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
2643 +#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK)
2644 +#define PRECOVER() RECOGNIZER->recover(RECOGNIZER)
2645 +#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER)
2646 +#define LA(n) INPUT->istream->_LA(ISTREAM, n)
2647 +#define LT(n) INPUT->_LT(INPUT, n)
2648 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
2649 +#define CONSUME() ISTREAM->consume(ISTREAM)
2650 +#define MARK() ISTREAM->mark(ISTREAM)
2651 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
2652 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
2653 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
2654 +#define PERRORRECOVERY PSRSTATE->errorRecovery
2655 +#define FAILEDFLAG PSRSTATE->failed
2656 +#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE)
2657 +#define BACKTRACKING PSRSTATE->backtracking
2658 +#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
2659 +#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
2660 +#define ADAPTOR ctx->adaptor
2661 +#define RULEMEMO PSRSTATE->ruleMemo
2662 +#define DBG RECOGNIZER->debugger
2664 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
2666 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
2667 + * then for the present you must use different names for your defines as these are hard coded
2668 + * in the code generator. It would be better not to use such names internally, and maybe
2669 + * we can change this in a forthcoming release. I deliberately do not #undef these
2670 + * here as this will at least give you a redefined error somewhere if they clash.
2672 +#define UP ANTLR3_TOKEN_UP
2673 +#define DOWN ANTLR3_TOKEN_DOWN
2674 +#define EOR ANTLR3_TOKEN_EOR
2675 +#define INVALID ANTLR3_TOKEN_INVALID
2678 +/* =============================================================================
2679 + * Functions to create and destroy scopes. First come the rule scopes, followed
2680 + * by the global declared scopes.
2685 +/* ============================================================================= */
2687 +/* =============================================================================
2688 + * Start of recognizer
2693 +/** \brief Table of all token names in symbolic order, mainly used for
2694 + * error reporting.
2696 +pANTLR3_UINT8 DAAPParserTokenNames[8+4]
2698 + (pANTLR3_UINT8) "<invalid>", /* String to print to indicate an invalid token */
2699 + (pANTLR3_UINT8) "<EOR>",
2700 + (pANTLR3_UINT8) "<DOWN>",
2701 + (pANTLR3_UINT8) "<UP>",
2702 + (pANTLR3_UINT8) "NEWLINE",
2703 + (pANTLR3_UINT8) "OPOR",
2704 + (pANTLR3_UINT8) "OPAND",
2705 + (pANTLR3_UINT8) "LPAR",
2706 + (pANTLR3_UINT8) "RPAR",
2707 + (pANTLR3_UINT8) "STR",
2708 + (pANTLR3_UINT8) "QUOTE",
2709 + (pANTLR3_UINT8) "ESCAPED"
2714 +// Forward declare the locally static matching functions we have generated.
2716 +static DAAPParser_query_return query (pDAAPParser ctx);
2717 +static DAAPParser_expr_return expr (pDAAPParser ctx);
2718 +static DAAPParser_aexpr_return aexpr (pDAAPParser ctx);
2719 +static DAAPParser_crit_return crit (pDAAPParser ctx);
2720 +static void DAAPParserFree(pDAAPParser ctx);
2721 +/* For use in tree output where we are accumulating rule labels via label += ruleRef
2722 + * we need a function that knows how to free a return scope when the list is destroyed.
2723 + * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
2725 +static void ANTLR3_CDECL freeScope(void * scope)
2727 + ANTLR3_FREE(scope);
2730 +/** \brief Name of the grammar file that generated this code
2732 +static const char fileName[] = "DAAP.g";
2734 +/** \brief Return the name of the grammar file that generated this code.
2736 +static const char * getGrammarFileName()
2740 +/** \brief Create a new DAAPParser parser and return a context for it.
2742 + * \param[in] instream Pointer to an input stream interface.
2744 + * \return Pointer to new parser context upon success.
2746 +ANTLR3_API pDAAPParser
2747 +DAAPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream)
2749 + // See if we can create a new parser with the standard constructor
2751 + return DAAPParserNewSSD(instream, NULL);
2754 +/** \brief Create a new DAAPParser parser and return a context for it.
2756 + * \param[in] instream Pointer to an input stream interface.
2758 + * \return Pointer to new parser context upon success.
2760 +ANTLR3_API pDAAPParser
2761 +DAAPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
2763 + pDAAPParser ctx; /* Context structure we will build and return */
2765 + ctx = (pDAAPParser) ANTLR3_CALLOC(1, sizeof(DAAPParser));
2769 + // Failed to allocate memory for parser context
2774 + /* -------------------------------------------------------------------
2775 + * Memory for basic structure is allocated, now to fill in
2776 + * the base ANTLR3 structures. We initialize the function pointers
2777 + * for the standard ANTLR3 parser function set, but upon return
2778 + * from here, the programmer may set the pointers to provide custom
2779 + * implementations of each function.
2781 + * We don't use the macros defined in DAAPParser.h here, in order that you can get a sense
2782 + * of what goes where.
2785 + /* Create a base parser/recognizer, using the supplied token stream
2787 + ctx->pParser = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state);
2788 + /* Install the implementation of our DAAPParser interface
2790 + ctx->query = query;
2792 + ctx->aexpr = aexpr;
2794 + ctx->free = DAAPParserFree;
2795 + ctx->getGrammarFileName = getGrammarFileName;
2797 + /* Install the scope pushing methods.
2799 + ADAPTOR = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory);
2800 + ctx->vectors = antlr3VectorFactoryNew(0);
2804 + /* Install the token table
2806 + PSRSTATE->tokenNames = DAAPParserTokenNames;
2809 + /* Return the newly built parser to the caller
2814 +/** Free the parser resources
2817 + DAAPParserFree(pDAAPParser ctx)
2819 + /* Free any scope memory
2822 + ctx->vectors->close(ctx->vectors);
2823 + /* We created the adaptor so we must free it
2825 + ADAPTOR->free(ADAPTOR);
2826 + // Free this parser
2828 + ctx->pParser->free(ctx->pParser);
2831 + /* Everything is released, so we can return
2836 +/** Return token names used by this parser
2838 + * The returned pointer is used as an index into the token names table (using the token
2839 + * number as the index).
2841 + * \return Pointer to first char * in the table.
2843 +static pANTLR3_UINT8 *getTokenNames()
2845 + return DAAPParserTokenNames;
2849 +/* Declare the bitsets
2852 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_query42 */
2853 +static ANTLR3_BITWORD FOLLOW_expr_in_query42_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) };
2854 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_query42 = { FOLLOW_expr_in_query42_bits, 1 };
2855 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NEWLINE_in_query44 */
2856 +static ANTLR3_BITWORD FOLLOW_NEWLINE_in_query44_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000000) };
2857 +static ANTLR3_BITSET_LIST FOLLOW_NEWLINE_in_query44 = { FOLLOW_NEWLINE_in_query44_bits, 1 };
2858 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_EOF_in_query47 */
2859 +static ANTLR3_BITWORD FOLLOW_EOF_in_query47_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
2860 +static ANTLR3_BITSET_LIST FOLLOW_EOF_in_query47 = { FOLLOW_EOF_in_query47_bits, 1 };
2861 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expr62 */
2862 +static ANTLR3_BITWORD FOLLOW_aexpr_in_expr62_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) };
2863 +static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expr62 = { FOLLOW_aexpr_in_expr62_bits, 1 };
2864 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OPOR_in_expr65 */
2865 +static ANTLR3_BITWORD FOLLOW_OPOR_in_expr65_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) };
2866 +static ANTLR3_BITSET_LIST FOLLOW_OPOR_in_expr65 = { FOLLOW_OPOR_in_expr65_bits, 1 };
2867 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expr68 */
2868 +static ANTLR3_BITWORD FOLLOW_aexpr_in_expr68_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) };
2869 +static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expr68 = { FOLLOW_aexpr_in_expr68_bits, 1 };
2870 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_aexpr80 */
2871 +static ANTLR3_BITWORD FOLLOW_crit_in_aexpr80_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) };
2872 +static ANTLR3_BITSET_LIST FOLLOW_crit_in_aexpr80 = { FOLLOW_crit_in_aexpr80_bits, 1 };
2873 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OPAND_in_aexpr83 */
2874 +static ANTLR3_BITWORD FOLLOW_OPAND_in_aexpr83_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) };
2875 +static ANTLR3_BITSET_LIST FOLLOW_OPAND_in_aexpr83 = { FOLLOW_OPAND_in_aexpr83_bits, 1 };
2876 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_aexpr86 */
2877 +static ANTLR3_BITWORD FOLLOW_crit_in_aexpr86_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) };
2878 +static ANTLR3_BITSET_LIST FOLLOW_crit_in_aexpr86 = { FOLLOW_crit_in_aexpr86_bits, 1 };
2879 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_LPAR_in_crit98 */
2880 +static ANTLR3_BITWORD FOLLOW_LPAR_in_crit98_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) };
2881 +static ANTLR3_BITSET_LIST FOLLOW_LPAR_in_crit98 = { FOLLOW_LPAR_in_crit98_bits, 1 };
2882 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_crit100 */
2883 +static ANTLR3_BITWORD FOLLOW_expr_in_crit100_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000100) };
2884 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_crit100 = { FOLLOW_expr_in_crit100_bits, 1 };
2885 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_RPAR_in_crit102 */
2886 +static ANTLR3_BITWORD FOLLOW_RPAR_in_crit102_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
2887 +static ANTLR3_BITSET_LIST FOLLOW_RPAR_in_crit102 = { FOLLOW_RPAR_in_crit102_bits, 1 };
2888 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_crit112 */
2889 +static ANTLR3_BITWORD FOLLOW_STR_in_crit112_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
2890 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_crit112 = { FOLLOW_STR_in_crit112_bits, 1 };
2895 +/* ==============================================
2899 + * $ANTLR start query
2900 + * DAAP.g:27:1: query : expr ( NEWLINE )? EOF -> expr ;
2902 +static DAAPParser_query_return
2903 +query(pDAAPParser ctx)
2905 + DAAPParser_query_return retval;
2907 + pANTLR3_BASE_TREE root_0;
2909 + pANTLR3_COMMON_TOKEN NEWLINE2;
2910 + pANTLR3_COMMON_TOKEN EOF3;
2911 + DAAPParser_expr_return expr1;
2912 + #undef RETURN_TYPE_expr1
2913 + #define RETURN_TYPE_expr1 DAAPParser_expr_return
2915 + pANTLR3_BASE_TREE NEWLINE2_tree;
2916 + pANTLR3_BASE_TREE EOF3_tree;
2917 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NEWLINE;
2918 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_EOF;
2919 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr;
2920 + /* Initialize rule variables
2928 + expr1.tree = NULL;
2930 + retval.start = LT(1); retval.stop = retval.start;
2932 + NEWLINE2_tree = NULL;
2935 + stream_NEWLINE = NULL;
2936 + #define CREATE_stream_NEWLINE if (stream_NEWLINE == NULL) {stream_NEWLINE = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NEWLINE"); }
2937 + stream_EOF = NULL;
2938 + #define CREATE_stream_EOF if (stream_EOF == NULL) {stream_EOF = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token EOF"); }
2939 + stream_expr = NULL;
2940 + #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); }
2942 + retval.tree = NULL;
2944 + // DAAP.g:27:7: ( expr ( NEWLINE )? EOF -> expr )
2945 + // DAAP.g:27:9: expr ( NEWLINE )? EOF
2947 + FOLLOWPUSH(FOLLOW_expr_in_query42);
2951 + if (HASEXCEPTION())
2956 + CREATE_stream_expr; stream_expr->add(stream_expr, expr1.tree, NULL);
2958 + // DAAP.g:27:14: ( NEWLINE )?
2973 + // DAAP.g:27:14: NEWLINE
2975 + NEWLINE2 = (pANTLR3_COMMON_TOKEN) MATCHT(NEWLINE, &FOLLOW_NEWLINE_in_query44);
2976 + if (HASEXCEPTION())
2981 + CREATE_stream_NEWLINE; stream_NEWLINE->add(stream_NEWLINE, NEWLINE2, NULL);
2989 + EOF3 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_query47);
2990 + if (HASEXCEPTION())
2995 + CREATE_stream_EOF; stream_EOF->add(stream_EOF, EOF3, NULL);
3002 + * rule labels : retval
3003 + * token list labels :
3004 + * rule list labels :
3007 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
3009 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
3011 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
3012 + retval.tree = root_0;
3015 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
3019 + retval.tree = root_0; // set result root
3020 + if (stream_retval != NULL) stream_retval->free(stream_retval);
3029 + // This is where rules clean up and exit
3031 + goto rulequeryEx; /* Prevent compiler warnings */
3033 + retval.stop = LT(-1);
3035 + retval.stop = LT(-1);
3036 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
3037 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
3038 + if (stream_NEWLINE != NULL) stream_NEWLINE->free(stream_NEWLINE);
3039 + if (stream_EOF != NULL) stream_EOF->free(stream_EOF);
3040 + if (stream_expr != NULL) stream_expr->free(stream_expr);
3042 + if (HASEXCEPTION())
3046 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
3052 +/* $ANTLR end query */
3055 + * $ANTLR start expr
3056 + * DAAP.g:30:1: expr : aexpr ( OPOR aexpr )* ;
3058 +static DAAPParser_expr_return
3059 +expr(pDAAPParser ctx)
3061 + DAAPParser_expr_return retval;
3063 + pANTLR3_BASE_TREE root_0;
3065 + pANTLR3_COMMON_TOKEN OPOR5;
3066 + DAAPParser_aexpr_return aexpr4;
3067 + #undef RETURN_TYPE_aexpr4
3068 + #define RETURN_TYPE_aexpr4 DAAPParser_aexpr_return
3070 + DAAPParser_aexpr_return aexpr6;
3071 + #undef RETURN_TYPE_aexpr6
3072 + #define RETURN_TYPE_aexpr6 DAAPParser_aexpr_return
3074 + pANTLR3_BASE_TREE OPOR5_tree;
3076 + /* Initialize rule variables
3083 + aexpr4.tree = NULL;
3085 + aexpr6.tree = NULL;
3087 + retval.start = LT(1); retval.stop = retval.start;
3089 + OPOR5_tree = NULL;
3092 + retval.tree = NULL;
3094 + // DAAP.g:30:6: ( aexpr ( OPOR aexpr )* )
3095 + // DAAP.g:30:8: aexpr ( OPOR aexpr )*
3097 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
3099 + FOLLOWPUSH(FOLLOW_aexpr_in_expr62);
3100 + aexpr4=aexpr(ctx);
3103 + if (HASEXCEPTION())
3108 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr4.tree);
3110 + // DAAP.g:30:14: ( OPOR aexpr )*
3128 + // DAAP.g:30:15: OPOR aexpr
3130 + OPOR5 = (pANTLR3_COMMON_TOKEN) MATCHT(OPOR, &FOLLOW_OPOR_in_expr65);
3131 + if (HASEXCEPTION())
3136 + OPOR5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OPOR5));
3137 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OPOR5_tree, root_0));
3139 + FOLLOWPUSH(FOLLOW_aexpr_in_expr68);
3140 + aexpr6=aexpr(ctx);
3143 + if (HASEXCEPTION())
3148 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree);
3154 + goto loop2; /* break out of the loop */
3158 + loop2: ; /* Jump out to here if this rule does not match */
3166 + // This is where rules clean up and exit
3168 + goto ruleexprEx; /* Prevent compiler warnings */
3170 + retval.stop = LT(-1);
3172 + retval.stop = LT(-1);
3173 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
3174 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
3176 + if (HASEXCEPTION())
3180 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
3186 +/* $ANTLR end expr */
3189 + * $ANTLR start aexpr
3190 + * DAAP.g:33:1: aexpr : crit ( OPAND crit )* ;
3192 +static DAAPParser_aexpr_return
3193 +aexpr(pDAAPParser ctx)
3195 + DAAPParser_aexpr_return retval;
3197 + pANTLR3_BASE_TREE root_0;
3199 + pANTLR3_COMMON_TOKEN OPAND8;
3200 + DAAPParser_crit_return crit7;
3201 + #undef RETURN_TYPE_crit7
3202 + #define RETURN_TYPE_crit7 DAAPParser_crit_return
3204 + DAAPParser_crit_return crit9;
3205 + #undef RETURN_TYPE_crit9
3206 + #define RETURN_TYPE_crit9 DAAPParser_crit_return
3208 + pANTLR3_BASE_TREE OPAND8_tree;
3210 + /* Initialize rule variables
3217 + crit7.tree = NULL;
3219 + crit9.tree = NULL;
3221 + retval.start = LT(1); retval.stop = retval.start;
3223 + OPAND8_tree = NULL;
3226 + retval.tree = NULL;
3228 + // DAAP.g:33:7: ( crit ( OPAND crit )* )
3229 + // DAAP.g:33:9: crit ( OPAND crit )*
3231 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
3233 + FOLLOWPUSH(FOLLOW_crit_in_aexpr80);
3237 + if (HASEXCEPTION())
3242 + ADAPTOR->addChild(ADAPTOR, root_0, crit7.tree);
3244 + // DAAP.g:33:14: ( OPAND crit )*
3262 + // DAAP.g:33:15: OPAND crit
3264 + OPAND8 = (pANTLR3_COMMON_TOKEN) MATCHT(OPAND, &FOLLOW_OPAND_in_aexpr83);
3265 + if (HASEXCEPTION())
3270 + OPAND8_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OPAND8));
3271 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OPAND8_tree, root_0));
3273 + FOLLOWPUSH(FOLLOW_crit_in_aexpr86);
3277 + if (HASEXCEPTION())
3282 + ADAPTOR->addChild(ADAPTOR, root_0, crit9.tree);
3288 + goto loop3; /* break out of the loop */
3292 + loop3: ; /* Jump out to here if this rule does not match */
3300 + // This is where rules clean up and exit
3302 + goto ruleaexprEx; /* Prevent compiler warnings */
3304 + retval.stop = LT(-1);
3306 + retval.stop = LT(-1);
3307 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
3308 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
3310 + if (HASEXCEPTION())
3314 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
3320 +/* $ANTLR end aexpr */
3323 + * $ANTLR start crit
3324 + * DAAP.g:36:1: crit : ( LPAR expr RPAR -> expr | STR );
3326 +static DAAPParser_crit_return
3327 +crit(pDAAPParser ctx)
3329 + DAAPParser_crit_return retval;
3331 + pANTLR3_BASE_TREE root_0;
3333 + pANTLR3_COMMON_TOKEN LPAR10;
3334 + pANTLR3_COMMON_TOKEN RPAR12;
3335 + pANTLR3_COMMON_TOKEN STR13;
3336 + DAAPParser_expr_return expr11;
3337 + #undef RETURN_TYPE_expr11
3338 + #define RETURN_TYPE_expr11 DAAPParser_expr_return
3340 + pANTLR3_BASE_TREE LPAR10_tree;
3341 + pANTLR3_BASE_TREE RPAR12_tree;
3342 + pANTLR3_BASE_TREE STR13_tree;
3343 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_RPAR;
3344 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_LPAR;
3345 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr;
3346 + /* Initialize rule variables
3355 + expr11.tree = NULL;
3357 + retval.start = LT(1); retval.stop = retval.start;
3359 + LPAR10_tree = NULL;
3360 + RPAR12_tree = NULL;
3361 + STR13_tree = NULL;
3363 + stream_RPAR = NULL;
3364 + #define CREATE_stream_RPAR if (stream_RPAR == NULL) {stream_RPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token RPAR"); }
3365 + stream_LPAR = NULL;
3366 + #define CREATE_stream_LPAR if (stream_LPAR == NULL) {stream_LPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token LPAR"); }
3367 + stream_expr = NULL;
3368 + #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); }
3370 + retval.tree = NULL;
3373 + // DAAP.g:36:6: ( LPAR expr RPAR -> expr | STR )
3375 + ANTLR3_UINT32 alt4;
3394 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
3395 + EXCEPTION->message = (void *)"";
3396 + EXCEPTION->decisionNum = 4;
3397 + EXCEPTION->state = 0;
3406 + // DAAP.g:36:8: LPAR expr RPAR
3408 + LPAR10 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit98);
3409 + if (HASEXCEPTION())
3414 + CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR10, NULL);
3416 + FOLLOWPUSH(FOLLOW_expr_in_crit100);
3420 + if (HASEXCEPTION())
3425 + CREATE_stream_expr; stream_expr->add(stream_expr, expr11.tree, NULL);
3426 + RPAR12 = (pANTLR3_COMMON_TOKEN) MATCHT(RPAR, &FOLLOW_RPAR_in_crit102);
3427 + if (HASEXCEPTION())
3432 + CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR12, NULL);
3439 + * rule labels : retval
3440 + * token list labels :
3441 + * rule list labels :
3444 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
3446 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
3448 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
3449 + retval.tree = root_0;
3452 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
3456 + retval.tree = root_0; // set result root
3457 + if (stream_retval != NULL) stream_retval->free(stream_retval);
3464 + // DAAP.g:37:4: STR
3466 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
3468 + STR13 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_crit112);
3469 + if (HASEXCEPTION())
3474 + STR13_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR13));
3475 + ADAPTOR->addChild(ADAPTOR, root_0, STR13_tree);
3486 + // This is where rules clean up and exit
3488 + goto rulecritEx; /* Prevent compiler warnings */
3490 + retval.stop = LT(-1);
3492 + retval.stop = LT(-1);
3493 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
3494 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
3495 + if (stream_RPAR != NULL) stream_RPAR->free(stream_RPAR);
3496 + if (stream_LPAR != NULL) stream_LPAR->free(stream_LPAR);
3497 + if (stream_expr != NULL) stream_expr->free(stream_expr);
3499 + if (HASEXCEPTION())
3503 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
3509 +/* $ANTLR end crit */
3510 +/* End of parsing rules
3511 + * ==============================================
3514 +/* ==============================================
3515 + * Syntactic predicates
3517 +/* End of syntactic predicates
3518 + * ==============================================
3527 + * =============================================================================
3529 diff --git a/src/pregen/DAAPParser.h b/src/pregen/DAAPParser.h
3530 new file mode 100644
3531 index 0000000..e206694
3533 +++ b/src/pregen/DAAPParser.h
3536 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
3538 + * - From the grammar source file : DAAP.g
3539 + * - On : 2016-01-01 12:23:41
3540 + * - for the parser : DAAPParserParser *
3541 + * Editing it, at least manually, is not wise.
3543 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
3546 + * The parser DAAPParser has the callable functions (rules) shown below,
3547 + * which will invoke the code for the associated rule in the source grammar
3548 + * assuming that the input stream is pointing to a token/text stream that could begin
3551 + * For instance if you call the first (topmost) rule in a parser grammar, you will
3552 + * get the results of a full parse, but calling a rule half way through the grammar will
3553 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
3554 + * in editors and so on.
3556 + * The parser entry points are called indirectly (by function pointer to function) via
3557 + * a parser context typedef pDAAPParser, which is returned from a call to DAAPParserNew().
3559 + * The methods in pDAAPParser are as follows:
3561 + * - DAAPParser_query_return pDAAPParser->query(pDAAPParser)
3562 + * - DAAPParser_expr_return pDAAPParser->expr(pDAAPParser)
3563 + * - DAAPParser_aexpr_return pDAAPParser->aexpr(pDAAPParser)
3564 + * - DAAPParser_crit_return pDAAPParser->crit(pDAAPParser)
3566 + * The return type for any particular rule is of course determined by the source
3569 +// [The "BSD licence"]
3570 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
3571 +// http://www.temporal-wave.com
3572 +// http://www.linkedin.com/in/jimidle
3574 +// All rights reserved.
3576 +// Redistribution and use in source and binary forms, with or without
3577 +// modification, are permitted provided that the following conditions
3579 +// 1. Redistributions of source code must retain the above copyright
3580 +// notice, this list of conditions and the following disclaimer.
3581 +// 2. Redistributions in binary form must reproduce the above copyright
3582 +// notice, this list of conditions and the following disclaimer in the
3583 +// documentation and/or other materials provided with the distribution.
3584 +// 3. The name of the author may not be used to endorse or promote products
3585 +// derived from this software without specific prior written permission.
3587 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
3588 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
3589 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
3590 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
3591 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
3592 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3593 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3594 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3595 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3596 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3598 +#ifndef _DAAPParser_H
3599 +#define _DAAPParser_H
3600 +/* =============================================================================
3601 + * Standard antlr3 C runtime definitions
3603 +#include <antlr3.h>
3605 +/* End of standard antlr 3 runtime definitions
3606 + * =============================================================================
3613 +// Forward declare the context typedef so that we can use it before it is
3614 +// properly defined. Delegators and delegates (from import statements) are
3615 +// interdependent and their context structures contain pointers to each other
3616 +// C only allows such things to be declared if you pre-declare the typedef.
3618 +typedef struct DAAPParser_Ctx_struct DAAPParser, * pDAAPParser;
3622 +#ifdef ANTLR3_WINDOWS
3623 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
3624 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
3625 +// initialized but unused variable - tree rewrite variables declared but not needed
3626 +// Unreferenced local variable - lexer rule declares but does not always use _type
3627 +// potentially unitialized variable used - retval always returned from a rule
3628 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
3630 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
3631 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
3632 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
3633 +// this is a matter of orthogonality hence I disable that one.
3635 +#pragma warning( disable : 4100 )
3636 +#pragma warning( disable : 4101 )
3637 +#pragma warning( disable : 4127 )
3638 +#pragma warning( disable : 4189 )
3639 +#pragma warning( disable : 4505 )
3640 +#pragma warning( disable : 4701 )
3642 +typedef struct DAAPParser_query_return_struct
3644 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
3646 + pANTLR3_COMMON_TOKEN start;
3647 + pANTLR3_COMMON_TOKEN stop;
3648 + pANTLR3_BASE_TREE tree;
3651 + DAAPParser_query_return;
3653 +typedef struct DAAPParser_expr_return_struct
3655 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
3657 + pANTLR3_COMMON_TOKEN start;
3658 + pANTLR3_COMMON_TOKEN stop;
3659 + pANTLR3_BASE_TREE tree;
3662 + DAAPParser_expr_return;
3664 +typedef struct DAAPParser_aexpr_return_struct
3666 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
3668 + pANTLR3_COMMON_TOKEN start;
3669 + pANTLR3_COMMON_TOKEN stop;
3670 + pANTLR3_BASE_TREE tree;
3673 + DAAPParser_aexpr_return;
3675 +typedef struct DAAPParser_crit_return_struct
3677 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
3679 + pANTLR3_COMMON_TOKEN start;
3680 + pANTLR3_COMMON_TOKEN stop;
3681 + pANTLR3_BASE_TREE tree;
3684 + DAAPParser_crit_return;
3688 +/** Context tracking structure for DAAPParser
3690 +struct DAAPParser_Ctx_struct
3692 + /** Built in ANTLR3 context tracker contains all the generic elements
3693 + * required for context tracking.
3695 + pANTLR3_PARSER pParser;
3698 + DAAPParser_query_return (*query) (struct DAAPParser_Ctx_struct * ctx);
3699 + DAAPParser_expr_return (*expr) (struct DAAPParser_Ctx_struct * ctx);
3700 + DAAPParser_aexpr_return (*aexpr) (struct DAAPParser_Ctx_struct * ctx);
3701 + DAAPParser_crit_return (*crit) (struct DAAPParser_Ctx_struct * ctx);
3702 + // Delegated rules
3703 + const char * (*getGrammarFileName)();
3704 + void (*free) (struct DAAPParser_Ctx_struct * ctx);
3705 + /* @headerFile.members() */
3706 + pANTLR3_BASE_TREE_ADAPTOR adaptor;
3707 + pANTLR3_VECTOR_FACTORY vectors;
3708 + /* End @headerFile.members() */
3711 +// Function protoypes for the constructor functions that external translation units
3712 +// such as delegators and delegates may wish to call.
3714 +ANTLR3_API pDAAPParser DAAPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream);
3715 +ANTLR3_API pDAAPParser DAAPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
3717 +/** Symbolic definitions of all the tokens that the parser will work with.
3720 + * Antlr will define EOF, but we can't use that as it it is too common in
3721 + * in C header files and that would be confusing. There is no way to filter this out at the moment
3722 + * so we just undef it here for now. That isn't the value we get back from C recognizers
3723 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
3742 +#define EOF ANTLR3_TOKEN_EOF
3745 +#ifndef TOKENSOURCE
3746 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
3749 +/* End of token definitions for DAAPParser
3750 + * =============================================================================
3760 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
3761 diff --git a/src/pregen/RSP.u b/src/pregen/RSP.u
3762 new file mode 100644
3763 index 0000000..89256ff
3765 +++ b/src/pregen/RSP.u
3767 +RSPParser.c : RSP.g
3768 +./RSP.tokens : RSP.g
3769 +RSPParser.h : RSP.g
3772 +ANTLR_PRODUCTS += RSPParser.c ./RSP.tokens RSPParser.h RSPLexer.c RSPLexer.h
3773 \ No newline at end of file
3774 diff --git a/src/pregen/RSP2SQL.c b/src/pregen/RSP2SQL.c
3775 new file mode 100644
3776 index 0000000..40958f9
3778 +++ b/src/pregen/RSP2SQL.c
3781 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
3783 + * - From the grammar source file : RSP2SQL.g
3784 + * - On : 2016-01-01 12:23:43
3785 + * - for the tree parser : RSP2SQLTreeParser *
3786 + * Editing it, at least manually, is not wise.
3788 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
3792 +// [The "BSD licence"]
3793 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
3794 +// http://www.temporal-wave.com
3795 +// http://www.linkedin.com/in/jimidle
3797 +// All rights reserved.
3799 +// Redistribution and use in source and binary forms, with or without
3800 +// modification, are permitted provided that the following conditions
3802 +// 1. Redistributions of source code must retain the above copyright
3803 +// notice, this list of conditions and the following disclaimer.
3804 +// 2. Redistributions in binary form must reproduce the above copyright
3805 +// notice, this list of conditions and the following disclaimer in the
3806 +// documentation and/or other materials provided with the distribution.
3807 +// 3. The name of the author may not be used to endorse or promote products
3808 +// derived from this software without specific prior written permission.
3810 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
3811 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
3812 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
3813 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
3814 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
3815 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3816 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3817 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3818 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3819 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3822 +/* =============================================================================
3823 + * This is what the grammar programmer asked us to put at the top of every file.
3826 + /* Needs #define _GNU_SOURCE for strptime() */
3828 + #include <stdio.h>
3829 + #include <string.h>
3831 + #include <stdint.h>
3833 + #include "logger.h"
3836 + #include "rsp_query.h"
3838 +/* End of Header action.
3839 + * =============================================================================
3841 +/* -----------------------------------------
3842 + * Include the ANTLR3 generated header file.
3844 +#include "RSP2SQL.h"
3845 +/* ----------------------------------------- */
3851 +/* MACROS that hide the C interface implementations from the
3852 + * generated code, which makes it a little more understandable to the human eye.
3853 + * I am very much against using C pre-processor macros for function calls and bits
3854 + * of code as you cannot see what is happening when single stepping in debuggers
3855 + * and so on. The exception (in my book at least) is for generated code, where you are
3856 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
3857 + * hides some indirect calls, but is always referring to the input stream. This is
3858 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
3859 + * the runtime interfaces without changing the generated code too often, without
3860 + * confusing the reader of the generated output, who may not wish to know the gory
3861 + * details of the interface inheritance.
3866 +/* Aids in accessing scopes for grammar programmers
3871 +#define SCOPE_TYPE(scope) pRSP2SQL_##scope##_SCOPE
3872 +#define SCOPE_STACK(scope) pRSP2SQL_##scope##Stack
3873 +#define SCOPE_TOP(scope) ctx->pRSP2SQL_##scope##Top
3874 +#define SCOPE_SIZE(scope) ctx->pRSP2SQL_##scope##Stack_limit
3875 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
3877 +/* Macros for accessing things in the parser
3882 +#undef HAVEPARSEDRULE
3885 +#undef HASEXCEPTION
3893 +#undef PREPORTERROR
3901 +#undef PERRORRECOVERY
3904 +#undef RECOVERFROMMISMATCHEDSET
3905 +#undef RECOVERFROMMISMATCHEDELEMENT
3906 +#undef BACKTRACKING
3913 +#define PARSER ctx->pTreeParser
3914 +#define RECOGNIZER PARSER->rec
3915 +#define PSRSTATE RECOGNIZER->state
3916 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
3917 +#define INPUT PARSER->ctnstream
3918 +#define ISTREAM INPUT->tnstream->istream
3919 +#define STRSTREAM INPUT->tnstream
3920 +#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE)
3921 +#define EXCEPTION PSRSTATE->exception
3922 +#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs)
3923 +#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER)
3924 +#define FOLLOWSTACK PSRSTATE->following
3925 +#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
3926 +#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK)
3927 +#define PRECOVER() RECOGNIZER->recover(RECOGNIZER)
3928 +#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER)
3929 +#define LA(n) ISTREAM->_LA(ISTREAM, n)
3930 +#define LT(n) INPUT->tnstream->_LT(INPUT->tnstream, n)
3931 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
3932 +#define CONSUME() ISTREAM->consume(ISTREAM)
3933 +#define MARK() ISTREAM->mark(ISTREAM)
3934 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
3935 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
3936 +#define PERRORRECOVERY PSRSTATE->errorRecovery
3937 +#define FAILEDFLAG PSRSTATE->failed
3938 +#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE)
3939 +#define BACKTRACKING PSRSTATE->backtracking
3940 +#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
3941 +#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
3942 +#define ADAPTOR INPUT->adaptor
3943 +#define RULEMEMO PSRSTATE->ruleMemo
3944 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
3945 +#define INDEX() ISTREAM->index(ISTREAM)
3946 +#define DBG RECOGNIZER->debugger
3949 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
3951 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
3952 + * then for the present you must use different names for your defines as these are hard coded
3953 + * in the code generator. It would be better not to use such names internally, and maybe
3954 + * we can change this in a forthcoming release. I deliberately do not #undef these
3955 + * here as this will at least give you a redefined error somewhere if they clash.
3957 +#define UP ANTLR3_TOKEN_UP
3958 +#define DOWN ANTLR3_TOKEN_DOWN
3959 +#define EOR ANTLR3_TOKEN_EOR
3960 +#define INVALID ANTLR3_TOKEN_INVALID
3963 +/* =============================================================================
3964 + * Functions to create and destroy scopes. First come the rule scopes, followed
3965 + * by the global declared scopes.
3970 +/* ============================================================================= */
3972 +/* =============================================================================
3973 + * Start of recognizer
3978 +/** \brief Table of all token names in symbolic order, mainly used for
3979 + * error reporting.
3981 +pANTLR3_UINT8 RSP2SQLTokenNames[30+4]
3983 + (pANTLR3_UINT8) "<invalid>", /* String to print to indicate an invalid token */
3984 + (pANTLR3_UINT8) "<EOR>",
3985 + (pANTLR3_UINT8) "<DOWN>",
3986 + (pANTLR3_UINT8) "<UP>",
3987 + (pANTLR3_UINT8) "NEWLINE",
3988 + (pANTLR3_UINT8) "OR",
3989 + (pANTLR3_UINT8) "AND",
3990 + (pANTLR3_UINT8) "LPAR",
3991 + (pANTLR3_UINT8) "RPAR",
3992 + (pANTLR3_UINT8) "FIELD",
3993 + (pANTLR3_UINT8) "STR",
3994 + (pANTLR3_UINT8) "NOT",
3995 + (pANTLR3_UINT8) "EQUAL",
3996 + (pANTLR3_UINT8) "INCLUDES",
3997 + (pANTLR3_UINT8) "STARTSW",
3998 + (pANTLR3_UINT8) "ENDSW",
3999 + (pANTLR3_UINT8) "INT",
4000 + (pANTLR3_UINT8) "LESS",
4001 + (pANTLR3_UINT8) "GREATER",
4002 + (pANTLR3_UINT8) "LTE",
4003 + (pANTLR3_UINT8) "GTE",
4004 + (pANTLR3_UINT8) "BEFORE",
4005 + (pANTLR3_UINT8) "AFTER",
4006 + (pANTLR3_UINT8) "DATE",
4007 + (pANTLR3_UINT8) "TODAY",
4008 + (pANTLR3_UINT8) "DAY",
4009 + (pANTLR3_UINT8) "WEEK",
4010 + (pANTLR3_UINT8) "MONTH",
4011 + (pANTLR3_UINT8) "YEAR",
4012 + (pANTLR3_UINT8) "QUOTE",
4013 + (pANTLR3_UINT8) "WS",
4014 + (pANTLR3_UINT8) "DIGIT19",
4015 + (pANTLR3_UINT8) "DIGIT09",
4016 + (pANTLR3_UINT8) "ESCAPED"
4021 +// Forward declare the locally static matching functions we have generated.
4023 +static pANTLR3_STRING query (pRSP2SQL ctx);
4024 +static RSP2SQL_expr_return expr (pRSP2SQL ctx);
4025 +static RSP2SQL_strcrit_return strcrit (pRSP2SQL ctx);
4026 +static pANTLR3_COMMON_TOKEN strop (pRSP2SQL ctx);
4027 +static RSP2SQL_intcrit_return intcrit (pRSP2SQL ctx);
4028 +static pANTLR3_COMMON_TOKEN intop (pRSP2SQL ctx);
4029 +static RSP2SQL_datecrit_return datecrit (pRSP2SQL ctx);
4030 +static pANTLR3_COMMON_TOKEN dateop (pRSP2SQL ctx);
4031 +static RSP2SQL_datespec_return datespec (pRSP2SQL ctx);
4032 +static RSP2SQL_dateref_return dateref (pRSP2SQL ctx);
4033 +static RSP2SQL_dateintval_return dateintval (pRSP2SQL ctx);
4034 +static void RSP2SQLFree(pRSP2SQL ctx);
4035 +/* For use in tree output where we are accumulating rule labels via label += ruleRef
4036 + * we need a function that knows how to free a return scope when the list is destroyed.
4037 + * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
4039 +static void ANTLR3_CDECL freeScope(void * scope)
4041 + ANTLR3_FREE(scope);
4044 +/** \brief Name of the grammar file that generated this code
4046 +static const char fileName[] = "RSP2SQL.g";
4048 +/** \brief Return the name of the grammar file that generated this code.
4050 +static const char * getGrammarFileName()
4054 +/** \brief Create a new RSP2SQL parser and return a context for it.
4056 + * \param[in] instream Pointer to an input stream interface.
4058 + * \return Pointer to new parser context upon success.
4060 +ANTLR3_API pRSP2SQL
4061 +RSP2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream)
4063 + // See if we can create a new parser with the standard constructor
4065 + return RSP2SQLNewSSD(instream, NULL);
4068 +/** \brief Create a new RSP2SQL parser and return a context for it.
4070 + * \param[in] instream Pointer to an input stream interface.
4072 + * \return Pointer to new parser context upon success.
4074 +ANTLR3_API pRSP2SQL
4075 +RSP2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
4077 + pRSP2SQL ctx; /* Context structure we will build and return */
4079 + ctx = (pRSP2SQL) ANTLR3_CALLOC(1, sizeof(RSP2SQL));
4083 + // Failed to allocate memory for parser context
4088 + /* -------------------------------------------------------------------
4089 + * Memory for basic structure is allocated, now to fill in
4090 + * the base ANTLR3 structures. We initialize the function pointers
4091 + * for the standard ANTLR3 parser function set, but upon return
4092 + * from here, the programmer may set the pointers to provide custom
4093 + * implementations of each function.
4095 + * We don't use the macros defined in RSP2SQL.h here, in order that you can get a sense
4096 + * of what goes where.
4099 + /* Create a base Tree parser/recognizer, using the supplied tree node stream
4101 + ctx->pTreeParser = antlr3TreeParserNewStream(ANTLR3_SIZE_HINT, instream, state);
4102 + /* Install the implementation of our RSP2SQL interface
4104 + ctx->query = query;
4106 + ctx->strcrit = strcrit;
4107 + ctx->strop = strop;
4108 + ctx->intcrit = intcrit;
4109 + ctx->intop = intop;
4110 + ctx->datecrit = datecrit;
4111 + ctx->dateop = dateop;
4112 + ctx->datespec = datespec;
4113 + ctx->dateref = dateref;
4114 + ctx->dateintval = dateintval;
4115 + ctx->free = RSP2SQLFree;
4116 + ctx->getGrammarFileName = getGrammarFileName;
4118 + /* Install the scope pushing methods.
4125 + /* Install the token table
4127 + PSRSTATE->tokenNames = RSP2SQLTokenNames;
4130 + /* Return the newly built parser to the caller
4135 +/** Free the parser resources
4138 + RSP2SQLFree(pRSP2SQL ctx)
4140 + /* Free any scope memory
4144 + // Free this parser
4146 + ctx->pTreeParser->free(ctx->pTreeParser);
4149 + /* Everything is released, so we can return
4154 +/** Return token names used by this tree parser
4156 + * The returned pointer is used as an index into the token names table (using the token
4157 + * number as the index).
4159 + * \return Pointer to first char * in the table.
4161 +static pANTLR3_UINT8 *getTokenNames()
4163 + return RSP2SQLTokenNames;
4167 + #define RSP_TYPE_STRING 0
4168 + #define RSP_TYPE_INT 1
4169 + #define RSP_TYPE_DATE 2
4171 + struct rsp_query_field_map {
4174 + /* RSP fields are named after the DB columns - or vice versa */
4177 + /* gperf static hash, rsp_query.gperf */
4178 + #include "rsp_query_hash.c"
4181 +/* Declare the bitsets
4184 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_query70 */
4185 +static ANTLR3_BITWORD FOLLOW_expr_in_query70_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4186 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_query70 = { FOLLOW_expr_in_query70_bits, 1 };
4187 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_expr95 */
4188 +static ANTLR3_BITWORD FOLLOW_AND_in_expr95_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4189 +static ANTLR3_BITSET_LIST FOLLOW_AND_in_expr95 = { FOLLOW_AND_in_expr95_bits, 1 };
4190 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr101 */
4191 +static ANTLR3_BITWORD FOLLOW_expr_in_expr101_bits[] = { ANTLR3_UINT64_LIT(0x00000000007EF860) };
4192 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr101 = { FOLLOW_expr_in_expr101_bits, 1 };
4193 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr107 */
4194 +static ANTLR3_BITWORD FOLLOW_expr_in_expr107_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4195 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr107 = { FOLLOW_expr_in_expr107_bits, 1 };
4196 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expr118 */
4197 +static ANTLR3_BITWORD FOLLOW_OR_in_expr118_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4198 +static ANTLR3_BITSET_LIST FOLLOW_OR_in_expr118 = { FOLLOW_OR_in_expr118_bits, 1 };
4199 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr124 */
4200 +static ANTLR3_BITWORD FOLLOW_expr_in_expr124_bits[] = { ANTLR3_UINT64_LIT(0x00000000007EF860) };
4201 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr124 = { FOLLOW_expr_in_expr124_bits, 1 };
4202 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr130 */
4203 +static ANTLR3_BITWORD FOLLOW_expr_in_expr130_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4204 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr130 = { FOLLOW_expr_in_expr130_bits, 1 };
4205 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_strcrit_in_expr144 */
4206 +static ANTLR3_BITWORD FOLLOW_strcrit_in_expr144_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4207 +static ANTLR3_BITSET_LIST FOLLOW_strcrit_in_expr144 = { FOLLOW_strcrit_in_expr144_bits, 1 };
4208 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_expr154 */
4209 +static ANTLR3_BITWORD FOLLOW_NOT_in_expr154_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4210 +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_expr154 = { FOLLOW_NOT_in_expr154_bits, 1 };
4211 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_strcrit_in_expr160 */
4212 +static ANTLR3_BITWORD FOLLOW_strcrit_in_expr160_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4213 +static ANTLR3_BITSET_LIST FOLLOW_strcrit_in_expr160 = { FOLLOW_strcrit_in_expr160_bits, 1 };
4214 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intcrit_in_expr174 */
4215 +static ANTLR3_BITWORD FOLLOW_intcrit_in_expr174_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4216 +static ANTLR3_BITSET_LIST FOLLOW_intcrit_in_expr174 = { FOLLOW_intcrit_in_expr174_bits, 1 };
4217 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_expr184 */
4218 +static ANTLR3_BITWORD FOLLOW_NOT_in_expr184_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4219 +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_expr184 = { FOLLOW_NOT_in_expr184_bits, 1 };
4220 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intcrit_in_expr190 */
4221 +static ANTLR3_BITWORD FOLLOW_intcrit_in_expr190_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4222 +static ANTLR3_BITSET_LIST FOLLOW_intcrit_in_expr190 = { FOLLOW_intcrit_in_expr190_bits, 1 };
4223 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_datecrit_in_expr204 */
4224 +static ANTLR3_BITWORD FOLLOW_datecrit_in_expr204_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4225 +static ANTLR3_BITSET_LIST FOLLOW_datecrit_in_expr204 = { FOLLOW_datecrit_in_expr204_bits, 1 };
4226 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_strop_in_strcrit233 */
4227 +static ANTLR3_BITWORD FOLLOW_strop_in_strcrit233_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4228 +static ANTLR3_BITSET_LIST FOLLOW_strop_in_strcrit233 = { FOLLOW_strop_in_strcrit233_bits, 1 };
4229 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_strcrit239 */
4230 +static ANTLR3_BITWORD FOLLOW_FIELD_in_strcrit239_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000400) };
4231 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_strcrit239 = { FOLLOW_FIELD_in_strcrit239_bits, 1 };
4232 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_strcrit245 */
4233 +static ANTLR3_BITWORD FOLLOW_STR_in_strcrit245_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4234 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_strcrit245 = { FOLLOW_STR_in_strcrit245_bits, 1 };
4235 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_EQUAL_in_strop274 */
4236 +static ANTLR3_BITWORD FOLLOW_EQUAL_in_strop274_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4237 +static ANTLR3_BITSET_LIST FOLLOW_EQUAL_in_strop274 = { FOLLOW_EQUAL_in_strop274_bits, 1 };
4238 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INCLUDES_in_strop287 */
4239 +static ANTLR3_BITWORD FOLLOW_INCLUDES_in_strop287_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4240 +static ANTLR3_BITSET_LIST FOLLOW_INCLUDES_in_strop287 = { FOLLOW_INCLUDES_in_strop287_bits, 1 };
4241 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STARTSW_in_strop300 */
4242 +static ANTLR3_BITWORD FOLLOW_STARTSW_in_strop300_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4243 +static ANTLR3_BITSET_LIST FOLLOW_STARTSW_in_strop300 = { FOLLOW_STARTSW_in_strop300_bits, 1 };
4244 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENDSW_in_strop313 */
4245 +static ANTLR3_BITWORD FOLLOW_ENDSW_in_strop313_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4246 +static ANTLR3_BITSET_LIST FOLLOW_ENDSW_in_strop313 = { FOLLOW_ENDSW_in_strop313_bits, 1 };
4247 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intop_in_intcrit342 */
4248 +static ANTLR3_BITWORD FOLLOW_intop_in_intcrit342_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4249 +static ANTLR3_BITSET_LIST FOLLOW_intop_in_intcrit342 = { FOLLOW_intop_in_intcrit342_bits, 1 };
4250 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_intcrit348 */
4251 +static ANTLR3_BITWORD FOLLOW_FIELD_in_intcrit348_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) };
4252 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_intcrit348 = { FOLLOW_FIELD_in_intcrit348_bits, 1 };
4253 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_intcrit354 */
4254 +static ANTLR3_BITWORD FOLLOW_INT_in_intcrit354_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4255 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_intcrit354 = { FOLLOW_INT_in_intcrit354_bits, 1 };
4256 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_EQUAL_in_intop383 */
4257 +static ANTLR3_BITWORD FOLLOW_EQUAL_in_intop383_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4258 +static ANTLR3_BITSET_LIST FOLLOW_EQUAL_in_intop383 = { FOLLOW_EQUAL_in_intop383_bits, 1 };
4259 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_LESS_in_intop396 */
4260 +static ANTLR3_BITWORD FOLLOW_LESS_in_intop396_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4261 +static ANTLR3_BITSET_LIST FOLLOW_LESS_in_intop396 = { FOLLOW_LESS_in_intop396_bits, 1 };
4262 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_GREATER_in_intop409 */
4263 +static ANTLR3_BITWORD FOLLOW_GREATER_in_intop409_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4264 +static ANTLR3_BITSET_LIST FOLLOW_GREATER_in_intop409 = { FOLLOW_GREATER_in_intop409_bits, 1 };
4265 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_LTE_in_intop422 */
4266 +static ANTLR3_BITWORD FOLLOW_LTE_in_intop422_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4267 +static ANTLR3_BITSET_LIST FOLLOW_LTE_in_intop422 = { FOLLOW_LTE_in_intop422_bits, 1 };
4268 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_GTE_in_intop435 */
4269 +static ANTLR3_BITWORD FOLLOW_GTE_in_intop435_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4270 +static ANTLR3_BITSET_LIST FOLLOW_GTE_in_intop435 = { FOLLOW_GTE_in_intop435_bits, 1 };
4271 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datecrit464 */
4272 +static ANTLR3_BITWORD FOLLOW_dateop_in_datecrit464_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4273 +static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datecrit464 = { FOLLOW_dateop_in_datecrit464_bits, 1 };
4274 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_datecrit470 */
4275 +static ANTLR3_BITWORD FOLLOW_FIELD_in_datecrit470_bits[] = { ANTLR3_UINT64_LIT(0x0000000001FEF860) };
4276 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_datecrit470 = { FOLLOW_FIELD_in_datecrit470_bits, 1 };
4277 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_datespec_in_datecrit476 */
4278 +static ANTLR3_BITWORD FOLLOW_datespec_in_datecrit476_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4279 +static ANTLR3_BITSET_LIST FOLLOW_datespec_in_datecrit476 = { FOLLOW_datespec_in_datecrit476_bits, 1 };
4280 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateop505 */
4281 +static ANTLR3_BITWORD FOLLOW_BEFORE_in_dateop505_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4282 +static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateop505 = { FOLLOW_BEFORE_in_dateop505_bits, 1 };
4283 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateop518 */
4284 +static ANTLR3_BITWORD FOLLOW_AFTER_in_dateop518_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4285 +static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateop518 = { FOLLOW_AFTER_in_dateop518_bits, 1 };
4286 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec546 */
4287 +static ANTLR3_BITWORD FOLLOW_dateref_in_datespec546_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4288 +static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec546 = { FOLLOW_dateref_in_datespec546_bits, 1 };
4289 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datespec560 */
4290 +static ANTLR3_BITWORD FOLLOW_dateop_in_datespec560_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
4291 +static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datespec560 = { FOLLOW_dateop_in_datespec560_bits, 1 };
4292 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec566 */
4293 +static ANTLR3_BITWORD FOLLOW_dateref_in_datespec566_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) };
4294 +static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec566 = { FOLLOW_dateref_in_datespec566_bits, 1 };
4295 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_datespec572 */
4296 +static ANTLR3_BITWORD FOLLOW_INT_in_datespec572_bits[] = { ANTLR3_UINT64_LIT(0x000000001E000000) };
4297 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_datespec572 = { FOLLOW_INT_in_datespec572_bits, 1 };
4298 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateintval_in_datespec578 */
4299 +static ANTLR3_BITWORD FOLLOW_dateintval_in_datespec578_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
4300 +static ANTLR3_BITSET_LIST FOLLOW_dateintval_in_datespec578 = { FOLLOW_dateintval_in_datespec578_bits, 1 };
4301 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateref607 */
4302 +static ANTLR3_BITWORD FOLLOW_DATE_in_dateref607_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4303 +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateref607 = { FOLLOW_DATE_in_dateref607_bits, 1 };
4304 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_TODAY_in_dateref616 */
4305 +static ANTLR3_BITWORD FOLLOW_TODAY_in_dateref616_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4306 +static ANTLR3_BITSET_LIST FOLLOW_TODAY_in_dateref616 = { FOLLOW_TODAY_in_dateref616_bits, 1 };
4307 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DAY_in_dateintval640 */
4308 +static ANTLR3_BITWORD FOLLOW_DAY_in_dateintval640_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4309 +static ANTLR3_BITSET_LIST FOLLOW_DAY_in_dateintval640 = { FOLLOW_DAY_in_dateintval640_bits, 1 };
4310 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_WEEK_in_dateintval649 */
4311 +static ANTLR3_BITWORD FOLLOW_WEEK_in_dateintval649_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4312 +static ANTLR3_BITSET_LIST FOLLOW_WEEK_in_dateintval649 = { FOLLOW_WEEK_in_dateintval649_bits, 1 };
4313 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_MONTH_in_dateintval658 */
4314 +static ANTLR3_BITWORD FOLLOW_MONTH_in_dateintval658_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4315 +static ANTLR3_BITSET_LIST FOLLOW_MONTH_in_dateintval658 = { FOLLOW_MONTH_in_dateintval658_bits, 1 };
4316 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_YEAR_in_dateintval667 */
4317 +static ANTLR3_BITWORD FOLLOW_YEAR_in_dateintval667_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
4318 +static ANTLR3_BITSET_LIST FOLLOW_YEAR_in_dateintval667 = { FOLLOW_YEAR_in_dateintval667_bits, 1 };
4323 +/* ==============================================
4327 + * $ANTLR start query
4328 + * RSP2SQL.g:56:1: query returns [ pANTLR3_STRING result ] : e= expr ;
4330 +static pANTLR3_STRING
4331 +query(pRSP2SQL ctx)
4333 + pANTLR3_STRING result = NULL;
4335 + RSP2SQL_expr_return e;
4336 + #undef RETURN_TYPE_e
4337 + #define RETURN_TYPE_e RSP2SQL_expr_return
4339 + /* Initialize rule variables
4345 + // RSP2SQL.g:58:2: (e= expr )
4346 + // RSP2SQL.g:58:4: e= expr
4348 + FOLLOWPUSH(FOLLOW_expr_in_query70);
4352 + if (HASEXCEPTION())
4365 + result= e.result->factory->newRaw(e.result->factory);
4366 + result->append8(result, "(");
4367 + result->appendS(result, e.result);
4368 + result->append8(result, ")");
4378 + // This is where rules clean up and exit
4380 + goto rulequeryEx; /* Prevent compiler warnings */
4383 + if (HASEXCEPTION())
4392 +/* $ANTLR end query */
4395 + * $ANTLR start expr
4396 + * 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 );
4398 +static RSP2SQL_expr_return
4401 + RSP2SQL_expr_return retval;
4403 + RSP2SQL_expr_return a;
4404 + #undef RETURN_TYPE_a
4405 + #define RETURN_TYPE_a RSP2SQL_expr_return
4407 + RSP2SQL_expr_return b;
4408 + #undef RETURN_TYPE_b
4409 + #define RETURN_TYPE_b RSP2SQL_expr_return
4411 + RSP2SQL_strcrit_return c;
4412 + #undef RETURN_TYPE_c
4413 + #define RETURN_TYPE_c RSP2SQL_strcrit_return
4415 + RSP2SQL_intcrit_return i;
4416 + #undef RETURN_TYPE_i
4417 + #define RETURN_TYPE_i RSP2SQL_intcrit_return
4419 + RSP2SQL_datecrit_return d;
4420 + #undef RETURN_TYPE_d
4421 + #define RETURN_TYPE_d RSP2SQL_datecrit_return
4423 + /* Initialize rule variables
4427 + retval.result= NULL; retval.valid= 1;
4428 + retval.start = LT(1); retval.stop = retval.start;
4432 + // 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 )
4434 + ANTLR3_UINT32 alt1;
4475 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4476 + EXCEPTION->message = (void *)"";
4477 + EXCEPTION->decisionNum = 1;
4478 + EXCEPTION->state = 10;
4489 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4490 + EXCEPTION->message = (void *)"";
4491 + EXCEPTION->decisionNum = 1;
4492 + EXCEPTION->state = 8;
4503 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4504 + EXCEPTION->message = (void *)"";
4505 + EXCEPTION->decisionNum = 1;
4506 + EXCEPTION->state = 3;
4554 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4555 + EXCEPTION->message = (void *)"";
4556 + EXCEPTION->decisionNum = 1;
4557 + EXCEPTION->state = 15;
4568 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4569 + EXCEPTION->message = (void *)"";
4570 + EXCEPTION->decisionNum = 1;
4571 + EXCEPTION->state = 14;
4582 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4583 + EXCEPTION->message = (void *)"";
4584 + EXCEPTION->decisionNum = 1;
4585 + EXCEPTION->state = 11;
4611 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4612 + EXCEPTION->message = (void *)"";
4613 + EXCEPTION->decisionNum = 1;
4614 + EXCEPTION->state = 9;
4625 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4626 + EXCEPTION->message = (void *)"";
4627 + EXCEPTION->decisionNum = 1;
4628 + EXCEPTION->state = 5;
4653 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4654 + EXCEPTION->message = (void *)"";
4655 + EXCEPTION->decisionNum = 1;
4656 + EXCEPTION->state = 0;
4665 + // RSP2SQL.g:76:4: ^( AND a= expr b= expr )
4667 + MATCHT(AND, &FOLLOW_AND_in_expr95);
4668 + if (HASEXCEPTION())
4674 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
4675 + if (HASEXCEPTION())
4680 + FOLLOWPUSH(FOLLOW_expr_in_expr101);
4684 + if (HASEXCEPTION())
4689 + FOLLOWPUSH(FOLLOW_expr_in_expr107);
4693 + if (HASEXCEPTION())
4699 + MATCHT(ANTLR3_TOKEN_UP, NULL);
4700 + if (HASEXCEPTION())
4707 + if (!a.valid || !b.valid)
4713 + retval.result= a.result->factory->newRaw(a.result->factory);
4714 + retval.result->append8(retval.result, "(");
4715 + retval.result->appendS(retval.result, a.result);
4716 + retval.result->append8(retval.result, " AND ");
4717 + retval.result->appendS(retval.result, b.result);
4718 + retval.result->append8(retval.result, ")");
4726 + // RSP2SQL.g:92:4: ^( OR a= expr b= expr )
4728 + MATCHT(OR, &FOLLOW_OR_in_expr118);
4729 + if (HASEXCEPTION())
4735 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
4736 + if (HASEXCEPTION())
4741 + FOLLOWPUSH(FOLLOW_expr_in_expr124);
4745 + if (HASEXCEPTION())
4750 + FOLLOWPUSH(FOLLOW_expr_in_expr130);
4754 + if (HASEXCEPTION())
4760 + MATCHT(ANTLR3_TOKEN_UP, NULL);
4761 + if (HASEXCEPTION())
4768 + if (!a.valid || !b.valid)
4774 + retval.result= a.result->factory->newRaw(a.result->factory);
4775 + retval.result->append8(retval.result, "(");
4776 + retval.result->appendS(retval.result, a.result);
4777 + retval.result->append8(retval.result, " OR ");
4778 + retval.result->appendS(retval.result, b.result);
4779 + retval.result->append8(retval.result, ")");
4787 + // RSP2SQL.g:108:4: c= strcrit
4789 + FOLLOWPUSH(FOLLOW_strcrit_in_expr144);
4793 + if (HASEXCEPTION())
4800 + retval.valid= c.valid;
4801 + retval.result= c.result;
4808 + // RSP2SQL.g:113:4: ^( NOT c= strcrit )
4810 + MATCHT(NOT, &FOLLOW_NOT_in_expr154);
4811 + if (HASEXCEPTION())
4817 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
4818 + if (HASEXCEPTION())
4823 + FOLLOWPUSH(FOLLOW_strcrit_in_expr160);
4827 + if (HASEXCEPTION())
4833 + MATCHT(ANTLR3_TOKEN_UP, NULL);
4834 + if (HASEXCEPTION())
4847 + retval.result= c.result->factory->newRaw(c.result->factory);
4848 + retval.result->append8(retval.result, "(NOT ");
4849 + retval.result->appendS(retval.result, c.result);
4850 + retval.result->append8(retval.result, ")");
4858 + // RSP2SQL.g:127:4: i= intcrit
4860 + FOLLOWPUSH(FOLLOW_intcrit_in_expr174);
4864 + if (HASEXCEPTION())
4871 + retval.valid= i.valid;
4872 + retval.result= i.result;
4879 + // RSP2SQL.g:132:4: ^( NOT i= intcrit )
4881 + MATCHT(NOT, &FOLLOW_NOT_in_expr184);
4882 + if (HASEXCEPTION())
4888 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
4889 + if (HASEXCEPTION())
4894 + FOLLOWPUSH(FOLLOW_intcrit_in_expr190);
4898 + if (HASEXCEPTION())
4904 + MATCHT(ANTLR3_TOKEN_UP, NULL);
4905 + if (HASEXCEPTION())
4918 + retval.result= i.result->factory->newRaw(i.result->factory);
4919 + retval.result->append8(retval.result, "(NOT ");
4920 + retval.result->appendS(retval.result, i.result);
4921 + retval.result->append8(retval.result, ")");
4929 + // RSP2SQL.g:146:4: d= datecrit
4931 + FOLLOWPUSH(FOLLOW_datecrit_in_expr204);
4935 + if (HASEXCEPTION())
4942 + retval.valid= d.valid;
4943 + retval.result= d.result;
4955 + // This is where rules clean up and exit
4957 + goto ruleexprEx; /* Prevent compiler warnings */
4960 + if (HASEXCEPTION())
4969 +/* $ANTLR end expr */
4972 + * $ANTLR start strcrit
4973 + * RSP2SQL.g:153:1: strcrit returns [ pANTLR3_STRING result, int valid ] : ^(o= strop f= FIELD s= STR ) ;
4975 +static RSP2SQL_strcrit_return
4976 +strcrit(pRSP2SQL ctx)
4978 + RSP2SQL_strcrit_return retval;
4980 + pANTLR3_BASE_TREE f;
4981 + pANTLR3_BASE_TREE s;
4982 + pANTLR3_COMMON_TOKEN o;
4983 + #undef RETURN_TYPE_o
4984 + #define RETURN_TYPE_o pANTLR3_COMMON_TOKEN
4986 + /* Initialize rule variables
4990 + retval.result= NULL; retval.valid= 1;
4994 + retval.start = LT(1); retval.stop = retval.start;
4997 + // RSP2SQL.g:155:2: ( ^(o= strop f= FIELD s= STR ) )
4998 + // RSP2SQL.g:155:4: ^(o= strop f= FIELD s= STR )
5000 + FOLLOWPUSH(FOLLOW_strop_in_strcrit233);
5004 + if (HASEXCEPTION())
5006 + goto rulestrcritEx;
5010 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
5011 + if (HASEXCEPTION())
5013 + goto rulestrcritEx;
5016 + f = (pANTLR3_BASE_TREE) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit239);
5017 + if (HASEXCEPTION())
5019 + goto rulestrcritEx;
5022 + s = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_strcrit245);
5023 + if (HASEXCEPTION())
5025 + goto rulestrcritEx;
5029 + MATCHT(ANTLR3_TOKEN_UP, NULL);
5030 + if (HASEXCEPTION())
5032 + goto rulestrcritEx;
5038 + const struct rsp_query_field_map *rqfp;
5039 + pANTLR3_STRING field;
5041 + ANTLR3_UINT32 optok;
5046 + optok = o->getType(o);
5060 + field = f->getText(f);
5062 + /* Field lookup */
5063 + rqfp = rsp_query_field_lookup((char *)field->chars, strlen((char *)field->chars));
5066 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not a valid field in queries\n", field->chars);
5068 + goto strcrit_valid_0; /* ABORT */
5071 + /* Check field type */
5072 + if (rqfp->field_type != RSP_TYPE_STRING)
5074 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not a string field\n", field->chars);
5076 + goto strcrit_valid_0; /* ABORT */
5079 + escaped = db_escape_string((char *)s->getText(s)->chars);
5082 + DPRINTF(E_LOG, L_RSP, "Could not escape value\n");
5084 + goto strcrit_valid_0; /* ABORT */
5087 + retval.result= field->factory->newRaw(field->factory);
5088 + retval.result->append8(retval.result, "f.");
5089 + retval.result->appendS(retval.result, field);
5090 + retval.result->append8(retval.result, op);
5091 + retval.result->append8(retval.result, "'");
5092 + if ((optok == INCLUDES) || (optok == STARTSW))
5093 + retval.result->append8(retval.result, "%");
5095 + retval.result->append8(retval.result, escaped);
5097 + if ((optok == INCLUDES) || (optok == ENDSW))
5098 + retval.result->append8(retval.result, "%");
5099 + retval.result->append8(retval.result, "'");
5114 + // This is where rules clean up and exit
5116 + goto rulestrcritEx; /* Prevent compiler warnings */
5119 + if (HASEXCEPTION())
5128 +/* $ANTLR end strcrit */
5131 + * $ANTLR start strop
5132 + * RSP2SQL.g:229:1: strop returns [ pANTLR3_COMMON_TOKEN op ] : (n= EQUAL | n= INCLUDES | n= STARTSW | n= ENDSW );
5134 +static pANTLR3_COMMON_TOKEN
5135 +strop(pRSP2SQL ctx)
5137 + pANTLR3_COMMON_TOKEN op = NULL;
5139 + pANTLR3_BASE_TREE n;
5141 + /* Initialize rule variables
5150 + // RSP2SQL.g:231:2: (n= EQUAL | n= INCLUDES | n= STARTSW | n= ENDSW )
5152 + ANTLR3_UINT32 alt2;
5181 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
5182 + EXCEPTION->message = (void *)"";
5183 + EXCEPTION->decisionNum = 2;
5184 + EXCEPTION->state = 0;
5193 + // RSP2SQL.g:231:4: n= EQUAL
5195 + n = (pANTLR3_BASE_TREE) MATCHT(EQUAL, &FOLLOW_EQUAL_in_strop274);
5196 + if (HASEXCEPTION())
5202 + op= n->getToken(n);
5208 + // RSP2SQL.g:233:4: n= INCLUDES
5210 + n = (pANTLR3_BASE_TREE) MATCHT(INCLUDES, &FOLLOW_INCLUDES_in_strop287);
5211 + if (HASEXCEPTION())
5217 + op= n->getToken(n);
5223 + // RSP2SQL.g:235:4: n= STARTSW
5225 + n = (pANTLR3_BASE_TREE) MATCHT(STARTSW, &FOLLOW_STARTSW_in_strop300);
5226 + if (HASEXCEPTION())
5232 + op= n->getToken(n);
5238 + // RSP2SQL.g:237:4: n= ENDSW
5240 + n = (pANTLR3_BASE_TREE) MATCHT(ENDSW, &FOLLOW_ENDSW_in_strop313);
5241 + if (HASEXCEPTION())
5247 + op= n->getToken(n);
5258 + // This is where rules clean up and exit
5260 + goto rulestropEx; /* Prevent compiler warnings */
5263 + if (HASEXCEPTION())
5272 +/* $ANTLR end strop */
5275 + * $ANTLR start intcrit
5276 + * RSP2SQL.g:241:1: intcrit returns [ pANTLR3_STRING result, int valid ] : ^(o= intop f= FIELD i= INT ) ;
5278 +static RSP2SQL_intcrit_return
5279 +intcrit(pRSP2SQL ctx)
5281 + RSP2SQL_intcrit_return retval;
5283 + pANTLR3_BASE_TREE f;
5284 + pANTLR3_BASE_TREE i;
5285 + pANTLR3_COMMON_TOKEN o;
5286 + #undef RETURN_TYPE_o
5287 + #define RETURN_TYPE_o pANTLR3_COMMON_TOKEN
5289 + /* Initialize rule variables
5293 + retval.result= NULL; retval.valid= 1;
5297 + retval.start = LT(1); retval.stop = retval.start;
5300 + // RSP2SQL.g:243:2: ( ^(o= intop f= FIELD i= INT ) )
5301 + // RSP2SQL.g:243:4: ^(o= intop f= FIELD i= INT )
5303 + FOLLOWPUSH(FOLLOW_intop_in_intcrit342);
5307 + if (HASEXCEPTION())
5309 + goto ruleintcritEx;
5313 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
5314 + if (HASEXCEPTION())
5316 + goto ruleintcritEx;
5319 + f = (pANTLR3_BASE_TREE) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit348);
5320 + if (HASEXCEPTION())
5322 + goto ruleintcritEx;
5325 + i = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_intcrit354);
5326 + if (HASEXCEPTION())
5328 + goto ruleintcritEx;
5332 + MATCHT(ANTLR3_TOKEN_UP, NULL);
5333 + if (HASEXCEPTION())
5335 + goto ruleintcritEx;
5341 + const struct rsp_query_field_map *rqfp;
5342 + pANTLR3_STRING field;
5345 + switch (o->getType(o))
5368 + field = f->getText(f);
5370 + /* Field lookup */
5371 + rqfp = rsp_query_field_lookup((char *)field->chars, strlen((char *)field->chars));
5374 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not a valid field in queries\n", field->chars);
5376 + goto intcrit_valid_0; /* ABORT */
5379 + /* Check field type */
5380 + if (rqfp->field_type != RSP_TYPE_INT)
5382 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not an integer field\n", field->chars);
5384 + goto intcrit_valid_0; /* ABORT */
5387 + retval.result= field->factory->newRaw(field->factory);
5388 + retval.result->append8(retval.result, "f.");
5389 + retval.result->appendS(retval.result, field);
5390 + retval.result->append8(retval.result, op);
5391 + retval.result->appendS(retval.result, i->getText(i));
5403 + // This is where rules clean up and exit
5405 + goto ruleintcritEx; /* Prevent compiler warnings */
5408 + if (HASEXCEPTION())
5417 +/* $ANTLR end intcrit */
5420 + * $ANTLR start intop
5421 + * RSP2SQL.g:303:1: intop returns [ pANTLR3_COMMON_TOKEN op ] : (n= EQUAL | n= LESS | n= GREATER | n= LTE | n= GTE );
5423 +static pANTLR3_COMMON_TOKEN
5424 +intop(pRSP2SQL ctx)
5426 + pANTLR3_COMMON_TOKEN op = NULL;
5428 + pANTLR3_BASE_TREE n;
5430 + /* Initialize rule variables
5439 + // RSP2SQL.g:305:2: (n= EQUAL | n= LESS | n= GREATER | n= LTE | n= GTE )
5441 + ANTLR3_UINT32 alt3;
5475 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
5476 + EXCEPTION->message = (void *)"";
5477 + EXCEPTION->decisionNum = 3;
5478 + EXCEPTION->state = 0;
5487 + // RSP2SQL.g:305:4: n= EQUAL
5489 + n = (pANTLR3_BASE_TREE) MATCHT(EQUAL, &FOLLOW_EQUAL_in_intop383);
5490 + if (HASEXCEPTION())
5496 + op= n->getToken(n);
5502 + // RSP2SQL.g:307:4: n= LESS
5504 + n = (pANTLR3_BASE_TREE) MATCHT(LESS, &FOLLOW_LESS_in_intop396);
5505 + if (HASEXCEPTION())
5511 + op= n->getToken(n);
5517 + // RSP2SQL.g:309:4: n= GREATER
5519 + n = (pANTLR3_BASE_TREE) MATCHT(GREATER, &FOLLOW_GREATER_in_intop409);
5520 + if (HASEXCEPTION())
5526 + op= n->getToken(n);
5532 + // RSP2SQL.g:311:4: n= LTE
5534 + n = (pANTLR3_BASE_TREE) MATCHT(LTE, &FOLLOW_LTE_in_intop422);
5535 + if (HASEXCEPTION())
5541 + op= n->getToken(n);
5547 + // RSP2SQL.g:313:4: n= GTE
5549 + n = (pANTLR3_BASE_TREE) MATCHT(GTE, &FOLLOW_GTE_in_intop435);
5550 + if (HASEXCEPTION())
5556 + op= n->getToken(n);
5567 + // This is where rules clean up and exit
5569 + goto ruleintopEx; /* Prevent compiler warnings */
5572 + if (HASEXCEPTION())
5581 +/* $ANTLR end intop */
5584 + * $ANTLR start datecrit
5585 + * RSP2SQL.g:317:1: datecrit returns [ pANTLR3_STRING result, int valid ] : ^(o= dateop f= FIELD d= datespec ) ;
5587 +static RSP2SQL_datecrit_return
5588 +datecrit(pRSP2SQL ctx)
5590 + RSP2SQL_datecrit_return retval;
5592 + pANTLR3_BASE_TREE f;
5593 + pANTLR3_COMMON_TOKEN o;
5594 + #undef RETURN_TYPE_o
5595 + #define RETURN_TYPE_o pANTLR3_COMMON_TOKEN
5597 + RSP2SQL_datespec_return d;
5598 + #undef RETURN_TYPE_d
5599 + #define RETURN_TYPE_d RSP2SQL_datespec_return
5601 + /* Initialize rule variables
5605 + retval.result= NULL; retval.valid= 1;
5608 + retval.start = LT(1); retval.stop = retval.start;
5611 + // RSP2SQL.g:319:2: ( ^(o= dateop f= FIELD d= datespec ) )
5612 + // RSP2SQL.g:319:4: ^(o= dateop f= FIELD d= datespec )
5614 + FOLLOWPUSH(FOLLOW_dateop_in_datecrit464);
5618 + if (HASEXCEPTION())
5620 + goto ruledatecritEx;
5624 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
5625 + if (HASEXCEPTION())
5627 + goto ruledatecritEx;
5630 + f = (pANTLR3_BASE_TREE) MATCHT(FIELD, &FOLLOW_FIELD_in_datecrit470);
5631 + if (HASEXCEPTION())
5633 + goto ruledatecritEx;
5636 + FOLLOWPUSH(FOLLOW_datespec_in_datecrit476);
5640 + if (HASEXCEPTION())
5642 + goto ruledatecritEx;
5646 + MATCHT(ANTLR3_TOKEN_UP, NULL);
5647 + if (HASEXCEPTION())
5649 + goto ruledatecritEx;
5655 + const struct rsp_query_field_map *rqfp;
5656 + pANTLR3_STRING field;
5661 + switch (o->getType(o))
5672 + field = f->getText(f);
5674 + /* Field lookup */
5675 + rqfp = rsp_query_field_lookup((char *)field->chars, strlen((char *)field->chars));
5678 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not a valid field in queries\n", field->chars);
5680 + goto datecrit_valid_0; /* ABORT */
5683 + /* Check field type */
5684 + if (rqfp->field_type != RSP_TYPE_DATE)
5686 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not a date field\n", field->chars);
5688 + goto datecrit_valid_0; /* ABORT */
5691 + ret = snprintf(buf, sizeof(buf), "%ld", d.date);
5692 + if ((ret < 0) || (ret >= sizeof(buf)))
5694 + DPRINTF(E_LOG, L_RSP, "Date %ld too large for buffer, oops!\n", d.date);
5696 + goto datecrit_valid_0; /* ABORT */
5699 + retval.result= field->factory->newRaw(field->factory);
5700 + retval.result->append8(retval.result, "f.");
5701 + retval.result->appendS(retval.result, field);
5702 + retval.result->append8(retval.result, op);
5703 + retval.result->append8(retval.result, buf);
5715 + // This is where rules clean up and exit
5717 + goto ruledatecritEx; /* Prevent compiler warnings */
5720 + if (HASEXCEPTION())
5729 +/* $ANTLR end datecrit */
5732 + * $ANTLR start dateop
5733 + * RSP2SQL.g:377:1: dateop returns [ pANTLR3_COMMON_TOKEN op ] : (n= BEFORE | n= AFTER );
5735 +static pANTLR3_COMMON_TOKEN
5736 +dateop(pRSP2SQL ctx)
5738 + pANTLR3_COMMON_TOKEN op = NULL;
5740 + pANTLR3_BASE_TREE n;
5742 + /* Initialize rule variables
5751 + // RSP2SQL.g:379:2: (n= BEFORE | n= AFTER )
5753 + ANTLR3_UINT32 alt4;
5772 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
5773 + EXCEPTION->message = (void *)"";
5774 + EXCEPTION->decisionNum = 4;
5775 + EXCEPTION->state = 0;
5778 + goto ruledateopEx;
5784 + // RSP2SQL.g:379:4: n= BEFORE
5786 + n = (pANTLR3_BASE_TREE) MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateop505);
5787 + if (HASEXCEPTION())
5789 + goto ruledateopEx;
5793 + op= n->getToken(n);
5799 + // RSP2SQL.g:381:4: n= AFTER
5801 + n = (pANTLR3_BASE_TREE) MATCHT(AFTER, &FOLLOW_AFTER_in_dateop518);
5802 + if (HASEXCEPTION())
5804 + goto ruledateopEx;
5808 + op= n->getToken(n);
5819 + // This is where rules clean up and exit
5821 + goto ruledateopEx; /* Prevent compiler warnings */
5824 + if (HASEXCEPTION())
5833 +/* $ANTLR end dateop */
5836 + * $ANTLR start datespec
5837 + * RSP2SQL.g:385:1: datespec returns [ time_t date, int valid ] : (r= dateref | ^(o= dateop r= dateref m= INT i= dateintval ) );
5839 +static RSP2SQL_datespec_return
5840 +datespec(pRSP2SQL ctx)
5842 + RSP2SQL_datespec_return retval;
5844 + pANTLR3_BASE_TREE m;
5845 + RSP2SQL_dateref_return r;
5846 + #undef RETURN_TYPE_r
5847 + #define RETURN_TYPE_r RSP2SQL_dateref_return
5849 + pANTLR3_COMMON_TOKEN o;
5850 + #undef RETURN_TYPE_o
5851 + #define RETURN_TYPE_o pANTLR3_COMMON_TOKEN
5853 + RSP2SQL_dateintval_return i;
5854 + #undef RETURN_TYPE_i
5855 + #define RETURN_TYPE_i RSP2SQL_dateintval_return
5857 + /* Initialize rule variables
5861 + retval.date= 0; retval.valid= 1;
5864 + retval.start = LT(1); retval.stop = retval.start;
5868 + // RSP2SQL.g:387:2: (r= dateref | ^(o= dateop r= dateref m= INT i= dateintval ) )
5870 + ANTLR3_UINT32 alt5;
5891 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
5892 + EXCEPTION->message = (void *)"";
5893 + EXCEPTION->decisionNum = 5;
5894 + EXCEPTION->state = 0;
5897 + goto ruledatespecEx;
5903 + // RSP2SQL.g:387:4: r= dateref
5905 + FOLLOWPUSH(FOLLOW_dateref_in_datespec546);
5909 + if (HASEXCEPTION())
5911 + goto ruledatespecEx;
5919 + retval.date= r.date;
5926 + // RSP2SQL.g:394:4: ^(o= dateop r= dateref m= INT i= dateintval )
5928 + FOLLOWPUSH(FOLLOW_dateop_in_datespec560);
5932 + if (HASEXCEPTION())
5934 + goto ruledatespecEx;
5938 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
5939 + if (HASEXCEPTION())
5941 + goto ruledatespecEx;
5944 + FOLLOWPUSH(FOLLOW_dateref_in_datespec566);
5948 + if (HASEXCEPTION())
5950 + goto ruledatespecEx;
5953 + m = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_datespec572);
5954 + if (HASEXCEPTION())
5956 + goto ruledatespecEx;
5959 + FOLLOWPUSH(FOLLOW_dateintval_in_datespec578);
5960 + i=dateintval(ctx);
5963 + if (HASEXCEPTION())
5965 + goto ruledatespecEx;
5969 + MATCHT(ANTLR3_TOKEN_UP, NULL);
5970 + if (HASEXCEPTION())
5972 + goto ruledatespecEx;
5980 + if (!r.valid || !i.valid)
5983 + goto datespec_valid_0; /* ABORT */
5986 + ret = safe_atoi32((char *)m->getText(m)->chars, &val);
5989 + DPRINTF(E_LOG, L_RSP, "Could not convert '%s' to integer\n", (char *)m->getText(m));
5991 + goto datespec_valid_0; /* ABORT */
5994 + switch (o->getType(o))
5997 + retval.date= r.date - (val * i.period);
6001 + retval.date= r.date + (val * i.period);
6018 + // This is where rules clean up and exit
6020 + goto ruledatespecEx; /* Prevent compiler warnings */
6023 + if (HASEXCEPTION())
6032 +/* $ANTLR end datespec */
6035 + * $ANTLR start dateref
6036 + * RSP2SQL.g:429:1: dateref returns [ time_t date, int valid ] : (n= DATE | TODAY );
6038 +static RSP2SQL_dateref_return
6039 +dateref(pRSP2SQL ctx)
6041 + RSP2SQL_dateref_return retval;
6043 + pANTLR3_BASE_TREE n;
6045 + /* Initialize rule variables
6049 + retval.date= 0; retval.valid= 1;
6051 + retval.start = LT(1); retval.stop = retval.start;
6055 + // RSP2SQL.g:431:2: (n= DATE | TODAY )
6057 + ANTLR3_UINT32 alt6;
6076 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
6077 + EXCEPTION->message = (void *)"";
6078 + EXCEPTION->decisionNum = 6;
6079 + EXCEPTION->state = 0;
6082 + goto ruledaterefEx;
6088 + // RSP2SQL.g:431:4: n= DATE
6090 + n = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateref607);
6091 + if (HASEXCEPTION())
6093 + goto ruledaterefEx;
6101 + ret = strptime((char *)n->getText(n), "%Y-%m-%d", &tm);
6104 + DPRINTF(E_LOG, L_RSP, "Date '%s' could not be interpreted\n", (char *)n->getText(n));
6106 + goto dateref_valid_0; /* ABORT */
6111 + DPRINTF(E_LOG, L_RSP, "Garbage at end of date '%s' ?!\n", (char *)n->getText(n));
6113 + retval.date= mktime(&tm);
6114 + if (retval.date == (time_t) -1)
6116 + DPRINTF(E_LOG, L_RSP, "Date '%s' could not be converted to an epoch\n", (char *)n->getText(n));
6118 + goto dateref_valid_0; /* ABORT */
6130 + // RSP2SQL.g:460:4: TODAY
6132 + MATCHT(TODAY, &FOLLOW_TODAY_in_dateref616);
6133 + if (HASEXCEPTION())
6135 + goto ruledaterefEx;
6139 + retval.date= time(NULL);
6150 + // This is where rules clean up and exit
6152 + goto ruledaterefEx; /* Prevent compiler warnings */
6155 + if (HASEXCEPTION())
6164 +/* $ANTLR end dateref */
6167 + * $ANTLR start dateintval
6168 + * RSP2SQL.g:464:1: dateintval returns [ time_t period, int valid ] : ( DAY | WEEK | MONTH | YEAR );
6170 +static RSP2SQL_dateintval_return
6171 +dateintval(pRSP2SQL ctx)
6173 + RSP2SQL_dateintval_return retval;
6175 + /* Initialize rule variables
6179 + retval.period= 0; retval.valid= 1;
6180 + retval.start = LT(1); retval.stop = retval.start;
6184 + // RSP2SQL.g:466:2: ( DAY | WEEK | MONTH | YEAR )
6186 + ANTLR3_UINT32 alt7;
6215 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
6216 + EXCEPTION->message = (void *)"";
6217 + EXCEPTION->decisionNum = 7;
6218 + EXCEPTION->state = 0;
6221 + goto ruledateintvalEx;
6227 + // RSP2SQL.g:466:4: DAY
6229 + MATCHT(DAY, &FOLLOW_DAY_in_dateintval640);
6230 + if (HASEXCEPTION())
6232 + goto ruledateintvalEx;
6236 + retval.period= 24 * 60 * 60;
6242 + // RSP2SQL.g:468:4: WEEK
6244 + MATCHT(WEEK, &FOLLOW_WEEK_in_dateintval649);
6245 + if (HASEXCEPTION())
6247 + goto ruledateintvalEx;
6251 + retval.period= 7 * 24 * 60 * 60;
6257 + // RSP2SQL.g:470:4: MONTH
6259 + MATCHT(MONTH, &FOLLOW_MONTH_in_dateintval658);
6260 + if (HASEXCEPTION())
6262 + goto ruledateintvalEx;
6266 + retval.period= 30 * 24 * 60 * 60;
6272 + // RSP2SQL.g:472:4: YEAR
6274 + MATCHT(YEAR, &FOLLOW_YEAR_in_dateintval667);
6275 + if (HASEXCEPTION())
6277 + goto ruledateintvalEx;
6281 + retval.period= 365 * 24 * 60 * 60;
6292 + // This is where rules clean up and exit
6294 + goto ruledateintvalEx; /* Prevent compiler warnings */
6295 + ruledateintvalEx: ;
6297 + if (HASEXCEPTION())
6306 +/* $ANTLR end dateintval */
6307 +/* End of parsing rules
6308 + * ==============================================
6311 +/* ==============================================
6312 + * Syntactic predicates
6314 +/* End of syntactic predicates
6315 + * ==============================================
6324 + * =============================================================================
6326 diff --git a/src/pregen/RSP2SQL.h b/src/pregen/RSP2SQL.h
6327 new file mode 100644
6328 index 0000000..08ac7bb
6330 +++ b/src/pregen/RSP2SQL.h
6333 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
6335 + * - From the grammar source file : RSP2SQL.g
6336 + * - On : 2016-01-01 12:23:43
6337 + * - for the tree parser : RSP2SQLTreeParser *
6338 + * Editing it, at least manually, is not wise.
6340 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
6343 + * The tree parser RSP2SQL has the callable functions (rules) shown below,
6344 + * which will invoke the code for the associated rule in the source grammar
6345 + * assuming that the input stream is pointing to a token/text stream that could begin
6348 + * For instance if you call the first (topmost) rule in a parser grammar, you will
6349 + * get the results of a full parse, but calling a rule half way through the grammar will
6350 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
6351 + * in editors and so on.
6353 + * The parser entry points are called indirectly (by function pointer to function) via
6354 + * a parser context typedef pRSP2SQL, which is returned from a call to RSP2SQLNew().
6356 + * The methods in pRSP2SQL are as follows:
6358 + * - pANTLR3_STRING pRSP2SQL->query(pRSP2SQL)
6359 + * - RSP2SQL_expr_return pRSP2SQL->expr(pRSP2SQL)
6360 + * - RSP2SQL_strcrit_return pRSP2SQL->strcrit(pRSP2SQL)
6361 + * - pANTLR3_COMMON_TOKEN pRSP2SQL->strop(pRSP2SQL)
6362 + * - RSP2SQL_intcrit_return pRSP2SQL->intcrit(pRSP2SQL)
6363 + * - pANTLR3_COMMON_TOKEN pRSP2SQL->intop(pRSP2SQL)
6364 + * - RSP2SQL_datecrit_return pRSP2SQL->datecrit(pRSP2SQL)
6365 + * - pANTLR3_COMMON_TOKEN pRSP2SQL->dateop(pRSP2SQL)
6366 + * - RSP2SQL_datespec_return pRSP2SQL->datespec(pRSP2SQL)
6367 + * - RSP2SQL_dateref_return pRSP2SQL->dateref(pRSP2SQL)
6368 + * - RSP2SQL_dateintval_return pRSP2SQL->dateintval(pRSP2SQL)
6370 + * The return type for any particular rule is of course determined by the source
6373 +// [The "BSD licence"]
6374 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
6375 +// http://www.temporal-wave.com
6376 +// http://www.linkedin.com/in/jimidle
6378 +// All rights reserved.
6380 +// Redistribution and use in source and binary forms, with or without
6381 +// modification, are permitted provided that the following conditions
6383 +// 1. Redistributions of source code must retain the above copyright
6384 +// notice, this list of conditions and the following disclaimer.
6385 +// 2. Redistributions in binary form must reproduce the above copyright
6386 +// notice, this list of conditions and the following disclaimer in the
6387 +// documentation and/or other materials provided with the distribution.
6388 +// 3. The name of the author may not be used to endorse or promote products
6389 +// derived from this software without specific prior written permission.
6391 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
6392 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
6393 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
6394 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
6395 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
6396 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
6397 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
6398 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
6399 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
6400 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6404 +/* =============================================================================
6405 + * Standard antlr3 C runtime definitions
6407 +#include <antlr3.h>
6409 +/* End of standard antlr 3 runtime definitions
6410 + * =============================================================================
6417 +// Forward declare the context typedef so that we can use it before it is
6418 +// properly defined. Delegators and delegates (from import statements) are
6419 +// interdependent and their context structures contain pointers to each other
6420 +// C only allows such things to be declared if you pre-declare the typedef.
6422 +typedef struct RSP2SQL_Ctx_struct RSP2SQL, * pRSP2SQL;
6426 + /* Needs #define _GNU_SOURCE for strptime() */
6428 + #include <stdio.h>
6429 + #include <string.h>
6431 + #include <stdint.h>
6433 + #include "logger.h"
6436 + #include "rsp_query.h"
6439 +#ifdef ANTLR3_WINDOWS
6440 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
6441 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
6442 +// initialized but unused variable - tree rewrite variables declared but not needed
6443 +// Unreferenced local variable - lexer rule declares but does not always use _type
6444 +// potentially unitialized variable used - retval always returned from a rule
6445 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
6447 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
6448 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
6449 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
6450 +// this is a matter of orthogonality hence I disable that one.
6452 +#pragma warning( disable : 4100 )
6453 +#pragma warning( disable : 4101 )
6454 +#pragma warning( disable : 4127 )
6455 +#pragma warning( disable : 4189 )
6456 +#pragma warning( disable : 4505 )
6457 +#pragma warning( disable : 4701 )
6459 +typedef struct RSP2SQL_expr_return_struct
6461 + pANTLR3_BASE_TREE start;
6462 + pANTLR3_BASE_TREE stop;
6463 + pANTLR3_STRING result;
6466 + RSP2SQL_expr_return;
6468 +typedef struct RSP2SQL_strcrit_return_struct
6470 + pANTLR3_BASE_TREE start;
6471 + pANTLR3_BASE_TREE stop;
6472 + pANTLR3_STRING result;
6475 + RSP2SQL_strcrit_return;
6477 +typedef struct RSP2SQL_intcrit_return_struct
6479 + pANTLR3_BASE_TREE start;
6480 + pANTLR3_BASE_TREE stop;
6481 + pANTLR3_STRING result;
6484 + RSP2SQL_intcrit_return;
6486 +typedef struct RSP2SQL_datecrit_return_struct
6488 + pANTLR3_BASE_TREE start;
6489 + pANTLR3_BASE_TREE stop;
6490 + pANTLR3_STRING result;
6493 + RSP2SQL_datecrit_return;
6495 +typedef struct RSP2SQL_datespec_return_struct
6497 + pANTLR3_BASE_TREE start;
6498 + pANTLR3_BASE_TREE stop;
6502 + RSP2SQL_datespec_return;
6504 +typedef struct RSP2SQL_dateref_return_struct
6506 + pANTLR3_BASE_TREE start;
6507 + pANTLR3_BASE_TREE stop;
6511 + RSP2SQL_dateref_return;
6513 +typedef struct RSP2SQL_dateintval_return_struct
6515 + pANTLR3_BASE_TREE start;
6516 + pANTLR3_BASE_TREE stop;
6520 + RSP2SQL_dateintval_return;
6524 +/** Context tracking structure for RSP2SQL
6526 +struct RSP2SQL_Ctx_struct
6528 + /** Built in ANTLR3 context tracker contains all the generic elements
6529 + * required for context tracking.
6531 + pANTLR3_TREE_PARSER pTreeParser;
6534 + pANTLR3_STRING (*query) (struct RSP2SQL_Ctx_struct * ctx);
6535 + RSP2SQL_expr_return (*expr) (struct RSP2SQL_Ctx_struct * ctx);
6536 + RSP2SQL_strcrit_return (*strcrit) (struct RSP2SQL_Ctx_struct * ctx);
6537 + pANTLR3_COMMON_TOKEN (*strop) (struct RSP2SQL_Ctx_struct * ctx);
6538 + RSP2SQL_intcrit_return (*intcrit) (struct RSP2SQL_Ctx_struct * ctx);
6539 + pANTLR3_COMMON_TOKEN (*intop) (struct RSP2SQL_Ctx_struct * ctx);
6540 + RSP2SQL_datecrit_return (*datecrit) (struct RSP2SQL_Ctx_struct * ctx);
6541 + pANTLR3_COMMON_TOKEN (*dateop) (struct RSP2SQL_Ctx_struct * ctx);
6542 + RSP2SQL_datespec_return (*datespec) (struct RSP2SQL_Ctx_struct * ctx);
6543 + RSP2SQL_dateref_return (*dateref) (struct RSP2SQL_Ctx_struct * ctx);
6544 + RSP2SQL_dateintval_return (*dateintval) (struct RSP2SQL_Ctx_struct * ctx);
6545 + // Delegated rules
6546 + const char * (*getGrammarFileName)();
6547 + void (*free) (struct RSP2SQL_Ctx_struct * ctx);
6551 +// Function protoypes for the constructor functions that external translation units
6552 +// such as delegators and delegates may wish to call.
6554 +ANTLR3_API pRSP2SQL RSP2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream);
6555 +ANTLR3_API pRSP2SQL RSP2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
6557 +/** Symbolic definitions of all the tokens that the tree parser will work with.
6560 + * Antlr will define EOF, but we can't use that as it it is too common in
6561 + * in C header files and that would be confusing. There is no way to filter this out at the moment
6562 + * so we just undef it here for now. That isn't the value we get back from C recognizers
6563 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
6587 +#define INCLUDES 13
6604 +#define EOF ANTLR3_TOKEN_EOF
6607 +#ifndef TOKENSOURCE
6608 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
6611 +/* End of token definitions for RSP2SQL
6612 + * =============================================================================
6622 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
6623 diff --git a/src/pregen/RSP2SQL.u b/src/pregen/RSP2SQL.u
6624 new file mode 100644
6625 index 0000000..53d8cda
6627 +++ b/src/pregen/RSP2SQL.u
6629 +RSP2SQL.g: RSP.tokens
6630 +RSP2SQL.c : RSP2SQL.g
6631 +./RSP2SQL.tokens : RSP2SQL.g
6632 +RSP2SQL.h : RSP2SQL.g
6633 +ANTLR_PRODUCTS += RSP2SQL.c ./RSP2SQL.tokens RSP2SQL.h
6634 \ No newline at end of file
6635 diff --git a/src/pregen/RSPLexer.c b/src/pregen/RSPLexer.c
6636 new file mode 100644
6637 index 0000000..2e3faae
6639 +++ b/src/pregen/RSPLexer.c
6642 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
6644 + * - From the grammar source file : RSP.g
6645 + * - On : 2016-01-01 12:23:42
6646 + * - for the lexer : RSPLexerLexer *
6647 + * Editing it, at least manually, is not wise.
6649 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
6653 +// [The "BSD licence"]
6654 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
6655 +// http://www.temporal-wave.com
6656 +// http://www.linkedin.com/in/jimidle
6658 +// All rights reserved.
6660 +// Redistribution and use in source and binary forms, with or without
6661 +// modification, are permitted provided that the following conditions
6663 +// 1. Redistributions of source code must retain the above copyright
6664 +// notice, this list of conditions and the following disclaimer.
6665 +// 2. Redistributions in binary form must reproduce the above copyright
6666 +// notice, this list of conditions and the following disclaimer in the
6667 +// documentation and/or other materials provided with the distribution.
6668 +// 3. The name of the author may not be used to endorse or promote products
6669 +// derived from this software without specific prior written permission.
6671 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
6672 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
6673 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
6674 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
6675 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
6676 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
6677 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
6678 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
6679 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
6680 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6682 +/* -----------------------------------------
6683 + * Include the ANTLR3 generated header file.
6685 +#include "RSPLexer.h"
6686 +/* ----------------------------------------- */
6689 +/** String literals used by RSPLexer that we must do things like MATCHS() with.
6690 + * C will normally just lay down 8 bit characters, and you can use L"xxx" to
6691 + * get wchar_t, but wchar_t is 16 bits on Windows, which is not UTF32 and so
6692 + * we perform this little trick of defining the literals as arrays of UINT32
6693 + * and passing in the address of these.
6695 +static ANTLR3_UCHAR lit_1[] = { 0x61, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR};
6696 +static ANTLR3_UCHAR lit_2[] = { 0x6F, 0x72, ANTLR3_STRING_TERMINATOR};
6697 +static ANTLR3_UCHAR lit_3[] = { 0x69, 0x6E, 0x63, 0x6C, 0x75, 0x64, 0x65, 0x73, ANTLR3_STRING_TERMINATOR};
6698 +static ANTLR3_UCHAR lit_4[] = { 0x73, 0x74, 0x61, 0x72, 0x74, 0x73, 0x77, 0x69, 0x74, 0x68, ANTLR3_STRING_TERMINATOR};
6699 +static ANTLR3_UCHAR lit_5[] = { 0x65, 0x6E, 0x64, 0x73, 0x77, 0x69, 0x74, 0x68, ANTLR3_STRING_TERMINATOR};
6700 +static ANTLR3_UCHAR lit_6[] = { 0x3E, 0x3D, ANTLR3_STRING_TERMINATOR};
6701 +static ANTLR3_UCHAR lit_7[] = { 0x3C, 0x3D, ANTLR3_STRING_TERMINATOR};
6702 +static ANTLR3_UCHAR lit_8[] = { 0x62, 0x65, 0x66, 0x6F, 0x72, 0x65, ANTLR3_STRING_TERMINATOR};
6703 +static ANTLR3_UCHAR lit_9[] = { 0x61, 0x66, 0x74, 0x65, 0x72, ANTLR3_STRING_TERMINATOR};
6704 +static ANTLR3_UCHAR lit_10[] = { 0x64, 0x61, 0x79, ANTLR3_STRING_TERMINATOR};
6705 +static ANTLR3_UCHAR lit_11[] = { 0x64, 0x61, 0x79, 0x73, ANTLR3_STRING_TERMINATOR};
6706 +static ANTLR3_UCHAR lit_12[] = { 0x77, 0x65, 0x65, 0x6B, ANTLR3_STRING_TERMINATOR};
6707 +static ANTLR3_UCHAR lit_13[] = { 0x77, 0x65, 0x65, 0x6B, 0x73, ANTLR3_STRING_TERMINATOR};
6708 +static ANTLR3_UCHAR lit_14[] = { 0x6D, 0x6F, 0x6E, 0x74, 0x68, ANTLR3_STRING_TERMINATOR};
6709 +static ANTLR3_UCHAR lit_15[] = { 0x6D, 0x6F, 0x6E, 0x74, 0x68, 0x73, ANTLR3_STRING_TERMINATOR};
6710 +static ANTLR3_UCHAR lit_16[] = { 0x79, 0x65, 0x61, 0x72, ANTLR3_STRING_TERMINATOR};
6711 +static ANTLR3_UCHAR lit_17[] = { 0x79, 0x65, 0x61, 0x72, 0x73, ANTLR3_STRING_TERMINATOR};
6712 +static ANTLR3_UCHAR lit_18[] = { 0x74, 0x6F, 0x64, 0x61, 0x79, ANTLR3_STRING_TERMINATOR};
6717 +/* MACROS that hide the C interface implementations from the
6718 + * generated code, which makes it a little more understandable to the human eye.
6719 + * I am very much against using C pre-processor macros for function calls and bits
6720 + * of code as you cannot see what is happening when single stepping in debuggers
6721 + * and so on. The exception (in my book at least) is for generated code, where you are
6722 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
6723 + * hides some indirect calls, but is always referring to the input stream. This is
6724 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
6725 + * the runtime interfaces without changing the generated code too often, without
6726 + * confusing the reader of the generated output, who may not wish to know the gory
6727 + * details of the interface inheritance.
6732 +/* Aids in accessing scopes for grammar programmers
6737 +#define SCOPE_TYPE(scope) pRSPLexer_##scope##_SCOPE
6738 +#define SCOPE_STACK(scope) pRSPLexer_##scope##Stack
6739 +#define SCOPE_TOP(scope) ctx->pRSPLexer_##scope##Top
6740 +#define SCOPE_SIZE(scope) ctx->pRSPLexer_##scope##Stack_limit
6741 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
6744 +/* Macros for accessing things in a lexer
6749 +#undef GETCHARINDEX
6751 +#undef GETCHARPOSITIONINLINE
6763 +#undef HASEXCEPTION
6771 +#undef BACKTRACKING
6774 +#undef HAVEPARSEDRULE
6783 +#define LEXER ctx->pLexer
6784 +#define RECOGNIZER LEXER->rec
6785 +#define LEXSTATE RECOGNIZER->state
6786 +#define TOKSOURCE LEXSTATE->tokSource
6787 +#define GETCHARINDEX() LEXER->getCharIndex(LEXER)
6788 +#define GETLINE() LEXER->getLine(LEXER)
6789 +#define GETTEXT() LEXER->getText(LEXER)
6790 +#define GETCHARPOSITIONINLINE() LEXER->getCharPositionInLine(LEXER)
6791 +#define EMIT() LEXSTATE->type = _type; LEXER->emit(LEXER)
6792 +#define EMITNEW(t) LEXER->emitNew(LEXER, t)
6793 +#define MATCHC(c) LEXER->matchc(LEXER, c)
6794 +#define MATCHS(s) LEXER->matchs(LEXER, s)
6795 +#define MATCHRANGE(c1,c2) LEXER->matchRange(LEXER, c1, c2)
6796 +#define MATCHANY() LEXER->matchAny(LEXER)
6797 +#define LTOKEN LEXSTATE->token
6798 +#define HASFAILED() (LEXSTATE->failed == ANTLR3_TRUE)
6799 +#define BACKTRACKING LEXSTATE->backtracking
6800 +#define FAILEDFLAG LEXSTATE->failed
6801 +#define INPUT LEXER->input
6802 +#define STRSTREAM INPUT
6803 +#define ISTREAM INPUT->istream
6804 +#define INDEX() ISTREAM->index(ISTREAM)
6805 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
6806 +#define EOF_TOKEN &(LEXSTATE->tokSource->eofToken)
6807 +#define HASEXCEPTION() (LEXSTATE->error == ANTLR3_TRUE)
6808 +#define EXCEPTION LEXSTATE->exception
6809 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
6810 +#define LRECOVER() LEXER->recover(LEXER)
6811 +#define MARK() ISTREAM->mark(ISTREAM)
6812 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
6813 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
6814 +#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si)
6815 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
6816 +#define PUSHSTREAM(str) LEXER->pushCharStream(LEXER, str)
6817 +#define POPSTREAM() LEXER->popCharStream(LEXER)
6818 +#define SETTEXT(str) LEXSTATE->text = str
6819 +#define SKIP() LEXSTATE->token = &(TOKSOURCE->skipToken)
6820 +#define USER1 LEXSTATE->user1
6821 +#define USER2 LEXSTATE->user2
6822 +#define USER3 LEXSTATE->user3
6823 +#define CUSTOM LEXSTATE->custom
6824 +#define RULEMEMO LEXSTATE->ruleMemo
6825 +#define DBG RECOGNIZER->debugger
6827 +/* If we have been told we can rely on the standard 8 bit or 16 bit input
6828 + * stream, then we can define our macros to use the direct pointers
6829 + * in the input object, which is much faster than indirect calls. This
6830 + * is really only significant to lexers with a lot of fragment rules (which
6831 + * do not place LA(1) in a temporary at the moment) and even then
6832 + * only if there is a lot of input (order of say 1M or so).
6834 +#if defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16)
6836 +# ifdef ANTLR3_INLINE_INPUT_ASCII
6838 +/* 8 bit "ASCII" (actually any 8 bit character set) */
6840 +# define NEXTCHAR ((pANTLR3_UINT8)(INPUT->nextChar))
6841 +# define DATAP ((pANTLR3_UINT8)(INPUT->data))
6845 +# define NEXTCHAR ((pANTLR3_UINT16)(INPUT->nextChar))
6846 +# define DATAP ((pANTLR3_UINT16)(INPUT->data))
6850 +# define LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1)))
6851 +# define CONSUME() \
6853 + if (NEXTCHAR < (DATAP + INPUT->sizeBuf)) \
6855 + INPUT->charPositionInLine++; \
6856 + if ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar) \
6859 + INPUT->charPositionInLine = 0; \
6860 + INPUT->currentLine = (void *)(NEXTCHAR + 1); \
6862 + INPUT->nextChar = (void *)(NEXTCHAR + 1); \
6868 +// Pick up the input character by calling the input stream implementation.
6870 +#define CONSUME() INPUT->istream->consume(INPUT->istream)
6871 +#define LA(n) INPUT->istream->_LA(INPUT->istream, n)
6874 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
6876 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
6877 + * then for the present you must use different names for your defines as these are hard coded
6878 + * in the code generator. It would be better not to use such names internally, and maybe
6879 + * we can change this in a forthcoming release. I deliberately do not #undef these
6880 + * here as this will at least give you a redefined error somewhere if they clash.
6882 +#define UP ANTLR3_TOKEN_UP
6883 +#define DOWN ANTLR3_TOKEN_DOWN
6884 +#define EOR ANTLR3_TOKEN_EOR
6885 +#define INVALID ANTLR3_TOKEN_INVALID
6888 +/* =============================================================================
6889 + * Functions to create and destroy scopes. First come the rule scopes, followed
6890 + * by the global declared scopes.
6895 +/* ============================================================================= */
6897 +/* =============================================================================
6898 + * Start of recognizer
6902 +/* Forward declare the locally static matching functions we have generated and any predicate functions.
6904 +static ANTLR3_INLINE void mQUOTE (pRSPLexer ctx);
6905 +static ANTLR3_INLINE void mLPAR (pRSPLexer ctx);
6906 +static ANTLR3_INLINE void mRPAR (pRSPLexer ctx);
6907 +static ANTLR3_INLINE void mAND (pRSPLexer ctx);
6908 +static ANTLR3_INLINE void mOR (pRSPLexer ctx);
6909 +static ANTLR3_INLINE void mNOT (pRSPLexer ctx);
6910 +static ANTLR3_INLINE void mEQUAL (pRSPLexer ctx);
6911 +static ANTLR3_INLINE void mINCLUDES (pRSPLexer ctx);
6912 +static ANTLR3_INLINE void mSTARTSW (pRSPLexer ctx);
6913 +static ANTLR3_INLINE void mENDSW (pRSPLexer ctx);
6914 +static ANTLR3_INLINE void mGREATER (pRSPLexer ctx);
6915 +static ANTLR3_INLINE void mLESS (pRSPLexer ctx);
6916 +static ANTLR3_INLINE void mGTE (pRSPLexer ctx);
6917 +static ANTLR3_INLINE void mLTE (pRSPLexer ctx);
6918 +static ANTLR3_INLINE void mBEFORE (pRSPLexer ctx);
6919 +static ANTLR3_INLINE void mAFTER (pRSPLexer ctx);
6920 +static ANTLR3_INLINE void mDAY (pRSPLexer ctx);
6921 +static ANTLR3_INLINE void mWEEK (pRSPLexer ctx);
6922 +static ANTLR3_INLINE void mMONTH (pRSPLexer ctx);
6923 +static ANTLR3_INLINE void mYEAR (pRSPLexer ctx);
6924 +static ANTLR3_INLINE void mTODAY (pRSPLexer ctx);
6925 +static ANTLR3_INLINE void mNEWLINE (pRSPLexer ctx);
6926 +static ANTLR3_INLINE void mWS (pRSPLexer ctx);
6927 +static ANTLR3_INLINE void mFIELD (pRSPLexer ctx);
6928 +static ANTLR3_INLINE void mINT (pRSPLexer ctx);
6929 +static ANTLR3_INLINE void mDATE (pRSPLexer ctx);
6930 +static ANTLR3_INLINE void mSTR (pRSPLexer ctx);
6931 +static ANTLR3_INLINE void mESCAPED (pRSPLexer ctx);
6932 +static ANTLR3_INLINE void mDIGIT09 (pRSPLexer ctx);
6933 +static ANTLR3_INLINE void mDIGIT19 (pRSPLexer ctx);
6934 +static ANTLR3_INLINE void mTokens (pRSPLexer ctx);
6935 +static void RSPLexerFree(pRSPLexer ctx);
6937 +/* =========================================================================
6938 + * Lexer matching rules end.
6939 + * =========================================================================
6945 +RSPLexerFree (pRSPLexer ctx)
6947 + LEXER->free(LEXER);
6952 +/** \brief Name of the grammar file that generated this code
6954 +static const char fileName[] = "RSP.g";
6956 +/** \brief Return the name of the grammar file that generated this code.
6958 +static const char * getGrammarFileName()
6963 +/** \brief Create a new lexer called RSPLexer
6965 + * \param[in] instream Pointer to an initialized input stream
6967 + * - Success pRSPLexer initialized for the lex start
6970 +ANTLR3_API pRSPLexer RSPLexerNew
6971 +(pANTLR3_INPUT_STREAM instream)
6973 + // See if we can create a new lexer with the standard constructor
6975 + return RSPLexerNewSSD(instream, NULL);
6978 +/** \brief Create a new lexer called RSPLexer
6980 + * \param[in] instream Pointer to an initialized input stream
6981 + * \param[state] state Previously created shared recognizer stat
6983 + * - Success pRSPLexer initialized for the lex start
6986 +ANTLR3_API pRSPLexer RSPLexerNewSSD
6987 +(pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
6989 + pRSPLexer ctx; // Context structure we will build and return
6991 + ctx = (pRSPLexer) ANTLR3_CALLOC(1, sizeof(RSPLexer));
6995 + // Failed to allocate memory for lexer context
6999 + /* -------------------------------------------------------------------
7000 + * Memory for basic structure is allocated, now to fill in
7001 + * in base ANTLR3 structures. We initialize the function pointers
7002 + * for the standard ANTLR3 lexer function set, but upon return
7003 + * from here, the programmer may set the pointers to provide custom
7004 + * implementations of each function.
7006 + * We don't use the macros defined in RSPLexer.h here so you can get a sense
7007 + * of what goes where.
7010 + /* Create a base lexer, using the supplied input stream
7012 + ctx->pLexer = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state);
7014 + /* Check that we allocated the memory correctly
7016 + if (ctx->pLexer == NULL)
7021 + /* Install the implementation of our RSPLexer interface
7023 + ctx->mQUOTE = mQUOTE;
7024 + ctx->mLPAR = mLPAR;
7025 + ctx->mRPAR = mRPAR;
7029 + ctx->mEQUAL = mEQUAL;
7030 + ctx->mINCLUDES = mINCLUDES;
7031 + ctx->mSTARTSW = mSTARTSW;
7032 + ctx->mENDSW = mENDSW;
7033 + ctx->mGREATER = mGREATER;
7034 + ctx->mLESS = mLESS;
7037 + ctx->mBEFORE = mBEFORE;
7038 + ctx->mAFTER = mAFTER;
7040 + ctx->mWEEK = mWEEK;
7041 + ctx->mMONTH = mMONTH;
7042 + ctx->mYEAR = mYEAR;
7043 + ctx->mTODAY = mTODAY;
7044 + ctx->mNEWLINE = mNEWLINE;
7046 + ctx->mFIELD = mFIELD;
7048 + ctx->mDATE = mDATE;
7050 + ctx->mESCAPED = mESCAPED;
7051 + ctx->mDIGIT09 = mDIGIT09;
7052 + ctx->mDIGIT19 = mDIGIT19;
7053 + ctx->mTokens = mTokens;
7055 + /** When the nextToken() call is made to this lexer's pANTLR3_TOKEN_SOURCE
7056 + * it will call mTokens() in this generated code, and will pass it the ctx
7057 + * pointer of this lexer, not the context of the base lexer, so store that now.
7059 + ctx->pLexer->ctx = ctx;
7061 + /**Install the token matching function
7063 + ctx->pLexer->mTokens = (void (*) (void *))(mTokens);
7065 + ctx->getGrammarFileName = getGrammarFileName;
7066 + ctx->free = RSPLexerFree;
7072 + /* Return the newly built lexer to the caller
7078 +/* =========================================================================
7079 + * Functions to match the lexer grammar defined tokens from the input stream
7082 +// Comes from: 85:7: ( '\"' )
7083 +/** \brief Lexer rule generated by ANTLR3
7085 + * $ANTLR start QUOTE
7087 + * Looks to match the characters the constitute the token QUOTE
7088 + * from the attached input stream.
7092 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7094 +static ANTLR3_INLINE
7095 +void mQUOTE(pRSPLexer ctx)
7097 + ANTLR3_UINT32 _type;
7102 + // RSP.g:85:7: ( '\"' )
7103 + // RSP.g:85:9: '\"'
7106 + if (HASEXCEPTION())
7114 + LEXSTATE->type = _type;
7116 + // This is where rules clean up and exit
7118 + goto ruleQUOTEEx; /* Prevent compiler warnings */
7122 +// $ANTLR end QUOTE
7124 +// Comes from: 86:6: ( '(' )
7125 +/** \brief Lexer rule generated by ANTLR3
7127 + * $ANTLR start LPAR
7129 + * Looks to match the characters the constitute the token LPAR
7130 + * from the attached input stream.
7134 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7136 +static ANTLR3_INLINE
7137 +void mLPAR(pRSPLexer ctx)
7139 + ANTLR3_UINT32 _type;
7144 + // RSP.g:86:6: ( '(' )
7145 + // RSP.g:86:8: '('
7148 + if (HASEXCEPTION())
7156 + LEXSTATE->type = _type;
7158 + // This is where rules clean up and exit
7160 + goto ruleLPAREx; /* Prevent compiler warnings */
7166 +// Comes from: 87:6: ( ')' )
7167 +/** \brief Lexer rule generated by ANTLR3
7169 + * $ANTLR start RPAR
7171 + * Looks to match the characters the constitute the token RPAR
7172 + * from the attached input stream.
7176 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7178 +static ANTLR3_INLINE
7179 +void mRPAR(pRSPLexer ctx)
7181 + ANTLR3_UINT32 _type;
7186 + // RSP.g:87:6: ( ')' )
7187 + // RSP.g:87:8: ')'
7190 + if (HASEXCEPTION())
7198 + LEXSTATE->type = _type;
7200 + // This is where rules clean up and exit
7202 + goto ruleRPAREx; /* Prevent compiler warnings */
7208 +// Comes from: 89:5: ( 'and' )
7209 +/** \brief Lexer rule generated by ANTLR3
7211 + * $ANTLR start AND
7213 + * Looks to match the characters the constitute the token AND
7214 + * from the attached input stream.
7218 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7220 +static ANTLR3_INLINE
7221 +void mAND(pRSPLexer ctx)
7223 + ANTLR3_UINT32 _type;
7228 + // RSP.g:89:5: ( 'and' )
7229 + // RSP.g:89:7: 'and'
7232 + if (HASEXCEPTION())
7241 + LEXSTATE->type = _type;
7243 + // This is where rules clean up and exit
7245 + goto ruleANDEx; /* Prevent compiler warnings */
7251 +// Comes from: 90:4: ( 'or' )
7252 +/** \brief Lexer rule generated by ANTLR3
7256 + * Looks to match the characters the constitute the token OR
7257 + * from the attached input stream.
7261 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7263 +static ANTLR3_INLINE
7264 +void mOR(pRSPLexer ctx)
7266 + ANTLR3_UINT32 _type;
7271 + // RSP.g:90:4: ( 'or' )
7272 + // RSP.g:90:6: 'or'
7275 + if (HASEXCEPTION())
7284 + LEXSTATE->type = _type;
7286 + // This is where rules clean up and exit
7288 + goto ruleOREx; /* Prevent compiler warnings */
7294 +// Comes from: 91:5: ( '!' )
7295 +/** \brief Lexer rule generated by ANTLR3
7297 + * $ANTLR start NOT
7299 + * Looks to match the characters the constitute the token NOT
7300 + * from the attached input stream.
7304 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7306 +static ANTLR3_INLINE
7307 +void mNOT(pRSPLexer ctx)
7309 + ANTLR3_UINT32 _type;
7314 + // RSP.g:91:5: ( '!' )
7315 + // RSP.g:91:7: '!'
7318 + if (HASEXCEPTION())
7326 + LEXSTATE->type = _type;
7328 + // This is where rules clean up and exit
7330 + goto ruleNOTEx; /* Prevent compiler warnings */
7336 +// Comes from: 94:7: ( '=' )
7337 +/** \brief Lexer rule generated by ANTLR3
7339 + * $ANTLR start EQUAL
7341 + * Looks to match the characters the constitute the token EQUAL
7342 + * from the attached input stream.
7346 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7348 +static ANTLR3_INLINE
7349 +void mEQUAL(pRSPLexer ctx)
7351 + ANTLR3_UINT32 _type;
7356 + // RSP.g:94:7: ( '=' )
7357 + // RSP.g:94:9: '='
7360 + if (HASEXCEPTION())
7368 + LEXSTATE->type = _type;
7370 + // This is where rules clean up and exit
7372 + goto ruleEQUALEx; /* Prevent compiler warnings */
7376 +// $ANTLR end EQUAL
7378 +// Comes from: 97:9: ( 'includes' )
7379 +/** \brief Lexer rule generated by ANTLR3
7381 + * $ANTLR start INCLUDES
7383 + * Looks to match the characters the constitute the token INCLUDES
7384 + * from the attached input stream.
7388 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7390 +static ANTLR3_INLINE
7391 +void mINCLUDES(pRSPLexer ctx)
7393 + ANTLR3_UINT32 _type;
7398 + // RSP.g:97:9: ( 'includes' )
7399 + // RSP.g:97:11: 'includes'
7402 + if (HASEXCEPTION())
7404 + goto ruleINCLUDESEx;
7411 + LEXSTATE->type = _type;
7413 + // This is where rules clean up and exit
7415 + goto ruleINCLUDESEx; /* Prevent compiler warnings */
7419 +// $ANTLR end INCLUDES
7421 +// Comes from: 98:9: ( 'startswith' )
7422 +/** \brief Lexer rule generated by ANTLR3
7424 + * $ANTLR start STARTSW
7426 + * Looks to match the characters the constitute the token STARTSW
7427 + * from the attached input stream.
7431 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7433 +static ANTLR3_INLINE
7434 +void mSTARTSW(pRSPLexer ctx)
7436 + ANTLR3_UINT32 _type;
7441 + // RSP.g:98:9: ( 'startswith' )
7442 + // RSP.g:98:11: 'startswith'
7445 + if (HASEXCEPTION())
7447 + goto ruleSTARTSWEx;
7454 + LEXSTATE->type = _type;
7456 + // This is where rules clean up and exit
7458 + goto ruleSTARTSWEx; /* Prevent compiler warnings */
7462 +// $ANTLR end STARTSW
7464 +// Comes from: 99:7: ( 'endswith' )
7465 +/** \brief Lexer rule generated by ANTLR3
7467 + * $ANTLR start ENDSW
7469 + * Looks to match the characters the constitute the token ENDSW
7470 + * from the attached input stream.
7474 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7476 +static ANTLR3_INLINE
7477 +void mENDSW(pRSPLexer ctx)
7479 + ANTLR3_UINT32 _type;
7484 + // RSP.g:99:7: ( 'endswith' )
7485 + // RSP.g:99:9: 'endswith'
7488 + if (HASEXCEPTION())
7497 + LEXSTATE->type = _type;
7499 + // This is where rules clean up and exit
7501 + goto ruleENDSWEx; /* Prevent compiler warnings */
7505 +// $ANTLR end ENDSW
7507 +// Comes from: 102:9: ( '>' )
7508 +/** \brief Lexer rule generated by ANTLR3
7510 + * $ANTLR start GREATER
7512 + * Looks to match the characters the constitute the token GREATER
7513 + * from the attached input stream.
7517 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7519 +static ANTLR3_INLINE
7520 +void mGREATER(pRSPLexer ctx)
7522 + ANTLR3_UINT32 _type;
7527 + // RSP.g:102:9: ( '>' )
7528 + // RSP.g:102:11: '>'
7531 + if (HASEXCEPTION())
7533 + goto ruleGREATEREx;
7539 + LEXSTATE->type = _type;
7541 + // This is where rules clean up and exit
7543 + goto ruleGREATEREx; /* Prevent compiler warnings */
7547 +// $ANTLR end GREATER
7549 +// Comes from: 103:6: ( '<' )
7550 +/** \brief Lexer rule generated by ANTLR3
7552 + * $ANTLR start LESS
7554 + * Looks to match the characters the constitute the token LESS
7555 + * from the attached input stream.
7559 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7561 +static ANTLR3_INLINE
7562 +void mLESS(pRSPLexer ctx)
7564 + ANTLR3_UINT32 _type;
7569 + // RSP.g:103:6: ( '<' )
7570 + // RSP.g:103:8: '<'
7573 + if (HASEXCEPTION())
7581 + LEXSTATE->type = _type;
7583 + // This is where rules clean up and exit
7585 + goto ruleLESSEx; /* Prevent compiler warnings */
7591 +// Comes from: 104:5: ( '>=' )
7592 +/** \brief Lexer rule generated by ANTLR3
7594 + * $ANTLR start GTE
7596 + * Looks to match the characters the constitute the token GTE
7597 + * from the attached input stream.
7601 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7603 +static ANTLR3_INLINE
7604 +void mGTE(pRSPLexer ctx)
7606 + ANTLR3_UINT32 _type;
7611 + // RSP.g:104:5: ( '>=' )
7612 + // RSP.g:104:7: '>='
7615 + if (HASEXCEPTION())
7624 + LEXSTATE->type = _type;
7626 + // This is where rules clean up and exit
7628 + goto ruleGTEEx; /* Prevent compiler warnings */
7634 +// Comes from: 105:5: ( '<=' )
7635 +/** \brief Lexer rule generated by ANTLR3
7637 + * $ANTLR start LTE
7639 + * Looks to match the characters the constitute the token LTE
7640 + * from the attached input stream.
7644 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7646 +static ANTLR3_INLINE
7647 +void mLTE(pRSPLexer ctx)
7649 + ANTLR3_UINT32 _type;
7654 + // RSP.g:105:5: ( '<=' )
7655 + // RSP.g:105:7: '<='
7658 + if (HASEXCEPTION())
7667 + LEXSTATE->type = _type;
7669 + // This is where rules clean up and exit
7671 + goto ruleLTEEx; /* Prevent compiler warnings */
7677 +// Comes from: 108:8: ( 'before' )
7678 +/** \brief Lexer rule generated by ANTLR3
7680 + * $ANTLR start BEFORE
7682 + * Looks to match the characters the constitute the token BEFORE
7683 + * from the attached input stream.
7687 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7689 +static ANTLR3_INLINE
7690 +void mBEFORE(pRSPLexer ctx)
7692 + ANTLR3_UINT32 _type;
7697 + // RSP.g:108:8: ( 'before' )
7698 + // RSP.g:108:10: 'before'
7701 + if (HASEXCEPTION())
7703 + goto ruleBEFOREEx;
7710 + LEXSTATE->type = _type;
7712 + // This is where rules clean up and exit
7714 + goto ruleBEFOREEx; /* Prevent compiler warnings */
7718 +// $ANTLR end BEFORE
7720 +// Comes from: 109:7: ( 'after' )
7721 +/** \brief Lexer rule generated by ANTLR3
7723 + * $ANTLR start AFTER
7725 + * Looks to match the characters the constitute the token AFTER
7726 + * from the attached input stream.
7730 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7732 +static ANTLR3_INLINE
7733 +void mAFTER(pRSPLexer ctx)
7735 + ANTLR3_UINT32 _type;
7740 + // RSP.g:109:7: ( 'after' )
7741 + // RSP.g:109:9: 'after'
7744 + if (HASEXCEPTION())
7753 + LEXSTATE->type = _type;
7755 + // This is where rules clean up and exit
7757 + goto ruleAFTEREx; /* Prevent compiler warnings */
7761 +// $ANTLR end AFTER
7763 +// Comes from: 110:5: ( 'day' | 'days' )
7764 +/** \brief Lexer rule generated by ANTLR3
7766 + * $ANTLR start DAY
7768 + * Looks to match the characters the constitute the token DAY
7769 + * from the attached input stream.
7773 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7775 +static ANTLR3_INLINE
7776 +void mDAY(pRSPLexer ctx)
7778 + ANTLR3_UINT32 _type;
7784 + // RSP.g:110:5: ( 'day' | 'days' )
7786 + ANTLR3_UINT32 alt1;
7818 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7819 + EXCEPTION->message = (void *)"";
7820 + EXCEPTION->decisionNum = 1;
7821 + EXCEPTION->state = 2;
7832 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7833 + EXCEPTION->message = (void *)"";
7834 + EXCEPTION->decisionNum = 1;
7835 + EXCEPTION->state = 1;
7846 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7847 + EXCEPTION->message = (void *)"";
7848 + EXCEPTION->decisionNum = 1;
7849 + EXCEPTION->state = 0;
7858 + // RSP.g:110:7: 'day'
7861 + if (HASEXCEPTION())
7871 + // RSP.g:110:15: 'days'
7874 + if (HASEXCEPTION())
7886 + LEXSTATE->type = _type;
7888 + // This is where rules clean up and exit
7890 + goto ruleDAYEx; /* Prevent compiler warnings */
7896 +// Comes from: 111:6: ( 'week' | 'weeks' )
7897 +/** \brief Lexer rule generated by ANTLR3
7899 + * $ANTLR start WEEK
7901 + * Looks to match the characters the constitute the token WEEK
7902 + * from the attached input stream.
7906 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7908 +static ANTLR3_INLINE
7909 +void mWEEK(pRSPLexer ctx)
7911 + ANTLR3_UINT32 _type;
7917 + // RSP.g:111:6: ( 'week' | 'weeks' )
7919 + ANTLR3_UINT32 alt2;
7955 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7956 + EXCEPTION->message = (void *)"";
7957 + EXCEPTION->decisionNum = 2;
7958 + EXCEPTION->state = 3;
7969 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7970 + EXCEPTION->message = (void *)"";
7971 + EXCEPTION->decisionNum = 2;
7972 + EXCEPTION->state = 2;
7983 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7984 + EXCEPTION->message = (void *)"";
7985 + EXCEPTION->decisionNum = 2;
7986 + EXCEPTION->state = 1;
7997 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7998 + EXCEPTION->message = (void *)"";
7999 + EXCEPTION->decisionNum = 2;
8000 + EXCEPTION->state = 0;
8009 + // RSP.g:111:8: 'week'
8012 + if (HASEXCEPTION())
8022 + // RSP.g:111:17: 'weeks'
8025 + if (HASEXCEPTION())
8037 + LEXSTATE->type = _type;
8039 + // This is where rules clean up and exit
8041 + goto ruleWEEKEx; /* Prevent compiler warnings */
8047 +// Comes from: 112:7: ( 'month' | 'months' )
8048 +/** \brief Lexer rule generated by ANTLR3
8050 + * $ANTLR start MONTH
8052 + * Looks to match the characters the constitute the token MONTH
8053 + * from the attached input stream.
8057 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8059 +static ANTLR3_INLINE
8060 +void mMONTH(pRSPLexer ctx)
8062 + ANTLR3_UINT32 _type;
8068 + // RSP.g:112:7: ( 'month' | 'months' )
8070 + ANTLR3_UINT32 alt3;
8110 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8111 + EXCEPTION->message = (void *)"";
8112 + EXCEPTION->decisionNum = 3;
8113 + EXCEPTION->state = 4;
8124 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8125 + EXCEPTION->message = (void *)"";
8126 + EXCEPTION->decisionNum = 3;
8127 + EXCEPTION->state = 3;
8138 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8139 + EXCEPTION->message = (void *)"";
8140 + EXCEPTION->decisionNum = 3;
8141 + EXCEPTION->state = 2;
8152 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8153 + EXCEPTION->message = (void *)"";
8154 + EXCEPTION->decisionNum = 3;
8155 + EXCEPTION->state = 1;
8166 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8167 + EXCEPTION->message = (void *)"";
8168 + EXCEPTION->decisionNum = 3;
8169 + EXCEPTION->state = 0;
8178 + // RSP.g:112:9: 'month'
8181 + if (HASEXCEPTION())
8191 + // RSP.g:112:19: 'months'
8194 + if (HASEXCEPTION())
8206 + LEXSTATE->type = _type;
8208 + // This is where rules clean up and exit
8210 + goto ruleMONTHEx; /* Prevent compiler warnings */
8214 +// $ANTLR end MONTH
8216 +// Comes from: 113:6: ( 'year' | 'years' )
8217 +/** \brief Lexer rule generated by ANTLR3
8219 + * $ANTLR start YEAR
8221 + * Looks to match the characters the constitute the token YEAR
8222 + * from the attached input stream.
8226 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8228 +static ANTLR3_INLINE
8229 +void mYEAR(pRSPLexer ctx)
8231 + ANTLR3_UINT32 _type;
8237 + // RSP.g:113:6: ( 'year' | 'years' )
8239 + ANTLR3_UINT32 alt4;
8275 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8276 + EXCEPTION->message = (void *)"";
8277 + EXCEPTION->decisionNum = 4;
8278 + EXCEPTION->state = 3;
8289 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8290 + EXCEPTION->message = (void *)"";
8291 + EXCEPTION->decisionNum = 4;
8292 + EXCEPTION->state = 2;
8303 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8304 + EXCEPTION->message = (void *)"";
8305 + EXCEPTION->decisionNum = 4;
8306 + EXCEPTION->state = 1;
8317 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8318 + EXCEPTION->message = (void *)"";
8319 + EXCEPTION->decisionNum = 4;
8320 + EXCEPTION->state = 0;
8329 + // RSP.g:113:8: 'year'
8332 + if (HASEXCEPTION())
8342 + // RSP.g:113:17: 'years'
8345 + if (HASEXCEPTION())
8357 + LEXSTATE->type = _type;
8359 + // This is where rules clean up and exit
8361 + goto ruleYEAREx; /* Prevent compiler warnings */
8367 +// Comes from: 114:7: ( 'today' )
8368 +/** \brief Lexer rule generated by ANTLR3
8370 + * $ANTLR start TODAY
8372 + * Looks to match the characters the constitute the token TODAY
8373 + * from the attached input stream.
8377 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8379 +static ANTLR3_INLINE
8380 +void mTODAY(pRSPLexer ctx)
8382 + ANTLR3_UINT32 _type;
8387 + // RSP.g:114:7: ( 'today' )
8388 + // RSP.g:114:9: 'today'
8391 + if (HASEXCEPTION())
8400 + LEXSTATE->type = _type;
8402 + // This is where rules clean up and exit
8404 + goto ruleTODAYEx; /* Prevent compiler warnings */
8408 +// $ANTLR end TODAY
8410 +// Comes from: 116:9: ( ( '\\r' )? '\\n' )
8411 +/** \brief Lexer rule generated by ANTLR3
8413 + * $ANTLR start NEWLINE
8415 + * Looks to match the characters the constitute the token NEWLINE
8416 + * from the attached input stream.
8420 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8422 +static ANTLR3_INLINE
8423 +void mNEWLINE(pRSPLexer ctx)
8425 + ANTLR3_UINT32 _type;
8430 + // RSP.g:116:9: ( ( '\\r' )? '\\n' )
8431 + // RSP.g:116:11: ( '\\r' )? '\\n'
8434 + // RSP.g:116:11: ( '\\r' )?
8449 + // RSP.g:116:11: '\\r'
8452 + if (HASEXCEPTION())
8454 + goto ruleNEWLINEEx;
8464 + if (HASEXCEPTION())
8466 + goto ruleNEWLINEEx;
8472 + LEXSTATE->type = _type;
8474 + // This is where rules clean up and exit
8476 + goto ruleNEWLINEEx; /* Prevent compiler warnings */
8480 +// $ANTLR end NEWLINE
8482 +// Comes from: 118:4: ( ( ' ' | '\\t' ) )
8483 +/** \brief Lexer rule generated by ANTLR3
8487 + * Looks to match the characters the constitute the token WS
8488 + * from the attached input stream.
8492 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8494 +static ANTLR3_INLINE
8495 +void mWS(pRSPLexer ctx)
8497 + ANTLR3_UINT32 _type;
8502 + // RSP.g:118:4: ( ( ' ' | '\\t' ) )
8503 + // RSP.g:118:6: ( ' ' | '\\t' )
8505 + if ( LA(1) == '\t' || LA(1) == ' ' )
8513 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
8514 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
8516 + LRECOVER(); goto ruleWSEx;
8520 + LEXSTATE->channel = HIDDEN;
8525 + LEXSTATE->type = _type;
8527 + // This is where rules clean up and exit
8529 + goto ruleWSEx; /* Prevent compiler warnings */
8535 +// Comes from: 120:7: ( 'a' .. 'z' ( 'a' .. 'z' | '_' )* 'a' .. 'z' )
8536 +/** \brief Lexer rule generated by ANTLR3
8538 + * $ANTLR start FIELD
8540 + * Looks to match the characters the constitute the token FIELD
8541 + * from the attached input stream.
8545 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8547 +static ANTLR3_INLINE
8548 +void mFIELD(pRSPLexer ctx)
8550 + ANTLR3_UINT32 _type;
8555 + // RSP.g:120:7: ( 'a' .. 'z' ( 'a' .. 'z' | '_' )* 'a' .. 'z' )
8556 + // RSP.g:120:9: 'a' .. 'z' ( 'a' .. 'z' | '_' )* 'a' .. 'z'
8558 + MATCHRANGE('a', 'z');
8559 + if (HASEXCEPTION())
8565 + // RSP.g:120:18: ( 'a' .. 'z' | '_' )*
8650 + if ( LA(1) == '_' || ((LA(1) >= 'a') && (LA(1) <= 'z')) )
8658 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
8659 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
8661 + LRECOVER(); goto ruleFIELDEx;
8669 + goto loop6; /* break out of the loop */
8673 + loop6: ; /* Jump out to here if this rule does not match */
8675 + MATCHRANGE('a', 'z');
8676 + if (HASEXCEPTION())
8684 + LEXSTATE->type = _type;
8686 + // This is where rules clean up and exit
8688 + goto ruleFIELDEx; /* Prevent compiler warnings */
8692 +// $ANTLR end FIELD
8694 +// Comes from: 122:5: ( DIGIT19 ( DIGIT09 )* )
8695 +/** \brief Lexer rule generated by ANTLR3
8697 + * $ANTLR start INT
8699 + * Looks to match the characters the constitute the token INT
8700 + * from the attached input stream.
8704 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8706 +static ANTLR3_INLINE
8707 +void mINT(pRSPLexer ctx)
8709 + ANTLR3_UINT32 _type;
8714 + // RSP.g:122:5: ( DIGIT19 ( DIGIT09 )* )
8715 + // RSP.g:122:7: DIGIT19 ( DIGIT09 )*
8717 + /* 122:7: DIGIT19 ( DIGIT09 )* */
8719 + if (HASEXCEPTION())
8725 + // RSP.g:122:15: ( DIGIT09 )*
8752 + // RSP.g:122:15: DIGIT09
8754 + /* 122:15: DIGIT09 */
8756 + if (HASEXCEPTION())
8766 + goto loop7; /* break out of the loop */
8770 + loop7: ; /* Jump out to here if this rule does not match */
8775 + LEXSTATE->type = _type;
8777 + // This is where rules clean up and exit
8779 + goto ruleINTEx; /* Prevent compiler warnings */
8785 +// Comes from: 125:6: ( DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) )
8786 +/** \brief Lexer rule generated by ANTLR3
8788 + * $ANTLR start DATE
8790 + * Looks to match the characters the constitute the token DATE
8791 + * from the attached input stream.
8795 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8797 +static ANTLR3_INLINE
8798 +void mDATE(pRSPLexer ctx)
8800 + ANTLR3_UINT32 _type;
8805 + // RSP.g:125:6: ( DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) )
8806 + // RSP.g:125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' )
8808 + /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */
8810 + if (HASEXCEPTION())
8815 + /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */
8817 + if (HASEXCEPTION())
8822 + /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */
8824 + if (HASEXCEPTION())
8829 + /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */
8831 + if (HASEXCEPTION())
8837 + if (HASEXCEPTION())
8843 + // RSP.g:125:44: ( '0' DIGIT19 | '1' '0' .. '2' )
8861 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8862 + EXCEPTION->message = (void *)"";
8863 + EXCEPTION->decisionNum = 8;
8864 + EXCEPTION->state = 0;
8873 + // RSP.g:125:45: '0' DIGIT19
8876 + if (HASEXCEPTION())
8881 + /* 125:45: '0' DIGIT19 */
8883 + if (HASEXCEPTION())
8892 + // RSP.g:125:59: '1' '0' .. '2'
8895 + if (HASEXCEPTION())
8900 + MATCHRANGE('0', '2');
8901 + if (HASEXCEPTION())
8913 + if (HASEXCEPTION())
8919 + // RSP.g:125:77: ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' )
8943 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8944 + EXCEPTION->message = (void *)"";
8945 + EXCEPTION->decisionNum = 9;
8946 + EXCEPTION->state = 0;
8955 + // RSP.g:125:78: '0' DIGIT19
8958 + if (HASEXCEPTION())
8963 + /* 125:78: '0' DIGIT19 */
8965 + if (HASEXCEPTION())
8974 + // RSP.g:125:92: '1' .. '2' DIGIT09
8976 + MATCHRANGE('1', '2');
8977 + if (HASEXCEPTION())
8982 + /* 125:92: '1' .. '2' DIGIT09 */
8984 + if (HASEXCEPTION())
8993 + // RSP.g:125:111: '3' '0' .. '1'
8996 + if (HASEXCEPTION())
9001 + MATCHRANGE('0', '1');
9002 + if (HASEXCEPTION())
9016 + LEXSTATE->type = _type;
9018 + // This is where rules clean up and exit
9020 + goto ruleDATEEx; /* Prevent compiler warnings */
9026 +// Comes from: 133:2: ( QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE )
9027 +/** \brief Lexer rule generated by ANTLR3
9029 + * $ANTLR start STR
9031 + * Looks to match the characters the constitute the token STR
9032 + * from the attached input stream.
9036 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
9038 +static ANTLR3_INLINE
9039 +void mSTR(pRSPLexer ctx)
9041 + ANTLR3_UINT32 _type;
9042 + pANTLR3_COMMON_TOKEN esc;
9043 + ANTLR3_UINT32 reg;
9050 + pANTLR3_STRING unesc = GETTEXT()->factory->newRaw(GETTEXT()->factory);
9052 + // RSP.g:133:2: ( QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE )
9053 + // RSP.g:133:4: QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE
9055 + /* 133:4: QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE */
9057 + if (HASEXCEPTION())
9062 + // RSP.g:133:10: (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+
9070 + /* dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState)
9072 + int LA10_0 = LA(1);
9073 + if ( (((LA10_0 >= 0x0000) && (LA10_0 <= '!')) || ((LA10_0 >= '#') && (LA10_0 <= '[')) || ((LA10_0 >= ']') && (LA10_0 <= 0xFFFF))) )
9077 + else if ( (LA10_0 == '\\') )
9086 + // RSP.g:133:12: reg=~ ( '\\\\' | '\"' )
9089 + if ( ((LA(1) >= 0x0000) && (LA(1) <= '!')) || ((LA(1) >= '#') && (LA(1) <= '[')) || ((LA(1) >= ']') && (LA(1) <= 0xFFFF)) )
9097 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
9098 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
9100 + LRECOVER(); goto ruleSTREx;
9104 + unesc->addc(unesc, reg);
9110 + // RSP.g:134:6: esc= ESCAPED
9112 + /* 134:6: esc= ESCAPED */
9114 + ANTLR3_MARKER escStart381 = GETCHARINDEX();
9116 + if (HASEXCEPTION())
9121 + esc = LEXSTATE->tokFactory->newToken(LEXSTATE->tokFactory);
9122 + esc->setType(esc, ANTLR3_TOKEN_INVALID);
9123 + esc->setStartIndex(esc, escStart381);
9124 + esc->setStopIndex(esc, GETCHARINDEX()-1);
9125 + esc->input = INPUT;
9128 + unesc->appendS(unesc, GETTEXT());
9140 + /* mismatchedSetEx()
9143 + EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
9144 + EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
9151 + loop10: ; /* Jump to here if this rule does not match */
9153 + /* 133:4: QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE */
9155 + if (HASEXCEPTION())
9166 + LEXSTATE->type = _type;
9168 + // This is where rules clean up and exit
9170 + goto ruleSTREx; /* Prevent compiler warnings */
9178 +// Comes from: 138:9: ( '\\\\' ( '\\\\' | '\"' ) )
9179 +/** \brief Lexer rule generated by ANTLR3
9181 + * $ANTLR start ESCAPED
9183 + * Looks to match the characters the constitute the token ESCAPED
9184 + * from the attached input stream.
9188 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
9190 +static ANTLR3_INLINE
9191 +void mESCAPED(pRSPLexer ctx)
9193 + ANTLR3_UINT32 _type;
9196 + // RSP.g:138:9: ( '\\\\' ( '\\\\' | '\"' ) )
9197 + // RSP.g:138:11: '\\\\' ( '\\\\' | '\"' )
9200 + if (HASEXCEPTION())
9202 + goto ruleESCAPEDEx;
9206 + // RSP.g:139:3: ( '\\\\' | '\"' )
9224 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
9225 + EXCEPTION->message = (void *)"";
9226 + EXCEPTION->decisionNum = 11;
9227 + EXCEPTION->state = 0;
9230 + goto ruleESCAPEDEx;
9236 + // RSP.g:139:5: '\\\\'
9239 + if (HASEXCEPTION())
9241 + goto ruleESCAPEDEx;
9245 + SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\\"));
9251 + // RSP.g:140:5: '\"'
9254 + if (HASEXCEPTION())
9256 + goto ruleESCAPEDEx;
9260 + SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\""));
9273 + // This is where rules clean up and exit
9275 + goto ruleESCAPEDEx; /* Prevent compiler warnings */
9279 +// $ANTLR end ESCAPED
9281 +// Comes from: 145:9: ( '0' .. '9' )
9282 +/** \brief Lexer rule generated by ANTLR3
9284 + * $ANTLR start DIGIT09
9286 + * Looks to match the characters the constitute the token DIGIT09
9287 + * from the attached input stream.
9291 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
9293 +static ANTLR3_INLINE
9294 +void mDIGIT09(pRSPLexer ctx)
9296 + ANTLR3_UINT32 _type;
9299 + // RSP.g:145:9: ( '0' .. '9' )
9300 + // RSP.g:145:11: '0' .. '9'
9302 + MATCHRANGE('0', '9');
9303 + if (HASEXCEPTION())
9305 + goto ruleDIGIT09Ex;
9313 + // This is where rules clean up and exit
9315 + goto ruleDIGIT09Ex; /* Prevent compiler warnings */
9319 +// $ANTLR end DIGIT09
9321 +// Comes from: 148:9: ( '1' .. '9' )
9322 +/** \brief Lexer rule generated by ANTLR3
9324 + * $ANTLR start DIGIT19
9326 + * Looks to match the characters the constitute the token DIGIT19
9327 + * from the attached input stream.
9331 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
9333 +static ANTLR3_INLINE
9334 +void mDIGIT19(pRSPLexer ctx)
9336 + ANTLR3_UINT32 _type;
9339 + // RSP.g:148:9: ( '1' .. '9' )
9340 + // RSP.g:148:11: '1' .. '9'
9342 + MATCHRANGE('1', '9');
9343 + if (HASEXCEPTION())
9345 + goto ruleDIGIT19Ex;
9353 + // This is where rules clean up and exit
9355 + goto ruleDIGIT19Ex; /* Prevent compiler warnings */
9359 +// $ANTLR end DIGIT19
9361 +/** This is the entry point in to the lexer from an object that
9362 + * wants to generate the next token, such as a pCOMMON_TOKEN_STREAM
9365 +mTokens(pRSPLexer ctx)
9368 + // 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 )
9370 + ANTLR3_UINT32 alt12;
9380 + int LA12_1 = LA(2);
9381 + if ( (((LA12_1 >= 0x0000) && (LA12_1 <= '!')) || ((LA12_1 >= '#') && (LA12_1 <= 0xFFFF))) )
9559 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
9560 + EXCEPTION->message = (void *)"";
9561 + EXCEPTION->decisionNum = 12;
9562 + EXCEPTION->state = 4;
9565 + goto ruleTokensEx;
9648 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
9649 + EXCEPTION->message = (void *)"";
9650 + EXCEPTION->decisionNum = 12;
9651 + EXCEPTION->state = 5;
9654 + goto ruleTokensEx;
9807 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
9808 + EXCEPTION->message = (void *)"";
9809 + EXCEPTION->decisionNum = 12;
9810 + EXCEPTION->state = 8;
9813 + goto ruleTokensEx;
9976 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
9977 + EXCEPTION->message = (void *)"";
9978 + EXCEPTION->decisionNum = 12;
9979 + EXCEPTION->state = 9;
9982 + goto ruleTokensEx;
10125 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10126 + EXCEPTION->message = (void *)"";
10127 + EXCEPTION->decisionNum = 12;
10128 + EXCEPTION->state = 10;
10131 + goto ruleTokensEx;
10284 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10285 + EXCEPTION->message = (void *)"";
10286 + EXCEPTION->decisionNum = 12;
10287 + EXCEPTION->state = 13;
10290 + goto ruleTokensEx;
10423 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10424 + EXCEPTION->message = (void *)"";
10425 + EXCEPTION->decisionNum = 12;
10426 + EXCEPTION->state = 14;
10429 + goto ruleTokensEx;
10572 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10573 + EXCEPTION->message = (void *)"";
10574 + EXCEPTION->decisionNum = 12;
10575 + EXCEPTION->state = 15;
10578 + goto ruleTokensEx;
10731 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10732 + EXCEPTION->message = (void *)"";
10733 + EXCEPTION->decisionNum = 12;
10734 + EXCEPTION->state = 16;
10737 + goto ruleTokensEx;
10880 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10881 + EXCEPTION->message = (void *)"";
10882 + EXCEPTION->decisionNum = 12;
10883 + EXCEPTION->state = 17;
10886 + goto ruleTokensEx;
10999 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
11000 + EXCEPTION->message = (void *)"";
11001 + EXCEPTION->decisionNum = 12;
11002 + EXCEPTION->state = 18;
11005 + goto ruleTokensEx;
11124 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
11125 + EXCEPTION->message = (void *)"";
11126 + EXCEPTION->decisionNum = 12;
11127 + EXCEPTION->state = 0;
11130 + goto ruleTokensEx;
11136 + // RSP.g:1:10: QUOTE
11138 + /* 1:10: QUOTE */
11140 + if (HASEXCEPTION())
11142 + goto ruleTokensEx;
11149 + // RSP.g:1:16: LPAR
11153 + if (HASEXCEPTION())
11155 + goto ruleTokensEx;
11162 + // RSP.g:1:21: RPAR
11166 + if (HASEXCEPTION())
11168 + goto ruleTokensEx;
11175 + // RSP.g:1:26: AND
11179 + if (HASEXCEPTION())
11181 + goto ruleTokensEx;
11188 + // RSP.g:1:30: OR
11192 + if (HASEXCEPTION())
11194 + goto ruleTokensEx;
11201 + // RSP.g:1:33: NOT
11205 + if (HASEXCEPTION())
11207 + goto ruleTokensEx;
11214 + // RSP.g:1:37: EQUAL
11216 + /* 1:37: EQUAL */
11218 + if (HASEXCEPTION())
11220 + goto ruleTokensEx;
11227 + // RSP.g:1:43: INCLUDES
11229 + /* 1:43: INCLUDES */
11231 + if (HASEXCEPTION())
11233 + goto ruleTokensEx;
11240 + // RSP.g:1:52: STARTSW
11242 + /* 1:52: STARTSW */
11244 + if (HASEXCEPTION())
11246 + goto ruleTokensEx;
11253 + // RSP.g:1:60: ENDSW
11255 + /* 1:60: ENDSW */
11257 + if (HASEXCEPTION())
11259 + goto ruleTokensEx;
11266 + // RSP.g:1:66: GREATER
11268 + /* 1:66: GREATER */
11270 + if (HASEXCEPTION())
11272 + goto ruleTokensEx;
11279 + // RSP.g:1:74: LESS
11283 + if (HASEXCEPTION())
11285 + goto ruleTokensEx;
11292 + // RSP.g:1:79: GTE
11296 + if (HASEXCEPTION())
11298 + goto ruleTokensEx;
11305 + // RSP.g:1:83: LTE
11309 + if (HASEXCEPTION())
11311 + goto ruleTokensEx;
11318 + // RSP.g:1:87: BEFORE
11320 + /* 1:87: BEFORE */
11322 + if (HASEXCEPTION())
11324 + goto ruleTokensEx;
11331 + // RSP.g:1:94: AFTER
11333 + /* 1:94: AFTER */
11335 + if (HASEXCEPTION())
11337 + goto ruleTokensEx;
11344 + // RSP.g:1:100: DAY
11348 + if (HASEXCEPTION())
11350 + goto ruleTokensEx;
11357 + // RSP.g:1:104: WEEK
11359 + /* 1:104: WEEK */
11361 + if (HASEXCEPTION())
11363 + goto ruleTokensEx;
11370 + // RSP.g:1:109: MONTH
11372 + /* 1:109: MONTH */
11374 + if (HASEXCEPTION())
11376 + goto ruleTokensEx;
11383 + // RSP.g:1:115: YEAR
11385 + /* 1:115: YEAR */
11387 + if (HASEXCEPTION())
11389 + goto ruleTokensEx;
11396 + // RSP.g:1:120: TODAY
11398 + /* 1:120: TODAY */
11400 + if (HASEXCEPTION())
11402 + goto ruleTokensEx;
11409 + // RSP.g:1:126: NEWLINE
11411 + /* 1:126: NEWLINE */
11413 + if (HASEXCEPTION())
11415 + goto ruleTokensEx;
11422 + // RSP.g:1:134: WS
11426 + if (HASEXCEPTION())
11428 + goto ruleTokensEx;
11435 + // RSP.g:1:137: FIELD
11437 + /* 1:137: FIELD */
11439 + if (HASEXCEPTION())
11441 + goto ruleTokensEx;
11448 + // RSP.g:1:143: INT
11452 + if (HASEXCEPTION())
11454 + goto ruleTokensEx;
11461 + // RSP.g:1:147: DATE
11463 + /* 1:147: DATE */
11465 + if (HASEXCEPTION())
11467 + goto ruleTokensEx;
11474 + // RSP.g:1:152: STR
11478 + if (HASEXCEPTION())
11480 + goto ruleTokensEx;
11491 + goto ruleTokensEx; /* Prevent compiler warnings */
11495 +/* =========================================================================
11496 + * Lexer matching rules end.
11497 + * =========================================================================
11499 +/* End of Lexer code
11500 + * ================================================
11501 + * ================================================
11506 + * =============================================================================
11508 diff --git a/src/pregen/RSPLexer.h b/src/pregen/RSPLexer.h
11509 new file mode 100644
11510 index 0000000..27bc791
11512 +++ b/src/pregen/RSPLexer.h
11515 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
11517 + * - From the grammar source file : RSP.g
11518 + * - On : 2016-01-01 12:23:42
11519 + * - for the lexer : RSPLexerLexer *
11520 + * Editing it, at least manually, is not wise.
11522 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
11525 + * The lexer RSPLexer has the callable functions (rules) shown below,
11526 + * which will invoke the code for the associated rule in the source grammar
11527 + * assuming that the input stream is pointing to a token/text stream that could begin
11530 + * For instance if you call the first (topmost) rule in a parser grammar, you will
11531 + * get the results of a full parse, but calling a rule half way through the grammar will
11532 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
11533 + * in editors and so on.
11535 + * The parser entry points are called indirectly (by function pointer to function) via
11536 + * a parser context typedef pRSPLexer, which is returned from a call to RSPLexerNew().
11538 + * As this is a generated lexer, it is unlikely you will call it 'manually'. However
11539 + * the methods are provided anyway.
11540 + * * The methods in pRSPLexer are as follows:
11542 + * - void pRSPLexer->QUOTE(pRSPLexer)
11543 + * - void pRSPLexer->LPAR(pRSPLexer)
11544 + * - void pRSPLexer->RPAR(pRSPLexer)
11545 + * - void pRSPLexer->AND(pRSPLexer)
11546 + * - void pRSPLexer->OR(pRSPLexer)
11547 + * - void pRSPLexer->NOT(pRSPLexer)
11548 + * - void pRSPLexer->EQUAL(pRSPLexer)
11549 + * - void pRSPLexer->INCLUDES(pRSPLexer)
11550 + * - void pRSPLexer->STARTSW(pRSPLexer)
11551 + * - void pRSPLexer->ENDSW(pRSPLexer)
11552 + * - void pRSPLexer->GREATER(pRSPLexer)
11553 + * - void pRSPLexer->LESS(pRSPLexer)
11554 + * - void pRSPLexer->GTE(pRSPLexer)
11555 + * - void pRSPLexer->LTE(pRSPLexer)
11556 + * - void pRSPLexer->BEFORE(pRSPLexer)
11557 + * - void pRSPLexer->AFTER(pRSPLexer)
11558 + * - void pRSPLexer->DAY(pRSPLexer)
11559 + * - void pRSPLexer->WEEK(pRSPLexer)
11560 + * - void pRSPLexer->MONTH(pRSPLexer)
11561 + * - void pRSPLexer->YEAR(pRSPLexer)
11562 + * - void pRSPLexer->TODAY(pRSPLexer)
11563 + * - void pRSPLexer->NEWLINE(pRSPLexer)
11564 + * - void pRSPLexer->WS(pRSPLexer)
11565 + * - void pRSPLexer->FIELD(pRSPLexer)
11566 + * - void pRSPLexer->INT(pRSPLexer)
11567 + * - void pRSPLexer->DATE(pRSPLexer)
11568 + * - void pRSPLexer->STR(pRSPLexer)
11569 + * - void pRSPLexer->ESCAPED(pRSPLexer)
11570 + * - void pRSPLexer->DIGIT09(pRSPLexer)
11571 + * - void pRSPLexer->DIGIT19(pRSPLexer)
11572 + * - void pRSPLexer->Tokens(pRSPLexer)
11574 + * The return type for any particular rule is of course determined by the source
11577 +// [The "BSD licence"]
11578 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
11579 +// http://www.temporal-wave.com
11580 +// http://www.linkedin.com/in/jimidle
11582 +// All rights reserved.
11584 +// Redistribution and use in source and binary forms, with or without
11585 +// modification, are permitted provided that the following conditions
11587 +// 1. Redistributions of source code must retain the above copyright
11588 +// notice, this list of conditions and the following disclaimer.
11589 +// 2. Redistributions in binary form must reproduce the above copyright
11590 +// notice, this list of conditions and the following disclaimer in the
11591 +// documentation and/or other materials provided with the distribution.
11592 +// 3. The name of the author may not be used to endorse or promote products
11593 +// derived from this software without specific prior written permission.
11595 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
11596 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
11597 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11598 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
11599 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
11600 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11601 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11602 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11603 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
11604 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11606 +#ifndef _RSPLexer_H
11607 +#define _RSPLexer_H
11608 +/* =============================================================================
11609 + * Standard antlr3 C runtime definitions
11611 +#include <antlr3.h>
11613 +/* End of standard antlr 3 runtime definitions
11614 + * =============================================================================
11617 +#ifdef __cplusplus
11621 +// Forward declare the context typedef so that we can use it before it is
11622 +// properly defined. Delegators and delegates (from import statements) are
11623 +// interdependent and their context structures contain pointers to each other
11624 +// C only allows such things to be declared if you pre-declare the typedef.
11626 +typedef struct RSPLexer_Ctx_struct RSPLexer, * pRSPLexer;
11630 +#ifdef ANTLR3_WINDOWS
11631 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
11632 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
11633 +// initialized but unused variable - tree rewrite variables declared but not needed
11634 +// Unreferenced local variable - lexer rule declares but does not always use _type
11635 +// potentially unitialized variable used - retval always returned from a rule
11636 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
11638 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
11639 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
11640 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
11641 +// this is a matter of orthogonality hence I disable that one.
11643 +#pragma warning( disable : 4100 )
11644 +#pragma warning( disable : 4101 )
11645 +#pragma warning( disable : 4127 )
11646 +#pragma warning( disable : 4189 )
11647 +#pragma warning( disable : 4505 )
11648 +#pragma warning( disable : 4701 )
11651 +/** Context tracking structure for RSPLexer
11653 +struct RSPLexer_Ctx_struct
11655 + /** Built in ANTLR3 context tracker contains all the generic elements
11656 + * required for context tracking.
11658 + pANTLR3_LEXER pLexer;
11661 + void (*mQUOTE) (struct RSPLexer_Ctx_struct * ctx);
11662 + void (*mLPAR) (struct RSPLexer_Ctx_struct * ctx);
11663 + void (*mRPAR) (struct RSPLexer_Ctx_struct * ctx);
11664 + void (*mAND) (struct RSPLexer_Ctx_struct * ctx);
11665 + void (*mOR) (struct RSPLexer_Ctx_struct * ctx);
11666 + void (*mNOT) (struct RSPLexer_Ctx_struct * ctx);
11667 + void (*mEQUAL) (struct RSPLexer_Ctx_struct * ctx);
11668 + void (*mINCLUDES) (struct RSPLexer_Ctx_struct * ctx);
11669 + void (*mSTARTSW) (struct RSPLexer_Ctx_struct * ctx);
11670 + void (*mENDSW) (struct RSPLexer_Ctx_struct * ctx);
11671 + void (*mGREATER) (struct RSPLexer_Ctx_struct * ctx);
11672 + void (*mLESS) (struct RSPLexer_Ctx_struct * ctx);
11673 + void (*mGTE) (struct RSPLexer_Ctx_struct * ctx);
11674 + void (*mLTE) (struct RSPLexer_Ctx_struct * ctx);
11675 + void (*mBEFORE) (struct RSPLexer_Ctx_struct * ctx);
11676 + void (*mAFTER) (struct RSPLexer_Ctx_struct * ctx);
11677 + void (*mDAY) (struct RSPLexer_Ctx_struct * ctx);
11678 + void (*mWEEK) (struct RSPLexer_Ctx_struct * ctx);
11679 + void (*mMONTH) (struct RSPLexer_Ctx_struct * ctx);
11680 + void (*mYEAR) (struct RSPLexer_Ctx_struct * ctx);
11681 + void (*mTODAY) (struct RSPLexer_Ctx_struct * ctx);
11682 + void (*mNEWLINE) (struct RSPLexer_Ctx_struct * ctx);
11683 + void (*mWS) (struct RSPLexer_Ctx_struct * ctx);
11684 + void (*mFIELD) (struct RSPLexer_Ctx_struct * ctx);
11685 + void (*mINT) (struct RSPLexer_Ctx_struct * ctx);
11686 + void (*mDATE) (struct RSPLexer_Ctx_struct * ctx);
11687 + void (*mSTR) (struct RSPLexer_Ctx_struct * ctx);
11688 + void (*mESCAPED) (struct RSPLexer_Ctx_struct * ctx);
11689 + void (*mDIGIT09) (struct RSPLexer_Ctx_struct * ctx);
11690 + void (*mDIGIT19) (struct RSPLexer_Ctx_struct * ctx);
11691 + void (*mTokens) (struct RSPLexer_Ctx_struct * ctx); const char * (*getGrammarFileName)();
11692 + void (*free) (struct RSPLexer_Ctx_struct * ctx);
11696 +// Function protoypes for the constructor functions that external translation units
11697 +// such as delegators and delegates may wish to call.
11699 +ANTLR3_API pRSPLexer RSPLexerNew (pANTLR3_INPUT_STREAM instream);
11700 +ANTLR3_API pRSPLexer RSPLexerNewSSD (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
11702 +/** Symbolic definitions of all the tokens that the lexer will work with.
11705 + * Antlr will define EOF, but we can't use that as it it is too common in
11706 + * in C header files and that would be confusing. There is no way to filter this out at the moment
11707 + * so we just undef it here for now. That isn't the value we get back from C recognizers
11708 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
11716 +#define STARTSW 14
11731 +#define DIGIT19 31
11732 +#define INCLUDES 13
11735 +#define GREATER 18
11744 +#define ESCAPED 33
11746 +#define DIGIT09 32
11749 +#define EOF ANTLR3_TOKEN_EOF
11752 +#ifndef TOKENSOURCE
11753 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
11756 +/* End of token definitions for RSPLexer
11757 + * =============================================================================
11761 +#ifdef __cplusplus
11767 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
11768 diff --git a/src/pregen/RSPParser.c b/src/pregen/RSPParser.c
11769 new file mode 100644
11770 index 0000000..ba8a9d2
11772 +++ b/src/pregen/RSPParser.c
11775 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
11777 + * - From the grammar source file : RSP.g
11778 + * - On : 2016-01-01 12:23:42
11779 + * - for the parser : RSPParserParser *
11780 + * Editing it, at least manually, is not wise.
11782 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
11786 +// [The "BSD licence"]
11787 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
11788 +// http://www.temporal-wave.com
11789 +// http://www.linkedin.com/in/jimidle
11791 +// All rights reserved.
11793 +// Redistribution and use in source and binary forms, with or without
11794 +// modification, are permitted provided that the following conditions
11796 +// 1. Redistributions of source code must retain the above copyright
11797 +// notice, this list of conditions and the following disclaimer.
11798 +// 2. Redistributions in binary form must reproduce the above copyright
11799 +// notice, this list of conditions and the following disclaimer in the
11800 +// documentation and/or other materials provided with the distribution.
11801 +// 3. The name of the author may not be used to endorse or promote products
11802 +// derived from this software without specific prior written permission.
11804 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
11805 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
11806 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11807 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
11808 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
11809 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11810 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11811 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11812 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
11813 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11815 +/* -----------------------------------------
11816 + * Include the ANTLR3 generated header file.
11818 +#include "RSPParser.h"
11819 +/* ----------------------------------------- */
11825 +/* MACROS that hide the C interface implementations from the
11826 + * generated code, which makes it a little more understandable to the human eye.
11827 + * I am very much against using C pre-processor macros for function calls and bits
11828 + * of code as you cannot see what is happening when single stepping in debuggers
11829 + * and so on. The exception (in my book at least) is for generated code, where you are
11830 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
11831 + * hides some indirect calls, but is always referring to the input stream. This is
11832 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
11833 + * the runtime interfaces without changing the generated code too often, without
11834 + * confusing the reader of the generated output, who may not wish to know the gory
11835 + * details of the interface inheritance.
11840 +/* Aids in accessing scopes for grammar programmers
11843 +#undef SCOPE_STACK
11845 +#define SCOPE_TYPE(scope) pRSPParser_##scope##_SCOPE
11846 +#define SCOPE_STACK(scope) pRSPParser_##scope##Stack
11847 +#define SCOPE_TOP(scope) ctx->pRSPParser_##scope##Top
11848 +#define SCOPE_SIZE(scope) ctx->pRSPParser_##scope##Stack_limit
11849 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
11851 +/* Macros for accessing things in the parser
11856 +#undef HAVEPARSEDRULE
11860 +#undef HASEXCEPTION
11864 +#undef FOLLOWSTACK
11868 +#undef PREPORTERROR
11871 +#undef CONSTRUCTEX
11876 +#undef PERRORRECOVERY
11879 +#undef RECOVERFROMMISMATCHEDSET
11880 +#undef RECOVERFROMMISMATCHEDELEMENT
11887 +#define PARSER ctx->pParser
11888 +#define RECOGNIZER PARSER->rec
11889 +#define PSRSTATE RECOGNIZER->state
11890 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
11891 +#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si)
11892 +#define INPUT PARSER->tstream
11893 +#define STRSTREAM INPUT
11894 +#define ISTREAM INPUT->istream
11895 +#define INDEX() ISTREAM->index(INPUT->istream)
11896 +#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE)
11897 +#define EXCEPTION PSRSTATE->exception
11898 +#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs)
11899 +#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER)
11900 +#define FOLLOWSTACK PSRSTATE->following
11901 +#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
11902 +#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK)
11903 +#define PRECOVER() RECOGNIZER->recover(RECOGNIZER)
11904 +#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER)
11905 +#define LA(n) INPUT->istream->_LA(ISTREAM, n)
11906 +#define LT(n) INPUT->_LT(INPUT, n)
11907 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
11908 +#define CONSUME() ISTREAM->consume(ISTREAM)
11909 +#define MARK() ISTREAM->mark(ISTREAM)
11910 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
11911 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
11912 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
11913 +#define PERRORRECOVERY PSRSTATE->errorRecovery
11914 +#define FAILEDFLAG PSRSTATE->failed
11915 +#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE)
11916 +#define BACKTRACKING PSRSTATE->backtracking
11917 +#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
11918 +#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
11919 +#define ADAPTOR ctx->adaptor
11920 +#define RULEMEMO PSRSTATE->ruleMemo
11921 +#define DBG RECOGNIZER->debugger
11923 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
11925 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
11926 + * then for the present you must use different names for your defines as these are hard coded
11927 + * in the code generator. It would be better not to use such names internally, and maybe
11928 + * we can change this in a forthcoming release. I deliberately do not #undef these
11929 + * here as this will at least give you a redefined error somewhere if they clash.
11931 +#define UP ANTLR3_TOKEN_UP
11932 +#define DOWN ANTLR3_TOKEN_DOWN
11933 +#define EOR ANTLR3_TOKEN_EOR
11934 +#define INVALID ANTLR3_TOKEN_INVALID
11937 +/* =============================================================================
11938 + * Functions to create and destroy scopes. First come the rule scopes, followed
11939 + * by the global declared scopes.
11944 +/* ============================================================================= */
11946 +/* =============================================================================
11947 + * Start of recognizer
11952 +/** \brief Table of all token names in symbolic order, mainly used for
11953 + * error reporting.
11955 +pANTLR3_UINT8 RSPParserTokenNames[30+4]
11957 + (pANTLR3_UINT8) "<invalid>", /* String to print to indicate an invalid token */
11958 + (pANTLR3_UINT8) "<EOR>",
11959 + (pANTLR3_UINT8) "<DOWN>",
11960 + (pANTLR3_UINT8) "<UP>",
11961 + (pANTLR3_UINT8) "NEWLINE",
11962 + (pANTLR3_UINT8) "OR",
11963 + (pANTLR3_UINT8) "AND",
11964 + (pANTLR3_UINT8) "LPAR",
11965 + (pANTLR3_UINT8) "RPAR",
11966 + (pANTLR3_UINT8) "FIELD",
11967 + (pANTLR3_UINT8) "STR",
11968 + (pANTLR3_UINT8) "NOT",
11969 + (pANTLR3_UINT8) "EQUAL",
11970 + (pANTLR3_UINT8) "INCLUDES",
11971 + (pANTLR3_UINT8) "STARTSW",
11972 + (pANTLR3_UINT8) "ENDSW",
11973 + (pANTLR3_UINT8) "INT",
11974 + (pANTLR3_UINT8) "LESS",
11975 + (pANTLR3_UINT8) "GREATER",
11976 + (pANTLR3_UINT8) "LTE",
11977 + (pANTLR3_UINT8) "GTE",
11978 + (pANTLR3_UINT8) "BEFORE",
11979 + (pANTLR3_UINT8) "AFTER",
11980 + (pANTLR3_UINT8) "DATE",
11981 + (pANTLR3_UINT8) "TODAY",
11982 + (pANTLR3_UINT8) "DAY",
11983 + (pANTLR3_UINT8) "WEEK",
11984 + (pANTLR3_UINT8) "MONTH",
11985 + (pANTLR3_UINT8) "YEAR",
11986 + (pANTLR3_UINT8) "QUOTE",
11987 + (pANTLR3_UINT8) "WS",
11988 + (pANTLR3_UINT8) "DIGIT19",
11989 + (pANTLR3_UINT8) "DIGIT09",
11990 + (pANTLR3_UINT8) "ESCAPED"
11995 +// Forward declare the locally static matching functions we have generated.
11997 +static RSPParser_query_return query (pRSPParser ctx);
11998 +static RSPParser_expr_return expr (pRSPParser ctx);
11999 +static RSPParser_aexpr_return aexpr (pRSPParser ctx);
12000 +static RSPParser_crit_return crit (pRSPParser ctx);
12001 +static RSPParser_strcrit_return strcrit (pRSPParser ctx);
12002 +static RSPParser_strop_return strop (pRSPParser ctx);
12003 +static RSPParser_intcrit_return intcrit (pRSPParser ctx);
12004 +static RSPParser_intop_return intop (pRSPParser ctx);
12005 +static RSPParser_datecrit_return datecrit (pRSPParser ctx);
12006 +static RSPParser_dateop_return dateop (pRSPParser ctx);
12007 +static RSPParser_datespec_return datespec (pRSPParser ctx);
12008 +static RSPParser_dateref_return dateref (pRSPParser ctx);
12009 +static RSPParser_dateintval_return dateintval (pRSPParser ctx);
12010 +static void RSPParserFree(pRSPParser ctx);
12011 +/* For use in tree output where we are accumulating rule labels via label += ruleRef
12012 + * we need a function that knows how to free a return scope when the list is destroyed.
12013 + * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
12015 +static void ANTLR3_CDECL freeScope(void * scope)
12017 + ANTLR3_FREE(scope);
12020 +/** \brief Name of the grammar file that generated this code
12022 +static const char fileName[] = "RSP.g";
12024 +/** \brief Return the name of the grammar file that generated this code.
12026 +static const char * getGrammarFileName()
12030 +/** \brief Create a new RSPParser parser and return a context for it.
12032 + * \param[in] instream Pointer to an input stream interface.
12034 + * \return Pointer to new parser context upon success.
12036 +ANTLR3_API pRSPParser
12037 +RSPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream)
12039 + // See if we can create a new parser with the standard constructor
12041 + return RSPParserNewSSD(instream, NULL);
12044 +/** \brief Create a new RSPParser parser and return a context for it.
12046 + * \param[in] instream Pointer to an input stream interface.
12048 + * \return Pointer to new parser context upon success.
12050 +ANTLR3_API pRSPParser
12051 +RSPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
12053 + pRSPParser ctx; /* Context structure we will build and return */
12055 + ctx = (pRSPParser) ANTLR3_CALLOC(1, sizeof(RSPParser));
12059 + // Failed to allocate memory for parser context
12064 + /* -------------------------------------------------------------------
12065 + * Memory for basic structure is allocated, now to fill in
12066 + * the base ANTLR3 structures. We initialize the function pointers
12067 + * for the standard ANTLR3 parser function set, but upon return
12068 + * from here, the programmer may set the pointers to provide custom
12069 + * implementations of each function.
12071 + * We don't use the macros defined in RSPParser.h here, in order that you can get a sense
12072 + * of what goes where.
12075 + /* Create a base parser/recognizer, using the supplied token stream
12077 + ctx->pParser = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state);
12078 + /* Install the implementation of our RSPParser interface
12080 + ctx->query = query;
12081 + ctx->expr = expr;
12082 + ctx->aexpr = aexpr;
12083 + ctx->crit = crit;
12084 + ctx->strcrit = strcrit;
12085 + ctx->strop = strop;
12086 + ctx->intcrit = intcrit;
12087 + ctx->intop = intop;
12088 + ctx->datecrit = datecrit;
12089 + ctx->dateop = dateop;
12090 + ctx->datespec = datespec;
12091 + ctx->dateref = dateref;
12092 + ctx->dateintval = dateintval;
12093 + ctx->free = RSPParserFree;
12094 + ctx->getGrammarFileName = getGrammarFileName;
12096 + /* Install the scope pushing methods.
12098 + ADAPTOR = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory);
12099 + ctx->vectors = antlr3VectorFactoryNew(0);
12103 + /* Install the token table
12105 + PSRSTATE->tokenNames = RSPParserTokenNames;
12108 + /* Return the newly built parser to the caller
12113 +/** Free the parser resources
12116 + RSPParserFree(pRSPParser ctx)
12118 + /* Free any scope memory
12121 + ctx->vectors->close(ctx->vectors);
12122 + /* We created the adaptor so we must free it
12124 + ADAPTOR->free(ADAPTOR);
12125 + // Free this parser
12127 + ctx->pParser->free(ctx->pParser);
12128 + ANTLR3_FREE(ctx);
12130 + /* Everything is released, so we can return
12135 +/** Return token names used by this parser
12137 + * The returned pointer is used as an index into the token names table (using the token
12138 + * number as the index).
12140 + * \return Pointer to first char * in the table.
12142 +static pANTLR3_UINT8 *getTokenNames()
12144 + return RSPParserTokenNames;
12148 +/* Declare the bitsets
12151 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_query42 */
12152 +static ANTLR3_BITWORD FOLLOW_expr_in_query42_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) };
12153 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_query42 = { FOLLOW_expr_in_query42_bits, 1 };
12154 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NEWLINE_in_query44 */
12155 +static ANTLR3_BITWORD FOLLOW_NEWLINE_in_query44_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000000) };
12156 +static ANTLR3_BITSET_LIST FOLLOW_NEWLINE_in_query44 = { FOLLOW_NEWLINE_in_query44_bits, 1 };
12157 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_EOF_in_query47 */
12158 +static ANTLR3_BITWORD FOLLOW_EOF_in_query47_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12159 +static ANTLR3_BITSET_LIST FOLLOW_EOF_in_query47 = { FOLLOW_EOF_in_query47_bits, 1 };
12160 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expr63 */
12161 +static ANTLR3_BITWORD FOLLOW_aexpr_in_expr63_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) };
12162 +static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expr63 = { FOLLOW_aexpr_in_expr63_bits, 1 };
12163 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expr66 */
12164 +static ANTLR3_BITWORD FOLLOW_OR_in_expr66_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) };
12165 +static ANTLR3_BITSET_LIST FOLLOW_OR_in_expr66 = { FOLLOW_OR_in_expr66_bits, 1 };
12166 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expr69 */
12167 +static ANTLR3_BITWORD FOLLOW_aexpr_in_expr69_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) };
12168 +static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expr69 = { FOLLOW_aexpr_in_expr69_bits, 1 };
12169 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_aexpr81 */
12170 +static ANTLR3_BITWORD FOLLOW_crit_in_aexpr81_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) };
12171 +static ANTLR3_BITSET_LIST FOLLOW_crit_in_aexpr81 = { FOLLOW_crit_in_aexpr81_bits, 1 };
12172 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_aexpr84 */
12173 +static ANTLR3_BITWORD FOLLOW_AND_in_aexpr84_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) };
12174 +static ANTLR3_BITSET_LIST FOLLOW_AND_in_aexpr84 = { FOLLOW_AND_in_aexpr84_bits, 1 };
12175 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_aexpr87 */
12176 +static ANTLR3_BITWORD FOLLOW_crit_in_aexpr87_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) };
12177 +static ANTLR3_BITSET_LIST FOLLOW_crit_in_aexpr87 = { FOLLOW_crit_in_aexpr87_bits, 1 };
12178 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_LPAR_in_crit99 */
12179 +static ANTLR3_BITWORD FOLLOW_LPAR_in_crit99_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) };
12180 +static ANTLR3_BITSET_LIST FOLLOW_LPAR_in_crit99 = { FOLLOW_LPAR_in_crit99_bits, 1 };
12181 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_crit101 */
12182 +static ANTLR3_BITWORD FOLLOW_expr_in_crit101_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000100) };
12183 +static ANTLR3_BITSET_LIST FOLLOW_expr_in_crit101 = { FOLLOW_expr_in_crit101_bits, 1 };
12184 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_RPAR_in_crit103 */
12185 +static ANTLR3_BITWORD FOLLOW_RPAR_in_crit103_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12186 +static ANTLR3_BITSET_LIST FOLLOW_RPAR_in_crit103 = { FOLLOW_RPAR_in_crit103_bits, 1 };
12187 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_strcrit_in_crit114 */
12188 +static ANTLR3_BITWORD FOLLOW_strcrit_in_crit114_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12189 +static ANTLR3_BITSET_LIST FOLLOW_strcrit_in_crit114 = { FOLLOW_strcrit_in_crit114_bits, 1 };
12190 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intcrit_in_crit119 */
12191 +static ANTLR3_BITWORD FOLLOW_intcrit_in_crit119_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12192 +static ANTLR3_BITSET_LIST FOLLOW_intcrit_in_crit119 = { FOLLOW_intcrit_in_crit119_bits, 1 };
12193 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_datecrit_in_crit124 */
12194 +static ANTLR3_BITWORD FOLLOW_datecrit_in_crit124_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12195 +static ANTLR3_BITSET_LIST FOLLOW_datecrit_in_crit124 = { FOLLOW_datecrit_in_crit124_bits, 1 };
12196 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_strcrit134 */
12197 +static ANTLR3_BITWORD FOLLOW_FIELD_in_strcrit134_bits[] = { ANTLR3_UINT64_LIT(0x000000000000F000) };
12198 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_strcrit134 = { FOLLOW_FIELD_in_strcrit134_bits, 1 };
12199 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_strop_in_strcrit136 */
12200 +static ANTLR3_BITWORD FOLLOW_strop_in_strcrit136_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000400) };
12201 +static ANTLR3_BITSET_LIST FOLLOW_strop_in_strcrit136 = { FOLLOW_strop_in_strcrit136_bits, 1 };
12202 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_strcrit138 */
12203 +static ANTLR3_BITWORD FOLLOW_STR_in_strcrit138_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12204 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_strcrit138 = { FOLLOW_STR_in_strcrit138_bits, 1 };
12205 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_strcrit155 */
12206 +static ANTLR3_BITWORD FOLLOW_FIELD_in_strcrit155_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000800) };
12207 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_strcrit155 = { FOLLOW_FIELD_in_strcrit155_bits, 1 };
12208 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_strcrit157 */
12209 +static ANTLR3_BITWORD FOLLOW_NOT_in_strcrit157_bits[] = { ANTLR3_UINT64_LIT(0x000000000000F000) };
12210 +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_strcrit157 = { FOLLOW_NOT_in_strcrit157_bits, 1 };
12211 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_strop_in_strcrit159 */
12212 +static ANTLR3_BITWORD FOLLOW_strop_in_strcrit159_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000400) };
12213 +static ANTLR3_BITSET_LIST FOLLOW_strop_in_strcrit159 = { FOLLOW_strop_in_strcrit159_bits, 1 };
12214 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_strcrit161 */
12215 +static ANTLR3_BITWORD FOLLOW_STR_in_strcrit161_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12216 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_strcrit161 = { FOLLOW_STR_in_strcrit161_bits, 1 };
12217 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_EQUAL_in_strop188 */
12218 +static ANTLR3_BITWORD FOLLOW_EQUAL_in_strop188_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12219 +static ANTLR3_BITSET_LIST FOLLOW_EQUAL_in_strop188 = { FOLLOW_EQUAL_in_strop188_bits, 1 };
12220 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INCLUDES_in_strop195 */
12221 +static ANTLR3_BITWORD FOLLOW_INCLUDES_in_strop195_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12222 +static ANTLR3_BITSET_LIST FOLLOW_INCLUDES_in_strop195 = { FOLLOW_INCLUDES_in_strop195_bits, 1 };
12223 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STARTSW_in_strop202 */
12224 +static ANTLR3_BITWORD FOLLOW_STARTSW_in_strop202_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12225 +static ANTLR3_BITSET_LIST FOLLOW_STARTSW_in_strop202 = { FOLLOW_STARTSW_in_strop202_bits, 1 };
12226 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENDSW_in_strop209 */
12227 +static ANTLR3_BITWORD FOLLOW_ENDSW_in_strop209_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12228 +static ANTLR3_BITSET_LIST FOLLOW_ENDSW_in_strop209 = { FOLLOW_ENDSW_in_strop209_bits, 1 };
12229 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_intcrit219 */
12230 +static ANTLR3_BITWORD FOLLOW_FIELD_in_intcrit219_bits[] = { ANTLR3_UINT64_LIT(0x00000000001E1000) };
12231 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_intcrit219 = { FOLLOW_FIELD_in_intcrit219_bits, 1 };
12232 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intop_in_intcrit221 */
12233 +static ANTLR3_BITWORD FOLLOW_intop_in_intcrit221_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) };
12234 +static ANTLR3_BITSET_LIST FOLLOW_intop_in_intcrit221 = { FOLLOW_intop_in_intcrit221_bits, 1 };
12235 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_intcrit223 */
12236 +static ANTLR3_BITWORD FOLLOW_INT_in_intcrit223_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12237 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_intcrit223 = { FOLLOW_INT_in_intcrit223_bits, 1 };
12238 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_intcrit240 */
12239 +static ANTLR3_BITWORD FOLLOW_FIELD_in_intcrit240_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000800) };
12240 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_intcrit240 = { FOLLOW_FIELD_in_intcrit240_bits, 1 };
12241 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_intcrit242 */
12242 +static ANTLR3_BITWORD FOLLOW_NOT_in_intcrit242_bits[] = { ANTLR3_UINT64_LIT(0x00000000001E1000) };
12243 +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_intcrit242 = { FOLLOW_NOT_in_intcrit242_bits, 1 };
12244 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intop_in_intcrit244 */
12245 +static ANTLR3_BITWORD FOLLOW_intop_in_intcrit244_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) };
12246 +static ANTLR3_BITSET_LIST FOLLOW_intop_in_intcrit244 = { FOLLOW_intop_in_intcrit244_bits, 1 };
12247 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_intcrit246 */
12248 +static ANTLR3_BITWORD FOLLOW_INT_in_intcrit246_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12249 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_intcrit246 = { FOLLOW_INT_in_intcrit246_bits, 1 };
12250 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_EQUAL_in_intop273 */
12251 +static ANTLR3_BITWORD FOLLOW_EQUAL_in_intop273_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12252 +static ANTLR3_BITSET_LIST FOLLOW_EQUAL_in_intop273 = { FOLLOW_EQUAL_in_intop273_bits, 1 };
12253 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_LESS_in_intop280 */
12254 +static ANTLR3_BITWORD FOLLOW_LESS_in_intop280_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12255 +static ANTLR3_BITSET_LIST FOLLOW_LESS_in_intop280 = { FOLLOW_LESS_in_intop280_bits, 1 };
12256 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_GREATER_in_intop287 */
12257 +static ANTLR3_BITWORD FOLLOW_GREATER_in_intop287_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12258 +static ANTLR3_BITSET_LIST FOLLOW_GREATER_in_intop287 = { FOLLOW_GREATER_in_intop287_bits, 1 };
12259 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_LTE_in_intop294 */
12260 +static ANTLR3_BITWORD FOLLOW_LTE_in_intop294_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12261 +static ANTLR3_BITSET_LIST FOLLOW_LTE_in_intop294 = { FOLLOW_LTE_in_intop294_bits, 1 };
12262 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_GTE_in_intop301 */
12263 +static ANTLR3_BITWORD FOLLOW_GTE_in_intop301_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12264 +static ANTLR3_BITSET_LIST FOLLOW_GTE_in_intop301 = { FOLLOW_GTE_in_intop301_bits, 1 };
12265 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_datecrit310 */
12266 +static ANTLR3_BITWORD FOLLOW_FIELD_in_datecrit310_bits[] = { ANTLR3_UINT64_LIT(0x0000000000600000) };
12267 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_datecrit310 = { FOLLOW_FIELD_in_datecrit310_bits, 1 };
12268 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datecrit312 */
12269 +static ANTLR3_BITWORD FOLLOW_dateop_in_datecrit312_bits[] = { ANTLR3_UINT64_LIT(0x0000000001810000) };
12270 +static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datecrit312 = { FOLLOW_dateop_in_datecrit312_bits, 1 };
12271 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_datespec_in_datecrit314 */
12272 +static ANTLR3_BITWORD FOLLOW_datespec_in_datecrit314_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12273 +static ANTLR3_BITSET_LIST FOLLOW_datespec_in_datecrit314 = { FOLLOW_datespec_in_datecrit314_bits, 1 };
12274 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateop337 */
12275 +static ANTLR3_BITWORD FOLLOW_BEFORE_in_dateop337_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12276 +static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateop337 = { FOLLOW_BEFORE_in_dateop337_bits, 1 };
12277 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateop344 */
12278 +static ANTLR3_BITWORD FOLLOW_AFTER_in_dateop344_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12279 +static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateop344 = { FOLLOW_AFTER_in_dateop344_bits, 1 };
12280 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec353 */
12281 +static ANTLR3_BITWORD FOLLOW_dateref_in_datespec353_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12282 +static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec353 = { FOLLOW_dateref_in_datespec353_bits, 1 };
12283 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_datespec358 */
12284 +static ANTLR3_BITWORD FOLLOW_INT_in_datespec358_bits[] = { ANTLR3_UINT64_LIT(0x000000001E000000) };
12285 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_datespec358 = { FOLLOW_INT_in_datespec358_bits, 1 };
12286 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateintval_in_datespec360 */
12287 +static ANTLR3_BITWORD FOLLOW_dateintval_in_datespec360_bits[] = { ANTLR3_UINT64_LIT(0x0000000000600000) };
12288 +static ANTLR3_BITSET_LIST FOLLOW_dateintval_in_datespec360 = { FOLLOW_dateintval_in_datespec360_bits, 1 };
12289 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datespec362 */
12290 +static ANTLR3_BITWORD FOLLOW_dateop_in_datespec362_bits[] = { ANTLR3_UINT64_LIT(0x0000000001800000) };
12291 +static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datespec362 = { FOLLOW_dateop_in_datespec362_bits, 1 };
12292 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec364 */
12293 +static ANTLR3_BITWORD FOLLOW_dateref_in_datespec364_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12294 +static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec364 = { FOLLOW_dateref_in_datespec364_bits, 1 };
12295 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateref388 */
12296 +static ANTLR3_BITWORD FOLLOW_DATE_in_dateref388_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12297 +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateref388 = { FOLLOW_DATE_in_dateref388_bits, 1 };
12298 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_TODAY_in_dateref395 */
12299 +static ANTLR3_BITWORD FOLLOW_TODAY_in_dateref395_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12300 +static ANTLR3_BITSET_LIST FOLLOW_TODAY_in_dateref395 = { FOLLOW_TODAY_in_dateref395_bits, 1 };
12301 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DAY_in_dateintval408 */
12302 +static ANTLR3_BITWORD FOLLOW_DAY_in_dateintval408_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12303 +static ANTLR3_BITSET_LIST FOLLOW_DAY_in_dateintval408 = { FOLLOW_DAY_in_dateintval408_bits, 1 };
12304 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_WEEK_in_dateintval415 */
12305 +static ANTLR3_BITWORD FOLLOW_WEEK_in_dateintval415_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12306 +static ANTLR3_BITSET_LIST FOLLOW_WEEK_in_dateintval415 = { FOLLOW_WEEK_in_dateintval415_bits, 1 };
12307 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_MONTH_in_dateintval422 */
12308 +static ANTLR3_BITWORD FOLLOW_MONTH_in_dateintval422_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12309 +static ANTLR3_BITSET_LIST FOLLOW_MONTH_in_dateintval422 = { FOLLOW_MONTH_in_dateintval422_bits, 1 };
12310 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_YEAR_in_dateintval429 */
12311 +static ANTLR3_BITWORD FOLLOW_YEAR_in_dateintval429_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12312 +static ANTLR3_BITSET_LIST FOLLOW_YEAR_in_dateintval429 = { FOLLOW_YEAR_in_dateintval429_bits, 1 };
12317 +/* ==============================================
12321 + * $ANTLR start query
12322 + * RSP.g:27:1: query : expr ( NEWLINE )? EOF -> expr ;
12324 +static RSPParser_query_return
12325 +query(pRSPParser ctx)
12327 + RSPParser_query_return retval;
12329 + pANTLR3_BASE_TREE root_0;
12331 + pANTLR3_COMMON_TOKEN NEWLINE2;
12332 + pANTLR3_COMMON_TOKEN EOF3;
12333 + RSPParser_expr_return expr1;
12334 + #undef RETURN_TYPE_expr1
12335 + #define RETURN_TYPE_expr1 RSPParser_expr_return
12337 + pANTLR3_BASE_TREE NEWLINE2_tree;
12338 + pANTLR3_BASE_TREE EOF3_tree;
12339 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NEWLINE;
12340 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_EOF;
12341 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr;
12342 + /* Initialize rule variables
12350 + expr1.tree = NULL;
12352 + retval.start = LT(1); retval.stop = retval.start;
12354 + NEWLINE2_tree = NULL;
12355 + EOF3_tree = NULL;
12357 + stream_NEWLINE = NULL;
12358 + #define CREATE_stream_NEWLINE if (stream_NEWLINE == NULL) {stream_NEWLINE = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NEWLINE"); }
12359 + stream_EOF = NULL;
12360 + #define CREATE_stream_EOF if (stream_EOF == NULL) {stream_EOF = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token EOF"); }
12361 + stream_expr = NULL;
12362 + #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); }
12364 + retval.tree = NULL;
12366 + // RSP.g:27:7: ( expr ( NEWLINE )? EOF -> expr )
12367 + // RSP.g:27:9: expr ( NEWLINE )? EOF
12369 + FOLLOWPUSH(FOLLOW_expr_in_query42);
12373 + if (HASEXCEPTION())
12375 + goto rulequeryEx;
12378 + CREATE_stream_expr; stream_expr->add(stream_expr, expr1.tree, NULL);
12380 + // RSP.g:27:14: ( NEWLINE )?
12395 + // RSP.g:27:14: NEWLINE
12397 + NEWLINE2 = (pANTLR3_COMMON_TOKEN) MATCHT(NEWLINE, &FOLLOW_NEWLINE_in_query44);
12398 + if (HASEXCEPTION())
12400 + goto rulequeryEx;
12403 + CREATE_stream_NEWLINE; stream_NEWLINE->add(stream_NEWLINE, NEWLINE2, NULL);
12411 + EOF3 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_query47);
12412 + if (HASEXCEPTION())
12414 + goto rulequeryEx;
12417 + CREATE_stream_EOF; stream_EOF->add(stream_EOF, EOF3, NULL);
12422 + * elements : expr
12424 + * rule labels : retval
12425 + * token list labels :
12426 + * rule list labels :
12429 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
12431 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
12433 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12434 + retval.tree = root_0;
12435 + // 27:28: -> expr
12437 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
12441 + retval.tree = root_0; // set result root
12442 + if (stream_retval != NULL) stream_retval->free(stream_retval);
12451 + // This is where rules clean up and exit
12453 + goto rulequeryEx; /* Prevent compiler warnings */
12455 + retval.stop = LT(-1);
12457 + retval.stop = LT(-1);
12458 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
12459 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
12460 + if (stream_NEWLINE != NULL) stream_NEWLINE->free(stream_NEWLINE);
12461 + if (stream_EOF != NULL) stream_EOF->free(stream_EOF);
12462 + if (stream_expr != NULL) stream_expr->free(stream_expr);
12464 + if (HASEXCEPTION())
12468 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
12474 +/* $ANTLR end query */
12477 + * $ANTLR start expr
12478 + * RSP.g:30:1: expr : aexpr ( OR aexpr )* ;
12480 +static RSPParser_expr_return
12481 +expr(pRSPParser ctx)
12483 + RSPParser_expr_return retval;
12485 + pANTLR3_BASE_TREE root_0;
12487 + pANTLR3_COMMON_TOKEN OR5;
12488 + RSPParser_aexpr_return aexpr4;
12489 + #undef RETURN_TYPE_aexpr4
12490 + #define RETURN_TYPE_aexpr4 RSPParser_aexpr_return
12492 + RSPParser_aexpr_return aexpr6;
12493 + #undef RETURN_TYPE_aexpr6
12494 + #define RETURN_TYPE_aexpr6 RSPParser_aexpr_return
12496 + pANTLR3_BASE_TREE OR5_tree;
12498 + /* Initialize rule variables
12505 + aexpr4.tree = NULL;
12507 + aexpr6.tree = NULL;
12509 + retval.start = LT(1); retval.stop = retval.start;
12514 + retval.tree = NULL;
12516 + // RSP.g:30:6: ( aexpr ( OR aexpr )* )
12517 + // RSP.g:30:8: aexpr ( OR aexpr )*
12519 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12521 + FOLLOWPUSH(FOLLOW_aexpr_in_expr63);
12522 + aexpr4=aexpr(ctx);
12525 + if (HASEXCEPTION())
12530 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr4.tree);
12532 + // RSP.g:30:14: ( OR aexpr )*
12550 + // RSP.g:30:15: OR aexpr
12552 + OR5 = (pANTLR3_COMMON_TOKEN) MATCHT(OR, &FOLLOW_OR_in_expr66);
12553 + if (HASEXCEPTION())
12558 + OR5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OR5));
12559 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OR5_tree, root_0));
12561 + FOLLOWPUSH(FOLLOW_aexpr_in_expr69);
12562 + aexpr6=aexpr(ctx);
12565 + if (HASEXCEPTION())
12570 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree);
12576 + goto loop2; /* break out of the loop */
12580 + loop2: ; /* Jump out to here if this rule does not match */
12588 + // This is where rules clean up and exit
12590 + goto ruleexprEx; /* Prevent compiler warnings */
12592 + retval.stop = LT(-1);
12594 + retval.stop = LT(-1);
12595 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
12596 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
12598 + if (HASEXCEPTION())
12602 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
12608 +/* $ANTLR end expr */
12611 + * $ANTLR start aexpr
12612 + * RSP.g:33:1: aexpr : crit ( AND crit )* ;
12614 +static RSPParser_aexpr_return
12615 +aexpr(pRSPParser ctx)
12617 + RSPParser_aexpr_return retval;
12619 + pANTLR3_BASE_TREE root_0;
12621 + pANTLR3_COMMON_TOKEN AND8;
12622 + RSPParser_crit_return crit7;
12623 + #undef RETURN_TYPE_crit7
12624 + #define RETURN_TYPE_crit7 RSPParser_crit_return
12626 + RSPParser_crit_return crit9;
12627 + #undef RETURN_TYPE_crit9
12628 + #define RETURN_TYPE_crit9 RSPParser_crit_return
12630 + pANTLR3_BASE_TREE AND8_tree;
12632 + /* Initialize rule variables
12639 + crit7.tree = NULL;
12641 + crit9.tree = NULL;
12643 + retval.start = LT(1); retval.stop = retval.start;
12645 + AND8_tree = NULL;
12648 + retval.tree = NULL;
12650 + // RSP.g:33:7: ( crit ( AND crit )* )
12651 + // RSP.g:33:9: crit ( AND crit )*
12653 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12655 + FOLLOWPUSH(FOLLOW_crit_in_aexpr81);
12659 + if (HASEXCEPTION())
12661 + goto ruleaexprEx;
12664 + ADAPTOR->addChild(ADAPTOR, root_0, crit7.tree);
12666 + // RSP.g:33:14: ( AND crit )*
12684 + // RSP.g:33:15: AND crit
12686 + AND8 = (pANTLR3_COMMON_TOKEN) MATCHT(AND, &FOLLOW_AND_in_aexpr84);
12687 + if (HASEXCEPTION())
12689 + goto ruleaexprEx;
12692 + AND8_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AND8));
12693 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, AND8_tree, root_0));
12695 + FOLLOWPUSH(FOLLOW_crit_in_aexpr87);
12699 + if (HASEXCEPTION())
12701 + goto ruleaexprEx;
12704 + ADAPTOR->addChild(ADAPTOR, root_0, crit9.tree);
12710 + goto loop3; /* break out of the loop */
12714 + loop3: ; /* Jump out to here if this rule does not match */
12722 + // This is where rules clean up and exit
12724 + goto ruleaexprEx; /* Prevent compiler warnings */
12726 + retval.stop = LT(-1);
12728 + retval.stop = LT(-1);
12729 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
12730 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
12732 + if (HASEXCEPTION())
12736 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
12742 +/* $ANTLR end aexpr */
12745 + * $ANTLR start crit
12746 + * RSP.g:36:1: crit : ( LPAR expr RPAR -> expr | strcrit | intcrit | datecrit );
12748 +static RSPParser_crit_return
12749 +crit(pRSPParser ctx)
12751 + RSPParser_crit_return retval;
12753 + pANTLR3_BASE_TREE root_0;
12755 + pANTLR3_COMMON_TOKEN LPAR10;
12756 + pANTLR3_COMMON_TOKEN RPAR12;
12757 + RSPParser_expr_return expr11;
12758 + #undef RETURN_TYPE_expr11
12759 + #define RETURN_TYPE_expr11 RSPParser_expr_return
12761 + RSPParser_strcrit_return strcrit13;
12762 + #undef RETURN_TYPE_strcrit13
12763 + #define RETURN_TYPE_strcrit13 RSPParser_strcrit_return
12765 + RSPParser_intcrit_return intcrit14;
12766 + #undef RETURN_TYPE_intcrit14
12767 + #define RETURN_TYPE_intcrit14 RSPParser_intcrit_return
12769 + RSPParser_datecrit_return datecrit15;
12770 + #undef RETURN_TYPE_datecrit15
12771 + #define RETURN_TYPE_datecrit15 RSPParser_datecrit_return
12773 + pANTLR3_BASE_TREE LPAR10_tree;
12774 + pANTLR3_BASE_TREE RPAR12_tree;
12775 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_RPAR;
12776 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_LPAR;
12777 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr;
12778 + /* Initialize rule variables
12786 + expr11.tree = NULL;
12788 + strcrit13.tree = NULL;
12790 + intcrit14.tree = NULL;
12792 + datecrit15.tree = NULL;
12794 + retval.start = LT(1); retval.stop = retval.start;
12796 + LPAR10_tree = NULL;
12797 + RPAR12_tree = NULL;
12799 + stream_RPAR = NULL;
12800 + #define CREATE_stream_RPAR if (stream_RPAR == NULL) {stream_RPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token RPAR"); }
12801 + stream_LPAR = NULL;
12802 + #define CREATE_stream_LPAR if (stream_LPAR == NULL) {stream_LPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token LPAR"); }
12803 + stream_expr = NULL;
12804 + #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); }
12806 + retval.tree = NULL;
12809 + // RSP.g:36:6: ( LPAR expr RPAR -> expr | strcrit | intcrit | datecrit )
12811 + ANTLR3_UINT32 alt4;
12847 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12848 + EXCEPTION->message = (void *)"";
12849 + EXCEPTION->decisionNum = 4;
12850 + EXCEPTION->state = 8;
12876 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12877 + EXCEPTION->message = (void *)"";
12878 + EXCEPTION->decisionNum = 4;
12879 + EXCEPTION->state = 3;
12910 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12911 + EXCEPTION->message = (void *)"";
12912 + EXCEPTION->decisionNum = 4;
12913 + EXCEPTION->state = 5;
12939 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12940 + EXCEPTION->message = (void *)"";
12941 + EXCEPTION->decisionNum = 4;
12942 + EXCEPTION->state = 2;
12953 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12954 + EXCEPTION->message = (void *)"";
12955 + EXCEPTION->decisionNum = 4;
12956 + EXCEPTION->state = 0;
12965 + // RSP.g:36:8: LPAR expr RPAR
12967 + LPAR10 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit99);
12968 + if (HASEXCEPTION())
12973 + CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR10, NULL);
12975 + FOLLOWPUSH(FOLLOW_expr_in_crit101);
12976 + expr11=expr(ctx);
12979 + if (HASEXCEPTION())
12984 + CREATE_stream_expr; stream_expr->add(stream_expr, expr11.tree, NULL);
12985 + RPAR12 = (pANTLR3_COMMON_TOKEN) MATCHT(RPAR, &FOLLOW_RPAR_in_crit103);
12986 + if (HASEXCEPTION())
12991 + CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR12, NULL);
12996 + * elements : expr
12998 + * rule labels : retval
12999 + * token list labels :
13000 + * rule list labels :
13003 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13005 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13007 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13008 + retval.tree = root_0;
13009 + // 36:25: -> expr
13011 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
13015 + retval.tree = root_0; // set result root
13016 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13023 + // RSP.g:37:4: strcrit
13025 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13027 + FOLLOWPUSH(FOLLOW_strcrit_in_crit114);
13028 + strcrit13=strcrit(ctx);
13031 + if (HASEXCEPTION())
13036 + ADAPTOR->addChild(ADAPTOR, root_0, strcrit13.tree);
13041 + // RSP.g:38:4: intcrit
13043 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13045 + FOLLOWPUSH(FOLLOW_intcrit_in_crit119);
13046 + intcrit14=intcrit(ctx);
13049 + if (HASEXCEPTION())
13054 + ADAPTOR->addChild(ADAPTOR, root_0, intcrit14.tree);
13059 + // RSP.g:39:4: datecrit
13061 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13063 + FOLLOWPUSH(FOLLOW_datecrit_in_crit124);
13064 + datecrit15=datecrit(ctx);
13067 + if (HASEXCEPTION())
13072 + ADAPTOR->addChild(ADAPTOR, root_0, datecrit15.tree);
13082 + // This is where rules clean up and exit
13084 + goto rulecritEx; /* Prevent compiler warnings */
13086 + retval.stop = LT(-1);
13088 + retval.stop = LT(-1);
13089 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13090 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13091 + if (stream_RPAR != NULL) stream_RPAR->free(stream_RPAR);
13092 + if (stream_LPAR != NULL) stream_LPAR->free(stream_LPAR);
13093 + if (stream_expr != NULL) stream_expr->free(stream_expr);
13095 + if (HASEXCEPTION())
13099 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13105 +/* $ANTLR end crit */
13108 + * $ANTLR start strcrit
13109 + * RSP.g:42:1: strcrit : ( FIELD strop STR -> ^( strop FIELD STR ) | FIELD NOT strop STR -> ^( NOT ^( strop FIELD STR ) ) );
13111 +static RSPParser_strcrit_return
13112 +strcrit(pRSPParser ctx)
13114 + RSPParser_strcrit_return retval;
13116 + pANTLR3_BASE_TREE root_0;
13118 + pANTLR3_COMMON_TOKEN FIELD16;
13119 + pANTLR3_COMMON_TOKEN STR18;
13120 + pANTLR3_COMMON_TOKEN FIELD19;
13121 + pANTLR3_COMMON_TOKEN NOT20;
13122 + pANTLR3_COMMON_TOKEN STR22;
13123 + RSPParser_strop_return strop17;
13124 + #undef RETURN_TYPE_strop17
13125 + #define RETURN_TYPE_strop17 RSPParser_strop_return
13127 + RSPParser_strop_return strop21;
13128 + #undef RETURN_TYPE_strop21
13129 + #define RETURN_TYPE_strop21 RSPParser_strop_return
13131 + pANTLR3_BASE_TREE FIELD16_tree;
13132 + pANTLR3_BASE_TREE STR18_tree;
13133 + pANTLR3_BASE_TREE FIELD19_tree;
13134 + pANTLR3_BASE_TREE NOT20_tree;
13135 + pANTLR3_BASE_TREE STR22_tree;
13136 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_STR;
13137 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_FIELD;
13138 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NOT;
13139 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_strop;
13140 + /* Initialize rule variables
13151 + strop17.tree = NULL;
13153 + strop21.tree = NULL;
13155 + retval.start = LT(1); retval.stop = retval.start;
13157 + FIELD16_tree = NULL;
13158 + STR18_tree = NULL;
13159 + FIELD19_tree = NULL;
13160 + NOT20_tree = NULL;
13161 + STR22_tree = NULL;
13163 + stream_STR = NULL;
13164 + #define CREATE_stream_STR if (stream_STR == NULL) {stream_STR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token STR"); }
13165 + stream_FIELD = NULL;
13166 + #define CREATE_stream_FIELD if (stream_FIELD == NULL) {stream_FIELD = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token FIELD"); }
13167 + stream_NOT = NULL;
13168 + #define CREATE_stream_NOT if (stream_NOT == NULL) {stream_NOT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NOT"); }
13169 + stream_strop = NULL;
13170 + #define CREATE_stream_strop if (stream_strop == NULL) {stream_strop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule strop"); }
13172 + retval.tree = NULL;
13175 + // RSP.g:42:9: ( FIELD strop STR -> ^( strop FIELD STR ) | FIELD NOT strop STR -> ^( NOT ^( strop FIELD STR ) ) )
13177 + ANTLR3_UINT32 alt5;
13203 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13204 + EXCEPTION->message = (void *)"";
13205 + EXCEPTION->decisionNum = 5;
13206 + EXCEPTION->state = 1;
13209 + goto rulestrcritEx;
13217 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13218 + EXCEPTION->message = (void *)"";
13219 + EXCEPTION->decisionNum = 5;
13220 + EXCEPTION->state = 0;
13223 + goto rulestrcritEx;
13229 + // RSP.g:42:11: FIELD strop STR
13231 + FIELD16 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit134);
13232 + if (HASEXCEPTION())
13234 + goto rulestrcritEx;
13237 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD16, NULL);
13239 + FOLLOWPUSH(FOLLOW_strop_in_strcrit136);
13240 + strop17=strop(ctx);
13243 + if (HASEXCEPTION())
13245 + goto rulestrcritEx;
13248 + CREATE_stream_strop; stream_strop->add(stream_strop, strop17.tree, NULL);
13249 + STR18 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_strcrit138);
13250 + if (HASEXCEPTION())
13252 + goto rulestrcritEx;
13255 + CREATE_stream_STR; stream_STR->add(stream_STR, STR18, NULL);
13260 + * elements : FIELD, STR, strop
13262 + * rule labels : retval
13263 + * token list labels :
13264 + * rule list labels :
13267 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13269 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13271 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13272 + retval.tree = root_0;
13273 + // 42:29: -> ^( strop FIELD STR )
13275 + // RSP.g:42:32: ^( strop FIELD STR )
13277 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13278 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_strop == NULL ? NULL : stream_strop->nextNode(stream_strop), root_1));
13280 + ADAPTOR->addChild(ADAPTOR, root_1, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
13281 + ADAPTOR->addChild(ADAPTOR, root_1, stream_STR == NULL ? NULL : stream_STR->nextNode(stream_STR));
13283 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13288 + retval.tree = root_0; // set result root
13289 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13296 + // RSP.g:43:4: FIELD NOT strop STR
13298 + FIELD19 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit155);
13299 + if (HASEXCEPTION())
13301 + goto rulestrcritEx;
13304 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD19, NULL);
13306 + NOT20 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_strcrit157);
13307 + if (HASEXCEPTION())
13309 + goto rulestrcritEx;
13312 + CREATE_stream_NOT; stream_NOT->add(stream_NOT, NOT20, NULL);
13314 + FOLLOWPUSH(FOLLOW_strop_in_strcrit159);
13315 + strop21=strop(ctx);
13318 + if (HASEXCEPTION())
13320 + goto rulestrcritEx;
13323 + CREATE_stream_strop; stream_strop->add(stream_strop, strop21.tree, NULL);
13324 + STR22 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_strcrit161);
13325 + if (HASEXCEPTION())
13327 + goto rulestrcritEx;
13330 + CREATE_stream_STR; stream_STR->add(stream_STR, STR22, NULL);
13335 + * elements : STR, FIELD, strop, NOT
13337 + * rule labels : retval
13338 + * token list labels :
13339 + * rule list labels :
13342 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13344 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13346 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13347 + retval.tree = root_0;
13348 + // 43:25: -> ^( NOT ^( strop FIELD STR ) )
13350 + // RSP.g:43:28: ^( NOT ^( strop FIELD STR ) )
13352 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13353 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_NOT == NULL ? NULL : stream_NOT->nextNode(stream_NOT), root_1));
13355 + // RSP.g:43:34: ^( strop FIELD STR )
13357 + pANTLR3_BASE_TREE root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13358 + root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_strop == NULL ? NULL : stream_strop->nextNode(stream_strop), root_2));
13360 + ADAPTOR->addChild(ADAPTOR, root_2, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
13361 + ADAPTOR->addChild(ADAPTOR, root_2, stream_STR == NULL ? NULL : stream_STR->nextNode(stream_STR));
13363 + ADAPTOR->addChild(ADAPTOR, root_1, root_2);
13366 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13371 + retval.tree = root_0; // set result root
13372 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13384 + // This is where rules clean up and exit
13386 + goto rulestrcritEx; /* 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);
13393 + if (stream_STR != NULL) stream_STR->free(stream_STR);
13394 + if (stream_FIELD != NULL) stream_FIELD->free(stream_FIELD);
13395 + if (stream_NOT != NULL) stream_NOT->free(stream_NOT);
13396 + if (stream_strop != NULL) stream_strop->free(stream_strop);
13398 + if (HASEXCEPTION())
13402 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13408 +/* $ANTLR end strcrit */
13411 + * $ANTLR start strop
13412 + * RSP.g:46:1: strop : (equal= EQUAL | includes= INCLUDES | startsw= STARTSW | endsw= ENDSW );
13414 +static RSPParser_strop_return
13415 +strop(pRSPParser ctx)
13417 + RSPParser_strop_return retval;
13419 + pANTLR3_BASE_TREE root_0;
13421 + pANTLR3_COMMON_TOKEN equal;
13422 + pANTLR3_COMMON_TOKEN includes;
13423 + pANTLR3_COMMON_TOKEN startsw;
13424 + pANTLR3_COMMON_TOKEN endsw;
13426 + pANTLR3_BASE_TREE equal_tree;
13427 + pANTLR3_BASE_TREE includes_tree;
13428 + pANTLR3_BASE_TREE startsw_tree;
13429 + pANTLR3_BASE_TREE endsw_tree;
13431 + /* Initialize rule variables
13441 + retval.start = LT(1); retval.stop = retval.start;
13443 + equal_tree = NULL;
13444 + includes_tree = NULL;
13445 + startsw_tree = NULL;
13446 + endsw_tree = NULL;
13449 + retval.tree = NULL;
13452 + // RSP.g:46:7: (equal= EQUAL | includes= INCLUDES | startsw= STARTSW | endsw= ENDSW )
13454 + ANTLR3_UINT32 alt6;
13483 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13484 + EXCEPTION->message = (void *)"";
13485 + EXCEPTION->decisionNum = 6;
13486 + EXCEPTION->state = 0;
13489 + goto rulestropEx;
13495 + // RSP.g:46:9: equal= EQUAL
13497 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13499 + equal = (pANTLR3_COMMON_TOKEN) MATCHT(EQUAL, &FOLLOW_EQUAL_in_strop188);
13500 + if (HASEXCEPTION())
13502 + goto rulestropEx;
13505 + equal_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, equal));
13506 + ADAPTOR->addChild(ADAPTOR, root_0, equal_tree);
13512 + // RSP.g:47:4: includes= INCLUDES
13514 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13516 + includes = (pANTLR3_COMMON_TOKEN) MATCHT(INCLUDES, &FOLLOW_INCLUDES_in_strop195);
13517 + if (HASEXCEPTION())
13519 + goto rulestropEx;
13522 + includes_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, includes));
13523 + ADAPTOR->addChild(ADAPTOR, root_0, includes_tree);
13529 + // RSP.g:48:4: startsw= STARTSW
13531 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13533 + startsw = (pANTLR3_COMMON_TOKEN) MATCHT(STARTSW, &FOLLOW_STARTSW_in_strop202);
13534 + if (HASEXCEPTION())
13536 + goto rulestropEx;
13539 + startsw_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, startsw));
13540 + ADAPTOR->addChild(ADAPTOR, root_0, startsw_tree);
13546 + // RSP.g:49:4: endsw= ENDSW
13548 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13550 + endsw = (pANTLR3_COMMON_TOKEN) MATCHT(ENDSW, &FOLLOW_ENDSW_in_strop209);
13551 + if (HASEXCEPTION())
13553 + goto rulestropEx;
13556 + endsw_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, endsw));
13557 + ADAPTOR->addChild(ADAPTOR, root_0, endsw_tree);
13568 + // This is where rules clean up and exit
13570 + goto rulestropEx; /* Prevent compiler warnings */
13572 + retval.stop = LT(-1);
13574 + retval.stop = LT(-1);
13575 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13576 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13578 + if (HASEXCEPTION())
13582 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13588 +/* $ANTLR end strop */
13591 + * $ANTLR start intcrit
13592 + * RSP.g:52:1: intcrit : ( FIELD intop INT -> ^( intop FIELD INT ) | FIELD NOT intop INT -> ^( NOT ^( intop FIELD INT ) ) );
13594 +static RSPParser_intcrit_return
13595 +intcrit(pRSPParser ctx)
13597 + RSPParser_intcrit_return retval;
13599 + pANTLR3_BASE_TREE root_0;
13601 + pANTLR3_COMMON_TOKEN FIELD23;
13602 + pANTLR3_COMMON_TOKEN INT25;
13603 + pANTLR3_COMMON_TOKEN FIELD26;
13604 + pANTLR3_COMMON_TOKEN NOT27;
13605 + pANTLR3_COMMON_TOKEN INT29;
13606 + RSPParser_intop_return intop24;
13607 + #undef RETURN_TYPE_intop24
13608 + #define RETURN_TYPE_intop24 RSPParser_intop_return
13610 + RSPParser_intop_return intop28;
13611 + #undef RETURN_TYPE_intop28
13612 + #define RETURN_TYPE_intop28 RSPParser_intop_return
13614 + pANTLR3_BASE_TREE FIELD23_tree;
13615 + pANTLR3_BASE_TREE INT25_tree;
13616 + pANTLR3_BASE_TREE FIELD26_tree;
13617 + pANTLR3_BASE_TREE NOT27_tree;
13618 + pANTLR3_BASE_TREE INT29_tree;
13619 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_FIELD;
13620 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_INT;
13621 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NOT;
13622 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_intop;
13623 + /* Initialize rule variables
13634 + intop24.tree = NULL;
13636 + intop28.tree = NULL;
13638 + retval.start = LT(1); retval.stop = retval.start;
13640 + FIELD23_tree = NULL;
13641 + INT25_tree = NULL;
13642 + FIELD26_tree = NULL;
13643 + NOT27_tree = NULL;
13644 + INT29_tree = NULL;
13646 + stream_FIELD = NULL;
13647 + #define CREATE_stream_FIELD if (stream_FIELD == NULL) {stream_FIELD = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token FIELD"); }
13648 + stream_INT = NULL;
13649 + #define CREATE_stream_INT if (stream_INT == NULL) {stream_INT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token INT"); }
13650 + stream_NOT = NULL;
13651 + #define CREATE_stream_NOT if (stream_NOT == NULL) {stream_NOT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NOT"); }
13652 + stream_intop = NULL;
13653 + #define CREATE_stream_intop if (stream_intop == NULL) {stream_intop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule intop"); }
13655 + retval.tree = NULL;
13658 + // RSP.g:52:9: ( FIELD intop INT -> ^( intop FIELD INT ) | FIELD NOT intop INT -> ^( NOT ^( intop FIELD INT ) ) )
13660 + ANTLR3_UINT32 alt7;
13687 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13688 + EXCEPTION->message = (void *)"";
13689 + EXCEPTION->decisionNum = 7;
13690 + EXCEPTION->state = 1;
13693 + goto ruleintcritEx;
13701 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13702 + EXCEPTION->message = (void *)"";
13703 + EXCEPTION->decisionNum = 7;
13704 + EXCEPTION->state = 0;
13707 + goto ruleintcritEx;
13713 + // RSP.g:52:11: FIELD intop INT
13715 + FIELD23 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit219);
13716 + if (HASEXCEPTION())
13718 + goto ruleintcritEx;
13721 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD23, NULL);
13723 + FOLLOWPUSH(FOLLOW_intop_in_intcrit221);
13724 + intop24=intop(ctx);
13727 + if (HASEXCEPTION())
13729 + goto ruleintcritEx;
13732 + CREATE_stream_intop; stream_intop->add(stream_intop, intop24.tree, NULL);
13733 + INT25 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_intcrit223);
13734 + if (HASEXCEPTION())
13736 + goto ruleintcritEx;
13739 + CREATE_stream_INT; stream_INT->add(stream_INT, INT25, NULL);
13744 + * elements : FIELD, INT, intop
13746 + * rule labels : retval
13747 + * token list labels :
13748 + * rule list labels :
13751 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13753 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13755 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13756 + retval.tree = root_0;
13757 + // 52:29: -> ^( intop FIELD INT )
13759 + // RSP.g:52:32: ^( intop FIELD INT )
13761 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13762 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_intop == NULL ? NULL : stream_intop->nextNode(stream_intop), root_1));
13764 + ADAPTOR->addChild(ADAPTOR, root_1, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
13765 + ADAPTOR->addChild(ADAPTOR, root_1, stream_INT == NULL ? NULL : stream_INT->nextNode(stream_INT));
13767 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13772 + retval.tree = root_0; // set result root
13773 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13780 + // RSP.g:53:4: FIELD NOT intop INT
13782 + FIELD26 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit240);
13783 + if (HASEXCEPTION())
13785 + goto ruleintcritEx;
13788 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD26, NULL);
13790 + NOT27 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_intcrit242);
13791 + if (HASEXCEPTION())
13793 + goto ruleintcritEx;
13796 + CREATE_stream_NOT; stream_NOT->add(stream_NOT, NOT27, NULL);
13798 + FOLLOWPUSH(FOLLOW_intop_in_intcrit244);
13799 + intop28=intop(ctx);
13802 + if (HASEXCEPTION())
13804 + goto ruleintcritEx;
13807 + CREATE_stream_intop; stream_intop->add(stream_intop, intop28.tree, NULL);
13808 + INT29 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_intcrit246);
13809 + if (HASEXCEPTION())
13811 + goto ruleintcritEx;
13814 + CREATE_stream_INT; stream_INT->add(stream_INT, INT29, NULL);
13819 + * elements : intop, NOT, INT, FIELD
13821 + * rule labels : retval
13822 + * token list labels :
13823 + * rule list labels :
13826 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13828 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13830 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13831 + retval.tree = root_0;
13832 + // 53:25: -> ^( NOT ^( intop FIELD INT ) )
13834 + // RSP.g:53:28: ^( NOT ^( intop FIELD INT ) )
13836 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13837 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_NOT == NULL ? NULL : stream_NOT->nextNode(stream_NOT), root_1));
13839 + // RSP.g:53:34: ^( intop FIELD INT )
13841 + pANTLR3_BASE_TREE root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13842 + root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_intop == NULL ? NULL : stream_intop->nextNode(stream_intop), root_2));
13844 + ADAPTOR->addChild(ADAPTOR, root_2, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
13845 + ADAPTOR->addChild(ADAPTOR, root_2, stream_INT == NULL ? NULL : stream_INT->nextNode(stream_INT));
13847 + ADAPTOR->addChild(ADAPTOR, root_1, root_2);
13850 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13855 + retval.tree = root_0; // set result root
13856 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13868 + // This is where rules clean up and exit
13870 + goto ruleintcritEx; /* Prevent compiler warnings */
13872 + retval.stop = LT(-1);
13874 + retval.stop = LT(-1);
13875 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13876 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13877 + if (stream_FIELD != NULL) stream_FIELD->free(stream_FIELD);
13878 + if (stream_INT != NULL) stream_INT->free(stream_INT);
13879 + if (stream_NOT != NULL) stream_NOT->free(stream_NOT);
13880 + if (stream_intop != NULL) stream_intop->free(stream_intop);
13882 + if (HASEXCEPTION())
13886 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13892 +/* $ANTLR end intcrit */
13895 + * $ANTLR start intop
13896 + * RSP.g:56:1: intop : (equal= EQUAL | less= LESS | greater= GREATER | lte= LTE | gte= GTE );
13898 +static RSPParser_intop_return
13899 +intop(pRSPParser ctx)
13901 + RSPParser_intop_return retval;
13903 + pANTLR3_BASE_TREE root_0;
13905 + pANTLR3_COMMON_TOKEN equal;
13906 + pANTLR3_COMMON_TOKEN less;
13907 + pANTLR3_COMMON_TOKEN greater;
13908 + pANTLR3_COMMON_TOKEN lte;
13909 + pANTLR3_COMMON_TOKEN gte;
13911 + pANTLR3_BASE_TREE equal_tree;
13912 + pANTLR3_BASE_TREE less_tree;
13913 + pANTLR3_BASE_TREE greater_tree;
13914 + pANTLR3_BASE_TREE lte_tree;
13915 + pANTLR3_BASE_TREE gte_tree;
13917 + /* Initialize rule variables
13928 + retval.start = LT(1); retval.stop = retval.start;
13930 + equal_tree = NULL;
13931 + less_tree = NULL;
13932 + greater_tree = NULL;
13937 + retval.tree = NULL;
13940 + // RSP.g:56:7: (equal= EQUAL | less= LESS | greater= GREATER | lte= LTE | gte= GTE )
13942 + ANTLR3_UINT32 alt8;
13976 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13977 + EXCEPTION->message = (void *)"";
13978 + EXCEPTION->decisionNum = 8;
13979 + EXCEPTION->state = 0;
13982 + goto ruleintopEx;
13988 + // RSP.g:56:9: equal= EQUAL
13990 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13992 + equal = (pANTLR3_COMMON_TOKEN) MATCHT(EQUAL, &FOLLOW_EQUAL_in_intop273);
13993 + if (HASEXCEPTION())
13995 + goto ruleintopEx;
13998 + equal_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, equal));
13999 + ADAPTOR->addChild(ADAPTOR, root_0, equal_tree);
14005 + // RSP.g:57:4: less= LESS
14007 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14009 + less = (pANTLR3_COMMON_TOKEN) MATCHT(LESS, &FOLLOW_LESS_in_intop280);
14010 + if (HASEXCEPTION())
14012 + goto ruleintopEx;
14015 + less_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, less));
14016 + ADAPTOR->addChild(ADAPTOR, root_0, less_tree);
14022 + // RSP.g:58:4: greater= GREATER
14024 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14026 + greater = (pANTLR3_COMMON_TOKEN) MATCHT(GREATER, &FOLLOW_GREATER_in_intop287);
14027 + if (HASEXCEPTION())
14029 + goto ruleintopEx;
14032 + greater_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, greater));
14033 + ADAPTOR->addChild(ADAPTOR, root_0, greater_tree);
14039 + // RSP.g:59:4: lte= LTE
14041 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14043 + lte = (pANTLR3_COMMON_TOKEN) MATCHT(LTE, &FOLLOW_LTE_in_intop294);
14044 + if (HASEXCEPTION())
14046 + goto ruleintopEx;
14049 + lte_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, lte));
14050 + ADAPTOR->addChild(ADAPTOR, root_0, lte_tree);
14056 + // RSP.g:60:4: gte= GTE
14058 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14060 + gte = (pANTLR3_COMMON_TOKEN) MATCHT(GTE, &FOLLOW_GTE_in_intop301);
14061 + if (HASEXCEPTION())
14063 + goto ruleintopEx;
14066 + gte_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, gte));
14067 + ADAPTOR->addChild(ADAPTOR, root_0, gte_tree);
14078 + // This is where rules clean up and exit
14080 + goto ruleintopEx; /* Prevent compiler warnings */
14082 + retval.stop = LT(-1);
14084 + retval.stop = LT(-1);
14085 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
14086 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
14088 + if (HASEXCEPTION())
14092 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14098 +/* $ANTLR end intop */
14101 + * $ANTLR start datecrit
14102 + * RSP.g:63:1: datecrit : FIELD dateop datespec -> ^( dateop FIELD datespec ) ;
14104 +static RSPParser_datecrit_return
14105 +datecrit(pRSPParser ctx)
14107 + RSPParser_datecrit_return retval;
14109 + pANTLR3_BASE_TREE root_0;
14111 + pANTLR3_COMMON_TOKEN FIELD30;
14112 + RSPParser_dateop_return dateop31;
14113 + #undef RETURN_TYPE_dateop31
14114 + #define RETURN_TYPE_dateop31 RSPParser_dateop_return
14116 + RSPParser_datespec_return datespec32;
14117 + #undef RETURN_TYPE_datespec32
14118 + #define RETURN_TYPE_datespec32 RSPParser_datespec_return
14120 + pANTLR3_BASE_TREE FIELD30_tree;
14121 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_FIELD;
14122 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_datespec;
14123 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateop;
14124 + /* Initialize rule variables
14131 + dateop31.tree = NULL;
14133 + datespec32.tree = NULL;
14135 + retval.start = LT(1); retval.stop = retval.start;
14137 + FIELD30_tree = NULL;
14139 + stream_FIELD = NULL;
14140 + #define CREATE_stream_FIELD if (stream_FIELD == NULL) {stream_FIELD = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token FIELD"); }
14141 + stream_datespec = NULL;
14142 + #define CREATE_stream_datespec if (stream_datespec == NULL) {stream_datespec = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule datespec"); }
14143 + stream_dateop = NULL;
14144 + #define CREATE_stream_dateop if (stream_dateop == NULL) {stream_dateop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateop"); }
14146 + retval.tree = NULL;
14148 + // RSP.g:63:9: ( FIELD dateop datespec -> ^( dateop FIELD datespec ) )
14149 + // RSP.g:63:11: FIELD dateop datespec
14151 + FIELD30 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_datecrit310);
14152 + if (HASEXCEPTION())
14154 + goto ruledatecritEx;
14157 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD30, NULL);
14159 + FOLLOWPUSH(FOLLOW_dateop_in_datecrit312);
14160 + dateop31=dateop(ctx);
14163 + if (HASEXCEPTION())
14165 + goto ruledatecritEx;
14168 + CREATE_stream_dateop; stream_dateop->add(stream_dateop, dateop31.tree, NULL);
14169 + FOLLOWPUSH(FOLLOW_datespec_in_datecrit314);
14170 + datespec32=datespec(ctx);
14173 + if (HASEXCEPTION())
14175 + goto ruledatecritEx;
14178 + CREATE_stream_datespec; stream_datespec->add(stream_datespec, datespec32.tree, NULL);
14182 + * elements : FIELD, dateop, datespec
14184 + * rule labels : retval
14185 + * token list labels :
14186 + * rule list labels :
14189 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
14191 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
14193 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14194 + retval.tree = root_0;
14195 + // 63:34: -> ^( dateop FIELD datespec )
14197 + // RSP.g:63:37: ^( dateop FIELD datespec )
14199 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14200 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_dateop == NULL ? NULL : stream_dateop->nextNode(stream_dateop), root_1));
14202 + ADAPTOR->addChild(ADAPTOR, root_1, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
14203 + ADAPTOR->addChild(ADAPTOR, root_1, stream_datespec == NULL ? NULL : stream_datespec->nextTree(stream_datespec));
14205 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
14210 + retval.tree = root_0; // set result root
14211 + if (stream_retval != NULL) stream_retval->free(stream_retval);
14220 + // This is where rules clean up and exit
14222 + goto ruledatecritEx; /* Prevent compiler warnings */
14223 + ruledatecritEx: ;
14224 + retval.stop = LT(-1);
14226 + retval.stop = LT(-1);
14227 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
14228 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
14229 + if (stream_FIELD != NULL) stream_FIELD->free(stream_FIELD);
14230 + if (stream_datespec != NULL) stream_datespec->free(stream_datespec);
14231 + if (stream_dateop != NULL) stream_dateop->free(stream_dateop);
14233 + if (HASEXCEPTION())
14237 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14243 +/* $ANTLR end datecrit */
14246 + * $ANTLR start dateop
14247 + * RSP.g:66:1: dateop : (before= BEFORE | after= AFTER );
14249 +static RSPParser_dateop_return
14250 +dateop(pRSPParser ctx)
14252 + RSPParser_dateop_return retval;
14254 + pANTLR3_BASE_TREE root_0;
14256 + pANTLR3_COMMON_TOKEN before;
14257 + pANTLR3_COMMON_TOKEN after;
14259 + pANTLR3_BASE_TREE before_tree;
14260 + pANTLR3_BASE_TREE after_tree;
14262 + /* Initialize rule variables
14270 + retval.start = LT(1); retval.stop = retval.start;
14272 + before_tree = NULL;
14273 + after_tree = NULL;
14276 + retval.tree = NULL;
14279 + // RSP.g:66:8: (before= BEFORE | after= AFTER )
14281 + ANTLR3_UINT32 alt9;
14300 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
14301 + EXCEPTION->message = (void *)"";
14302 + EXCEPTION->decisionNum = 9;
14303 + EXCEPTION->state = 0;
14306 + goto ruledateopEx;
14312 + // RSP.g:66:10: before= BEFORE
14314 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14316 + before = (pANTLR3_COMMON_TOKEN) MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateop337);
14317 + if (HASEXCEPTION())
14319 + goto ruledateopEx;
14322 + before_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, before));
14323 + ADAPTOR->addChild(ADAPTOR, root_0, before_tree);
14329 + // RSP.g:67:4: after= AFTER
14331 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14333 + after = (pANTLR3_COMMON_TOKEN) MATCHT(AFTER, &FOLLOW_AFTER_in_dateop344);
14334 + if (HASEXCEPTION())
14336 + goto ruledateopEx;
14339 + after_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, after));
14340 + ADAPTOR->addChild(ADAPTOR, root_0, after_tree);
14351 + // This is where rules clean up and exit
14353 + goto ruledateopEx; /* Prevent compiler warnings */
14355 + retval.stop = LT(-1);
14357 + retval.stop = LT(-1);
14358 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
14359 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
14361 + if (HASEXCEPTION())
14365 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14371 +/* $ANTLR end dateop */
14374 + * $ANTLR start datespec
14375 + * RSP.g:70:1: datespec : ( dateref | INT dateintval dateop dateref -> ^( dateop dateref INT dateintval ) );
14377 +static RSPParser_datespec_return
14378 +datespec(pRSPParser ctx)
14380 + RSPParser_datespec_return retval;
14382 + pANTLR3_BASE_TREE root_0;
14384 + pANTLR3_COMMON_TOKEN INT34;
14385 + RSPParser_dateref_return dateref33;
14386 + #undef RETURN_TYPE_dateref33
14387 + #define RETURN_TYPE_dateref33 RSPParser_dateref_return
14389 + RSPParser_dateintval_return dateintval35;
14390 + #undef RETURN_TYPE_dateintval35
14391 + #define RETURN_TYPE_dateintval35 RSPParser_dateintval_return
14393 + RSPParser_dateop_return dateop36;
14394 + #undef RETURN_TYPE_dateop36
14395 + #define RETURN_TYPE_dateop36 RSPParser_dateop_return
14397 + RSPParser_dateref_return dateref37;
14398 + #undef RETURN_TYPE_dateref37
14399 + #define RETURN_TYPE_dateref37 RSPParser_dateref_return
14401 + pANTLR3_BASE_TREE INT34_tree;
14402 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_INT;
14403 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateintval;
14404 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateref;
14405 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateop;
14406 + /* Initialize rule variables
14413 + dateref33.tree = NULL;
14415 + dateintval35.tree = NULL;
14417 + dateop36.tree = NULL;
14419 + dateref37.tree = NULL;
14421 + retval.start = LT(1); retval.stop = retval.start;
14423 + INT34_tree = NULL;
14425 + stream_INT = NULL;
14426 + #define CREATE_stream_INT if (stream_INT == NULL) {stream_INT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token INT"); }
14427 + stream_dateintval = NULL;
14428 + #define CREATE_stream_dateintval if (stream_dateintval == NULL) {stream_dateintval = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateintval"); }
14429 + stream_dateref = NULL;
14430 + #define CREATE_stream_dateref if (stream_dateref == NULL) {stream_dateref = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateref"); }
14431 + stream_dateop = NULL;
14432 + #define CREATE_stream_dateop if (stream_dateop == NULL) {stream_dateop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateop"); }
14434 + retval.tree = NULL;
14437 + // RSP.g:70:9: ( dateref | INT dateintval dateop dateref -> ^( dateop dateref INT dateintval ) )
14439 + ANTLR3_UINT32 alt10;
14459 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
14460 + EXCEPTION->message = (void *)"";
14461 + EXCEPTION->decisionNum = 10;
14462 + EXCEPTION->state = 0;
14465 + goto ruledatespecEx;
14471 + // RSP.g:70:11: dateref
14473 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14475 + FOLLOWPUSH(FOLLOW_dateref_in_datespec353);
14476 + dateref33=dateref(ctx);
14479 + if (HASEXCEPTION())
14481 + goto ruledatespecEx;
14484 + ADAPTOR->addChild(ADAPTOR, root_0, dateref33.tree);
14489 + // RSP.g:71:4: INT dateintval dateop dateref
14491 + INT34 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_datespec358);
14492 + if (HASEXCEPTION())
14494 + goto ruledatespecEx;
14497 + CREATE_stream_INT; stream_INT->add(stream_INT, INT34, NULL);
14499 + FOLLOWPUSH(FOLLOW_dateintval_in_datespec360);
14500 + dateintval35=dateintval(ctx);
14503 + if (HASEXCEPTION())
14505 + goto ruledatespecEx;
14508 + CREATE_stream_dateintval; stream_dateintval->add(stream_dateintval, dateintval35.tree, NULL);
14509 + FOLLOWPUSH(FOLLOW_dateop_in_datespec362);
14510 + dateop36=dateop(ctx);
14513 + if (HASEXCEPTION())
14515 + goto ruledatespecEx;
14518 + CREATE_stream_dateop; stream_dateop->add(stream_dateop, dateop36.tree, NULL);
14519 + FOLLOWPUSH(FOLLOW_dateref_in_datespec364);
14520 + dateref37=dateref(ctx);
14523 + if (HASEXCEPTION())
14525 + goto ruledatespecEx;
14528 + CREATE_stream_dateref; stream_dateref->add(stream_dateref, dateref37.tree, NULL);
14532 + * elements : dateop, INT, dateintval, dateref
14534 + * rule labels : retval
14535 + * token list labels :
14536 + * rule list labels :
14539 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
14541 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
14543 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14544 + retval.tree = root_0;
14545 + // 71:34: -> ^( dateop dateref INT dateintval )
14547 + // RSP.g:71:37: ^( dateop dateref INT dateintval )
14549 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14550 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_dateop == NULL ? NULL : stream_dateop->nextNode(stream_dateop), root_1));
14552 + ADAPTOR->addChild(ADAPTOR, root_1, stream_dateref == NULL ? NULL : stream_dateref->nextTree(stream_dateref));
14553 + ADAPTOR->addChild(ADAPTOR, root_1, stream_INT == NULL ? NULL : stream_INT->nextNode(stream_INT));
14554 + ADAPTOR->addChild(ADAPTOR, root_1, stream_dateintval == NULL ? NULL : stream_dateintval->nextTree(stream_dateintval));
14556 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
14561 + retval.tree = root_0; // set result root
14562 + if (stream_retval != NULL) stream_retval->free(stream_retval);
14574 + // This is where rules clean up and exit
14576 + goto ruledatespecEx; /* Prevent compiler warnings */
14577 + ruledatespecEx: ;
14578 + retval.stop = LT(-1);
14580 + retval.stop = LT(-1);
14581 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
14582 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
14583 + if (stream_INT != NULL) stream_INT->free(stream_INT);
14584 + if (stream_dateintval != NULL) stream_dateintval->free(stream_dateintval);
14585 + if (stream_dateref != NULL) stream_dateref->free(stream_dateref);
14586 + if (stream_dateop != NULL) stream_dateop->free(stream_dateop);
14588 + if (HASEXCEPTION())
14592 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14598 +/* $ANTLR end datespec */
14601 + * $ANTLR start dateref
14602 + * RSP.g:74:1: dateref : (date= DATE | today= TODAY );
14604 +static RSPParser_dateref_return
14605 +dateref(pRSPParser ctx)
14607 + RSPParser_dateref_return retval;
14609 + pANTLR3_BASE_TREE root_0;
14611 + pANTLR3_COMMON_TOKEN date;
14612 + pANTLR3_COMMON_TOKEN today;
14614 + pANTLR3_BASE_TREE date_tree;
14615 + pANTLR3_BASE_TREE today_tree;
14617 + /* Initialize rule variables
14625 + retval.start = LT(1); retval.stop = retval.start;
14627 + date_tree = NULL;
14628 + today_tree = NULL;
14631 + retval.tree = NULL;
14634 + // RSP.g:74:9: (date= DATE | today= TODAY )
14636 + ANTLR3_UINT32 alt11;
14655 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
14656 + EXCEPTION->message = (void *)"";
14657 + EXCEPTION->decisionNum = 11;
14658 + EXCEPTION->state = 0;
14661 + goto ruledaterefEx;
14667 + // RSP.g:74:11: date= DATE
14669 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14671 + date = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateref388);
14672 + if (HASEXCEPTION())
14674 + goto ruledaterefEx;
14677 + date_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, date));
14678 + ADAPTOR->addChild(ADAPTOR, root_0, date_tree);
14684 + // RSP.g:75:4: today= TODAY
14686 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14688 + today = (pANTLR3_COMMON_TOKEN) MATCHT(TODAY, &FOLLOW_TODAY_in_dateref395);
14689 + if (HASEXCEPTION())
14691 + goto ruledaterefEx;
14694 + today_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, today));
14695 + ADAPTOR->addChild(ADAPTOR, root_0, today_tree);
14706 + // This is where rules clean up and exit
14708 + goto ruledaterefEx; /* Prevent compiler warnings */
14710 + retval.stop = LT(-1);
14712 + retval.stop = LT(-1);
14713 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
14714 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
14716 + if (HASEXCEPTION())
14720 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14726 +/* $ANTLR end dateref */
14729 + * $ANTLR start dateintval
14730 + * RSP.g:78:1: dateintval : (day= DAY | week= WEEK | month= MONTH | year= YEAR );
14732 +static RSPParser_dateintval_return
14733 +dateintval(pRSPParser ctx)
14735 + RSPParser_dateintval_return retval;
14737 + pANTLR3_BASE_TREE root_0;
14739 + pANTLR3_COMMON_TOKEN day;
14740 + pANTLR3_COMMON_TOKEN week;
14741 + pANTLR3_COMMON_TOKEN month;
14742 + pANTLR3_COMMON_TOKEN year;
14744 + pANTLR3_BASE_TREE day_tree;
14745 + pANTLR3_BASE_TREE week_tree;
14746 + pANTLR3_BASE_TREE month_tree;
14747 + pANTLR3_BASE_TREE year_tree;
14749 + /* Initialize rule variables
14759 + retval.start = LT(1); retval.stop = retval.start;
14762 + week_tree = NULL;
14763 + month_tree = NULL;
14764 + year_tree = NULL;
14767 + retval.tree = NULL;
14770 + // RSP.g:79:2: (day= DAY | week= WEEK | month= MONTH | year= YEAR )
14772 + ANTLR3_UINT32 alt12;
14801 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
14802 + EXCEPTION->message = (void *)"";
14803 + EXCEPTION->decisionNum = 12;
14804 + EXCEPTION->state = 0;
14807 + goto ruledateintvalEx;
14813 + // RSP.g:79:4: day= DAY
14815 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14817 + day = (pANTLR3_COMMON_TOKEN) MATCHT(DAY, &FOLLOW_DAY_in_dateintval408);
14818 + if (HASEXCEPTION())
14820 + goto ruledateintvalEx;
14823 + day_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, day));
14824 + ADAPTOR->addChild(ADAPTOR, root_0, day_tree);
14830 + // RSP.g:80:4: week= WEEK
14832 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14834 + week = (pANTLR3_COMMON_TOKEN) MATCHT(WEEK, &FOLLOW_WEEK_in_dateintval415);
14835 + if (HASEXCEPTION())
14837 + goto ruledateintvalEx;
14840 + week_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, week));
14841 + ADAPTOR->addChild(ADAPTOR, root_0, week_tree);
14847 + // RSP.g:81:4: month= MONTH
14849 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14851 + month = (pANTLR3_COMMON_TOKEN) MATCHT(MONTH, &FOLLOW_MONTH_in_dateintval422);
14852 + if (HASEXCEPTION())
14854 + goto ruledateintvalEx;
14857 + month_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, month));
14858 + ADAPTOR->addChild(ADAPTOR, root_0, month_tree);
14864 + // RSP.g:82:4: year= YEAR
14866 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14868 + year = (pANTLR3_COMMON_TOKEN) MATCHT(YEAR, &FOLLOW_YEAR_in_dateintval429);
14869 + if (HASEXCEPTION())
14871 + goto ruledateintvalEx;
14874 + year_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, year));
14875 + ADAPTOR->addChild(ADAPTOR, root_0, year_tree);
14886 + // This is where rules clean up and exit
14888 + goto ruledateintvalEx; /* Prevent compiler warnings */
14889 + ruledateintvalEx: ;
14890 + retval.stop = LT(-1);
14892 + retval.stop = LT(-1);
14893 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
14894 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
14896 + if (HASEXCEPTION())
14900 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14906 +/* $ANTLR end dateintval */
14907 +/* End of parsing rules
14908 + * ==============================================
14911 +/* ==============================================
14912 + * Syntactic predicates
14914 +/* End of syntactic predicates
14915 + * ==============================================
14924 + * =============================================================================
14926 diff --git a/src/pregen/RSPParser.h b/src/pregen/RSPParser.h
14927 new file mode 100644
14928 index 0000000..1796c0a
14930 +++ b/src/pregen/RSPParser.h
14933 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
14935 + * - From the grammar source file : RSP.g
14936 + * - On : 2016-01-01 12:23:42
14937 + * - for the parser : RSPParserParser *
14938 + * Editing it, at least manually, is not wise.
14940 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
14943 + * The parser RSPParser has the callable functions (rules) shown below,
14944 + * which will invoke the code for the associated rule in the source grammar
14945 + * assuming that the input stream is pointing to a token/text stream that could begin
14948 + * For instance if you call the first (topmost) rule in a parser grammar, you will
14949 + * get the results of a full parse, but calling a rule half way through the grammar will
14950 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
14951 + * in editors and so on.
14953 + * The parser entry points are called indirectly (by function pointer to function) via
14954 + * a parser context typedef pRSPParser, which is returned from a call to RSPParserNew().
14956 + * The methods in pRSPParser are as follows:
14958 + * - RSPParser_query_return pRSPParser->query(pRSPParser)
14959 + * - RSPParser_expr_return pRSPParser->expr(pRSPParser)
14960 + * - RSPParser_aexpr_return pRSPParser->aexpr(pRSPParser)
14961 + * - RSPParser_crit_return pRSPParser->crit(pRSPParser)
14962 + * - RSPParser_strcrit_return pRSPParser->strcrit(pRSPParser)
14963 + * - RSPParser_strop_return pRSPParser->strop(pRSPParser)
14964 + * - RSPParser_intcrit_return pRSPParser->intcrit(pRSPParser)
14965 + * - RSPParser_intop_return pRSPParser->intop(pRSPParser)
14966 + * - RSPParser_datecrit_return pRSPParser->datecrit(pRSPParser)
14967 + * - RSPParser_dateop_return pRSPParser->dateop(pRSPParser)
14968 + * - RSPParser_datespec_return pRSPParser->datespec(pRSPParser)
14969 + * - RSPParser_dateref_return pRSPParser->dateref(pRSPParser)
14970 + * - RSPParser_dateintval_return pRSPParser->dateintval(pRSPParser)
14972 + * The return type for any particular rule is of course determined by the source
14975 +// [The "BSD licence"]
14976 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
14977 +// http://www.temporal-wave.com
14978 +// http://www.linkedin.com/in/jimidle
14980 +// All rights reserved.
14982 +// Redistribution and use in source and binary forms, with or without
14983 +// modification, are permitted provided that the following conditions
14985 +// 1. Redistributions of source code must retain the above copyright
14986 +// notice, this list of conditions and the following disclaimer.
14987 +// 2. Redistributions in binary form must reproduce the above copyright
14988 +// notice, this list of conditions and the following disclaimer in the
14989 +// documentation and/or other materials provided with the distribution.
14990 +// 3. The name of the author may not be used to endorse or promote products
14991 +// derived from this software without specific prior written permission.
14993 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14994 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14995 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14996 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
14997 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
14998 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
14999 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
15000 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
15001 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
15002 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15004 +#ifndef _RSPParser_H
15005 +#define _RSPParser_H
15006 +/* =============================================================================
15007 + * Standard antlr3 C runtime definitions
15009 +#include <antlr3.h>
15011 +/* End of standard antlr 3 runtime definitions
15012 + * =============================================================================
15015 +#ifdef __cplusplus
15019 +// Forward declare the context typedef so that we can use it before it is
15020 +// properly defined. Delegators and delegates (from import statements) are
15021 +// interdependent and their context structures contain pointers to each other
15022 +// C only allows such things to be declared if you pre-declare the typedef.
15024 +typedef struct RSPParser_Ctx_struct RSPParser, * pRSPParser;
15028 +#ifdef ANTLR3_WINDOWS
15029 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
15030 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
15031 +// initialized but unused variable - tree rewrite variables declared but not needed
15032 +// Unreferenced local variable - lexer rule declares but does not always use _type
15033 +// potentially unitialized variable used - retval always returned from a rule
15034 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
15036 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
15037 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
15038 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
15039 +// this is a matter of orthogonality hence I disable that one.
15041 +#pragma warning( disable : 4100 )
15042 +#pragma warning( disable : 4101 )
15043 +#pragma warning( disable : 4127 )
15044 +#pragma warning( disable : 4189 )
15045 +#pragma warning( disable : 4505 )
15046 +#pragma warning( disable : 4701 )
15048 +typedef struct RSPParser_query_return_struct
15050 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
15052 + pANTLR3_COMMON_TOKEN start;
15053 + pANTLR3_COMMON_TOKEN stop;
15054 + pANTLR3_BASE_TREE tree;
15057 + RSPParser_query_return;
15059 +typedef struct RSPParser_expr_return_struct
15061 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
15063 + pANTLR3_COMMON_TOKEN start;
15064 + pANTLR3_COMMON_TOKEN stop;
15065 + pANTLR3_BASE_TREE tree;
15068 + RSPParser_expr_return;
15070 +typedef struct RSPParser_aexpr_return_struct
15072 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
15074 + pANTLR3_COMMON_TOKEN start;
15075 + pANTLR3_COMMON_TOKEN stop;
15076 + pANTLR3_BASE_TREE tree;
15079 + RSPParser_aexpr_return;
15081 +typedef struct RSPParser_crit_return_struct
15083 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
15085 + pANTLR3_COMMON_TOKEN start;
15086 + pANTLR3_COMMON_TOKEN stop;
15087 + pANTLR3_BASE_TREE tree;
15090 + RSPParser_crit_return;
15092 +typedef struct RSPParser_strcrit_return_struct
15094 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
15096 + pANTLR3_COMMON_TOKEN start;
15097 + pANTLR3_COMMON_TOKEN stop;
15098 + pANTLR3_BASE_TREE tree;
15101 + RSPParser_strcrit_return;
15103 +typedef struct RSPParser_strop_return_struct
15105 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
15107 + pANTLR3_COMMON_TOKEN start;
15108 + pANTLR3_COMMON_TOKEN stop;
15109 + pANTLR3_BASE_TREE tree;
15112 + RSPParser_strop_return;
15114 +typedef struct RSPParser_intcrit_return_struct
15116 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
15118 + pANTLR3_COMMON_TOKEN start;
15119 + pANTLR3_COMMON_TOKEN stop;
15120 + pANTLR3_BASE_TREE tree;
15123 + RSPParser_intcrit_return;
15125 +typedef struct RSPParser_intop_return_struct
15127 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
15129 + pANTLR3_COMMON_TOKEN start;
15130 + pANTLR3_COMMON_TOKEN stop;
15131 + pANTLR3_BASE_TREE tree;
15134 + RSPParser_intop_return;
15136 +typedef struct RSPParser_datecrit_return_struct
15138 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
15140 + pANTLR3_COMMON_TOKEN start;
15141 + pANTLR3_COMMON_TOKEN stop;
15142 + pANTLR3_BASE_TREE tree;
15145 + RSPParser_datecrit_return;
15147 +typedef struct RSPParser_dateop_return_struct
15149 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
15151 + pANTLR3_COMMON_TOKEN start;
15152 + pANTLR3_COMMON_TOKEN stop;
15153 + pANTLR3_BASE_TREE tree;
15156 + RSPParser_dateop_return;
15158 +typedef struct RSPParser_datespec_return_struct
15160 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
15162 + pANTLR3_COMMON_TOKEN start;
15163 + pANTLR3_COMMON_TOKEN stop;
15164 + pANTLR3_BASE_TREE tree;
15167 + RSPParser_datespec_return;
15169 +typedef struct RSPParser_dateref_return_struct
15171 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
15173 + pANTLR3_COMMON_TOKEN start;
15174 + pANTLR3_COMMON_TOKEN stop;
15175 + pANTLR3_BASE_TREE tree;
15178 + RSPParser_dateref_return;
15180 +typedef struct RSPParser_dateintval_return_struct
15182 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
15184 + pANTLR3_COMMON_TOKEN start;
15185 + pANTLR3_COMMON_TOKEN stop;
15186 + pANTLR3_BASE_TREE tree;
15189 + RSPParser_dateintval_return;
15193 +/** Context tracking structure for RSPParser
15195 +struct RSPParser_Ctx_struct
15197 + /** Built in ANTLR3 context tracker contains all the generic elements
15198 + * required for context tracking.
15200 + pANTLR3_PARSER pParser;
15203 + RSPParser_query_return (*query) (struct RSPParser_Ctx_struct * ctx);
15204 + RSPParser_expr_return (*expr) (struct RSPParser_Ctx_struct * ctx);
15205 + RSPParser_aexpr_return (*aexpr) (struct RSPParser_Ctx_struct * ctx);
15206 + RSPParser_crit_return (*crit) (struct RSPParser_Ctx_struct * ctx);
15207 + RSPParser_strcrit_return (*strcrit) (struct RSPParser_Ctx_struct * ctx);
15208 + RSPParser_strop_return (*strop) (struct RSPParser_Ctx_struct * ctx);
15209 + RSPParser_intcrit_return (*intcrit) (struct RSPParser_Ctx_struct * ctx);
15210 + RSPParser_intop_return (*intop) (struct RSPParser_Ctx_struct * ctx);
15211 + RSPParser_datecrit_return (*datecrit) (struct RSPParser_Ctx_struct * ctx);
15212 + RSPParser_dateop_return (*dateop) (struct RSPParser_Ctx_struct * ctx);
15213 + RSPParser_datespec_return (*datespec) (struct RSPParser_Ctx_struct * ctx);
15214 + RSPParser_dateref_return (*dateref) (struct RSPParser_Ctx_struct * ctx);
15215 + RSPParser_dateintval_return (*dateintval) (struct RSPParser_Ctx_struct * ctx);
15216 + // Delegated rules
15217 + const char * (*getGrammarFileName)();
15218 + void (*free) (struct RSPParser_Ctx_struct * ctx);
15219 + /* @headerFile.members() */
15220 + pANTLR3_BASE_TREE_ADAPTOR adaptor;
15221 + pANTLR3_VECTOR_FACTORY vectors;
15222 + /* End @headerFile.members() */
15225 +// Function protoypes for the constructor functions that external translation units
15226 +// such as delegators and delegates may wish to call.
15228 +ANTLR3_API pRSPParser RSPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream);
15229 +ANTLR3_API pRSPParser RSPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
15231 +/** Symbolic definitions of all the tokens that the parser will work with.
15234 + * Antlr will define EOF, but we can't use that as it it is too common in
15235 + * in C header files and that would be confusing. There is no way to filter this out at the moment
15236 + * so we just undef it here for now. That isn't the value we get back from C recognizers
15237 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
15245 +#define STARTSW 14
15260 +#define DIGIT19 31
15261 +#define INCLUDES 13
15265 +#define GREATER 18
15273 +#define ESCAPED 33
15275 +#define DIGIT09 32
15278 +#define EOF ANTLR3_TOKEN_EOF
15281 +#ifndef TOKENSOURCE
15282 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
15285 +/* End of token definitions for RSPParser
15286 + * =============================================================================
15290 +#ifdef __cplusplus
15296 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
15297 diff --git a/src/pregen/SMARTPL.u b/src/pregen/SMARTPL.u
15298 new file mode 100644
15299 index 0000000..2a66bf3
15301 +++ b/src/pregen/SMARTPL.u
15303 +SMARTPLParser.c : SMARTPL.g
15304 +./SMARTPL.tokens : SMARTPL.g
15305 +SMARTPLParser.h : SMARTPL.g
15306 +SMARTPLLexer.c : SMARTPL.g
15307 +SMARTPLLexer.h : SMARTPL.g
15308 +ANTLR_PRODUCTS += SMARTPLParser.c ./SMARTPL.tokens SMARTPLParser.h SMARTPLLexer.c SMARTPLLexer.h
15309 \ No newline at end of file
15310 diff --git a/src/pregen/SMARTPL2SQL.c b/src/pregen/SMARTPL2SQL.c
15311 new file mode 100644
15312 index 0000000..bd93752
15314 +++ b/src/pregen/SMARTPL2SQL.c
15317 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
15319 + * - From the grammar source file : SMARTPL2SQL.g
15320 + * - On : 2016-01-01 12:23:44
15321 + * - for the tree parser : SMARTPL2SQLTreeParser *
15322 + * Editing it, at least manually, is not wise.
15324 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
15328 +// [The "BSD licence"]
15329 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
15330 +// http://www.temporal-wave.com
15331 +// http://www.linkedin.com/in/jimidle
15333 +// All rights reserved.
15335 +// Redistribution and use in source and binary forms, with or without
15336 +// modification, are permitted provided that the following conditions
15338 +// 1. Redistributions of source code must retain the above copyright
15339 +// notice, this list of conditions and the following disclaimer.
15340 +// 2. Redistributions in binary form must reproduce the above copyright
15341 +// notice, this list of conditions and the following disclaimer in the
15342 +// documentation and/or other materials provided with the distribution.
15343 +// 3. The name of the author may not be used to endorse or promote products
15344 +// derived from this software without specific prior written permission.
15346 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15347 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15348 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15349 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15350 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
15351 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
15352 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
15353 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
15354 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
15355 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15358 +/* =============================================================================
15359 + * This is what the grammar programmer asked us to put at the top of every file.
15362 + #include <stdio.h>
15363 + #include <stdlib.h>
15364 + #include <string.h>
15365 + #include <limits.h>
15366 + #include <errno.h>
15367 + #include <time.h>
15368 + #include <sqlite3.h>
15370 + #include "logger.h"
15373 +/* End of Header action.
15374 + * =============================================================================
15376 +/* -----------------------------------------
15377 + * Include the ANTLR3 generated header file.
15379 +#include "SMARTPL2SQL.h"
15380 +/* ----------------------------------------- */
15386 +/* MACROS that hide the C interface implementations from the
15387 + * generated code, which makes it a little more understandable to the human eye.
15388 + * I am very much against using C pre-processor macros for function calls and bits
15389 + * of code as you cannot see what is happening when single stepping in debuggers
15390 + * and so on. The exception (in my book at least) is for generated code, where you are
15391 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
15392 + * hides some indirect calls, but is always referring to the input stream. This is
15393 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
15394 + * the runtime interfaces without changing the generated code too often, without
15395 + * confusing the reader of the generated output, who may not wish to know the gory
15396 + * details of the interface inheritance.
15401 +/* Aids in accessing scopes for grammar programmers
15404 +#undef SCOPE_STACK
15406 +#define SCOPE_TYPE(scope) pSMARTPL2SQL_##scope##_SCOPE
15407 +#define SCOPE_STACK(scope) pSMARTPL2SQL_##scope##Stack
15408 +#define SCOPE_TOP(scope) ctx->pSMARTPL2SQL_##scope##Top
15409 +#define SCOPE_SIZE(scope) ctx->pSMARTPL2SQL_##scope##Stack_limit
15410 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
15412 +/* Macros for accessing things in the parser
15417 +#undef HAVEPARSEDRULE
15420 +#undef HASEXCEPTION
15424 +#undef FOLLOWSTACK
15428 +#undef PREPORTERROR
15431 +#undef CONSTRUCTEX
15436 +#undef PERRORRECOVERY
15439 +#undef RECOVERFROMMISMATCHEDSET
15440 +#undef RECOVERFROMMISMATCHEDELEMENT
15441 +#undef BACKTRACKING
15448 +#define PARSER ctx->pTreeParser
15449 +#define RECOGNIZER PARSER->rec
15450 +#define PSRSTATE RECOGNIZER->state
15451 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
15452 +#define INPUT PARSER->ctnstream
15453 +#define ISTREAM INPUT->tnstream->istream
15454 +#define STRSTREAM INPUT->tnstream
15455 +#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE)
15456 +#define EXCEPTION PSRSTATE->exception
15457 +#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs)
15458 +#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER)
15459 +#define FOLLOWSTACK PSRSTATE->following
15460 +#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
15461 +#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK)
15462 +#define PRECOVER() RECOGNIZER->recover(RECOGNIZER)
15463 +#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER)
15464 +#define LA(n) ISTREAM->_LA(ISTREAM, n)
15465 +#define LT(n) INPUT->tnstream->_LT(INPUT->tnstream, n)
15466 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
15467 +#define CONSUME() ISTREAM->consume(ISTREAM)
15468 +#define MARK() ISTREAM->mark(ISTREAM)
15469 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
15470 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
15471 +#define PERRORRECOVERY PSRSTATE->errorRecovery
15472 +#define FAILEDFLAG PSRSTATE->failed
15473 +#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE)
15474 +#define BACKTRACKING PSRSTATE->backtracking
15475 +#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
15476 +#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
15477 +#define ADAPTOR INPUT->adaptor
15478 +#define RULEMEMO PSRSTATE->ruleMemo
15479 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
15480 +#define INDEX() ISTREAM->index(ISTREAM)
15481 +#define DBG RECOGNIZER->debugger
15484 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
15486 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
15487 + * then for the present you must use different names for your defines as these are hard coded
15488 + * in the code generator. It would be better not to use such names internally, and maybe
15489 + * we can change this in a forthcoming release. I deliberately do not #undef these
15490 + * here as this will at least give you a redefined error somewhere if they clash.
15492 +#define UP ANTLR3_TOKEN_UP
15493 +#define DOWN ANTLR3_TOKEN_DOWN
15494 +#define EOR ANTLR3_TOKEN_EOR
15495 +#define INVALID ANTLR3_TOKEN_INVALID
15498 +/* =============================================================================
15499 + * Functions to create and destroy scopes. First come the rule scopes, followed
15500 + * by the global declared scopes.
15505 +/* ============================================================================= */
15507 +/* =============================================================================
15508 + * Start of recognizer
15513 +/** \brief Table of all token names in symbolic order, mainly used for
15514 + * error reporting.
15516 +pANTLR3_UINT8 SMARTPL2SQLTokenNames[28+4]
15518 + (pANTLR3_UINT8) "<invalid>", /* String to print to indicate an invalid token */
15519 + (pANTLR3_UINT8) "<EOR>",
15520 + (pANTLR3_UINT8) "<DOWN>",
15521 + (pANTLR3_UINT8) "<UP>",
15522 + (pANTLR3_UINT8) "STR",
15523 + (pANTLR3_UINT8) "OR",
15524 + (pANTLR3_UINT8) "AND",
15525 + (pANTLR3_UINT8) "NOT",
15526 + (pANTLR3_UINT8) "LPAR",
15527 + (pANTLR3_UINT8) "RPAR",
15528 + (pANTLR3_UINT8) "STRTAG",
15529 + (pANTLR3_UINT8) "INCLUDES",
15530 + (pANTLR3_UINT8) "IS",
15531 + (pANTLR3_UINT8) "INTTAG",
15532 + (pANTLR3_UINT8) "INTBOOL",
15533 + (pANTLR3_UINT8) "INT",
15534 + (pANTLR3_UINT8) "DATETAG",
15535 + (pANTLR3_UINT8) "AFTER",
15536 + (pANTLR3_UINT8) "BEFORE",
15537 + (pANTLR3_UINT8) "ENUMTAG",
15538 + (pANTLR3_UINT8) "ENUMVAL",
15539 + (pANTLR3_UINT8) "DATE",
15540 + (pANTLR3_UINT8) "AGO",
15541 + (pANTLR3_UINT8) "DATINTERVAL",
15542 + (pANTLR3_UINT8) "GREATER",
15543 + (pANTLR3_UINT8) "GREATEREQUAL",
15544 + (pANTLR3_UINT8) "LESS",
15545 + (pANTLR3_UINT8) "LESSEQUAL",
15546 + (pANTLR3_UINT8) "EQUAL",
15547 + (pANTLR3_UINT8) "WHITESPACE",
15548 + (pANTLR3_UINT8) "'{'",
15549 + (pANTLR3_UINT8) "'}'"
15554 +// Forward declare the locally static matching functions we have generated.
15556 +static SMARTPL2SQL_playlist_return playlist (pSMARTPL2SQL ctx);
15557 +static pANTLR3_STRING expression (pSMARTPL2SQL ctx);
15558 +static int dateval (pSMARTPL2SQL ctx);
15559 +static int interval (pSMARTPL2SQL ctx);
15560 +static void SMARTPL2SQLFree(pSMARTPL2SQL ctx);
15561 +/* For use in tree output where we are accumulating rule labels via label += ruleRef
15562 + * we need a function that knows how to free a return scope when the list is destroyed.
15563 + * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
15565 +static void ANTLR3_CDECL freeScope(void * scope)
15567 + ANTLR3_FREE(scope);
15570 +/** \brief Name of the grammar file that generated this code
15572 +static const char fileName[] = "SMARTPL2SQL.g";
15574 +/** \brief Return the name of the grammar file that generated this code.
15576 +static const char * getGrammarFileName()
15580 +/** \brief Create a new SMARTPL2SQL parser and return a context for it.
15582 + * \param[in] instream Pointer to an input stream interface.
15584 + * \return Pointer to new parser context upon success.
15586 +ANTLR3_API pSMARTPL2SQL
15587 +SMARTPL2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream)
15589 + // See if we can create a new parser with the standard constructor
15591 + return SMARTPL2SQLNewSSD(instream, NULL);
15594 +/** \brief Create a new SMARTPL2SQL parser and return a context for it.
15596 + * \param[in] instream Pointer to an input stream interface.
15598 + * \return Pointer to new parser context upon success.
15600 +ANTLR3_API pSMARTPL2SQL
15601 +SMARTPL2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
15603 + pSMARTPL2SQL ctx; /* Context structure we will build and return */
15605 + ctx = (pSMARTPL2SQL) ANTLR3_CALLOC(1, sizeof(SMARTPL2SQL));
15609 + // Failed to allocate memory for parser context
15614 + /* -------------------------------------------------------------------
15615 + * Memory for basic structure is allocated, now to fill in
15616 + * the base ANTLR3 structures. We initialize the function pointers
15617 + * for the standard ANTLR3 parser function set, but upon return
15618 + * from here, the programmer may set the pointers to provide custom
15619 + * implementations of each function.
15621 + * We don't use the macros defined in SMARTPL2SQL.h here, in order that you can get a sense
15622 + * of what goes where.
15625 + /* Create a base Tree parser/recognizer, using the supplied tree node stream
15627 + ctx->pTreeParser = antlr3TreeParserNewStream(ANTLR3_SIZE_HINT, instream, state);
15628 + /* Install the implementation of our SMARTPL2SQL interface
15630 + ctx->playlist = playlist;
15631 + ctx->expression = expression;
15632 + ctx->dateval = dateval;
15633 + ctx->interval = interval;
15634 + ctx->free = SMARTPL2SQLFree;
15635 + ctx->getGrammarFileName = getGrammarFileName;
15637 + /* Install the scope pushing methods.
15644 + /* Install the token table
15646 + PSRSTATE->tokenNames = SMARTPL2SQLTokenNames;
15649 + /* Return the newly built parser to the caller
15654 +/** Free the parser resources
15657 + SMARTPL2SQLFree(pSMARTPL2SQL ctx)
15659 + /* Free any scope memory
15663 + // Free this parser
15665 + ctx->pTreeParser->free(ctx->pTreeParser);
15666 + ANTLR3_FREE(ctx);
15668 + /* Everything is released, so we can return
15673 +/** Return token names used by this tree parser
15675 + * The returned pointer is used as an index into the token names table (using the token
15676 + * number as the index).
15678 + * \return Pointer to first char * in the table.
15680 +static pANTLR3_UINT8 *getTokenNames()
15682 + return SMARTPL2SQLTokenNames;
15688 +/* Declare the bitsets
15691 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_playlist66 */
15692 +static ANTLR3_BITWORD FOLLOW_STR_in_playlist66_bits[] = { ANTLR3_UINT64_LIT(0x0000000040000000) };
15693 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_playlist66 = { FOLLOW_STR_in_playlist66_bits, 1 };
15694 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_30_in_playlist68 */
15695 +static ANTLR3_BITWORD FOLLOW_30_in_playlist68_bits[] = { ANTLR3_UINT64_LIT(0x00000000000924E0) };
15696 +static ANTLR3_BITSET_LIST FOLLOW_30_in_playlist68 = { FOLLOW_30_in_playlist68_bits, 1 };
15697 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_playlist74 */
15698 +static ANTLR3_BITWORD FOLLOW_expression_in_playlist74_bits[] = { ANTLR3_UINT64_LIT(0x0000000080000000) };
15699 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_playlist74 = { FOLLOW_expression_in_playlist74_bits, 1 };
15700 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_31_in_playlist76 */
15701 +static ANTLR3_BITWORD FOLLOW_31_in_playlist76_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15702 +static ANTLR3_BITSET_LIST FOLLOW_31_in_playlist76 = { FOLLOW_31_in_playlist76_bits, 1 };
15703 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_expression101 */
15704 +static ANTLR3_BITWORD FOLLOW_NOT_in_expression101_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
15705 +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_expression101 = { FOLLOW_NOT_in_expression101_bits, 1 };
15706 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression107 */
15707 +static ANTLR3_BITWORD FOLLOW_expression_in_expression107_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
15708 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression107 = { FOLLOW_expression_in_expression107_bits, 1 };
15709 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_expression118 */
15710 +static ANTLR3_BITWORD FOLLOW_AND_in_expression118_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
15711 +static ANTLR3_BITSET_LIST FOLLOW_AND_in_expression118 = { FOLLOW_AND_in_expression118_bits, 1 };
15712 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression124 */
15713 +static ANTLR3_BITWORD FOLLOW_expression_in_expression124_bits[] = { ANTLR3_UINT64_LIT(0x00000000000924E0) };
15714 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression124 = { FOLLOW_expression_in_expression124_bits, 1 };
15715 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression130 */
15716 +static ANTLR3_BITWORD FOLLOW_expression_in_expression130_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
15717 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression130 = { FOLLOW_expression_in_expression130_bits, 1 };
15718 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expression141 */
15719 +static ANTLR3_BITWORD FOLLOW_OR_in_expression141_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
15720 +static ANTLR3_BITSET_LIST FOLLOW_OR_in_expression141 = { FOLLOW_OR_in_expression141_bits, 1 };
15721 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression147 */
15722 +static ANTLR3_BITWORD FOLLOW_expression_in_expression147_bits[] = { ANTLR3_UINT64_LIT(0x00000000000924E0) };
15723 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression147 = { FOLLOW_expression_in_expression147_bits, 1 };
15724 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression153 */
15725 +static ANTLR3_BITWORD FOLLOW_expression_in_expression153_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
15726 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression153 = { FOLLOW_expression_in_expression153_bits, 1 };
15727 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STRTAG_in_expression163 */
15728 +static ANTLR3_BITWORD FOLLOW_STRTAG_in_expression163_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000800) };
15729 +static ANTLR3_BITSET_LIST FOLLOW_STRTAG_in_expression163 = { FOLLOW_STRTAG_in_expression163_bits, 1 };
15730 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INCLUDES_in_expression165 */
15731 +static ANTLR3_BITWORD FOLLOW_INCLUDES_in_expression165_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) };
15732 +static ANTLR3_BITSET_LIST FOLLOW_INCLUDES_in_expression165 = { FOLLOW_INCLUDES_in_expression165_bits, 1 };
15733 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_expression167 */
15734 +static ANTLR3_BITWORD FOLLOW_STR_in_expression167_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15735 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_expression167 = { FOLLOW_STR_in_expression167_bits, 1 };
15736 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STRTAG_in_expression176 */
15737 +static ANTLR3_BITWORD FOLLOW_STRTAG_in_expression176_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001000) };
15738 +static ANTLR3_BITSET_LIST FOLLOW_STRTAG_in_expression176 = { FOLLOW_STRTAG_in_expression176_bits, 1 };
15739 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_IS_in_expression178 */
15740 +static ANTLR3_BITWORD FOLLOW_IS_in_expression178_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) };
15741 +static ANTLR3_BITSET_LIST FOLLOW_IS_in_expression178 = { FOLLOW_IS_in_expression178_bits, 1 };
15742 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_expression180 */
15743 +static ANTLR3_BITWORD FOLLOW_STR_in_expression180_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15744 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_expression180 = { FOLLOW_STR_in_expression180_bits, 1 };
15745 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTTAG_in_expression189 */
15746 +static ANTLR3_BITWORD FOLLOW_INTTAG_in_expression189_bits[] = { ANTLR3_UINT64_LIT(0x0000000000004000) };
15747 +static ANTLR3_BITSET_LIST FOLLOW_INTTAG_in_expression189 = { FOLLOW_INTTAG_in_expression189_bits, 1 };
15748 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTBOOL_in_expression191 */
15749 +static ANTLR3_BITWORD FOLLOW_INTBOOL_in_expression191_bits[] = { ANTLR3_UINT64_LIT(0x0000000000008000) };
15750 +static ANTLR3_BITSET_LIST FOLLOW_INTBOOL_in_expression191 = { FOLLOW_INTBOOL_in_expression191_bits, 1 };
15751 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_expression193 */
15752 +static ANTLR3_BITWORD FOLLOW_INT_in_expression193_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15753 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_expression193 = { FOLLOW_INT_in_expression193_bits, 1 };
15754 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATETAG_in_expression202 */
15755 +static ANTLR3_BITWORD FOLLOW_DATETAG_in_expression202_bits[] = { ANTLR3_UINT64_LIT(0x0000000000020000) };
15756 +static ANTLR3_BITSET_LIST FOLLOW_DATETAG_in_expression202 = { FOLLOW_DATETAG_in_expression202_bits, 1 };
15757 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_expression204 */
15758 +static ANTLR3_BITWORD FOLLOW_AFTER_in_expression204_bits[] = { ANTLR3_UINT64_LIT(0x0000000000208000) };
15759 +static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_expression204 = { FOLLOW_AFTER_in_expression204_bits, 1 };
15760 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateval_in_expression206 */
15761 +static ANTLR3_BITWORD FOLLOW_dateval_in_expression206_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15762 +static ANTLR3_BITSET_LIST FOLLOW_dateval_in_expression206 = { FOLLOW_dateval_in_expression206_bits, 1 };
15763 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATETAG_in_expression215 */
15764 +static ANTLR3_BITWORD FOLLOW_DATETAG_in_expression215_bits[] = { ANTLR3_UINT64_LIT(0x0000000000040000) };
15765 +static ANTLR3_BITSET_LIST FOLLOW_DATETAG_in_expression215 = { FOLLOW_DATETAG_in_expression215_bits, 1 };
15766 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_expression217 */
15767 +static ANTLR3_BITWORD FOLLOW_BEFORE_in_expression217_bits[] = { ANTLR3_UINT64_LIT(0x0000000000208000) };
15768 +static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_expression217 = { FOLLOW_BEFORE_in_expression217_bits, 1 };
15769 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateval_in_expression219 */
15770 +static ANTLR3_BITWORD FOLLOW_dateval_in_expression219_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15771 +static ANTLR3_BITSET_LIST FOLLOW_dateval_in_expression219 = { FOLLOW_dateval_in_expression219_bits, 1 };
15772 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMTAG_in_expression228 */
15773 +static ANTLR3_BITWORD FOLLOW_ENUMTAG_in_expression228_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001000) };
15774 +static ANTLR3_BITSET_LIST FOLLOW_ENUMTAG_in_expression228 = { FOLLOW_ENUMTAG_in_expression228_bits, 1 };
15775 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_IS_in_expression230 */
15776 +static ANTLR3_BITWORD FOLLOW_IS_in_expression230_bits[] = { ANTLR3_UINT64_LIT(0x0000000000100000) };
15777 +static ANTLR3_BITSET_LIST FOLLOW_IS_in_expression230 = { FOLLOW_IS_in_expression230_bits, 1 };
15778 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMVAL_in_expression232 */
15779 +static ANTLR3_BITWORD FOLLOW_ENUMVAL_in_expression232_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15780 +static ANTLR3_BITSET_LIST FOLLOW_ENUMVAL_in_expression232 = { FOLLOW_ENUMVAL_in_expression232_bits, 1 };
15781 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval257 */
15782 +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval257_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15783 +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval257 = { FOLLOW_DATE_in_dateval257_bits, 1 };
15784 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval266 */
15785 +static ANTLR3_BITWORD FOLLOW_interval_in_dateval266_bits[] = { ANTLR3_UINT64_LIT(0x0000000000040000) };
15786 +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval266 = { FOLLOW_interval_in_dateval266_bits, 1 };
15787 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateval268 */
15788 +static ANTLR3_BITWORD FOLLOW_BEFORE_in_dateval268_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) };
15789 +static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateval268 = { FOLLOW_BEFORE_in_dateval268_bits, 1 };
15790 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval270 */
15791 +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval270_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15792 +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval270 = { FOLLOW_DATE_in_dateval270_bits, 1 };
15793 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval279 */
15794 +static ANTLR3_BITWORD FOLLOW_interval_in_dateval279_bits[] = { ANTLR3_UINT64_LIT(0x0000000000020000) };
15795 +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval279 = { FOLLOW_interval_in_dateval279_bits, 1 };
15796 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateval281 */
15797 +static ANTLR3_BITWORD FOLLOW_AFTER_in_dateval281_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) };
15798 +static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateval281 = { FOLLOW_AFTER_in_dateval281_bits, 1 };
15799 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval283 */
15800 +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval283_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15801 +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval283 = { FOLLOW_DATE_in_dateval283_bits, 1 };
15802 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval292 */
15803 +static ANTLR3_BITWORD FOLLOW_interval_in_dateval292_bits[] = { ANTLR3_UINT64_LIT(0x0000000000400000) };
15804 +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval292 = { FOLLOW_interval_in_dateval292_bits, 1 };
15805 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AGO_in_dateval294 */
15806 +static ANTLR3_BITWORD FOLLOW_AGO_in_dateval294_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15807 +static ANTLR3_BITSET_LIST FOLLOW_AGO_in_dateval294 = { FOLLOW_AGO_in_dateval294_bits, 1 };
15808 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_interval318 */
15809 +static ANTLR3_BITWORD FOLLOW_INT_in_interval318_bits[] = { ANTLR3_UINT64_LIT(0x0000000000800000) };
15810 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_interval318 = { FOLLOW_INT_in_interval318_bits, 1 };
15811 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATINTERVAL_in_interval320 */
15812 +static ANTLR3_BITWORD FOLLOW_DATINTERVAL_in_interval320_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15813 +static ANTLR3_BITSET_LIST FOLLOW_DATINTERVAL_in_interval320 = { FOLLOW_DATINTERVAL_in_interval320_bits, 1 };
15818 +/* ==============================================
15822 + * $ANTLR start playlist
15823 + * SMARTPL2SQL.g:43:1: playlist returns [ pANTLR3_STRING title, pANTLR3_STRING query ] : STR '{' e= expression '}' ;
15825 +static SMARTPL2SQL_playlist_return
15826 +playlist(pSMARTPL2SQL ctx)
15828 + SMARTPL2SQL_playlist_return retval;
15830 + pANTLR3_BASE_TREE STR1;
15831 + pANTLR3_STRING e;
15832 + #undef RETURN_TYPE_e
15833 + #define RETURN_TYPE_e pANTLR3_STRING
15835 + /* Initialize rule variables
15839 + retval.title= NULL; retval.query= NULL;
15842 + retval.start = LT(1); retval.stop = retval.start;
15845 + // SMARTPL2SQL.g:45:2: ( STR '{' e= expression '}' )
15846 + // SMARTPL2SQL.g:45:4: STR '{' e= expression '}'
15848 + STR1 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_playlist66);
15849 + if (HASEXCEPTION())
15851 + goto ruleplaylistEx;
15854 + MATCHT(30, &FOLLOW_30_in_playlist68);
15855 + if (HASEXCEPTION())
15857 + goto ruleplaylistEx;
15860 + FOLLOWPUSH(FOLLOW_expression_in_playlist74);
15861 + e=expression(ctx);
15864 + if (HASEXCEPTION())
15866 + goto ruleplaylistEx;
15869 + MATCHT(31, &FOLLOW_31_in_playlist76);
15870 + if (HASEXCEPTION())
15872 + goto ruleplaylistEx;
15877 + pANTLR3_UINT8 val;
15878 + val = (STR1->getText(STR1))->toUTF8((STR1->getText(STR1)))->chars;
15880 + val[strlen((const char *)val) - 1] = '\0';
15882 + retval.title= (STR1->getText(STR1))->factory->newRaw((STR1->getText(STR1))->factory);
15883 + retval.title->append8(retval.title, (const char *)val);
15885 + retval.query= e->factory->newRaw(e->factory);
15886 + retval.query->append8(retval.query, "(");
15887 + retval.query->appendS(retval.query, e);
15888 + retval.query->append8(retval.query, ")");
15897 + // This is where rules clean up and exit
15899 + goto ruleplaylistEx; /* Prevent compiler warnings */
15900 + ruleplaylistEx: ;
15902 + if (HASEXCEPTION())
15911 +/* $ANTLR end playlist */
15914 + * $ANTLR start expression
15915 + * SMARTPL2SQL.g:62:1: expression returns [ pANTLR3_STRING result ] : ( ^( NOT a= expression ) | ^( AND a= expression b= expression ) | ^( OR a= expression b= expression ) | STRTAG INCLUDES STR | STRTAG IS STR | INTTAG INTBOOL INT | DATETAG AFTER dateval | DATETAG BEFORE dateval | ENUMTAG IS ENUMVAL );
15917 +static pANTLR3_STRING
15918 +expression(pSMARTPL2SQL ctx)
15920 + pANTLR3_STRING result = NULL;
15922 + pANTLR3_BASE_TREE STR2;
15923 + pANTLR3_BASE_TREE STRTAG3;
15924 + pANTLR3_BASE_TREE STR4;
15925 + pANTLR3_BASE_TREE STRTAG5;
15926 + pANTLR3_BASE_TREE INTTAG6;
15927 + pANTLR3_BASE_TREE INTBOOL7;
15928 + pANTLR3_BASE_TREE INT8;
15929 + pANTLR3_BASE_TREE DATETAG10;
15930 + pANTLR3_BASE_TREE DATETAG12;
15931 + pANTLR3_BASE_TREE ENUMTAG13;
15932 + pANTLR3_BASE_TREE ENUMVAL14;
15933 + pANTLR3_STRING a;
15934 + #undef RETURN_TYPE_a
15935 + #define RETURN_TYPE_a pANTLR3_STRING
15937 + pANTLR3_STRING b;
15938 + #undef RETURN_TYPE_b
15939 + #define RETURN_TYPE_b pANTLR3_STRING
15942 + #undef RETURN_TYPE_dateval9
15943 + #define RETURN_TYPE_dateval9 int
15946 + #undef RETURN_TYPE_dateval11
15947 + #define RETURN_TYPE_dateval11 int
15949 + /* Initialize rule variables
15961 + DATETAG10 = NULL;
15962 + DATETAG12 = NULL;
15963 + ENUMTAG13 = NULL;
15964 + ENUMVAL14 = NULL;
15972 + // SMARTPL2SQL.g:64:2: ( ^( NOT a= expression ) | ^( AND a= expression b= expression ) | ^( OR a= expression b= expression ) | STRTAG INCLUDES STR | STRTAG IS STR | INTTAG INTBOOL INT | DATETAG AFTER dateval | DATETAG BEFORE dateval | ENUMTAG IS ENUMVAL )
15974 + ANTLR3_UINT32 alt1;
16012 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
16013 + EXCEPTION->message = (void *)"";
16014 + EXCEPTION->decisionNum = 1;
16015 + EXCEPTION->state = 4;
16018 + goto ruleexpressionEx;
16045 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
16046 + EXCEPTION->message = (void *)"";
16047 + EXCEPTION->decisionNum = 1;
16048 + EXCEPTION->state = 6;
16051 + goto ruleexpressionEx;
16064 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
16065 + EXCEPTION->message = (void *)"";
16066 + EXCEPTION->decisionNum = 1;
16067 + EXCEPTION->state = 0;
16070 + goto ruleexpressionEx;
16076 + // SMARTPL2SQL.g:64:4: ^( NOT a= expression )
16078 + MATCHT(NOT, &FOLLOW_NOT_in_expression101);
16079 + if (HASEXCEPTION())
16081 + goto ruleexpressionEx;
16085 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
16086 + if (HASEXCEPTION())
16088 + goto ruleexpressionEx;
16091 + FOLLOWPUSH(FOLLOW_expression_in_expression107);
16092 + a=expression(ctx);
16095 + if (HASEXCEPTION())
16097 + goto ruleexpressionEx;
16101 + MATCHT(ANTLR3_TOKEN_UP, NULL);
16102 + if (HASEXCEPTION())
16104 + goto ruleexpressionEx;
16109 + result= a->factory->newRaw(a->factory);
16110 + result->append8(result, "NOT(");
16111 + result->appendS(result, a);
16112 + result->append8(result, ")");
16119 + // SMARTPL2SQL.g:71:4: ^( AND a= expression b= expression )
16121 + MATCHT(AND, &FOLLOW_AND_in_expression118);
16122 + if (HASEXCEPTION())
16124 + goto ruleexpressionEx;
16128 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
16129 + if (HASEXCEPTION())
16131 + goto ruleexpressionEx;
16134 + FOLLOWPUSH(FOLLOW_expression_in_expression124);
16135 + a=expression(ctx);
16138 + if (HASEXCEPTION())
16140 + goto ruleexpressionEx;
16143 + FOLLOWPUSH(FOLLOW_expression_in_expression130);
16144 + b=expression(ctx);
16147 + if (HASEXCEPTION())
16149 + goto ruleexpressionEx;
16153 + MATCHT(ANTLR3_TOKEN_UP, NULL);
16154 + if (HASEXCEPTION())
16156 + goto ruleexpressionEx;
16161 + result= a->factory->newRaw(a->factory);
16162 + result->append8(result, "(");
16163 + result->appendS(result, a);
16164 + result->append8(result, " AND ");
16165 + result->appendS(result, b);
16166 + result->append8(result, ")");
16173 + // SMARTPL2SQL.g:80:4: ^( OR a= expression b= expression )
16175 + MATCHT(OR, &FOLLOW_OR_in_expression141);
16176 + if (HASEXCEPTION())
16178 + goto ruleexpressionEx;
16182 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
16183 + if (HASEXCEPTION())
16185 + goto ruleexpressionEx;
16188 + FOLLOWPUSH(FOLLOW_expression_in_expression147);
16189 + a=expression(ctx);
16192 + if (HASEXCEPTION())
16194 + goto ruleexpressionEx;
16197 + FOLLOWPUSH(FOLLOW_expression_in_expression153);
16198 + b=expression(ctx);
16201 + if (HASEXCEPTION())
16203 + goto ruleexpressionEx;
16207 + MATCHT(ANTLR3_TOKEN_UP, NULL);
16208 + if (HASEXCEPTION())
16210 + goto ruleexpressionEx;
16215 + result= a->factory->newRaw(a->factory);
16216 + result->append8(result, "(");
16217 + result->appendS(result, a);
16218 + result->append8(result, " OR ");
16219 + result->appendS(result, b);
16220 + result->append8(result, ")");
16227 + // SMARTPL2SQL.g:89:4: STRTAG INCLUDES STR
16229 + STRTAG3 = (pANTLR3_BASE_TREE) MATCHT(STRTAG, &FOLLOW_STRTAG_in_expression163);
16230 + if (HASEXCEPTION())
16232 + goto ruleexpressionEx;
16235 + MATCHT(INCLUDES, &FOLLOW_INCLUDES_in_expression165);
16236 + if (HASEXCEPTION())
16238 + goto ruleexpressionEx;
16241 + STR2 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expression167);
16242 + if (HASEXCEPTION())
16244 + goto ruleexpressionEx;
16249 + pANTLR3_UINT8 val;
16250 + val = (STR2->getText(STR2))->toUTF8((STR2->getText(STR2)))->chars;
16252 + val[strlen((const char *)val) - 1] = '\0';
16254 + result= (STR2->getText(STR2))->factory->newRaw((STR2->getText(STR2))->factory);
16255 + result->append8(result, "f.");
16256 + result->appendS(result, (STRTAG3->getText(STRTAG3))->toUTF8((STRTAG3->getText(STRTAG3))));
16257 + result->append8(result, " LIKE '%");
16258 + result->append8(result, sqlite3_mprintf("%q", (const char *)val));
16259 + result->append8(result, "%'");
16266 + // SMARTPL2SQL.g:103:4: STRTAG IS STR
16268 + STRTAG5 = (pANTLR3_BASE_TREE) MATCHT(STRTAG, &FOLLOW_STRTAG_in_expression176);
16269 + if (HASEXCEPTION())
16271 + goto ruleexpressionEx;
16274 + MATCHT(IS, &FOLLOW_IS_in_expression178);
16275 + if (HASEXCEPTION())
16277 + goto ruleexpressionEx;
16280 + STR4 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expression180);
16281 + if (HASEXCEPTION())
16283 + goto ruleexpressionEx;
16288 + pANTLR3_UINT8 val;
16289 + val = (STR4->getText(STR4))->toUTF8((STR4->getText(STR4)))->chars;
16291 + val[strlen((const char *)val) - 1] = '\0';
16293 + result= (STR4->getText(STR4))->factory->newRaw((STR4->getText(STR4))->factory);
16294 + result->append8(result, "f.");
16295 + result->appendS(result, (STRTAG5->getText(STRTAG5))->toUTF8((STRTAG5->getText(STRTAG5))));
16296 + result->append8(result, " LIKE '");
16297 + result->append8(result, sqlite3_mprintf("%q", (const char *)val));
16298 + result->append8(result, "'");
16305 + // SMARTPL2SQL.g:117:4: INTTAG INTBOOL INT
16307 + INTTAG6 = (pANTLR3_BASE_TREE) MATCHT(INTTAG, &FOLLOW_INTTAG_in_expression189);
16308 + if (HASEXCEPTION())
16310 + goto ruleexpressionEx;
16313 + INTBOOL7 = (pANTLR3_BASE_TREE) MATCHT(INTBOOL, &FOLLOW_INTBOOL_in_expression191);
16314 + if (HASEXCEPTION())
16316 + goto ruleexpressionEx;
16319 + INT8 = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_expression193);
16320 + if (HASEXCEPTION())
16322 + goto ruleexpressionEx;
16327 + result= (INTTAG6->getText(INTTAG6))->factory->newRaw((INTTAG6->getText(INTTAG6))->factory);
16328 + result->append8(result, "f.");
16329 + result->appendS(result, (INTTAG6->getText(INTTAG6))->toUTF8((INTTAG6->getText(INTTAG6))));
16330 + result->append8(result, " ");
16331 + result->appendS(result, (INTBOOL7->getText(INTBOOL7))->toUTF8((INTBOOL7->getText(INTBOOL7))));
16332 + result->append8(result, " ");
16333 + result->appendS(result, (INT8->getText(INT8))->toUTF8((INT8->getText(INT8))));
16340 + // SMARTPL2SQL.g:127:4: DATETAG AFTER dateval
16342 + DATETAG10 = (pANTLR3_BASE_TREE) MATCHT(DATETAG, &FOLLOW_DATETAG_in_expression202);
16343 + if (HASEXCEPTION())
16345 + goto ruleexpressionEx;
16348 + MATCHT(AFTER, &FOLLOW_AFTER_in_expression204);
16349 + if (HASEXCEPTION())
16351 + goto ruleexpressionEx;
16354 + FOLLOWPUSH(FOLLOW_dateval_in_expression206);
16355 + dateval9=dateval(ctx);
16358 + if (HASEXCEPTION())
16360 + goto ruleexpressionEx;
16366 + sprintf(str, "%d", dateval9);
16368 + result= (DATETAG10->getText(DATETAG10))->factory->newRaw((DATETAG10->getText(DATETAG10))->factory);
16369 + result->append8(result, "f.");
16370 + result->appendS(result, (DATETAG10->getText(DATETAG10))->toUTF8((DATETAG10->getText(DATETAG10))));
16371 + result->append8(result, " > ");
16372 + result->append8(result, str);
16379 + // SMARTPL2SQL.g:138:4: DATETAG BEFORE dateval
16381 + DATETAG12 = (pANTLR3_BASE_TREE) MATCHT(DATETAG, &FOLLOW_DATETAG_in_expression215);
16382 + if (HASEXCEPTION())
16384 + goto ruleexpressionEx;
16387 + MATCHT(BEFORE, &FOLLOW_BEFORE_in_expression217);
16388 + if (HASEXCEPTION())
16390 + goto ruleexpressionEx;
16393 + FOLLOWPUSH(FOLLOW_dateval_in_expression219);
16394 + dateval11=dateval(ctx);
16397 + if (HASEXCEPTION())
16399 + goto ruleexpressionEx;
16405 + sprintf(str, "%d", dateval11);
16407 + result= (DATETAG12->getText(DATETAG12))->factory->newRaw((DATETAG12->getText(DATETAG12))->factory);
16408 + result->append8(result, "f.");
16409 + result->appendS(result, (DATETAG12->getText(DATETAG12))->toUTF8((DATETAG12->getText(DATETAG12))));
16410 + result->append8(result, " > ");
16411 + result->append8(result, str);
16418 + // SMARTPL2SQL.g:149:4: ENUMTAG IS ENUMVAL
16420 + ENUMTAG13 = (pANTLR3_BASE_TREE) MATCHT(ENUMTAG, &FOLLOW_ENUMTAG_in_expression228);
16421 + if (HASEXCEPTION())
16423 + goto ruleexpressionEx;
16426 + MATCHT(IS, &FOLLOW_IS_in_expression230);
16427 + if (HASEXCEPTION())
16429 + goto ruleexpressionEx;
16432 + ENUMVAL14 = (pANTLR3_BASE_TREE) MATCHT(ENUMVAL, &FOLLOW_ENUMVAL_in_expression232);
16433 + if (HASEXCEPTION())
16435 + goto ruleexpressionEx;
16440 + pANTLR3_UINT8 tag;
16441 + pANTLR3_UINT8 val;
16444 + sprintf(str, "1=1");
16446 + tag = (ENUMTAG13->getText(ENUMTAG13))->chars;
16447 + val = (ENUMVAL14->getText(ENUMVAL14))->chars;
16448 + if (strcmp((char *)tag, "media_kind") == 0)
16450 + if (strcmp((char *)val, "music") == 0)
16452 + sprintf(str, "f.media_kind = %d", MEDIA_KIND_MUSIC);
16454 + else if (strcmp((char *)val, "movie") == 0)
16456 + sprintf(str, "f.media_kind = %d", MEDIA_KIND_MOVIE);
16458 + else if (strcmp((char *)val, "podcast") == 0)
16460 + sprintf(str, "f.media_kind = %d", MEDIA_KIND_PODCAST);
16462 + else if (strcmp((char *)val, "audiobook") == 0)
16464 + sprintf(str, "f.media_kind = %d", MEDIA_KIND_AUDIOBOOK);
16466 + else if (strcmp((char *)val, "tvshow") == 0)
16468 + sprintf(str, "f.media_kind = %d", MEDIA_KIND_TVSHOW);
16471 + else if (strcmp((char *)tag, "data_kind") == 0)
16473 + if (strcmp((char *)val, "file") == 0)
16475 + sprintf(str, "f.data_kind = %d", DATA_KIND_FILE);
16477 + else if (strcmp((char *)val, "url") == 0)
16479 + sprintf(str, "f.data_kind = %d", DATA_KIND_HTTP);
16481 + else if (strcmp((char *)val, "spotify") == 0)
16483 + sprintf(str, "f.data_kind = %d", DATA_KIND_SPOTIFY);
16485 + else if (strcmp((char *)val, "pipe") == 0)
16487 + sprintf(str, "f.data_kind = %d", DATA_KIND_PIPE);
16491 + result= (ENUMTAG13->getText(ENUMTAG13))->factory->newRaw((ENUMTAG13->getText(ENUMTAG13))->factory);
16492 + result->append8(result, str);
16504 + // This is where rules clean up and exit
16506 + goto ruleexpressionEx; /* Prevent compiler warnings */
16507 + ruleexpressionEx: ;
16509 + if (HASEXCEPTION())
16518 +/* $ANTLR end expression */
16521 + * $ANTLR start dateval
16522 + * SMARTPL2SQL.g:207:1: dateval returns [ int result ] : ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO );
16525 +dateval(pSMARTPL2SQL ctx)
16529 + pANTLR3_BASE_TREE DATE15;
16530 + pANTLR3_BASE_TREE DATE16;
16531 + pANTLR3_BASE_TREE DATE18;
16533 + #undef RETURN_TYPE_interval17
16534 + #define RETURN_TYPE_interval17 int
16537 + #undef RETURN_TYPE_interval19
16538 + #define RETURN_TYPE_interval19 int
16541 + #undef RETURN_TYPE_interval20
16542 + #define RETURN_TYPE_interval20 int
16544 + /* Initialize rule variables
16558 + // SMARTPL2SQL.g:209:2: ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO )
16560 + ANTLR3_UINT32 alt2;
16575 + case DATINTERVAL:
16597 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
16598 + EXCEPTION->message = (void *)"";
16599 + EXCEPTION->decisionNum = 2;
16600 + EXCEPTION->state = 3;
16603 + goto ruledatevalEx;
16611 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
16612 + EXCEPTION->message = (void *)"";
16613 + EXCEPTION->decisionNum = 2;
16614 + EXCEPTION->state = 2;
16617 + goto ruledatevalEx;
16625 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
16626 + EXCEPTION->message = (void *)"";
16627 + EXCEPTION->decisionNum = 2;
16628 + EXCEPTION->state = 0;
16631 + goto ruledatevalEx;
16637 + // SMARTPL2SQL.g:209:4: DATE
16639 + DATE15 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval257);
16640 + if (HASEXCEPTION())
16642 + goto ruledatevalEx;
16647 + pANTLR3_UINT8 datval;
16649 + datval = (DATE15->getText(DATE15))->chars;
16651 + if (strcmp((char *)datval, "today") == 0)
16653 + result= time(NULL);
16655 + else if (strcmp((char *)datval, "yesterday") == 0)
16657 + result= time(NULL) - 24 * 3600;
16659 + else if (strcmp((char *)datval, "last week") == 0)
16661 + result= time(NULL) - 24 * 3600 * 7;
16663 + else if (strcmp((char *)datval, "last month") == 0)
16665 + result= time(NULL) - 24 * 3600 * 30;
16667 + else if (strcmp((char *)datval, "last year") == 0)
16669 + result= time(NULL) - 24 * 3600 * 365;
16678 + memset((void*)&tm,0,sizeof(tm));
16679 + memset(year, 0, sizeof(year));
16680 + memset(month, 0, sizeof(month));
16681 + memset(day, 0, sizeof(day));
16683 + strncpy(year, (const char *)datval, 4);
16684 + strncpy(month, (const char *)datval + 5, 2);
16685 + strncpy(day, (const char *)datval + 8, 2);
16687 + tm.tm_year = atoi(year) - 1900;
16688 + tm.tm_mon = atoi(month) - 1;
16689 + tm.tm_mday = atoi(day);
16691 + result= mktime(&tm);
16699 + // SMARTPL2SQL.g:258:4: interval BEFORE DATE
16701 + FOLLOWPUSH(FOLLOW_interval_in_dateval266);
16702 + interval17=interval(ctx);
16705 + if (HASEXCEPTION())
16707 + goto ruledatevalEx;
16710 + MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateval268);
16711 + if (HASEXCEPTION())
16713 + goto ruledatevalEx;
16716 + DATE16 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval270);
16717 + if (HASEXCEPTION())
16719 + goto ruledatevalEx;
16724 + pANTLR3_UINT8 datval;
16726 + datval = (DATE16->getText(DATE16))->chars;
16728 + if (strcmp((char *)datval, "yesterday") == 0)
16730 + result= time(NULL) - 24 * 3600;
16732 + else if (strcmp((char *)datval, "last week") == 0)
16734 + result= time(NULL) - 24 * 3600 * 7;
16736 + else if (strcmp((char *)datval, "last month") == 0)
16738 + result= time(NULL) - 24 * 3600 * 30;
16740 + else if (strcmp((char *)datval, "last year") == 0)
16742 + result= time(NULL) - 24 * 3600 * 365;
16746 + result= time(NULL);
16749 + result= result - interval17;
16756 + // SMARTPL2SQL.g:287:4: interval AFTER DATE
16758 + FOLLOWPUSH(FOLLOW_interval_in_dateval279);
16759 + interval19=interval(ctx);
16762 + if (HASEXCEPTION())
16764 + goto ruledatevalEx;
16767 + MATCHT(AFTER, &FOLLOW_AFTER_in_dateval281);
16768 + if (HASEXCEPTION())
16770 + goto ruledatevalEx;
16773 + DATE18 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval283);
16774 + if (HASEXCEPTION())
16776 + goto ruledatevalEx;
16781 + pANTLR3_UINT8 datval;
16783 + datval = (DATE18->getText(DATE18))->chars;
16785 + if (strcmp((char *)datval, "yesterday") == 0)
16787 + result= time(NULL) - 24 * 3600;
16789 + else if (strcmp((char *)datval, "last week") == 0)
16791 + result= time(NULL) - 24 * 3600 * 7;
16793 + else if (strcmp((char *)datval, "last month") == 0)
16795 + result= time(NULL) - 24 * 3600 * 30;
16797 + else if (strcmp((char *)datval, "last year") == 0)
16799 + result= time(NULL) - 24 * 3600 * 365;
16803 + result= time(NULL);
16806 + result= result + interval19;
16813 + // SMARTPL2SQL.g:316:4: interval AGO
16815 + FOLLOWPUSH(FOLLOW_interval_in_dateval292);
16816 + interval20=interval(ctx);
16819 + if (HASEXCEPTION())
16821 + goto ruledatevalEx;
16824 + MATCHT(AGO, &FOLLOW_AGO_in_dateval294);
16825 + if (HASEXCEPTION())
16827 + goto ruledatevalEx;
16832 + result= time(NULL) - interval20;
16844 + // This is where rules clean up and exit
16846 + goto ruledatevalEx; /* Prevent compiler warnings */
16849 + if (HASEXCEPTION())
16858 +/* $ANTLR end dateval */
16861 + * $ANTLR start interval
16862 + * SMARTPL2SQL.g:322:1: interval returns [ int result ] : INT DATINTERVAL ;
16865 +interval(pSMARTPL2SQL ctx)
16869 + pANTLR3_BASE_TREE INT21;
16870 + pANTLR3_BASE_TREE DATINTERVAL22;
16872 + /* Initialize rule variables
16878 + DATINTERVAL22 = NULL;
16881 + // SMARTPL2SQL.g:324:2: ( INT DATINTERVAL )
16882 + // SMARTPL2SQL.g:324:4: INT DATINTERVAL
16884 + INT21 = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_interval318);
16885 + if (HASEXCEPTION())
16887 + goto ruleintervalEx;
16890 + DATINTERVAL22 = (pANTLR3_BASE_TREE) MATCHT(DATINTERVAL, &FOLLOW_DATINTERVAL_in_interval320);
16891 + if (HASEXCEPTION())
16893 + goto ruleintervalEx;
16898 + pANTLR3_UINT8 interval;
16900 + result= atoi((const char *)(INT21->getText(INT21))->chars);
16901 + interval = (DATINTERVAL22->getText(DATINTERVAL22))->chars;
16903 + if (strcmp((char *)interval, "days") == 0)
16905 + result= result * 24 * 3600;
16907 + else if (strcmp((char *)interval, "weeks") == 0)
16909 + result= result * 24 * 3600 * 7;
16911 + else if (strcmp((char *)interval, "months") == 0)
16913 + result= result * 24 * 3600 * 30;
16915 + else if (strcmp((char *)interval, "weeks") == 0)
16917 + result= result * 24 * 3600 * 365;
16931 + // This is where rules clean up and exit
16933 + goto ruleintervalEx; /* Prevent compiler warnings */
16934 + ruleintervalEx: ;
16936 + if (HASEXCEPTION())
16945 +/* $ANTLR end interval */
16946 +/* End of parsing rules
16947 + * ==============================================
16950 +/* ==============================================
16951 + * Syntactic predicates
16953 +/* End of syntactic predicates
16954 + * ==============================================
16963 + * =============================================================================
16965 diff --git a/src/pregen/SMARTPL2SQL.h b/src/pregen/SMARTPL2SQL.h
16966 new file mode 100644
16967 index 0000000..8e06de7
16969 +++ b/src/pregen/SMARTPL2SQL.h
16972 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
16974 + * - From the grammar source file : SMARTPL2SQL.g
16975 + * - On : 2016-01-01 12:23:44
16976 + * - for the tree parser : SMARTPL2SQLTreeParser *
16977 + * Editing it, at least manually, is not wise.
16979 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
16982 + * The tree parser SMARTPL2SQL has the callable functions (rules) shown below,
16983 + * which will invoke the code for the associated rule in the source grammar
16984 + * assuming that the input stream is pointing to a token/text stream that could begin
16987 + * For instance if you call the first (topmost) rule in a parser grammar, you will
16988 + * get the results of a full parse, but calling a rule half way through the grammar will
16989 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
16990 + * in editors and so on.
16992 + * The parser entry points are called indirectly (by function pointer to function) via
16993 + * a parser context typedef pSMARTPL2SQL, which is returned from a call to SMARTPL2SQLNew().
16995 + * The methods in pSMARTPL2SQL are as follows:
16997 + * - SMARTPL2SQL_playlist_return pSMARTPL2SQL->playlist(pSMARTPL2SQL)
16998 + * - pANTLR3_STRING pSMARTPL2SQL->expression(pSMARTPL2SQL)
16999 + * - int pSMARTPL2SQL->dateval(pSMARTPL2SQL)
17000 + * - int pSMARTPL2SQL->interval(pSMARTPL2SQL)
17002 + * The return type for any particular rule is of course determined by the source
17005 +// [The "BSD licence"]
17006 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
17007 +// http://www.temporal-wave.com
17008 +// http://www.linkedin.com/in/jimidle
17010 +// All rights reserved.
17012 +// Redistribution and use in source and binary forms, with or without
17013 +// modification, are permitted provided that the following conditions
17015 +// 1. Redistributions of source code must retain the above copyright
17016 +// notice, this list of conditions and the following disclaimer.
17017 +// 2. Redistributions in binary form must reproduce the above copyright
17018 +// notice, this list of conditions and the following disclaimer in the
17019 +// documentation and/or other materials provided with the distribution.
17020 +// 3. The name of the author may not be used to endorse or promote products
17021 +// derived from this software without specific prior written permission.
17023 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17024 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17025 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17026 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17027 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17028 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
17029 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
17030 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
17031 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
17032 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17034 +#ifndef _SMARTPL2SQL_H
17035 +#define _SMARTPL2SQL_H
17036 +/* =============================================================================
17037 + * Standard antlr3 C runtime definitions
17039 +#include <antlr3.h>
17041 +/* End of standard antlr 3 runtime definitions
17042 + * =============================================================================
17045 +#ifdef __cplusplus
17049 +// Forward declare the context typedef so that we can use it before it is
17050 +// properly defined. Delegators and delegates (from import statements) are
17051 +// interdependent and their context structures contain pointers to each other
17052 +// C only allows such things to be declared if you pre-declare the typedef.
17054 +typedef struct SMARTPL2SQL_Ctx_struct SMARTPL2SQL, * pSMARTPL2SQL;
17058 + #include <stdio.h>
17059 + #include <stdlib.h>
17060 + #include <string.h>
17061 + #include <limits.h>
17062 + #include <errno.h>
17063 + #include <time.h>
17064 + #include <sqlite3.h>
17066 + #include "logger.h"
17070 +#ifdef ANTLR3_WINDOWS
17071 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
17072 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
17073 +// initialized but unused variable - tree rewrite variables declared but not needed
17074 +// Unreferenced local variable - lexer rule declares but does not always use _type
17075 +// potentially unitialized variable used - retval always returned from a rule
17076 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
17078 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
17079 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
17080 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
17081 +// this is a matter of orthogonality hence I disable that one.
17083 +#pragma warning( disable : 4100 )
17084 +#pragma warning( disable : 4101 )
17085 +#pragma warning( disable : 4127 )
17086 +#pragma warning( disable : 4189 )
17087 +#pragma warning( disable : 4505 )
17088 +#pragma warning( disable : 4701 )
17090 +typedef struct SMARTPL2SQL_playlist_return_struct
17092 + pANTLR3_BASE_TREE start;
17093 + pANTLR3_BASE_TREE stop;
17094 + pANTLR3_STRING title;
17095 + pANTLR3_STRING query;
17097 + SMARTPL2SQL_playlist_return;
17101 +/** Context tracking structure for SMARTPL2SQL
17103 +struct SMARTPL2SQL_Ctx_struct
17105 + /** Built in ANTLR3 context tracker contains all the generic elements
17106 + * required for context tracking.
17108 + pANTLR3_TREE_PARSER pTreeParser;
17111 + SMARTPL2SQL_playlist_return (*playlist) (struct SMARTPL2SQL_Ctx_struct * ctx);
17112 + pANTLR3_STRING (*expression) (struct SMARTPL2SQL_Ctx_struct * ctx);
17113 + int (*dateval) (struct SMARTPL2SQL_Ctx_struct * ctx);
17114 + int (*interval) (struct SMARTPL2SQL_Ctx_struct * ctx);
17115 + // Delegated rules
17116 + const char * (*getGrammarFileName)();
17117 + void (*free) (struct SMARTPL2SQL_Ctx_struct * ctx);
17121 +// Function protoypes for the constructor functions that external translation units
17122 +// such as delegators and delegates may wish to call.
17124 +ANTLR3_API pSMARTPL2SQL SMARTPL2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream);
17125 +ANTLR3_API pSMARTPL2SQL SMARTPL2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
17127 +/** Symbolic definitions of all the tokens that the tree parser will work with.
17130 + * Antlr will define EOF, but we can't use that as it it is too common in
17131 + * in C header files and that would be confusing. There is no way to filter this out at the moment
17132 + * so we just undef it here for now. That isn't the value we get back from C recognizers
17133 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
17141 +#define INTBOOL 14
17144 +#define WHITESPACE 29
17145 +#define GREATEREQUAL 25
17147 +#define DATETAG 16
17153 +#define INCLUDES 11
17157 +#define GREATER 24
17159 +#define ENUMTAG 19
17161 +#define ENUMVAL 20
17167 +#define LESSEQUAL 27
17169 +#define DATINTERVAL 23
17172 +#define EOF ANTLR3_TOKEN_EOF
17175 +#ifndef TOKENSOURCE
17176 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
17179 +/* End of token definitions for SMARTPL2SQL
17180 + * =============================================================================
17184 +#ifdef __cplusplus
17190 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
17191 diff --git a/src/pregen/SMARTPL2SQL.u b/src/pregen/SMARTPL2SQL.u
17192 new file mode 100644
17193 index 0000000..85567d1
17195 +++ b/src/pregen/SMARTPL2SQL.u
17197 +SMARTPL2SQL.g: SMARTPL.tokens
17198 +SMARTPL2SQL.c : SMARTPL2SQL.g
17199 +./SMARTPL2SQL.tokens : SMARTPL2SQL.g
17200 +SMARTPL2SQL.h : SMARTPL2SQL.g
17201 +ANTLR_PRODUCTS += SMARTPL2SQL.c ./SMARTPL2SQL.tokens SMARTPL2SQL.h
17202 \ No newline at end of file
17203 diff --git a/src/pregen/SMARTPLLexer.c b/src/pregen/SMARTPLLexer.c
17204 new file mode 100644
17205 index 0000000..91d6e99
17207 +++ b/src/pregen/SMARTPLLexer.c
17210 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
17212 + * - From the grammar source file : SMARTPL.g
17213 + * - On : 2016-01-01 12:23:40
17214 + * - for the lexer : SMARTPLLexerLexer *
17215 + * Editing it, at least manually, is not wise.
17217 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
17221 +// [The "BSD licence"]
17222 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
17223 +// http://www.temporal-wave.com
17224 +// http://www.linkedin.com/in/jimidle
17226 +// All rights reserved.
17228 +// Redistribution and use in source and binary forms, with or without
17229 +// modification, are permitted provided that the following conditions
17231 +// 1. Redistributions of source code must retain the above copyright
17232 +// notice, this list of conditions and the following disclaimer.
17233 +// 2. Redistributions in binary form must reproduce the above copyright
17234 +// notice, this list of conditions and the following disclaimer in the
17235 +// documentation and/or other materials provided with the distribution.
17236 +// 3. The name of the author may not be used to endorse or promote products
17237 +// derived from this software without specific prior written permission.
17239 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17240 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17241 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17242 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17243 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17244 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
17245 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
17246 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
17247 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
17248 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17250 +/* -----------------------------------------
17251 + * Include the ANTLR3 generated header file.
17253 +#include "SMARTPLLexer.h"
17254 +/* ----------------------------------------- */
17257 +/** String literals used by SMARTPLLexer that we must do things like MATCHS() with.
17258 + * C will normally just lay down 8 bit characters, and you can use L"xxx" to
17259 + * get wchar_t, but wchar_t is 16 bits on Windows, which is not UTF32 and so
17260 + * we perform this little trick of defining the literals as arrays of UINT32
17261 + * and passing in the address of these.
17263 +static ANTLR3_UCHAR lit_1[] = { 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, ANTLR3_STRING_TERMINATOR};
17264 +static ANTLR3_UCHAR lit_2[] = { 0x61, 0x6C, 0x62, 0x75, 0x6D, 0x5F, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, ANTLR3_STRING_TERMINATOR};
17265 +static ANTLR3_UCHAR lit_3[] = { 0x61, 0x6C, 0x62, 0x75, 0x6D, ANTLR3_STRING_TERMINATOR};
17266 +static ANTLR3_UCHAR lit_4[] = { 0x74, 0x69, 0x74, 0x6C, 0x65, ANTLR3_STRING_TERMINATOR};
17267 +static ANTLR3_UCHAR lit_5[] = { 0x67, 0x65, 0x6E, 0x72, 0x65, ANTLR3_STRING_TERMINATOR};
17268 +static ANTLR3_UCHAR lit_6[] = { 0x63, 0x6F, 0x6D, 0x70, 0x6F, 0x73, 0x65, 0x72, ANTLR3_STRING_TERMINATOR};
17269 +static ANTLR3_UCHAR lit_7[] = { 0x70, 0x61, 0x74, 0x68, ANTLR3_STRING_TERMINATOR};
17270 +static ANTLR3_UCHAR lit_8[] = { 0x74, 0x79, 0x70, 0x65, ANTLR3_STRING_TERMINATOR};
17271 +static ANTLR3_UCHAR lit_9[] = { 0x67, 0x72, 0x6F, 0x75, 0x70, 0x69, 0x6E, 0x67, ANTLR3_STRING_TERMINATOR};
17272 +static ANTLR3_UCHAR lit_10[] = { 0x70, 0x6C, 0x61, 0x79, 0x5F, 0x63, 0x6F, 0x75, 0x6E, 0x74, ANTLR3_STRING_TERMINATOR};
17273 +static ANTLR3_UCHAR lit_11[] = { 0x72, 0x61, 0x74, 0x69, 0x6E, 0x67, ANTLR3_STRING_TERMINATOR};
17274 +static ANTLR3_UCHAR lit_12[] = { 0x79, 0x65, 0x61, 0x72, ANTLR3_STRING_TERMINATOR};
17275 +static ANTLR3_UCHAR lit_13[] = { 0x63, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x61, 0x74, 0x69, 0x6F, 0x6E, ANTLR3_STRING_TERMINATOR};
17276 +static ANTLR3_UCHAR lit_14[] = { 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x61, 0x64, 0x64, 0x65, 0x64, ANTLR3_STRING_TERMINATOR};
17277 +static ANTLR3_UCHAR lit_15[] = { 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x70, 0x6C, 0x61, 0x79, 0x65, 0x64, ANTLR3_STRING_TERMINATOR};
17278 +static ANTLR3_UCHAR lit_16[] = { 0x64, 0x61, 0x74, 0x61, 0x5F, 0x6B, 0x69, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR};
17279 +static ANTLR3_UCHAR lit_17[] = { 0x6D, 0x65, 0x64, 0x69, 0x61, 0x5F, 0x6B, 0x69, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR};
17280 +static ANTLR3_UCHAR lit_18[] = { 0x69, 0x6E, 0x63, 0x6C, 0x75, 0x64, 0x65, 0x73, ANTLR3_STRING_TERMINATOR};
17281 +static ANTLR3_UCHAR lit_19[] = { 0x69, 0x73, ANTLR3_STRING_TERMINATOR};
17282 +static ANTLR3_UCHAR lit_20[] = { 0x3E, 0x3D, ANTLR3_STRING_TERMINATOR};
17283 +static ANTLR3_UCHAR lit_21[] = { 0x3C, 0x3D, ANTLR3_STRING_TERMINATOR};
17284 +static ANTLR3_UCHAR lit_22[] = { 0x61, 0x66, 0x74, 0x65, 0x72, ANTLR3_STRING_TERMINATOR};
17285 +static ANTLR3_UCHAR lit_23[] = { 0x62, 0x65, 0x66, 0x6F, 0x72, 0x65, ANTLR3_STRING_TERMINATOR};
17286 +static ANTLR3_UCHAR lit_24[] = { 0x61, 0x67, 0x6F, ANTLR3_STRING_TERMINATOR};
17287 +static ANTLR3_UCHAR lit_25[] = { 0x41, 0x4E, 0x44, ANTLR3_STRING_TERMINATOR};
17288 +static ANTLR3_UCHAR lit_26[] = { 0x61, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR};
17289 +static ANTLR3_UCHAR lit_27[] = { 0x4F, 0x52, ANTLR3_STRING_TERMINATOR};
17290 +static ANTLR3_UCHAR lit_28[] = { 0x6F, 0x72, ANTLR3_STRING_TERMINATOR};
17291 +static ANTLR3_UCHAR lit_29[] = { 0x4E, 0x4F, 0x54, ANTLR3_STRING_TERMINATOR};
17292 +static ANTLR3_UCHAR lit_30[] = { 0x6E, 0x6F, 0x74, ANTLR3_STRING_TERMINATOR};
17293 +static ANTLR3_UCHAR lit_31[] = { 0x74, 0x6F, 0x64, 0x61, 0x79, ANTLR3_STRING_TERMINATOR};
17294 +static ANTLR3_UCHAR lit_32[] = { 0x79, 0x65, 0x73, 0x74, 0x65, 0x72, 0x64, 0x61, 0x79, ANTLR3_STRING_TERMINATOR};
17295 +static ANTLR3_UCHAR lit_33[] = { 0x6C, 0x61, 0x73, 0x74, 0x20, 0x77, 0x65, 0x65, 0x6B, ANTLR3_STRING_TERMINATOR};
17296 +static ANTLR3_UCHAR lit_34[] = { 0x6C, 0x61, 0x73, 0x74, 0x20, 0x6D, 0x6F, 0x6E, 0x74, 0x68, ANTLR3_STRING_TERMINATOR};
17297 +static ANTLR3_UCHAR lit_35[] = { 0x6C, 0x61, 0x73, 0x74, 0x20, 0x79, 0x65, 0x61, 0x72, ANTLR3_STRING_TERMINATOR};
17298 +static ANTLR3_UCHAR lit_36[] = { 0x64, 0x61, 0x79, 0x73, ANTLR3_STRING_TERMINATOR};
17299 +static ANTLR3_UCHAR lit_37[] = { 0x77, 0x65, 0x65, 0x6B, 0x73, ANTLR3_STRING_TERMINATOR};
17300 +static ANTLR3_UCHAR lit_38[] = { 0x6D, 0x6F, 0x6E, 0x74, 0x68, 0x73, ANTLR3_STRING_TERMINATOR};
17301 +static ANTLR3_UCHAR lit_39[] = { 0x79, 0x65, 0x61, 0x72, 0x73, ANTLR3_STRING_TERMINATOR};
17302 +static ANTLR3_UCHAR lit_40[] = { 0x6D, 0x75, 0x73, 0x69, 0x63, ANTLR3_STRING_TERMINATOR};
17303 +static ANTLR3_UCHAR lit_41[] = { 0x6D, 0x6F, 0x76, 0x69, 0x65, ANTLR3_STRING_TERMINATOR};
17304 +static ANTLR3_UCHAR lit_42[] = { 0x70, 0x6F, 0x64, 0x63, 0x61, 0x73, 0x74, ANTLR3_STRING_TERMINATOR};
17305 +static ANTLR3_UCHAR lit_43[] = { 0x61, 0x75, 0x64, 0x69, 0x6F, 0x62, 0x6F, 0x6F, 0x6B, ANTLR3_STRING_TERMINATOR};
17306 +static ANTLR3_UCHAR lit_44[] = { 0x74, 0x76, 0x73, 0x68, 0x6F, 0x77, ANTLR3_STRING_TERMINATOR};
17307 +static ANTLR3_UCHAR lit_45[] = { 0x66, 0x69, 0x6C, 0x65, ANTLR3_STRING_TERMINATOR};
17308 +static ANTLR3_UCHAR lit_46[] = { 0x75, 0x72, 0x6C, ANTLR3_STRING_TERMINATOR};
17309 +static ANTLR3_UCHAR lit_47[] = { 0x73, 0x70, 0x6F, 0x74, 0x69, 0x66, 0x79, ANTLR3_STRING_TERMINATOR};
17310 +static ANTLR3_UCHAR lit_48[] = { 0x70, 0x69, 0x70, 0x65, ANTLR3_STRING_TERMINATOR};
17315 +/* MACROS that hide the C interface implementations from the
17316 + * generated code, which makes it a little more understandable to the human eye.
17317 + * I am very much against using C pre-processor macros for function calls and bits
17318 + * of code as you cannot see what is happening when single stepping in debuggers
17319 + * and so on. The exception (in my book at least) is for generated code, where you are
17320 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
17321 + * hides some indirect calls, but is always referring to the input stream. This is
17322 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
17323 + * the runtime interfaces without changing the generated code too often, without
17324 + * confusing the reader of the generated output, who may not wish to know the gory
17325 + * details of the interface inheritance.
17330 +/* Aids in accessing scopes for grammar programmers
17333 +#undef SCOPE_STACK
17335 +#define SCOPE_TYPE(scope) pSMARTPLLexer_##scope##_SCOPE
17336 +#define SCOPE_STACK(scope) pSMARTPLLexer_##scope##Stack
17337 +#define SCOPE_TOP(scope) ctx->pSMARTPLLexer_##scope##Top
17338 +#define SCOPE_SIZE(scope) ctx->pSMARTPLLexer_##scope##Stack_limit
17339 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
17342 +/* Macros for accessing things in a lexer
17347 +#undef GETCHARINDEX
17349 +#undef GETCHARPOSITIONINLINE
17361 +#undef HASEXCEPTION
17363 +#undef CONSTRUCTEX
17369 +#undef BACKTRACKING
17372 +#undef HAVEPARSEDRULE
17381 +#define LEXER ctx->pLexer
17382 +#define RECOGNIZER LEXER->rec
17383 +#define LEXSTATE RECOGNIZER->state
17384 +#define TOKSOURCE LEXSTATE->tokSource
17385 +#define GETCHARINDEX() LEXER->getCharIndex(LEXER)
17386 +#define GETLINE() LEXER->getLine(LEXER)
17387 +#define GETTEXT() LEXER->getText(LEXER)
17388 +#define GETCHARPOSITIONINLINE() LEXER->getCharPositionInLine(LEXER)
17389 +#define EMIT() LEXSTATE->type = _type; LEXER->emit(LEXER)
17390 +#define EMITNEW(t) LEXER->emitNew(LEXER, t)
17391 +#define MATCHC(c) LEXER->matchc(LEXER, c)
17392 +#define MATCHS(s) LEXER->matchs(LEXER, s)
17393 +#define MATCHRANGE(c1,c2) LEXER->matchRange(LEXER, c1, c2)
17394 +#define MATCHANY() LEXER->matchAny(LEXER)
17395 +#define LTOKEN LEXSTATE->token
17396 +#define HASFAILED() (LEXSTATE->failed == ANTLR3_TRUE)
17397 +#define BACKTRACKING LEXSTATE->backtracking
17398 +#define FAILEDFLAG LEXSTATE->failed
17399 +#define INPUT LEXER->input
17400 +#define STRSTREAM INPUT
17401 +#define ISTREAM INPUT->istream
17402 +#define INDEX() ISTREAM->index(ISTREAM)
17403 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
17404 +#define EOF_TOKEN &(LEXSTATE->tokSource->eofToken)
17405 +#define HASEXCEPTION() (LEXSTATE->error == ANTLR3_TRUE)
17406 +#define EXCEPTION LEXSTATE->exception
17407 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
17408 +#define LRECOVER() LEXER->recover(LEXER)
17409 +#define MARK() ISTREAM->mark(ISTREAM)
17410 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
17411 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
17412 +#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si)
17413 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
17414 +#define PUSHSTREAM(str) LEXER->pushCharStream(LEXER, str)
17415 +#define POPSTREAM() LEXER->popCharStream(LEXER)
17416 +#define SETTEXT(str) LEXSTATE->text = str
17417 +#define SKIP() LEXSTATE->token = &(TOKSOURCE->skipToken)
17418 +#define USER1 LEXSTATE->user1
17419 +#define USER2 LEXSTATE->user2
17420 +#define USER3 LEXSTATE->user3
17421 +#define CUSTOM LEXSTATE->custom
17422 +#define RULEMEMO LEXSTATE->ruleMemo
17423 +#define DBG RECOGNIZER->debugger
17425 +/* If we have been told we can rely on the standard 8 bit or 16 bit input
17426 + * stream, then we can define our macros to use the direct pointers
17427 + * in the input object, which is much faster than indirect calls. This
17428 + * is really only significant to lexers with a lot of fragment rules (which
17429 + * do not place LA(1) in a temporary at the moment) and even then
17430 + * only if there is a lot of input (order of say 1M or so).
17432 +#if defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16)
17434 +# ifdef ANTLR3_INLINE_INPUT_ASCII
17436 +/* 8 bit "ASCII" (actually any 8 bit character set) */
17438 +# define NEXTCHAR ((pANTLR3_UINT8)(INPUT->nextChar))
17439 +# define DATAP ((pANTLR3_UINT8)(INPUT->data))
17443 +# define NEXTCHAR ((pANTLR3_UINT16)(INPUT->nextChar))
17444 +# define DATAP ((pANTLR3_UINT16)(INPUT->data))
17448 +# define LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1)))
17449 +# define CONSUME() \
17451 + if (NEXTCHAR < (DATAP + INPUT->sizeBuf)) \
17453 + INPUT->charPositionInLine++; \
17454 + if ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar) \
17457 + INPUT->charPositionInLine = 0; \
17458 + INPUT->currentLine = (void *)(NEXTCHAR + 1); \
17460 + INPUT->nextChar = (void *)(NEXTCHAR + 1); \
17466 +// Pick up the input character by calling the input stream implementation.
17468 +#define CONSUME() INPUT->istream->consume(INPUT->istream)
17469 +#define LA(n) INPUT->istream->_LA(INPUT->istream, n)
17472 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
17474 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
17475 + * then for the present you must use different names for your defines as these are hard coded
17476 + * in the code generator. It would be better not to use such names internally, and maybe
17477 + * we can change this in a forthcoming release. I deliberately do not #undef these
17478 + * here as this will at least give you a redefined error somewhere if they clash.
17480 +#define UP ANTLR3_TOKEN_UP
17481 +#define DOWN ANTLR3_TOKEN_DOWN
17482 +#define EOR ANTLR3_TOKEN_EOR
17483 +#define INVALID ANTLR3_TOKEN_INVALID
17486 +/* =============================================================================
17487 + * Functions to create and destroy scopes. First come the rule scopes, followed
17488 + * by the global declared scopes.
17493 +/* ============================================================================= */
17495 +/* =============================================================================
17496 + * Start of recognizer
17500 +/* Forward declare the locally static matching functions we have generated and any predicate functions.
17502 +static ANTLR3_INLINE void mT__30 (pSMARTPLLexer ctx);
17503 +static ANTLR3_INLINE void mT__31 (pSMARTPLLexer ctx);
17504 +static ANTLR3_INLINE void mSTRTAG (pSMARTPLLexer ctx);
17505 +static ANTLR3_INLINE void mINTTAG (pSMARTPLLexer ctx);
17506 +static ANTLR3_INLINE void mDATETAG (pSMARTPLLexer ctx);
17507 +static ANTLR3_INLINE void mENUMTAG (pSMARTPLLexer ctx);
17508 +static ANTLR3_INLINE void mINCLUDES (pSMARTPLLexer ctx);
17509 +static ANTLR3_INLINE void mIS (pSMARTPLLexer ctx);
17510 +static ANTLR3_INLINE void mINTBOOL (pSMARTPLLexer ctx);
17511 +static ANTLR3_INLINE void mGREATER (pSMARTPLLexer ctx);
17512 +static ANTLR3_INLINE void mGREATEREQUAL (pSMARTPLLexer ctx);
17513 +static ANTLR3_INLINE void mLESS (pSMARTPLLexer ctx);
17514 +static ANTLR3_INLINE void mLESSEQUAL (pSMARTPLLexer ctx);
17515 +static ANTLR3_INLINE void mEQUAL (pSMARTPLLexer ctx);
17516 +static ANTLR3_INLINE void mAFTER (pSMARTPLLexer ctx);
17517 +static ANTLR3_INLINE void mBEFORE (pSMARTPLLexer ctx);
17518 +static ANTLR3_INLINE void mAGO (pSMARTPLLexer ctx);
17519 +static ANTLR3_INLINE void mAND (pSMARTPLLexer ctx);
17520 +static ANTLR3_INLINE void mOR (pSMARTPLLexer ctx);
17521 +static ANTLR3_INLINE void mNOT (pSMARTPLLexer ctx);
17522 +static ANTLR3_INLINE void mLPAR (pSMARTPLLexer ctx);
17523 +static ANTLR3_INLINE void mRPAR (pSMARTPLLexer ctx);
17524 +static ANTLR3_INLINE void mDATE (pSMARTPLLexer ctx);
17525 +static ANTLR3_INLINE void mDATINTERVAL (pSMARTPLLexer ctx);
17526 +static ANTLR3_INLINE void mENUMVAL (pSMARTPLLexer ctx);
17527 +static ANTLR3_INLINE void mSTR (pSMARTPLLexer ctx);
17528 +static ANTLR3_INLINE void mINT (pSMARTPLLexer ctx);
17529 +static ANTLR3_INLINE void mWHITESPACE (pSMARTPLLexer ctx);
17530 +static ANTLR3_INLINE void mTokens (pSMARTPLLexer ctx);
17531 +static void SMARTPLLexerFree(pSMARTPLLexer ctx);
17533 +/* =========================================================================
17534 + * Lexer matching rules end.
17535 + * =========================================================================
17541 +SMARTPLLexerFree (pSMARTPLLexer ctx)
17543 + LEXER->free(LEXER);
17545 + ANTLR3_FREE(ctx);
17548 +/** \brief Name of the grammar file that generated this code
17550 +static const char fileName[] = "SMARTPL.g";
17552 +/** \brief Return the name of the grammar file that generated this code.
17554 +static const char * getGrammarFileName()
17559 +/** \brief Create a new lexer called SMARTPLLexer
17561 + * \param[in] instream Pointer to an initialized input stream
17563 + * - Success pSMARTPLLexer initialized for the lex start
17566 +ANTLR3_API pSMARTPLLexer SMARTPLLexerNew
17567 +(pANTLR3_INPUT_STREAM instream)
17569 + // See if we can create a new lexer with the standard constructor
17571 + return SMARTPLLexerNewSSD(instream, NULL);
17574 +/** \brief Create a new lexer called SMARTPLLexer
17576 + * \param[in] instream Pointer to an initialized input stream
17577 + * \param[state] state Previously created shared recognizer stat
17579 + * - Success pSMARTPLLexer initialized for the lex start
17582 +ANTLR3_API pSMARTPLLexer SMARTPLLexerNewSSD
17583 +(pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
17585 + pSMARTPLLexer ctx; // Context structure we will build and return
17587 + ctx = (pSMARTPLLexer) ANTLR3_CALLOC(1, sizeof(SMARTPLLexer));
17591 + // Failed to allocate memory for lexer context
17595 + /* -------------------------------------------------------------------
17596 + * Memory for basic structure is allocated, now to fill in
17597 + * in base ANTLR3 structures. We initialize the function pointers
17598 + * for the standard ANTLR3 lexer function set, but upon return
17599 + * from here, the programmer may set the pointers to provide custom
17600 + * implementations of each function.
17602 + * We don't use the macros defined in SMARTPLLexer.h here so you can get a sense
17603 + * of what goes where.
17606 + /* Create a base lexer, using the supplied input stream
17608 + ctx->pLexer = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state);
17610 + /* Check that we allocated the memory correctly
17612 + if (ctx->pLexer == NULL)
17614 + ANTLR3_FREE(ctx);
17617 + /* Install the implementation of our SMARTPLLexer interface
17619 + ctx->mT__30 = mT__30;
17620 + ctx->mT__31 = mT__31;
17621 + ctx->mSTRTAG = mSTRTAG;
17622 + ctx->mINTTAG = mINTTAG;
17623 + ctx->mDATETAG = mDATETAG;
17624 + ctx->mENUMTAG = mENUMTAG;
17625 + ctx->mINCLUDES = mINCLUDES;
17627 + ctx->mINTBOOL = mINTBOOL;
17628 + ctx->mGREATER = mGREATER;
17629 + ctx->mGREATEREQUAL = mGREATEREQUAL;
17630 + ctx->mLESS = mLESS;
17631 + ctx->mLESSEQUAL = mLESSEQUAL;
17632 + ctx->mEQUAL = mEQUAL;
17633 + ctx->mAFTER = mAFTER;
17634 + ctx->mBEFORE = mBEFORE;
17635 + ctx->mAGO = mAGO;
17636 + ctx->mAND = mAND;
17638 + ctx->mNOT = mNOT;
17639 + ctx->mLPAR = mLPAR;
17640 + ctx->mRPAR = mRPAR;
17641 + ctx->mDATE = mDATE;
17642 + ctx->mDATINTERVAL = mDATINTERVAL;
17643 + ctx->mENUMVAL = mENUMVAL;
17644 + ctx->mSTR = mSTR;
17645 + ctx->mINT = mINT;
17646 + ctx->mWHITESPACE = mWHITESPACE;
17647 + ctx->mTokens = mTokens;
17649 + /** When the nextToken() call is made to this lexer's pANTLR3_TOKEN_SOURCE
17650 + * it will call mTokens() in this generated code, and will pass it the ctx
17651 + * pointer of this lexer, not the context of the base lexer, so store that now.
17653 + ctx->pLexer->ctx = ctx;
17655 + /**Install the token matching function
17657 + ctx->pLexer->mTokens = (void (*) (void *))(mTokens);
17659 + ctx->getGrammarFileName = getGrammarFileName;
17660 + ctx->free = SMARTPLLexerFree;
17666 + /* Return the newly built lexer to the caller
17672 +/* =========================================================================
17673 + * Functions to match the lexer grammar defined tokens from the input stream
17676 +// Comes from: 7:7: ( '{' )
17677 +/** \brief Lexer rule generated by ANTLR3
17679 + * $ANTLR start T__30
17681 + * Looks to match the characters the constitute the token T__30
17682 + * from the attached input stream.
17686 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
17688 +static ANTLR3_INLINE
17689 +void mT__30(pSMARTPLLexer ctx)
17691 + ANTLR3_UINT32 _type;
17696 + // SMARTPL.g:7:7: ( '{' )
17697 + // SMARTPL.g:7:9: '{'
17700 + if (HASEXCEPTION())
17702 + goto ruleT__30Ex;
17708 + LEXSTATE->type = _type;
17710 + // This is where rules clean up and exit
17712 + goto ruleT__30Ex; /* Prevent compiler warnings */
17716 +// $ANTLR end T__30
17718 +// Comes from: 8:7: ( '}' )
17719 +/** \brief Lexer rule generated by ANTLR3
17721 + * $ANTLR start T__31
17723 + * Looks to match the characters the constitute the token T__31
17724 + * from the attached input stream.
17728 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
17730 +static ANTLR3_INLINE
17731 +void mT__31(pSMARTPLLexer ctx)
17733 + ANTLR3_UINT32 _type;
17738 + // SMARTPL.g:8:7: ( '}' )
17739 + // SMARTPL.g:8:9: '}'
17742 + if (HASEXCEPTION())
17744 + goto ruleT__31Ex;
17750 + LEXSTATE->type = _type;
17752 + // This is where rules clean up and exit
17754 + goto ruleT__31Ex; /* Prevent compiler warnings */
17758 +// $ANTLR end T__31
17760 +// Comes from: 56:9: ( 'artist' | 'album_artist' | 'album' | 'title' | 'genre' | 'composer' | 'path' | 'type' | 'grouping' )
17761 +/** \brief Lexer rule generated by ANTLR3
17763 + * $ANTLR start STRTAG
17765 + * Looks to match the characters the constitute the token STRTAG
17766 + * from the attached input stream.
17770 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
17772 +static ANTLR3_INLINE
17773 +void mSTRTAG(pSMARTPLLexer ctx)
17775 + ANTLR3_UINT32 _type;
17781 + // SMARTPL.g:56:9: ( 'artist' | 'album_artist' | 'album' | 'title' | 'genre' | 'composer' | 'path' | 'type' | 'grouping' )
17783 + ANTLR3_UINT32 alt1;
17828 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17829 + EXCEPTION->message = (void *)"";
17830 + EXCEPTION->decisionNum = 1;
17831 + EXCEPTION->state = 13;
17834 + goto ruleSTRTAGEx;
17842 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17843 + EXCEPTION->message = (void *)"";
17844 + EXCEPTION->decisionNum = 1;
17845 + EXCEPTION->state = 12;
17848 + goto ruleSTRTAGEx;
17856 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17857 + EXCEPTION->message = (void *)"";
17858 + EXCEPTION->decisionNum = 1;
17859 + EXCEPTION->state = 7;
17862 + goto ruleSTRTAGEx;
17870 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17871 + EXCEPTION->message = (void *)"";
17872 + EXCEPTION->decisionNum = 1;
17873 + EXCEPTION->state = 1;
17876 + goto ruleSTRTAGEx;
17898 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17899 + EXCEPTION->message = (void *)"";
17900 + EXCEPTION->decisionNum = 1;
17901 + EXCEPTION->state = 2;
17904 + goto ruleSTRTAGEx;
17926 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17927 + EXCEPTION->message = (void *)"";
17928 + EXCEPTION->decisionNum = 1;
17929 + EXCEPTION->state = 3;
17932 + goto ruleSTRTAGEx;
17950 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17951 + EXCEPTION->message = (void *)"";
17952 + EXCEPTION->decisionNum = 1;
17953 + EXCEPTION->state = 0;
17956 + goto ruleSTRTAGEx;
17962 + // SMARTPL.g:56:11: 'artist'
17965 + if (HASEXCEPTION())
17967 + goto ruleSTRTAGEx;
17975 + // SMARTPL.g:57:6: 'album_artist'
17978 + if (HASEXCEPTION())
17980 + goto ruleSTRTAGEx;
17988 + // SMARTPL.g:58:6: 'album'
17991 + if (HASEXCEPTION())
17993 + goto ruleSTRTAGEx;
18001 + // SMARTPL.g:59:6: 'title'
18004 + if (HASEXCEPTION())
18006 + goto ruleSTRTAGEx;
18014 + // SMARTPL.g:60:6: 'genre'
18017 + if (HASEXCEPTION())
18019 + goto ruleSTRTAGEx;
18027 + // SMARTPL.g:61:6: 'composer'
18030 + if (HASEXCEPTION())
18032 + goto ruleSTRTAGEx;
18040 + // SMARTPL.g:62:6: 'path'
18043 + if (HASEXCEPTION())
18045 + goto ruleSTRTAGEx;
18053 + // SMARTPL.g:63:6: 'type'
18056 + if (HASEXCEPTION())
18058 + goto ruleSTRTAGEx;
18066 + // SMARTPL.g:64:6: 'grouping'
18069 + if (HASEXCEPTION())
18071 + goto ruleSTRTAGEx;
18081 + LEXSTATE->type = _type;
18083 + // This is where rules clean up and exit
18085 + goto ruleSTRTAGEx; /* Prevent compiler warnings */
18089 +// $ANTLR end STRTAG
18091 +// Comes from: 67:9: ( 'play_count' | 'rating' | 'year' | 'compilation' )
18092 +/** \brief Lexer rule generated by ANTLR3
18094 + * $ANTLR start INTTAG
18096 + * Looks to match the characters the constitute the token INTTAG
18097 + * from the attached input stream.
18101 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18103 +static ANTLR3_INLINE
18104 +void mINTTAG(pSMARTPLLexer ctx)
18106 + ANTLR3_UINT32 _type;
18112 + // SMARTPL.g:67:9: ( 'play_count' | 'rating' | 'year' | 'compilation' )
18114 + ANTLR3_UINT32 alt2;
18143 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18144 + EXCEPTION->message = (void *)"";
18145 + EXCEPTION->decisionNum = 2;
18146 + EXCEPTION->state = 0;
18149 + goto ruleINTTAGEx;
18155 + // SMARTPL.g:67:11: 'play_count'
18158 + if (HASEXCEPTION())
18160 + goto ruleINTTAGEx;
18168 + // SMARTPL.g:68:6: 'rating'
18171 + if (HASEXCEPTION())
18173 + goto ruleINTTAGEx;
18181 + // SMARTPL.g:69:6: 'year'
18184 + if (HASEXCEPTION())
18186 + goto ruleINTTAGEx;
18194 + // SMARTPL.g:70:6: 'compilation'
18197 + if (HASEXCEPTION())
18199 + goto ruleINTTAGEx;
18209 + LEXSTATE->type = _type;
18211 + // This is where rules clean up and exit
18213 + goto ruleINTTAGEx; /* Prevent compiler warnings */
18217 +// $ANTLR end INTTAG
18219 +// Comes from: 73:10: ( 'time_added' | 'time_played' )
18220 +/** \brief Lexer rule generated by ANTLR3
18222 + * $ANTLR start DATETAG
18224 + * Looks to match the characters the constitute the token DATETAG
18225 + * from the attached input stream.
18229 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18231 +static ANTLR3_INLINE
18232 +void mDATETAG(pSMARTPLLexer ctx)
18234 + ANTLR3_UINT32 _type;
18240 + // SMARTPL.g:73:10: ( 'time_added' | 'time_played' )
18242 + ANTLR3_UINT32 alt3;
18281 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18282 + EXCEPTION->message = (void *)"";
18283 + EXCEPTION->decisionNum = 3;
18284 + EXCEPTION->state = 5;
18287 + goto ruleDATETAGEx;
18295 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18296 + EXCEPTION->message = (void *)"";
18297 + EXCEPTION->decisionNum = 3;
18298 + EXCEPTION->state = 4;
18301 + goto ruleDATETAGEx;
18309 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18310 + EXCEPTION->message = (void *)"";
18311 + EXCEPTION->decisionNum = 3;
18312 + EXCEPTION->state = 3;
18315 + goto ruleDATETAGEx;
18323 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18324 + EXCEPTION->message = (void *)"";
18325 + EXCEPTION->decisionNum = 3;
18326 + EXCEPTION->state = 2;
18329 + goto ruleDATETAGEx;
18337 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18338 + EXCEPTION->message = (void *)"";
18339 + EXCEPTION->decisionNum = 3;
18340 + EXCEPTION->state = 1;
18343 + goto ruleDATETAGEx;
18351 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18352 + EXCEPTION->message = (void *)"";
18353 + EXCEPTION->decisionNum = 3;
18354 + EXCEPTION->state = 0;
18357 + goto ruleDATETAGEx;
18363 + // SMARTPL.g:73:12: 'time_added'
18366 + if (HASEXCEPTION())
18368 + goto ruleDATETAGEx;
18376 + // SMARTPL.g:74:6: 'time_played'
18379 + if (HASEXCEPTION())
18381 + goto ruleDATETAGEx;
18391 + LEXSTATE->type = _type;
18393 + // This is where rules clean up and exit
18395 + goto ruleDATETAGEx; /* Prevent compiler warnings */
18399 +// $ANTLR end DATETAG
18401 +// Comes from: 77:10: ( 'data_kind' | 'media_kind' )
18402 +/** \brief Lexer rule generated by ANTLR3
18404 + * $ANTLR start ENUMTAG
18406 + * Looks to match the characters the constitute the token ENUMTAG
18407 + * from the attached input stream.
18411 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18413 +static ANTLR3_INLINE
18414 +void mENUMTAG(pSMARTPLLexer ctx)
18416 + ANTLR3_UINT32 _type;
18422 + // SMARTPL.g:77:10: ( 'data_kind' | 'media_kind' )
18424 + ANTLR3_UINT32 alt4;
18443 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18444 + EXCEPTION->message = (void *)"";
18445 + EXCEPTION->decisionNum = 4;
18446 + EXCEPTION->state = 0;
18449 + goto ruleENUMTAGEx;
18455 + // SMARTPL.g:77:12: 'data_kind'
18458 + if (HASEXCEPTION())
18460 + goto ruleENUMTAGEx;
18468 + // SMARTPL.g:78:6: 'media_kind'
18471 + if (HASEXCEPTION())
18473 + goto ruleENUMTAGEx;
18483 + LEXSTATE->type = _type;
18485 + // This is where rules clean up and exit
18487 + goto ruleENUMTAGEx; /* Prevent compiler warnings */
18491 +// $ANTLR end ENUMTAG
18493 +// Comes from: 81:10: ( 'includes' )
18494 +/** \brief Lexer rule generated by ANTLR3
18496 + * $ANTLR start INCLUDES
18498 + * Looks to match the characters the constitute the token INCLUDES
18499 + * from the attached input stream.
18503 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18505 +static ANTLR3_INLINE
18506 +void mINCLUDES(pSMARTPLLexer ctx)
18508 + ANTLR3_UINT32 _type;
18510 + _type = INCLUDES;
18513 + // SMARTPL.g:81:10: ( 'includes' )
18514 + // SMARTPL.g:81:12: 'includes'
18517 + if (HASEXCEPTION())
18519 + goto ruleINCLUDESEx;
18526 + LEXSTATE->type = _type;
18528 + // This is where rules clean up and exit
18530 + goto ruleINCLUDESEx; /* Prevent compiler warnings */
18531 + ruleINCLUDESEx: ;
18534 +// $ANTLR end INCLUDES
18536 +// Comes from: 84:6: ( 'is' )
18537 +/** \brief Lexer rule generated by ANTLR3
18539 + * $ANTLR start IS
18541 + * Looks to match the characters the constitute the token IS
18542 + * from the attached input stream.
18546 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18548 +static ANTLR3_INLINE
18549 +void mIS(pSMARTPLLexer ctx)
18551 + ANTLR3_UINT32 _type;
18556 + // SMARTPL.g:84:6: ( 'is' )
18557 + // SMARTPL.g:84:8: 'is'
18560 + if (HASEXCEPTION())
18569 + LEXSTATE->type = _type;
18571 + // This is where rules clean up and exit
18573 + goto ruleISEx; /* Prevent compiler warnings */
18579 +// Comes from: 87:10: ( ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL ) )
18580 +/** \brief Lexer rule generated by ANTLR3
18582 + * $ANTLR start INTBOOL
18584 + * Looks to match the characters the constitute the token INTBOOL
18585 + * from the attached input stream.
18589 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18591 +static ANTLR3_INLINE
18592 +void mINTBOOL(pSMARTPLLexer ctx)
18594 + ANTLR3_UINT32 _type;
18599 + // SMARTPL.g:87:10: ( ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL ) )
18600 + // SMARTPL.g:87:12: ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL )
18603 + // SMARTPL.g:87:12: ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL )
18646 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18647 + EXCEPTION->message = (void *)"";
18648 + EXCEPTION->decisionNum = 5;
18649 + EXCEPTION->state = 0;
18652 + goto ruleINTBOOLEx;
18658 + // SMARTPL.g:87:13: GREATER
18660 + /* 87:13: GREATER */
18662 + if (HASEXCEPTION())
18664 + goto ruleINTBOOLEx;
18671 + // SMARTPL.g:87:21: GREATEREQUAL
18673 + /* 87:21: GREATEREQUAL */
18674 + mGREATEREQUAL(ctx );
18675 + if (HASEXCEPTION())
18677 + goto ruleINTBOOLEx;
18684 + // SMARTPL.g:87:34: LESS
18686 + /* 87:34: LESS */
18688 + if (HASEXCEPTION())
18690 + goto ruleINTBOOLEx;
18697 + // SMARTPL.g:87:39: LESSEQUAL
18699 + /* 87:39: LESSEQUAL */
18700 + mLESSEQUAL(ctx );
18701 + if (HASEXCEPTION())
18703 + goto ruleINTBOOLEx;
18710 + // SMARTPL.g:87:49: EQUAL
18712 + /* 87:49: EQUAL */
18714 + if (HASEXCEPTION())
18716 + goto ruleINTBOOLEx;
18728 + LEXSTATE->type = _type;
18730 + // This is where rules clean up and exit
18732 + goto ruleINTBOOLEx; /* Prevent compiler warnings */
18736 +// $ANTLR end INTBOOL
18738 +// Comes from: 91:10: ( '>' )
18739 +/** \brief Lexer rule generated by ANTLR3
18741 + * $ANTLR start GREATER
18743 + * Looks to match the characters the constitute the token GREATER
18744 + * from the attached input stream.
18748 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18750 +static ANTLR3_INLINE
18751 +void mGREATER(pSMARTPLLexer ctx)
18753 + ANTLR3_UINT32 _type;
18756 + // SMARTPL.g:91:10: ( '>' )
18757 + // SMARTPL.g:91:12: '>'
18760 + if (HASEXCEPTION())
18762 + goto ruleGREATEREx;
18770 + // This is where rules clean up and exit
18772 + goto ruleGREATEREx; /* Prevent compiler warnings */
18776 +// $ANTLR end GREATER
18778 +// Comes from: 95:13: ( '>=' )
18779 +/** \brief Lexer rule generated by ANTLR3
18781 + * $ANTLR start GREATEREQUAL
18783 + * Looks to match the characters the constitute the token GREATEREQUAL
18784 + * from the attached input stream.
18788 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18790 +static ANTLR3_INLINE
18791 +void mGREATEREQUAL(pSMARTPLLexer ctx)
18793 + ANTLR3_UINT32 _type;
18796 + // SMARTPL.g:95:13: ( '>=' )
18797 + // SMARTPL.g:95:15: '>='
18800 + if (HASEXCEPTION())
18802 + goto ruleGREATEREQUALEx;
18811 + // This is where rules clean up and exit
18813 + goto ruleGREATEREQUALEx; /* Prevent compiler warnings */
18814 + ruleGREATEREQUALEx: ;
18817 +// $ANTLR end GREATEREQUAL
18819 +// Comes from: 99:7: ( '<' )
18820 +/** \brief Lexer rule generated by ANTLR3
18822 + * $ANTLR start LESS
18824 + * Looks to match the characters the constitute the token LESS
18825 + * from the attached input stream.
18829 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18831 +static ANTLR3_INLINE
18832 +void mLESS(pSMARTPLLexer ctx)
18834 + ANTLR3_UINT32 _type;
18837 + // SMARTPL.g:99:7: ( '<' )
18838 + // SMARTPL.g:99:9: '<'
18841 + if (HASEXCEPTION())
18851 + // This is where rules clean up and exit
18853 + goto ruleLESSEx; /* Prevent compiler warnings */
18857 +// $ANTLR end LESS
18859 +// Comes from: 103:11: ( '<=' )
18860 +/** \brief Lexer rule generated by ANTLR3
18862 + * $ANTLR start LESSEQUAL
18864 + * Looks to match the characters the constitute the token LESSEQUAL
18865 + * from the attached input stream.
18869 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18871 +static ANTLR3_INLINE
18872 +void mLESSEQUAL(pSMARTPLLexer ctx)
18874 + ANTLR3_UINT32 _type;
18877 + // SMARTPL.g:103:11: ( '<=' )
18878 + // SMARTPL.g:103:13: '<='
18881 + if (HASEXCEPTION())
18883 + goto ruleLESSEQUALEx;
18892 + // This is where rules clean up and exit
18894 + goto ruleLESSEQUALEx; /* Prevent compiler warnings */
18895 + ruleLESSEQUALEx: ;
18898 +// $ANTLR end LESSEQUAL
18900 +// Comes from: 107:8: ( '=' )
18901 +/** \brief Lexer rule generated by ANTLR3
18903 + * $ANTLR start EQUAL
18905 + * Looks to match the characters the constitute the token EQUAL
18906 + * from the attached input stream.
18910 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18912 +static ANTLR3_INLINE
18913 +void mEQUAL(pSMARTPLLexer ctx)
18915 + ANTLR3_UINT32 _type;
18918 + // SMARTPL.g:107:8: ( '=' )
18919 + // SMARTPL.g:107:10: '='
18922 + if (HASEXCEPTION())
18924 + goto ruleEQUALEx;
18932 + // This is where rules clean up and exit
18934 + goto ruleEQUALEx; /* Prevent compiler warnings */
18938 +// $ANTLR end EQUAL
18940 +// Comes from: 110:8: ( 'after' )
18941 +/** \brief Lexer rule generated by ANTLR3
18943 + * $ANTLR start AFTER
18945 + * Looks to match the characters the constitute the token AFTER
18946 + * from the attached input stream.
18950 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18952 +static ANTLR3_INLINE
18953 +void mAFTER(pSMARTPLLexer ctx)
18955 + ANTLR3_UINT32 _type;
18960 + // SMARTPL.g:110:8: ( 'after' )
18961 + // SMARTPL.g:110:10: 'after'
18964 + if (HASEXCEPTION())
18966 + goto ruleAFTEREx;
18973 + LEXSTATE->type = _type;
18975 + // This is where rules clean up and exit
18977 + goto ruleAFTEREx; /* Prevent compiler warnings */
18981 +// $ANTLR end AFTER
18983 +// Comes from: 113:9: ( 'before' )
18984 +/** \brief Lexer rule generated by ANTLR3
18986 + * $ANTLR start BEFORE
18988 + * Looks to match the characters the constitute the token BEFORE
18989 + * from the attached input stream.
18993 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18995 +static ANTLR3_INLINE
18996 +void mBEFORE(pSMARTPLLexer ctx)
18998 + ANTLR3_UINT32 _type;
19003 + // SMARTPL.g:113:9: ( 'before' )
19004 + // SMARTPL.g:113:11: 'before'
19007 + if (HASEXCEPTION())
19009 + goto ruleBEFOREEx;
19016 + LEXSTATE->type = _type;
19018 + // This is where rules clean up and exit
19020 + goto ruleBEFOREEx; /* Prevent compiler warnings */
19024 +// $ANTLR end BEFORE
19026 +// Comes from: 116:7: ( 'ago' )
19027 +/** \brief Lexer rule generated by ANTLR3
19029 + * $ANTLR start AGO
19031 + * Looks to match the characters the constitute the token AGO
19032 + * from the attached input stream.
19036 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19038 +static ANTLR3_INLINE
19039 +void mAGO(pSMARTPLLexer ctx)
19041 + ANTLR3_UINT32 _type;
19046 + // SMARTPL.g:116:7: ( 'ago' )
19047 + // SMARTPL.g:116:9: 'ago'
19050 + if (HASEXCEPTION())
19059 + LEXSTATE->type = _type;
19061 + // This is where rules clean up and exit
19063 + goto ruleAGOEx; /* Prevent compiler warnings */
19069 +// Comes from: 119:7: ( 'AND' | 'and' )
19070 +/** \brief Lexer rule generated by ANTLR3
19072 + * $ANTLR start AND
19074 + * Looks to match the characters the constitute the token AND
19075 + * from the attached input stream.
19079 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19081 +static ANTLR3_INLINE
19082 +void mAND(pSMARTPLLexer ctx)
19084 + ANTLR3_UINT32 _type;
19090 + // SMARTPL.g:119:7: ( 'AND' | 'and' )
19092 + ANTLR3_UINT32 alt6;
19111 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19112 + EXCEPTION->message = (void *)"";
19113 + EXCEPTION->decisionNum = 6;
19114 + EXCEPTION->state = 0;
19123 + // SMARTPL.g:119:9: 'AND'
19126 + if (HASEXCEPTION())
19136 + // SMARTPL.g:120:6: 'and'
19139 + if (HASEXCEPTION())
19151 + LEXSTATE->type = _type;
19153 + // This is where rules clean up and exit
19155 + goto ruleANDEx; /* Prevent compiler warnings */
19161 +// Comes from: 123:6: ( 'OR' | 'or' )
19162 +/** \brief Lexer rule generated by ANTLR3
19164 + * $ANTLR start OR
19166 + * Looks to match the characters the constitute the token OR
19167 + * from the attached input stream.
19171 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19173 +static ANTLR3_INLINE
19174 +void mOR(pSMARTPLLexer ctx)
19176 + ANTLR3_UINT32 _type;
19182 + // SMARTPL.g:123:6: ( 'OR' | 'or' )
19184 + ANTLR3_UINT32 alt7;
19203 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19204 + EXCEPTION->message = (void *)"";
19205 + EXCEPTION->decisionNum = 7;
19206 + EXCEPTION->state = 0;
19215 + // SMARTPL.g:123:8: 'OR'
19218 + if (HASEXCEPTION())
19228 + // SMARTPL.g:124:6: 'or'
19231 + if (HASEXCEPTION())
19243 + LEXSTATE->type = _type;
19245 + // This is where rules clean up and exit
19247 + goto ruleOREx; /* Prevent compiler warnings */
19253 +// Comes from: 127:7: ( 'NOT' | 'not' )
19254 +/** \brief Lexer rule generated by ANTLR3
19256 + * $ANTLR start NOT
19258 + * Looks to match the characters the constitute the token NOT
19259 + * from the attached input stream.
19263 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19265 +static ANTLR3_INLINE
19266 +void mNOT(pSMARTPLLexer ctx)
19268 + ANTLR3_UINT32 _type;
19274 + // SMARTPL.g:127:7: ( 'NOT' | 'not' )
19276 + ANTLR3_UINT32 alt8;
19295 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19296 + EXCEPTION->message = (void *)"";
19297 + EXCEPTION->decisionNum = 8;
19298 + EXCEPTION->state = 0;
19307 + // SMARTPL.g:127:9: 'NOT'
19310 + if (HASEXCEPTION())
19320 + // SMARTPL.g:128:6: 'not'
19323 + if (HASEXCEPTION())
19335 + LEXSTATE->type = _type;
19337 + // This is where rules clean up and exit
19339 + goto ruleNOTEx; /* Prevent compiler warnings */
19345 +// Comes from: 131:7: ( '(' )
19346 +/** \brief Lexer rule generated by ANTLR3
19348 + * $ANTLR start LPAR
19350 + * Looks to match the characters the constitute the token LPAR
19351 + * from the attached input stream.
19355 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19357 +static ANTLR3_INLINE
19358 +void mLPAR(pSMARTPLLexer ctx)
19360 + ANTLR3_UINT32 _type;
19365 + // SMARTPL.g:131:7: ( '(' )
19366 + // SMARTPL.g:131:9: '('
19369 + if (HASEXCEPTION())
19377 + LEXSTATE->type = _type;
19379 + // This is where rules clean up and exit
19381 + goto ruleLPAREx; /* Prevent compiler warnings */
19385 +// $ANTLR end LPAR
19387 +// Comes from: 134:7: ( ')' )
19388 +/** \brief Lexer rule generated by ANTLR3
19390 + * $ANTLR start RPAR
19392 + * Looks to match the characters the constitute the token RPAR
19393 + * from the attached input stream.
19397 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19399 +static ANTLR3_INLINE
19400 +void mRPAR(pSMARTPLLexer ctx)
19402 + ANTLR3_UINT32 _type;
19407 + // SMARTPL.g:134:7: ( ')' )
19408 + // SMARTPL.g:134:9: ')'
19411 + if (HASEXCEPTION())
19419 + LEXSTATE->type = _type;
19421 + // This is where rules clean up and exit
19423 + goto ruleRPAREx; /* Prevent compiler warnings */
19427 +// $ANTLR end RPAR
19429 +// Comes from: 137:7: ( ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) '-' ( '0' .. '1' ) ( '0' .. '9' ) '-' ( '0' .. '3' ) ( '0' .. '9' ) | 'today' | 'yesterday' | 'last week' | 'last month' | 'last year' )
19430 +/** \brief Lexer rule generated by ANTLR3
19432 + * $ANTLR start DATE
19434 + * Looks to match the characters the constitute the token DATE
19435 + * from the attached input stream.
19439 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19441 +static ANTLR3_INLINE
19442 +void mDATE(pSMARTPLLexer ctx)
19444 + ANTLR3_UINT32 _type;
19450 + // SMARTPL.g:137:7: ( ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) '-' ( '0' .. '1' ) ( '0' .. '9' ) '-' ( '0' .. '3' ) ( '0' .. '9' ) | 'today' | 'yesterday' | 'last week' | 'last month' | 'last year' )
19452 + ANTLR3_UINT32 alt9;
19520 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19521 + EXCEPTION->message = (void *)"";
19522 + EXCEPTION->decisionNum = 9;
19523 + EXCEPTION->state = 8;
19534 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19535 + EXCEPTION->message = (void *)"";
19536 + EXCEPTION->decisionNum = 9;
19537 + EXCEPTION->state = 7;
19548 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19549 + EXCEPTION->message = (void *)"";
19550 + EXCEPTION->decisionNum = 9;
19551 + EXCEPTION->state = 6;
19562 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19563 + EXCEPTION->message = (void *)"";
19564 + EXCEPTION->decisionNum = 9;
19565 + EXCEPTION->state = 5;
19576 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19577 + EXCEPTION->message = (void *)"";
19578 + EXCEPTION->decisionNum = 9;
19579 + EXCEPTION->state = 4;
19590 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19591 + EXCEPTION->message = (void *)"";
19592 + EXCEPTION->decisionNum = 9;
19593 + EXCEPTION->state = 0;
19602 + // SMARTPL.g:137:9: ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) '-' ( '0' .. '1' ) ( '0' .. '9' ) '-' ( '0' .. '3' ) ( '0' .. '9' )
19604 + // SMARTPL.g:137:9: ( '0' .. '9' )
19605 + // SMARTPL.g:137:10: '0' .. '9'
19607 + MATCHRANGE('0', '9');
19608 + if (HASEXCEPTION())
19616 + // SMARTPL.g:137:19: ( '0' .. '9' )
19617 + // SMARTPL.g:137:20: '0' .. '9'
19619 + MATCHRANGE('0', '9');
19620 + if (HASEXCEPTION())
19628 + // SMARTPL.g:137:29: ( '0' .. '9' )
19629 + // SMARTPL.g:137:30: '0' .. '9'
19631 + MATCHRANGE('0', '9');
19632 + if (HASEXCEPTION())
19640 + // SMARTPL.g:137:39: ( '0' .. '9' )
19641 + // SMARTPL.g:137:40: '0' .. '9'
19643 + MATCHRANGE('0', '9');
19644 + if (HASEXCEPTION())
19653 + if (HASEXCEPTION())
19658 + // SMARTPL.g:137:52: ( '0' .. '1' )
19659 + // SMARTPL.g:137:53: '0' .. '1'
19661 + MATCHRANGE('0', '1');
19662 + if (HASEXCEPTION())
19670 + // SMARTPL.g:137:62: ( '0' .. '9' )
19671 + // SMARTPL.g:137:63: '0' .. '9'
19673 + MATCHRANGE('0', '9');
19674 + if (HASEXCEPTION())
19683 + if (HASEXCEPTION())
19688 + // SMARTPL.g:137:75: ( '0' .. '3' )
19689 + // SMARTPL.g:137:76: '0' .. '3'
19691 + MATCHRANGE('0', '3');
19692 + if (HASEXCEPTION())
19700 + // SMARTPL.g:137:85: ( '0' .. '9' )
19701 + // SMARTPL.g:137:86: '0' .. '9'
19703 + MATCHRANGE('0', '9');
19704 + if (HASEXCEPTION())
19716 + // SMARTPL.g:138:6: 'today'
19719 + if (HASEXCEPTION())
19729 + // SMARTPL.g:139:6: 'yesterday'
19732 + if (HASEXCEPTION())
19742 + // SMARTPL.g:140:6: 'last week'
19745 + if (HASEXCEPTION())
19755 + // SMARTPL.g:141:6: 'last month'
19758 + if (HASEXCEPTION())
19768 + // SMARTPL.g:142:6: 'last year'
19771 + if (HASEXCEPTION())
19783 + LEXSTATE->type = _type;
19785 + // This is where rules clean up and exit
19787 + goto ruleDATEEx; /* Prevent compiler warnings */
19791 +// $ANTLR end DATE
19793 +// Comes from: 145:13: ( 'days' | 'weeks' | 'months' | 'years' )
19794 +/** \brief Lexer rule generated by ANTLR3
19796 + * $ANTLR start DATINTERVAL
19798 + * Looks to match the characters the constitute the token DATINTERVAL
19799 + * from the attached input stream.
19803 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19805 +static ANTLR3_INLINE
19806 +void mDATINTERVAL(pSMARTPLLexer ctx)
19808 + ANTLR3_UINT32 _type;
19810 + _type = DATINTERVAL;
19814 + // SMARTPL.g:145:13: ( 'days' | 'weeks' | 'months' | 'years' )
19816 + ANTLR3_UINT32 alt10;
19845 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19846 + EXCEPTION->message = (void *)"";
19847 + EXCEPTION->decisionNum = 10;
19848 + EXCEPTION->state = 0;
19851 + goto ruleDATINTERVALEx;
19857 + // SMARTPL.g:145:15: 'days'
19860 + if (HASEXCEPTION())
19862 + goto ruleDATINTERVALEx;
19870 + // SMARTPL.g:146:6: 'weeks'
19873 + if (HASEXCEPTION())
19875 + goto ruleDATINTERVALEx;
19883 + // SMARTPL.g:147:6: 'months'
19886 + if (HASEXCEPTION())
19888 + goto ruleDATINTERVALEx;
19896 + // SMARTPL.g:148:6: 'years'
19899 + if (HASEXCEPTION())
19901 + goto ruleDATINTERVALEx;
19911 + LEXSTATE->type = _type;
19913 + // This is where rules clean up and exit
19915 + goto ruleDATINTERVALEx; /* Prevent compiler warnings */
19916 + ruleDATINTERVALEx: ;
19919 +// $ANTLR end DATINTERVAL
19921 +// Comes from: 151:10: ( 'music' | 'movie' | 'podcast' | 'audiobook' | 'tvshow' | 'file' | 'url' | 'spotify' | 'pipe' )
19922 +/** \brief Lexer rule generated by ANTLR3
19924 + * $ANTLR start ENUMVAL
19926 + * Looks to match the characters the constitute the token ENUMVAL
19927 + * from the attached input stream.
19931 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19933 +static ANTLR3_INLINE
19934 +void mENUMVAL(pSMARTPLLexer ctx)
19936 + ANTLR3_UINT32 _type;
19942 + // SMARTPL.g:151:10: ( 'music' | 'movie' | 'podcast' | 'audiobook' | 'tvshow' | 'file' | 'url' | 'spotify' | 'pipe' )
19944 + ANTLR3_UINT32 alt11;
19967 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19968 + EXCEPTION->message = (void *)"";
19969 + EXCEPTION->decisionNum = 11;
19970 + EXCEPTION->state = 1;
19973 + goto ruleENUMVALEx;
19995 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19996 + EXCEPTION->message = (void *)"";
19997 + EXCEPTION->decisionNum = 11;
19998 + EXCEPTION->state = 2;
20001 + goto ruleENUMVALEx;
20034 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20035 + EXCEPTION->message = (void *)"";
20036 + EXCEPTION->decisionNum = 11;
20037 + EXCEPTION->state = 0;
20040 + goto ruleENUMVALEx;
20046 + // SMARTPL.g:151:12: 'music'
20049 + if (HASEXCEPTION())
20051 + goto ruleENUMVALEx;
20059 + // SMARTPL.g:152:6: 'movie'
20062 + if (HASEXCEPTION())
20064 + goto ruleENUMVALEx;
20072 + // SMARTPL.g:153:6: 'podcast'
20075 + if (HASEXCEPTION())
20077 + goto ruleENUMVALEx;
20085 + // SMARTPL.g:154:6: 'audiobook'
20088 + if (HASEXCEPTION())
20090 + goto ruleENUMVALEx;
20098 + // SMARTPL.g:155:6: 'tvshow'
20101 + if (HASEXCEPTION())
20103 + goto ruleENUMVALEx;
20111 + // SMARTPL.g:156:6: 'file'
20114 + if (HASEXCEPTION())
20116 + goto ruleENUMVALEx;
20124 + // SMARTPL.g:157:6: 'url'
20127 + if (HASEXCEPTION())
20129 + goto ruleENUMVALEx;
20137 + // SMARTPL.g:158:6: 'spotify'
20140 + if (HASEXCEPTION())
20142 + goto ruleENUMVALEx;
20150 + // SMARTPL.g:159:6: 'pipe'
20153 + if (HASEXCEPTION())
20155 + goto ruleENUMVALEx;
20165 + LEXSTATE->type = _type;
20167 + // This is where rules clean up and exit
20169 + goto ruleENUMVALEx; /* Prevent compiler warnings */
20173 +// $ANTLR end ENUMVAL
20175 +// Comes from: 162:7: ( '\"' (~ ( '\"' ) )+ '\"' )
20176 +/** \brief Lexer rule generated by ANTLR3
20178 + * $ANTLR start STR
20180 + * Looks to match the characters the constitute the token STR
20181 + * from the attached input stream.
20185 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
20187 +static ANTLR3_INLINE
20188 +void mSTR(pSMARTPLLexer ctx)
20190 + ANTLR3_UINT32 _type;
20195 + // SMARTPL.g:162:7: ( '\"' (~ ( '\"' ) )+ '\"' )
20196 + // SMARTPL.g:162:9: '\"' (~ ( '\"' ) )+ '\"'
20199 + if (HASEXCEPTION())
20204 + // SMARTPL.g:162:13: (~ ( '\"' ) )+
20212 + /* dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState)
20214 + int LA12_0 = LA(1);
20215 + if ( (((LA12_0 >= 0x0000) && (LA12_0 <= '!')) || ((LA12_0 >= '#') && (LA12_0 <= 0xFFFF))) )
20224 + // SMARTPL.g:162:13: ~ ( '\"' )
20226 + if ( ((LA(1) >= 0x0000) && (LA(1) <= '!')) || ((LA(1) >= '#') && (LA(1) <= 0xFFFF)) )
20234 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
20235 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
20237 + LRECOVER(); goto ruleSTREx;
20246 + if ( cnt12 >= 1 )
20250 + /* mismatchedSetEx()
20253 + EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
20254 + EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
20261 + loop12: ; /* Jump to here if this rule does not match */
20264 + if (HASEXCEPTION())
20272 + LEXSTATE->type = _type;
20274 + // This is where rules clean up and exit
20276 + goto ruleSTREx; /* Prevent compiler warnings */
20282 +// Comes from: 165:7: ( ( '0' .. '9' )+ )
20283 +/** \brief Lexer rule generated by ANTLR3
20285 + * $ANTLR start INT
20287 + * Looks to match the characters the constitute the token INT
20288 + * from the attached input stream.
20292 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
20294 +static ANTLR3_INLINE
20295 +void mINT(pSMARTPLLexer ctx)
20297 + ANTLR3_UINT32 _type;
20302 + // SMARTPL.g:165:7: ( ( '0' .. '9' )+ )
20303 + // SMARTPL.g:165:9: ( '0' .. '9' )+
20305 + // SMARTPL.g:165:9: ( '0' .. '9' )+
20334 + // SMARTPL.g:165:10: '0' .. '9'
20336 + MATCHRANGE('0', '9');
20337 + if (HASEXCEPTION())
20348 + if ( cnt13 >= 1 )
20352 + /* mismatchedSetEx()
20355 + EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
20356 + EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
20363 + loop13: ; /* Jump to here if this rule does not match */
20368 + LEXSTATE->type = _type;
20370 + // This is where rules clean up and exit
20372 + goto ruleINTEx; /* Prevent compiler warnings */
20378 +// Comes from: 168:12: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' ) )
20379 +/** \brief Lexer rule generated by ANTLR3
20381 + * $ANTLR start WHITESPACE
20383 + * Looks to match the characters the constitute the token WHITESPACE
20384 + * from the attached input stream.
20388 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
20390 +static ANTLR3_INLINE
20391 +void mWHITESPACE(pSMARTPLLexer ctx)
20393 + ANTLR3_UINT32 _type;
20395 + _type = WHITESPACE;
20398 + // SMARTPL.g:168:12: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' ) )
20399 + // SMARTPL.g:168:14: ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' )
20401 + if ( ((LA(1) >= '\t') && (LA(1) <= '\n')) || ((LA(1) >= '\f') && (LA(1) <= '\r')) || LA(1) == ' ' )
20409 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
20410 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
20412 + LRECOVER(); goto ruleWHITESPACEEx;
20416 + LEXSTATE->channel = HIDDEN;
20421 + LEXSTATE->type = _type;
20423 + // This is where rules clean up and exit
20425 + goto ruleWHITESPACEEx; /* Prevent compiler warnings */
20426 + ruleWHITESPACEEx: ;
20429 +// $ANTLR end WHITESPACE
20431 +/** This is the entry point in to the lexer from an object that
20432 + * wants to generate the next token, such as a pCOMMON_TOKEN_STREAM
20435 +mTokens(pSMARTPLLexer ctx)
20438 + // SMARTPL.g:1:8: ( T__30 | T__31 | STRTAG | INTTAG | DATETAG | ENUMTAG | INCLUDES | IS | INTBOOL | AFTER | BEFORE | AGO | AND | OR | NOT | LPAR | RPAR | DATE | DATINTERVAL | ENUMVAL | STR | INT | WHITESPACE )
20440 + ANTLR3_UINT32 alt14;
20489 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20490 + EXCEPTION->message = (void *)"";
20491 + EXCEPTION->decisionNum = 14;
20492 + EXCEPTION->state = 3;
20495 + goto ruleTokensEx;
20521 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20522 + EXCEPTION->message = (void *)"";
20523 + EXCEPTION->decisionNum = 14;
20524 + EXCEPTION->state = 28;
20527 + goto ruleTokensEx;
20550 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20551 + EXCEPTION->message = (void *)"";
20552 + EXCEPTION->decisionNum = 14;
20553 + EXCEPTION->state = 4;
20556 + goto ruleTokensEx;
20595 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20596 + EXCEPTION->message = (void *)"";
20597 + EXCEPTION->decisionNum = 14;
20598 + EXCEPTION->state = 42;
20601 + goto ruleTokensEx;
20609 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20610 + EXCEPTION->message = (void *)"";
20611 + EXCEPTION->decisionNum = 14;
20612 + EXCEPTION->state = 39;
20615 + goto ruleTokensEx;
20623 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20624 + EXCEPTION->message = (void *)"";
20625 + EXCEPTION->decisionNum = 14;
20626 + EXCEPTION->state = 29;
20629 + goto ruleTokensEx;
20637 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20638 + EXCEPTION->message = (void *)"";
20639 + EXCEPTION->decisionNum = 14;
20640 + EXCEPTION->state = 6;
20643 + goto ruleTokensEx;
20671 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20672 + EXCEPTION->message = (void *)"";
20673 + EXCEPTION->decisionNum = 14;
20674 + EXCEPTION->state = 7;
20677 + goto ruleTokensEx;
20717 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20718 + EXCEPTION->message = (void *)"";
20719 + EXCEPTION->decisionNum = 14;
20720 + EXCEPTION->state = 40;
20723 + goto ruleTokensEx;
20736 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20737 + EXCEPTION->message = (void *)"";
20738 + EXCEPTION->decisionNum = 14;
20739 + EXCEPTION->state = 30;
20742 + goto ruleTokensEx;
20750 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20751 + EXCEPTION->message = (void *)"";
20752 + EXCEPTION->decisionNum = 14;
20753 + EXCEPTION->state = 9;
20756 + goto ruleTokensEx;
20782 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20783 + EXCEPTION->message = (void *)"";
20784 + EXCEPTION->decisionNum = 14;
20785 + EXCEPTION->state = 31;
20788 + goto ruleTokensEx;
20796 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20797 + EXCEPTION->message = (void *)"";
20798 + EXCEPTION->decisionNum = 14;
20799 + EXCEPTION->state = 10;
20802 + goto ruleTokensEx;
20833 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20834 + EXCEPTION->message = (void *)"";
20835 + EXCEPTION->decisionNum = 14;
20836 + EXCEPTION->state = 33;
20839 + goto ruleTokensEx;
20852 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20853 + EXCEPTION->message = (void *)"";
20854 + EXCEPTION->decisionNum = 14;
20855 + EXCEPTION->state = 11;
20858 + goto ruleTokensEx;
20880 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20881 + EXCEPTION->message = (void *)"";
20882 + EXCEPTION->decisionNum = 14;
20883 + EXCEPTION->state = 12;
20886 + goto ruleTokensEx;
21045 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
21046 + EXCEPTION->message = (void *)"";
21047 + EXCEPTION->decisionNum = 14;
21048 + EXCEPTION->state = 0;
21051 + goto ruleTokensEx;
21057 + // SMARTPL.g:1:10: T__30
21059 + /* 1:10: T__30 */
21061 + if (HASEXCEPTION())
21063 + goto ruleTokensEx;
21070 + // SMARTPL.g:1:16: T__31
21072 + /* 1:16: T__31 */
21074 + if (HASEXCEPTION())
21076 + goto ruleTokensEx;
21083 + // SMARTPL.g:1:22: STRTAG
21085 + /* 1:22: STRTAG */
21087 + if (HASEXCEPTION())
21089 + goto ruleTokensEx;
21096 + // SMARTPL.g:1:29: INTTAG
21098 + /* 1:29: INTTAG */
21100 + if (HASEXCEPTION())
21102 + goto ruleTokensEx;
21109 + // SMARTPL.g:1:36: DATETAG
21111 + /* 1:36: DATETAG */
21113 + if (HASEXCEPTION())
21115 + goto ruleTokensEx;
21122 + // SMARTPL.g:1:44: ENUMTAG
21124 + /* 1:44: ENUMTAG */
21126 + if (HASEXCEPTION())
21128 + goto ruleTokensEx;
21135 + // SMARTPL.g:1:52: INCLUDES
21137 + /* 1:52: INCLUDES */
21139 + if (HASEXCEPTION())
21141 + goto ruleTokensEx;
21148 + // SMARTPL.g:1:61: IS
21152 + if (HASEXCEPTION())
21154 + goto ruleTokensEx;
21161 + // SMARTPL.g:1:64: INTBOOL
21163 + /* 1:64: INTBOOL */
21165 + if (HASEXCEPTION())
21167 + goto ruleTokensEx;
21174 + // SMARTPL.g:1:72: AFTER
21176 + /* 1:72: AFTER */
21178 + if (HASEXCEPTION())
21180 + goto ruleTokensEx;
21187 + // SMARTPL.g:1:78: BEFORE
21189 + /* 1:78: BEFORE */
21191 + if (HASEXCEPTION())
21193 + goto ruleTokensEx;
21200 + // SMARTPL.g:1:85: AGO
21204 + if (HASEXCEPTION())
21206 + goto ruleTokensEx;
21213 + // SMARTPL.g:1:89: AND
21217 + if (HASEXCEPTION())
21219 + goto ruleTokensEx;
21226 + // SMARTPL.g:1:93: OR
21230 + if (HASEXCEPTION())
21232 + goto ruleTokensEx;
21239 + // SMARTPL.g:1:96: NOT
21243 + if (HASEXCEPTION())
21245 + goto ruleTokensEx;
21252 + // SMARTPL.g:1:100: LPAR
21254 + /* 1:100: LPAR */
21256 + if (HASEXCEPTION())
21258 + goto ruleTokensEx;
21265 + // SMARTPL.g:1:105: RPAR
21267 + /* 1:105: RPAR */
21269 + if (HASEXCEPTION())
21271 + goto ruleTokensEx;
21278 + // SMARTPL.g:1:110: DATE
21280 + /* 1:110: DATE */
21282 + if (HASEXCEPTION())
21284 + goto ruleTokensEx;
21291 + // SMARTPL.g:1:115: DATINTERVAL
21293 + /* 1:115: DATINTERVAL */
21294 + mDATINTERVAL(ctx );
21295 + if (HASEXCEPTION())
21297 + goto ruleTokensEx;
21304 + // SMARTPL.g:1:127: ENUMVAL
21306 + /* 1:127: ENUMVAL */
21308 + if (HASEXCEPTION())
21310 + goto ruleTokensEx;
21317 + // SMARTPL.g:1:135: STR
21321 + if (HASEXCEPTION())
21323 + goto ruleTokensEx;
21330 + // SMARTPL.g:1:139: INT
21334 + if (HASEXCEPTION())
21336 + goto ruleTokensEx;
21343 + // SMARTPL.g:1:143: WHITESPACE
21345 + /* 1:143: WHITESPACE */
21346 + mWHITESPACE(ctx );
21347 + if (HASEXCEPTION())
21349 + goto ruleTokensEx;
21360 + goto ruleTokensEx; /* Prevent compiler warnings */
21364 +/* =========================================================================
21365 + * Lexer matching rules end.
21366 + * =========================================================================
21368 +/* End of Lexer code
21369 + * ================================================
21370 + * ================================================
21375 + * =============================================================================
21377 diff --git a/src/pregen/SMARTPLLexer.h b/src/pregen/SMARTPLLexer.h
21378 new file mode 100644
21379 index 0000000..87e8c7e
21381 +++ b/src/pregen/SMARTPLLexer.h
21384 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
21386 + * - From the grammar source file : SMARTPL.g
21387 + * - On : 2016-01-01 12:23:40
21388 + * - for the lexer : SMARTPLLexerLexer *
21389 + * Editing it, at least manually, is not wise.
21391 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
21394 + * The lexer SMARTPLLexer has the callable functions (rules) shown below,
21395 + * which will invoke the code for the associated rule in the source grammar
21396 + * assuming that the input stream is pointing to a token/text stream that could begin
21399 + * For instance if you call the first (topmost) rule in a parser grammar, you will
21400 + * get the results of a full parse, but calling a rule half way through the grammar will
21401 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
21402 + * in editors and so on.
21404 + * The parser entry points are called indirectly (by function pointer to function) via
21405 + * a parser context typedef pSMARTPLLexer, which is returned from a call to SMARTPLLexerNew().
21407 + * As this is a generated lexer, it is unlikely you will call it 'manually'. However
21408 + * the methods are provided anyway.
21409 + * * The methods in pSMARTPLLexer are as follows:
21411 + * - void pSMARTPLLexer->T__30(pSMARTPLLexer)
21412 + * - void pSMARTPLLexer->T__31(pSMARTPLLexer)
21413 + * - void pSMARTPLLexer->STRTAG(pSMARTPLLexer)
21414 + * - void pSMARTPLLexer->INTTAG(pSMARTPLLexer)
21415 + * - void pSMARTPLLexer->DATETAG(pSMARTPLLexer)
21416 + * - void pSMARTPLLexer->ENUMTAG(pSMARTPLLexer)
21417 + * - void pSMARTPLLexer->INCLUDES(pSMARTPLLexer)
21418 + * - void pSMARTPLLexer->IS(pSMARTPLLexer)
21419 + * - void pSMARTPLLexer->INTBOOL(pSMARTPLLexer)
21420 + * - void pSMARTPLLexer->GREATER(pSMARTPLLexer)
21421 + * - void pSMARTPLLexer->GREATEREQUAL(pSMARTPLLexer)
21422 + * - void pSMARTPLLexer->LESS(pSMARTPLLexer)
21423 + * - void pSMARTPLLexer->LESSEQUAL(pSMARTPLLexer)
21424 + * - void pSMARTPLLexer->EQUAL(pSMARTPLLexer)
21425 + * - void pSMARTPLLexer->AFTER(pSMARTPLLexer)
21426 + * - void pSMARTPLLexer->BEFORE(pSMARTPLLexer)
21427 + * - void pSMARTPLLexer->AGO(pSMARTPLLexer)
21428 + * - void pSMARTPLLexer->AND(pSMARTPLLexer)
21429 + * - void pSMARTPLLexer->OR(pSMARTPLLexer)
21430 + * - void pSMARTPLLexer->NOT(pSMARTPLLexer)
21431 + * - void pSMARTPLLexer->LPAR(pSMARTPLLexer)
21432 + * - void pSMARTPLLexer->RPAR(pSMARTPLLexer)
21433 + * - void pSMARTPLLexer->DATE(pSMARTPLLexer)
21434 + * - void pSMARTPLLexer->DATINTERVAL(pSMARTPLLexer)
21435 + * - void pSMARTPLLexer->ENUMVAL(pSMARTPLLexer)
21436 + * - void pSMARTPLLexer->STR(pSMARTPLLexer)
21437 + * - void pSMARTPLLexer->INT(pSMARTPLLexer)
21438 + * - void pSMARTPLLexer->WHITESPACE(pSMARTPLLexer)
21439 + * - void pSMARTPLLexer->Tokens(pSMARTPLLexer)
21441 + * The return type for any particular rule is of course determined by the source
21444 +// [The "BSD licence"]
21445 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
21446 +// http://www.temporal-wave.com
21447 +// http://www.linkedin.com/in/jimidle
21449 +// All rights reserved.
21451 +// Redistribution and use in source and binary forms, with or without
21452 +// modification, are permitted provided that the following conditions
21454 +// 1. Redistributions of source code must retain the above copyright
21455 +// notice, this list of conditions and the following disclaimer.
21456 +// 2. Redistributions in binary form must reproduce the above copyright
21457 +// notice, this list of conditions and the following disclaimer in the
21458 +// documentation and/or other materials provided with the distribution.
21459 +// 3. The name of the author may not be used to endorse or promote products
21460 +// derived from this software without specific prior written permission.
21462 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21463 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21464 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21465 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21466 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21467 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21468 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21469 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21470 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21471 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21473 +#ifndef _SMARTPLLexer_H
21474 +#define _SMARTPLLexer_H
21475 +/* =============================================================================
21476 + * Standard antlr3 C runtime definitions
21478 +#include <antlr3.h>
21480 +/* End of standard antlr 3 runtime definitions
21481 + * =============================================================================
21484 +#ifdef __cplusplus
21488 +// Forward declare the context typedef so that we can use it before it is
21489 +// properly defined. Delegators and delegates (from import statements) are
21490 +// interdependent and their context structures contain pointers to each other
21491 +// C only allows such things to be declared if you pre-declare the typedef.
21493 +typedef struct SMARTPLLexer_Ctx_struct SMARTPLLexer, * pSMARTPLLexer;
21497 +#ifdef ANTLR3_WINDOWS
21498 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
21499 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
21500 +// initialized but unused variable - tree rewrite variables declared but not needed
21501 +// Unreferenced local variable - lexer rule declares but does not always use _type
21502 +// potentially unitialized variable used - retval always returned from a rule
21503 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
21505 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
21506 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
21507 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
21508 +// this is a matter of orthogonality hence I disable that one.
21510 +#pragma warning( disable : 4100 )
21511 +#pragma warning( disable : 4101 )
21512 +#pragma warning( disable : 4127 )
21513 +#pragma warning( disable : 4189 )
21514 +#pragma warning( disable : 4505 )
21515 +#pragma warning( disable : 4701 )
21518 +/** Context tracking structure for SMARTPLLexer
21520 +struct SMARTPLLexer_Ctx_struct
21522 + /** Built in ANTLR3 context tracker contains all the generic elements
21523 + * required for context tracking.
21525 + pANTLR3_LEXER pLexer;
21528 + void (*mT__30) (struct SMARTPLLexer_Ctx_struct * ctx);
21529 + void (*mT__31) (struct SMARTPLLexer_Ctx_struct * ctx);
21530 + void (*mSTRTAG) (struct SMARTPLLexer_Ctx_struct * ctx);
21531 + void (*mINTTAG) (struct SMARTPLLexer_Ctx_struct * ctx);
21532 + void (*mDATETAG) (struct SMARTPLLexer_Ctx_struct * ctx);
21533 + void (*mENUMTAG) (struct SMARTPLLexer_Ctx_struct * ctx);
21534 + void (*mINCLUDES) (struct SMARTPLLexer_Ctx_struct * ctx);
21535 + void (*mIS) (struct SMARTPLLexer_Ctx_struct * ctx);
21536 + void (*mINTBOOL) (struct SMARTPLLexer_Ctx_struct * ctx);
21537 + void (*mGREATER) (struct SMARTPLLexer_Ctx_struct * ctx);
21538 + void (*mGREATEREQUAL) (struct SMARTPLLexer_Ctx_struct * ctx);
21539 + void (*mLESS) (struct SMARTPLLexer_Ctx_struct * ctx);
21540 + void (*mLESSEQUAL) (struct SMARTPLLexer_Ctx_struct * ctx);
21541 + void (*mEQUAL) (struct SMARTPLLexer_Ctx_struct * ctx);
21542 + void (*mAFTER) (struct SMARTPLLexer_Ctx_struct * ctx);
21543 + void (*mBEFORE) (struct SMARTPLLexer_Ctx_struct * ctx);
21544 + void (*mAGO) (struct SMARTPLLexer_Ctx_struct * ctx);
21545 + void (*mAND) (struct SMARTPLLexer_Ctx_struct * ctx);
21546 + void (*mOR) (struct SMARTPLLexer_Ctx_struct * ctx);
21547 + void (*mNOT) (struct SMARTPLLexer_Ctx_struct * ctx);
21548 + void (*mLPAR) (struct SMARTPLLexer_Ctx_struct * ctx);
21549 + void (*mRPAR) (struct SMARTPLLexer_Ctx_struct * ctx);
21550 + void (*mDATE) (struct SMARTPLLexer_Ctx_struct * ctx);
21551 + void (*mDATINTERVAL) (struct SMARTPLLexer_Ctx_struct * ctx);
21552 + void (*mENUMVAL) (struct SMARTPLLexer_Ctx_struct * ctx);
21553 + void (*mSTR) (struct SMARTPLLexer_Ctx_struct * ctx);
21554 + void (*mINT) (struct SMARTPLLexer_Ctx_struct * ctx);
21555 + void (*mWHITESPACE) (struct SMARTPLLexer_Ctx_struct * ctx);
21556 + void (*mTokens) (struct SMARTPLLexer_Ctx_struct * ctx); const char * (*getGrammarFileName)();
21557 + void (*free) (struct SMARTPLLexer_Ctx_struct * ctx);
21561 +// Function protoypes for the constructor functions that external translation units
21562 +// such as delegators and delegates may wish to call.
21564 +ANTLR3_API pSMARTPLLexer SMARTPLLexerNew (pANTLR3_INPUT_STREAM instream);
21565 +ANTLR3_API pSMARTPLLexer SMARTPLLexerNewSSD (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
21567 +/** Symbolic definitions of all the tokens that the lexer will work with.
21570 + * Antlr will define EOF, but we can't use that as it it is too common in
21571 + * in C header files and that would be confusing. There is no way to filter this out at the moment
21572 + * so we just undef it here for now. That isn't the value we get back from C recognizers
21573 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
21581 +#define INTBOOL 14
21584 +#define WHITESPACE 29
21585 +#define GREATEREQUAL 25
21587 +#define DATETAG 16
21593 +#define INCLUDES 11
21597 +#define GREATER 24
21599 +#define ENUMTAG 19
21601 +#define ENUMVAL 20
21607 +#define LESSEQUAL 27
21609 +#define DATINTERVAL 23
21612 +#define EOF ANTLR3_TOKEN_EOF
21615 +#ifndef TOKENSOURCE
21616 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
21619 +/* End of token definitions for SMARTPLLexer
21620 + * =============================================================================
21624 +#ifdef __cplusplus
21630 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
21631 diff --git a/src/pregen/SMARTPLParser.c b/src/pregen/SMARTPLParser.c
21632 new file mode 100644
21633 index 0000000..f39e5ae
21635 +++ b/src/pregen/SMARTPLParser.c
21638 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
21640 + * - From the grammar source file : SMARTPL.g
21641 + * - On : 2016-01-01 12:23:40
21642 + * - for the parser : SMARTPLParserParser *
21643 + * Editing it, at least manually, is not wise.
21645 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
21649 +// [The "BSD licence"]
21650 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
21651 +// http://www.temporal-wave.com
21652 +// http://www.linkedin.com/in/jimidle
21654 +// All rights reserved.
21656 +// Redistribution and use in source and binary forms, with or without
21657 +// modification, are permitted provided that the following conditions
21659 +// 1. Redistributions of source code must retain the above copyright
21660 +// notice, this list of conditions and the following disclaimer.
21661 +// 2. Redistributions in binary form must reproduce the above copyright
21662 +// notice, this list of conditions and the following disclaimer in the
21663 +// documentation and/or other materials provided with the distribution.
21664 +// 3. The name of the author may not be used to endorse or promote products
21665 +// derived from this software without specific prior written permission.
21667 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21668 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21669 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21670 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21671 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21672 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21673 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21674 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21675 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21676 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21678 +/* -----------------------------------------
21679 + * Include the ANTLR3 generated header file.
21681 +#include "SMARTPLParser.h"
21682 +/* ----------------------------------------- */
21688 +/* MACROS that hide the C interface implementations from the
21689 + * generated code, which makes it a little more understandable to the human eye.
21690 + * I am very much against using C pre-processor macros for function calls and bits
21691 + * of code as you cannot see what is happening when single stepping in debuggers
21692 + * and so on. The exception (in my book at least) is for generated code, where you are
21693 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
21694 + * hides some indirect calls, but is always referring to the input stream. This is
21695 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
21696 + * the runtime interfaces without changing the generated code too often, without
21697 + * confusing the reader of the generated output, who may not wish to know the gory
21698 + * details of the interface inheritance.
21703 +/* Aids in accessing scopes for grammar programmers
21706 +#undef SCOPE_STACK
21708 +#define SCOPE_TYPE(scope) pSMARTPLParser_##scope##_SCOPE
21709 +#define SCOPE_STACK(scope) pSMARTPLParser_##scope##Stack
21710 +#define SCOPE_TOP(scope) ctx->pSMARTPLParser_##scope##Top
21711 +#define SCOPE_SIZE(scope) ctx->pSMARTPLParser_##scope##Stack_limit
21712 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
21714 +/* Macros for accessing things in the parser
21719 +#undef HAVEPARSEDRULE
21723 +#undef HASEXCEPTION
21727 +#undef FOLLOWSTACK
21731 +#undef PREPORTERROR
21734 +#undef CONSTRUCTEX
21739 +#undef PERRORRECOVERY
21742 +#undef RECOVERFROMMISMATCHEDSET
21743 +#undef RECOVERFROMMISMATCHEDELEMENT
21750 +#define PARSER ctx->pParser
21751 +#define RECOGNIZER PARSER->rec
21752 +#define PSRSTATE RECOGNIZER->state
21753 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
21754 +#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si)
21755 +#define INPUT PARSER->tstream
21756 +#define STRSTREAM INPUT
21757 +#define ISTREAM INPUT->istream
21758 +#define INDEX() ISTREAM->index(INPUT->istream)
21759 +#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE)
21760 +#define EXCEPTION PSRSTATE->exception
21761 +#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs)
21762 +#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER)
21763 +#define FOLLOWSTACK PSRSTATE->following
21764 +#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
21765 +#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK)
21766 +#define PRECOVER() RECOGNIZER->recover(RECOGNIZER)
21767 +#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER)
21768 +#define LA(n) INPUT->istream->_LA(ISTREAM, n)
21769 +#define LT(n) INPUT->_LT(INPUT, n)
21770 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
21771 +#define CONSUME() ISTREAM->consume(ISTREAM)
21772 +#define MARK() ISTREAM->mark(ISTREAM)
21773 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
21774 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
21775 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
21776 +#define PERRORRECOVERY PSRSTATE->errorRecovery
21777 +#define FAILEDFLAG PSRSTATE->failed
21778 +#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE)
21779 +#define BACKTRACKING PSRSTATE->backtracking
21780 +#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
21781 +#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
21782 +#define ADAPTOR ctx->adaptor
21783 +#define RULEMEMO PSRSTATE->ruleMemo
21784 +#define DBG RECOGNIZER->debugger
21786 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
21788 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
21789 + * then for the present you must use different names for your defines as these are hard coded
21790 + * in the code generator. It would be better not to use such names internally, and maybe
21791 + * we can change this in a forthcoming release. I deliberately do not #undef these
21792 + * here as this will at least give you a redefined error somewhere if they clash.
21794 +#define UP ANTLR3_TOKEN_UP
21795 +#define DOWN ANTLR3_TOKEN_DOWN
21796 +#define EOR ANTLR3_TOKEN_EOR
21797 +#define INVALID ANTLR3_TOKEN_INVALID
21800 +/* =============================================================================
21801 + * Functions to create and destroy scopes. First come the rule scopes, followed
21802 + * by the global declared scopes.
21807 +/* ============================================================================= */
21809 +/* =============================================================================
21810 + * Start of recognizer
21815 +/** \brief Table of all token names in symbolic order, mainly used for
21816 + * error reporting.
21818 +pANTLR3_UINT8 SMARTPLParserTokenNames[28+4]
21820 + (pANTLR3_UINT8) "<invalid>", /* String to print to indicate an invalid token */
21821 + (pANTLR3_UINT8) "<EOR>",
21822 + (pANTLR3_UINT8) "<DOWN>",
21823 + (pANTLR3_UINT8) "<UP>",
21824 + (pANTLR3_UINT8) "STR",
21825 + (pANTLR3_UINT8) "OR",
21826 + (pANTLR3_UINT8) "AND",
21827 + (pANTLR3_UINT8) "NOT",
21828 + (pANTLR3_UINT8) "LPAR",
21829 + (pANTLR3_UINT8) "RPAR",
21830 + (pANTLR3_UINT8) "STRTAG",
21831 + (pANTLR3_UINT8) "INCLUDES",
21832 + (pANTLR3_UINT8) "IS",
21833 + (pANTLR3_UINT8) "INTTAG",
21834 + (pANTLR3_UINT8) "INTBOOL",
21835 + (pANTLR3_UINT8) "INT",
21836 + (pANTLR3_UINT8) "DATETAG",
21837 + (pANTLR3_UINT8) "AFTER",
21838 + (pANTLR3_UINT8) "BEFORE",
21839 + (pANTLR3_UINT8) "ENUMTAG",
21840 + (pANTLR3_UINT8) "ENUMVAL",
21841 + (pANTLR3_UINT8) "DATE",
21842 + (pANTLR3_UINT8) "AGO",
21843 + (pANTLR3_UINT8) "DATINTERVAL",
21844 + (pANTLR3_UINT8) "GREATER",
21845 + (pANTLR3_UINT8) "GREATEREQUAL",
21846 + (pANTLR3_UINT8) "LESS",
21847 + (pANTLR3_UINT8) "LESSEQUAL",
21848 + (pANTLR3_UINT8) "EQUAL",
21849 + (pANTLR3_UINT8) "WHITESPACE",
21850 + (pANTLR3_UINT8) "'{'",
21851 + (pANTLR3_UINT8) "'}'"
21856 +// Forward declare the locally static matching functions we have generated.
21858 +static SMARTPLParser_playlist_return playlist (pSMARTPLParser ctx);
21859 +static SMARTPLParser_expression_return expression (pSMARTPLParser ctx);
21860 +static SMARTPLParser_aexpr_return aexpr (pSMARTPLParser ctx);
21861 +static SMARTPLParser_nexpr_return nexpr (pSMARTPLParser ctx);
21862 +static SMARTPLParser_crit_return crit (pSMARTPLParser ctx);
21863 +static SMARTPLParser_dateval_return dateval (pSMARTPLParser ctx);
21864 +static SMARTPLParser_interval_return interval (pSMARTPLParser ctx);
21865 +static void SMARTPLParserFree(pSMARTPLParser ctx);
21866 +/* For use in tree output where we are accumulating rule labels via label += ruleRef
21867 + * we need a function that knows how to free a return scope when the list is destroyed.
21868 + * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
21870 +static void ANTLR3_CDECL freeScope(void * scope)
21872 + ANTLR3_FREE(scope);
21875 +/** \brief Name of the grammar file that generated this code
21877 +static const char fileName[] = "SMARTPL.g";
21879 +/** \brief Return the name of the grammar file that generated this code.
21881 +static const char * getGrammarFileName()
21885 +/** \brief Create a new SMARTPLParser parser and return a context for it.
21887 + * \param[in] instream Pointer to an input stream interface.
21889 + * \return Pointer to new parser context upon success.
21891 +ANTLR3_API pSMARTPLParser
21892 +SMARTPLParserNew (pANTLR3_COMMON_TOKEN_STREAM instream)
21894 + // See if we can create a new parser with the standard constructor
21896 + return SMARTPLParserNewSSD(instream, NULL);
21899 +/** \brief Create a new SMARTPLParser parser and return a context for it.
21901 + * \param[in] instream Pointer to an input stream interface.
21903 + * \return Pointer to new parser context upon success.
21905 +ANTLR3_API pSMARTPLParser
21906 +SMARTPLParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
21908 + pSMARTPLParser ctx; /* Context structure we will build and return */
21910 + ctx = (pSMARTPLParser) ANTLR3_CALLOC(1, sizeof(SMARTPLParser));
21914 + // Failed to allocate memory for parser context
21919 + /* -------------------------------------------------------------------
21920 + * Memory for basic structure is allocated, now to fill in
21921 + * the base ANTLR3 structures. We initialize the function pointers
21922 + * for the standard ANTLR3 parser function set, but upon return
21923 + * from here, the programmer may set the pointers to provide custom
21924 + * implementations of each function.
21926 + * We don't use the macros defined in SMARTPLParser.h here, in order that you can get a sense
21927 + * of what goes where.
21930 + /* Create a base parser/recognizer, using the supplied token stream
21932 + ctx->pParser = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state);
21933 + /* Install the implementation of our SMARTPLParser interface
21935 + ctx->playlist = playlist;
21936 + ctx->expression = expression;
21937 + ctx->aexpr = aexpr;
21938 + ctx->nexpr = nexpr;
21939 + ctx->crit = crit;
21940 + ctx->dateval = dateval;
21941 + ctx->interval = interval;
21942 + ctx->free = SMARTPLParserFree;
21943 + ctx->getGrammarFileName = getGrammarFileName;
21945 + /* Install the scope pushing methods.
21947 + ADAPTOR = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory);
21948 + ctx->vectors = antlr3VectorFactoryNew(0);
21952 + /* Install the token table
21954 + PSRSTATE->tokenNames = SMARTPLParserTokenNames;
21957 + /* Return the newly built parser to the caller
21962 +/** Free the parser resources
21965 + SMARTPLParserFree(pSMARTPLParser ctx)
21967 + /* Free any scope memory
21970 + ctx->vectors->close(ctx->vectors);
21971 + /* We created the adaptor so we must free it
21973 + ADAPTOR->free(ADAPTOR);
21974 + // Free this parser
21976 + ctx->pParser->free(ctx->pParser);
21977 + ANTLR3_FREE(ctx);
21979 + /* Everything is released, so we can return
21984 +/** Return token names used by this parser
21986 + * The returned pointer is used as an index into the token names table (using the token
21987 + * number as the index).
21989 + * \return Pointer to first char * in the table.
21991 +static pANTLR3_UINT8 *getTokenNames()
21993 + return SMARTPLParserTokenNames;
21997 +/* Declare the bitsets
22000 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_playlist42 */
22001 +static ANTLR3_BITWORD FOLLOW_STR_in_playlist42_bits[] = { ANTLR3_UINT64_LIT(0x0000000040000000) };
22002 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_playlist42 = { FOLLOW_STR_in_playlist42_bits, 1 };
22003 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_30_in_playlist44 */
22004 +static ANTLR3_BITWORD FOLLOW_30_in_playlist44_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
22005 +static ANTLR3_BITSET_LIST FOLLOW_30_in_playlist44 = { FOLLOW_30_in_playlist44_bits, 1 };
22006 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_playlist46 */
22007 +static ANTLR3_BITWORD FOLLOW_expression_in_playlist46_bits[] = { ANTLR3_UINT64_LIT(0x0000000080000000) };
22008 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_playlist46 = { FOLLOW_expression_in_playlist46_bits, 1 };
22009 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_31_in_playlist48 */
22010 +static ANTLR3_BITWORD FOLLOW_31_in_playlist48_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000000) };
22011 +static ANTLR3_BITSET_LIST FOLLOW_31_in_playlist48 = { FOLLOW_31_in_playlist48_bits, 1 };
22012 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_EOF_in_playlist50 */
22013 +static ANTLR3_BITWORD FOLLOW_EOF_in_playlist50_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
22014 +static ANTLR3_BITSET_LIST FOLLOW_EOF_in_playlist50 = { FOLLOW_EOF_in_playlist50_bits, 1 };
22015 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expression62 */
22016 +static ANTLR3_BITWORD FOLLOW_aexpr_in_expression62_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) };
22017 +static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expression62 = { FOLLOW_aexpr_in_expression62_bits, 1 };
22018 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expression65 */
22019 +static ANTLR3_BITWORD FOLLOW_OR_in_expression65_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
22020 +static ANTLR3_BITSET_LIST FOLLOW_OR_in_expression65 = { FOLLOW_OR_in_expression65_bits, 1 };
22021 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expression68 */
22022 +static ANTLR3_BITWORD FOLLOW_aexpr_in_expression68_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) };
22023 +static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expression68 = { FOLLOW_aexpr_in_expression68_bits, 1 };
22024 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_nexpr_in_aexpr83 */
22025 +static ANTLR3_BITWORD FOLLOW_nexpr_in_aexpr83_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) };
22026 +static ANTLR3_BITSET_LIST FOLLOW_nexpr_in_aexpr83 = { FOLLOW_nexpr_in_aexpr83_bits, 1 };
22027 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_aexpr86 */
22028 +static ANTLR3_BITWORD FOLLOW_AND_in_aexpr86_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
22029 +static ANTLR3_BITSET_LIST FOLLOW_AND_in_aexpr86 = { FOLLOW_AND_in_aexpr86_bits, 1 };
22030 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_nexpr_in_aexpr89 */
22031 +static ANTLR3_BITWORD FOLLOW_nexpr_in_aexpr89_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) };
22032 +static ANTLR3_BITSET_LIST FOLLOW_nexpr_in_aexpr89 = { FOLLOW_nexpr_in_aexpr89_bits, 1 };
22033 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_nexpr104 */
22034 +static ANTLR3_BITWORD FOLLOW_NOT_in_nexpr104_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
22035 +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_nexpr104 = { FOLLOW_NOT_in_nexpr104_bits, 1 };
22036 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_nexpr107 */
22037 +static ANTLR3_BITWORD FOLLOW_crit_in_nexpr107_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
22038 +static ANTLR3_BITSET_LIST FOLLOW_crit_in_nexpr107 = { FOLLOW_crit_in_nexpr107_bits, 1 };
22039 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_nexpr114 */
22040 +static ANTLR3_BITWORD FOLLOW_crit_in_nexpr114_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
22041 +static ANTLR3_BITSET_LIST FOLLOW_crit_in_nexpr114 = { FOLLOW_crit_in_nexpr114_bits, 1 };
22042 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_LPAR_in_crit127 */
22043 +static ANTLR3_BITWORD FOLLOW_LPAR_in_crit127_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
22044 +static ANTLR3_BITSET_LIST FOLLOW_LPAR_in_crit127 = { FOLLOW_LPAR_in_crit127_bits, 1 };
22045 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_crit129 */
22046 +static ANTLR3_BITWORD FOLLOW_expression_in_crit129_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000200) };
22047 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_crit129 = { FOLLOW_expression_in_crit129_bits, 1 };
22048 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_RPAR_in_crit131 */
22049 +static ANTLR3_BITWORD FOLLOW_RPAR_in_crit131_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
22050 +static ANTLR3_BITSET_LIST FOLLOW_RPAR_in_crit131 = { FOLLOW_RPAR_in_crit131_bits, 1 };
22051 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STRTAG_in_crit142 */
22052 +static ANTLR3_BITWORD FOLLOW_STRTAG_in_crit142_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001800) };
22053 +static ANTLR3_BITSET_LIST FOLLOW_STRTAG_in_crit142 = { FOLLOW_STRTAG_in_crit142_bits, 1 };
22054 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_crit144 */
22055 +static ANTLR3_BITWORD FOLLOW_set_in_crit144_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) };
22056 +static ANTLR3_BITSET_LIST FOLLOW_set_in_crit144 = { FOLLOW_set_in_crit144_bits, 1 };
22057 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_crit150 */
22058 +static ANTLR3_BITWORD FOLLOW_STR_in_crit150_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
22059 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_crit150 = { FOLLOW_STR_in_crit150_bits, 1 };
22060 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTTAG_in_crit157 */
22061 +static ANTLR3_BITWORD FOLLOW_INTTAG_in_crit157_bits[] = { ANTLR3_UINT64_LIT(0x0000000000004000) };
22062 +static ANTLR3_BITSET_LIST FOLLOW_INTTAG_in_crit157 = { FOLLOW_INTTAG_in_crit157_bits, 1 };
22063 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTBOOL_in_crit159 */
22064 +static ANTLR3_BITWORD FOLLOW_INTBOOL_in_crit159_bits[] = { ANTLR3_UINT64_LIT(0x0000000000008000) };
22065 +static ANTLR3_BITSET_LIST FOLLOW_INTBOOL_in_crit159 = { FOLLOW_INTBOOL_in_crit159_bits, 1 };
22066 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_crit161 */
22067 +static ANTLR3_BITWORD FOLLOW_INT_in_crit161_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
22068 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_crit161 = { FOLLOW_INT_in_crit161_bits, 1 };
22069 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATETAG_in_crit168 */
22070 +static ANTLR3_BITWORD FOLLOW_DATETAG_in_crit168_bits[] = { ANTLR3_UINT64_LIT(0x0000000000060000) };
22071 +static ANTLR3_BITSET_LIST FOLLOW_DATETAG_in_crit168 = { FOLLOW_DATETAG_in_crit168_bits, 1 };
22072 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_crit170 */
22073 +static ANTLR3_BITWORD FOLLOW_set_in_crit170_bits[] = { ANTLR3_UINT64_LIT(0x0000000000208000) };
22074 +static ANTLR3_BITSET_LIST FOLLOW_set_in_crit170 = { FOLLOW_set_in_crit170_bits, 1 };
22075 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateval_in_crit176 */
22076 +static ANTLR3_BITWORD FOLLOW_dateval_in_crit176_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
22077 +static ANTLR3_BITSET_LIST FOLLOW_dateval_in_crit176 = { FOLLOW_dateval_in_crit176_bits, 1 };
22078 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMTAG_in_crit183 */
22079 +static ANTLR3_BITWORD FOLLOW_ENUMTAG_in_crit183_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001000) };
22080 +static ANTLR3_BITSET_LIST FOLLOW_ENUMTAG_in_crit183 = { FOLLOW_ENUMTAG_in_crit183_bits, 1 };
22081 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_IS_in_crit185 */
22082 +static ANTLR3_BITWORD FOLLOW_IS_in_crit185_bits[] = { ANTLR3_UINT64_LIT(0x0000000000100000) };
22083 +static ANTLR3_BITSET_LIST FOLLOW_IS_in_crit185 = { FOLLOW_IS_in_crit185_bits, 1 };
22084 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMVAL_in_crit187 */
22085 +static ANTLR3_BITWORD FOLLOW_ENUMVAL_in_crit187_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
22086 +static ANTLR3_BITSET_LIST FOLLOW_ENUMVAL_in_crit187 = { FOLLOW_ENUMVAL_in_crit187_bits, 1 };
22087 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval200 */
22088 +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval200_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
22089 +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval200 = { FOLLOW_DATE_in_dateval200_bits, 1 };
22090 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval207 */
22091 +static ANTLR3_BITWORD FOLLOW_interval_in_dateval207_bits[] = { ANTLR3_UINT64_LIT(0x0000000000040000) };
22092 +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval207 = { FOLLOW_interval_in_dateval207_bits, 1 };
22093 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateval209 */
22094 +static ANTLR3_BITWORD FOLLOW_BEFORE_in_dateval209_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) };
22095 +static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateval209 = { FOLLOW_BEFORE_in_dateval209_bits, 1 };
22096 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval211 */
22097 +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval211_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
22098 +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval211 = { FOLLOW_DATE_in_dateval211_bits, 1 };
22099 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval218 */
22100 +static ANTLR3_BITWORD FOLLOW_interval_in_dateval218_bits[] = { ANTLR3_UINT64_LIT(0x0000000000020000) };
22101 +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval218 = { FOLLOW_interval_in_dateval218_bits, 1 };
22102 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateval220 */
22103 +static ANTLR3_BITWORD FOLLOW_AFTER_in_dateval220_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) };
22104 +static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateval220 = { FOLLOW_AFTER_in_dateval220_bits, 1 };
22105 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval222 */
22106 +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval222_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
22107 +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval222 = { FOLLOW_DATE_in_dateval222_bits, 1 };
22108 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval229 */
22109 +static ANTLR3_BITWORD FOLLOW_interval_in_dateval229_bits[] = { ANTLR3_UINT64_LIT(0x0000000000400000) };
22110 +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval229 = { FOLLOW_interval_in_dateval229_bits, 1 };
22111 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AGO_in_dateval231 */
22112 +static ANTLR3_BITWORD FOLLOW_AGO_in_dateval231_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
22113 +static ANTLR3_BITSET_LIST FOLLOW_AGO_in_dateval231 = { FOLLOW_AGO_in_dateval231_bits, 1 };
22114 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_interval243 */
22115 +static ANTLR3_BITWORD FOLLOW_INT_in_interval243_bits[] = { ANTLR3_UINT64_LIT(0x0000000000800000) };
22116 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_interval243 = { FOLLOW_INT_in_interval243_bits, 1 };
22117 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATINTERVAL_in_interval245 */
22118 +static ANTLR3_BITWORD FOLLOW_DATINTERVAL_in_interval245_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
22119 +static ANTLR3_BITSET_LIST FOLLOW_DATINTERVAL_in_interval245 = { FOLLOW_DATINTERVAL_in_interval245_bits, 1 };
22124 +/* ==============================================
22128 + * $ANTLR start playlist
22129 + * SMARTPL.g:27:1: playlist : STR '{' expression '}' EOF ;
22131 +static SMARTPLParser_playlist_return
22132 +playlist(pSMARTPLParser ctx)
22134 + SMARTPLParser_playlist_return retval;
22136 + pANTLR3_BASE_TREE root_0;
22138 + pANTLR3_COMMON_TOKEN STR1;
22139 + pANTLR3_COMMON_TOKEN char_literal2;
22140 + pANTLR3_COMMON_TOKEN char_literal4;
22141 + pANTLR3_COMMON_TOKEN EOF5;
22142 + SMARTPLParser_expression_return expression3;
22143 + #undef RETURN_TYPE_expression3
22144 + #define RETURN_TYPE_expression3 SMARTPLParser_expression_return
22146 + pANTLR3_BASE_TREE STR1_tree;
22147 + pANTLR3_BASE_TREE char_literal2_tree;
22148 + pANTLR3_BASE_TREE char_literal4_tree;
22149 + pANTLR3_BASE_TREE EOF5_tree;
22151 + /* Initialize rule variables
22158 + char_literal2 = NULL;
22159 + char_literal4 = NULL;
22161 + expression3.tree = NULL;
22163 + retval.start = LT(1); retval.stop = retval.start;
22165 + STR1_tree = NULL;
22166 + char_literal2_tree = NULL;
22167 + char_literal4_tree = NULL;
22168 + EOF5_tree = NULL;
22171 + retval.tree = NULL;
22173 + // SMARTPL.g:27:10: ( STR '{' expression '}' EOF )
22174 + // SMARTPL.g:27:12: STR '{' expression '}' EOF
22176 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22178 + STR1 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_playlist42);
22179 + if (HASEXCEPTION())
22181 + goto ruleplaylistEx;
22184 + STR1_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR1));
22185 + ADAPTOR->addChild(ADAPTOR, root_0, STR1_tree);
22187 + char_literal2 = (pANTLR3_COMMON_TOKEN) MATCHT(30, &FOLLOW_30_in_playlist44);
22188 + if (HASEXCEPTION())
22190 + goto ruleplaylistEx;
22193 + char_literal2_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, char_literal2));
22194 + ADAPTOR->addChild(ADAPTOR, root_0, char_literal2_tree);
22196 + FOLLOWPUSH(FOLLOW_expression_in_playlist46);
22197 + expression3=expression(ctx);
22200 + if (HASEXCEPTION())
22202 + goto ruleplaylistEx;
22205 + ADAPTOR->addChild(ADAPTOR, root_0, expression3.tree);
22206 + char_literal4 = (pANTLR3_COMMON_TOKEN) MATCHT(31, &FOLLOW_31_in_playlist48);
22207 + if (HASEXCEPTION())
22209 + goto ruleplaylistEx;
22212 + char_literal4_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, char_literal4));
22213 + ADAPTOR->addChild(ADAPTOR, root_0, char_literal4_tree);
22215 + EOF5 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_playlist50);
22216 + if (HASEXCEPTION())
22218 + goto ruleplaylistEx;
22221 + EOF5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, EOF5));
22222 + ADAPTOR->addChild(ADAPTOR, root_0, EOF5_tree);
22230 + // This is where rules clean up and exit
22232 + goto ruleplaylistEx; /* Prevent compiler warnings */
22233 + ruleplaylistEx: ;
22234 + retval.stop = LT(-1);
22236 + retval.stop = LT(-1);
22237 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
22238 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
22240 + if (HASEXCEPTION())
22244 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
22250 +/* $ANTLR end playlist */
22253 + * $ANTLR start expression
22254 + * SMARTPL.g:30:1: expression : aexpr ( OR aexpr )* ;
22256 +static SMARTPLParser_expression_return
22257 +expression(pSMARTPLParser ctx)
22259 + SMARTPLParser_expression_return retval;
22261 + pANTLR3_BASE_TREE root_0;
22263 + pANTLR3_COMMON_TOKEN OR7;
22264 + SMARTPLParser_aexpr_return aexpr6;
22265 + #undef RETURN_TYPE_aexpr6
22266 + #define RETURN_TYPE_aexpr6 SMARTPLParser_aexpr_return
22268 + SMARTPLParser_aexpr_return aexpr8;
22269 + #undef RETURN_TYPE_aexpr8
22270 + #define RETURN_TYPE_aexpr8 SMARTPLParser_aexpr_return
22272 + pANTLR3_BASE_TREE OR7_tree;
22274 + /* Initialize rule variables
22281 + aexpr6.tree = NULL;
22283 + aexpr8.tree = NULL;
22285 + retval.start = LT(1); retval.stop = retval.start;
22290 + retval.tree = NULL;
22292 + // SMARTPL.g:30:12: ( aexpr ( OR aexpr )* )
22293 + // SMARTPL.g:30:14: aexpr ( OR aexpr )*
22295 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22297 + FOLLOWPUSH(FOLLOW_aexpr_in_expression62);
22298 + aexpr6=aexpr(ctx);
22301 + if (HASEXCEPTION())
22303 + goto ruleexpressionEx;
22306 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree);
22308 + // SMARTPL.g:30:20: ( OR aexpr )*
22326 + // SMARTPL.g:30:21: OR aexpr
22328 + OR7 = (pANTLR3_COMMON_TOKEN) MATCHT(OR, &FOLLOW_OR_in_expression65);
22329 + if (HASEXCEPTION())
22331 + goto ruleexpressionEx;
22334 + OR7_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OR7));
22335 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OR7_tree, root_0));
22337 + FOLLOWPUSH(FOLLOW_aexpr_in_expression68);
22338 + aexpr8=aexpr(ctx);
22341 + if (HASEXCEPTION())
22343 + goto ruleexpressionEx;
22346 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr8.tree);
22352 + goto loop1; /* break out of the loop */
22356 + loop1: ; /* Jump out to here if this rule does not match */
22364 + // This is where rules clean up and exit
22366 + goto ruleexpressionEx; /* Prevent compiler warnings */
22367 + ruleexpressionEx: ;
22368 + retval.stop = LT(-1);
22370 + retval.stop = LT(-1);
22371 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
22372 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
22374 + if (HASEXCEPTION())
22378 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
22384 +/* $ANTLR end expression */
22387 + * $ANTLR start aexpr
22388 + * SMARTPL.g:33:1: aexpr : nexpr ( AND nexpr )* ;
22390 +static SMARTPLParser_aexpr_return
22391 +aexpr(pSMARTPLParser ctx)
22393 + SMARTPLParser_aexpr_return retval;
22395 + pANTLR3_BASE_TREE root_0;
22397 + pANTLR3_COMMON_TOKEN AND10;
22398 + SMARTPLParser_nexpr_return nexpr9;
22399 + #undef RETURN_TYPE_nexpr9
22400 + #define RETURN_TYPE_nexpr9 SMARTPLParser_nexpr_return
22402 + SMARTPLParser_nexpr_return nexpr11;
22403 + #undef RETURN_TYPE_nexpr11
22404 + #define RETURN_TYPE_nexpr11 SMARTPLParser_nexpr_return
22406 + pANTLR3_BASE_TREE AND10_tree;
22408 + /* Initialize rule variables
22415 + nexpr9.tree = NULL;
22417 + nexpr11.tree = NULL;
22419 + retval.start = LT(1); retval.stop = retval.start;
22421 + AND10_tree = NULL;
22424 + retval.tree = NULL;
22426 + // SMARTPL.g:33:8: ( nexpr ( AND nexpr )* )
22427 + // SMARTPL.g:33:10: nexpr ( AND nexpr )*
22429 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22431 + FOLLOWPUSH(FOLLOW_nexpr_in_aexpr83);
22432 + nexpr9=nexpr(ctx);
22435 + if (HASEXCEPTION())
22437 + goto ruleaexprEx;
22440 + ADAPTOR->addChild(ADAPTOR, root_0, nexpr9.tree);
22442 + // SMARTPL.g:33:16: ( AND nexpr )*
22460 + // SMARTPL.g:33:17: AND nexpr
22462 + AND10 = (pANTLR3_COMMON_TOKEN) MATCHT(AND, &FOLLOW_AND_in_aexpr86);
22463 + if (HASEXCEPTION())
22465 + goto ruleaexprEx;
22468 + AND10_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AND10));
22469 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, AND10_tree, root_0));
22471 + FOLLOWPUSH(FOLLOW_nexpr_in_aexpr89);
22472 + nexpr11=nexpr(ctx);
22475 + if (HASEXCEPTION())
22477 + goto ruleaexprEx;
22480 + ADAPTOR->addChild(ADAPTOR, root_0, nexpr11.tree);
22486 + goto loop2; /* break out of the loop */
22490 + loop2: ; /* Jump out to here if this rule does not match */
22498 + // This is where rules clean up and exit
22500 + goto ruleaexprEx; /* Prevent compiler warnings */
22502 + retval.stop = LT(-1);
22504 + retval.stop = LT(-1);
22505 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
22506 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
22508 + if (HASEXCEPTION())
22512 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
22518 +/* $ANTLR end aexpr */
22521 + * $ANTLR start nexpr
22522 + * SMARTPL.g:36:1: nexpr : ( NOT crit | crit );
22524 +static SMARTPLParser_nexpr_return
22525 +nexpr(pSMARTPLParser ctx)
22527 + SMARTPLParser_nexpr_return retval;
22529 + pANTLR3_BASE_TREE root_0;
22531 + pANTLR3_COMMON_TOKEN NOT12;
22532 + SMARTPLParser_crit_return crit13;
22533 + #undef RETURN_TYPE_crit13
22534 + #define RETURN_TYPE_crit13 SMARTPLParser_crit_return
22536 + SMARTPLParser_crit_return crit14;
22537 + #undef RETURN_TYPE_crit14
22538 + #define RETURN_TYPE_crit14 SMARTPLParser_crit_return
22540 + pANTLR3_BASE_TREE NOT12_tree;
22542 + /* Initialize rule variables
22549 + crit13.tree = NULL;
22551 + crit14.tree = NULL;
22553 + retval.start = LT(1); retval.stop = retval.start;
22555 + NOT12_tree = NULL;
22558 + retval.tree = NULL;
22561 + // SMARTPL.g:36:8: ( NOT crit | crit )
22563 + ANTLR3_UINT32 alt3;
22586 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
22587 + EXCEPTION->message = (void *)"";
22588 + EXCEPTION->decisionNum = 3;
22589 + EXCEPTION->state = 0;
22592 + goto rulenexprEx;
22598 + // SMARTPL.g:36:10: NOT crit
22600 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22602 + NOT12 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_nexpr104);
22603 + if (HASEXCEPTION())
22605 + goto rulenexprEx;
22608 + NOT12_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, NOT12));
22609 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, NOT12_tree, root_0));
22611 + FOLLOWPUSH(FOLLOW_crit_in_nexpr107);
22612 + crit13=crit(ctx);
22615 + if (HASEXCEPTION())
22617 + goto rulenexprEx;
22620 + ADAPTOR->addChild(ADAPTOR, root_0, crit13.tree);
22625 + // SMARTPL.g:37:6: crit
22627 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22629 + FOLLOWPUSH(FOLLOW_crit_in_nexpr114);
22630 + crit14=crit(ctx);
22633 + if (HASEXCEPTION())
22635 + goto rulenexprEx;
22638 + ADAPTOR->addChild(ADAPTOR, root_0, crit14.tree);
22648 + // This is where rules clean up and exit
22650 + goto rulenexprEx; /* Prevent compiler warnings */
22652 + retval.stop = LT(-1);
22654 + retval.stop = LT(-1);
22655 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
22656 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
22658 + if (HASEXCEPTION())
22662 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
22668 +/* $ANTLR end nexpr */
22671 + * $ANTLR start crit
22672 + * SMARTPL.g:40:1: crit : ( LPAR expression RPAR -> expression | STRTAG ( INCLUDES | IS ) STR | INTTAG INTBOOL INT | DATETAG ( AFTER | BEFORE ) dateval | ENUMTAG IS ENUMVAL );
22674 +static SMARTPLParser_crit_return
22675 +crit(pSMARTPLParser ctx)
22677 + SMARTPLParser_crit_return retval;
22679 + pANTLR3_BASE_TREE root_0;
22681 + pANTLR3_COMMON_TOKEN LPAR15;
22682 + pANTLR3_COMMON_TOKEN RPAR17;
22683 + pANTLR3_COMMON_TOKEN STRTAG18;
22684 + pANTLR3_COMMON_TOKEN set19;
22685 + pANTLR3_COMMON_TOKEN STR20;
22686 + pANTLR3_COMMON_TOKEN INTTAG21;
22687 + pANTLR3_COMMON_TOKEN INTBOOL22;
22688 + pANTLR3_COMMON_TOKEN INT23;
22689 + pANTLR3_COMMON_TOKEN DATETAG24;
22690 + pANTLR3_COMMON_TOKEN set25;
22691 + pANTLR3_COMMON_TOKEN ENUMTAG27;
22692 + pANTLR3_COMMON_TOKEN IS28;
22693 + pANTLR3_COMMON_TOKEN ENUMVAL29;
22694 + SMARTPLParser_expression_return expression16;
22695 + #undef RETURN_TYPE_expression16
22696 + #define RETURN_TYPE_expression16 SMARTPLParser_expression_return
22698 + SMARTPLParser_dateval_return dateval26;
22699 + #undef RETURN_TYPE_dateval26
22700 + #define RETURN_TYPE_dateval26 SMARTPLParser_dateval_return
22702 + pANTLR3_BASE_TREE LPAR15_tree;
22703 + pANTLR3_BASE_TREE RPAR17_tree;
22704 + pANTLR3_BASE_TREE STRTAG18_tree;
22705 + pANTLR3_BASE_TREE set19_tree;
22706 + pANTLR3_BASE_TREE STR20_tree;
22707 + pANTLR3_BASE_TREE INTTAG21_tree;
22708 + pANTLR3_BASE_TREE INTBOOL22_tree;
22709 + pANTLR3_BASE_TREE INT23_tree;
22710 + pANTLR3_BASE_TREE DATETAG24_tree;
22711 + pANTLR3_BASE_TREE set25_tree;
22712 + pANTLR3_BASE_TREE ENUMTAG27_tree;
22713 + pANTLR3_BASE_TREE IS28_tree;
22714 + pANTLR3_BASE_TREE ENUMVAL29_tree;
22715 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_RPAR;
22716 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_LPAR;
22717 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expression;
22718 + /* Initialize rule variables
22730 + INTBOOL22 = NULL;
22732 + DATETAG24 = NULL;
22734 + ENUMTAG27 = NULL;
22736 + ENUMVAL29 = NULL;
22737 + expression16.tree = NULL;
22739 + dateval26.tree = NULL;
22741 + retval.start = LT(1); retval.stop = retval.start;
22743 + LPAR15_tree = NULL;
22744 + RPAR17_tree = NULL;
22745 + STRTAG18_tree = NULL;
22746 + set19_tree = NULL;
22747 + STR20_tree = NULL;
22748 + INTTAG21_tree = NULL;
22749 + INTBOOL22_tree = NULL;
22750 + INT23_tree = NULL;
22751 + DATETAG24_tree = NULL;
22752 + set25_tree = NULL;
22753 + ENUMTAG27_tree = NULL;
22754 + IS28_tree = NULL;
22755 + ENUMVAL29_tree = NULL;
22757 + stream_RPAR = NULL;
22758 + #define CREATE_stream_RPAR if (stream_RPAR == NULL) {stream_RPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token RPAR"); }
22759 + stream_LPAR = NULL;
22760 + #define CREATE_stream_LPAR if (stream_LPAR == NULL) {stream_LPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token LPAR"); }
22761 + stream_expression = NULL;
22762 + #define CREATE_stream_expression if (stream_expression == NULL) {stream_expression = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expression"); }
22764 + retval.tree = NULL;
22767 + // SMARTPL.g:40:7: ( LPAR expression RPAR -> expression | STRTAG ( INCLUDES | IS ) STR | INTTAG INTBOOL INT | DATETAG ( AFTER | BEFORE ) dateval | ENUMTAG IS ENUMVAL )
22769 + ANTLR3_UINT32 alt4;
22803 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
22804 + EXCEPTION->message = (void *)"";
22805 + EXCEPTION->decisionNum = 4;
22806 + EXCEPTION->state = 0;
22815 + // SMARTPL.g:40:9: LPAR expression RPAR
22817 + LPAR15 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit127);
22818 + if (HASEXCEPTION())
22823 + CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR15, NULL);
22825 + FOLLOWPUSH(FOLLOW_expression_in_crit129);
22826 + expression16=expression(ctx);
22829 + if (HASEXCEPTION())
22834 + CREATE_stream_expression; stream_expression->add(stream_expression, expression16.tree, NULL);
22835 + RPAR17 = (pANTLR3_COMMON_TOKEN) MATCHT(RPAR, &FOLLOW_RPAR_in_crit131);
22836 + if (HASEXCEPTION())
22841 + CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR17, NULL);
22846 + * elements : expression
22848 + * rule labels : retval
22849 + * token list labels :
22850 + * rule list labels :
22853 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
22855 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
22857 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22858 + retval.tree = root_0;
22859 + // 40:30: -> expression
22861 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expression == NULL ? NULL : stream_expression->nextTree(stream_expression));
22865 + retval.tree = root_0; // set result root
22866 + if (stream_retval != NULL) stream_retval->free(stream_retval);
22873 + // SMARTPL.g:41:6: STRTAG ( INCLUDES | IS ) STR
22875 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22877 + STRTAG18 = (pANTLR3_COMMON_TOKEN) MATCHT(STRTAG, &FOLLOW_STRTAG_in_crit142);
22878 + if (HASEXCEPTION())
22883 + STRTAG18_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STRTAG18));
22884 + ADAPTOR->addChild(ADAPTOR, root_0, STRTAG18_tree);
22886 + set19=(pANTLR3_COMMON_TOKEN)LT(1);
22887 + if ( ((LA(1) >= INCLUDES) && (LA(1) <= IS)) )
22890 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set19)));
22891 + PERRORRECOVERY=ANTLR3_FALSE;
22896 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
22897 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
22898 + EXCEPTION->expectingSet = &FOLLOW_set_in_crit144;
22899 + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_crit144); goto rulecritEx;
22902 + STR20 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_crit150);
22903 + if (HASEXCEPTION())
22908 + STR20_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR20));
22909 + ADAPTOR->addChild(ADAPTOR, root_0, STR20_tree);
22915 + // SMARTPL.g:42:6: INTTAG INTBOOL INT
22917 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22919 + INTTAG21 = (pANTLR3_COMMON_TOKEN) MATCHT(INTTAG, &FOLLOW_INTTAG_in_crit157);
22920 + if (HASEXCEPTION())
22925 + INTTAG21_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INTTAG21));
22926 + ADAPTOR->addChild(ADAPTOR, root_0, INTTAG21_tree);
22928 + INTBOOL22 = (pANTLR3_COMMON_TOKEN) MATCHT(INTBOOL, &FOLLOW_INTBOOL_in_crit159);
22929 + if (HASEXCEPTION())
22934 + INTBOOL22_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INTBOOL22));
22935 + ADAPTOR->addChild(ADAPTOR, root_0, INTBOOL22_tree);
22937 + INT23 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_crit161);
22938 + if (HASEXCEPTION())
22943 + INT23_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INT23));
22944 + ADAPTOR->addChild(ADAPTOR, root_0, INT23_tree);
22950 + // SMARTPL.g:43:6: DATETAG ( AFTER | BEFORE ) dateval
22952 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22954 + DATETAG24 = (pANTLR3_COMMON_TOKEN) MATCHT(DATETAG, &FOLLOW_DATETAG_in_crit168);
22955 + if (HASEXCEPTION())
22960 + DATETAG24_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATETAG24));
22961 + ADAPTOR->addChild(ADAPTOR, root_0, DATETAG24_tree);
22963 + set25=(pANTLR3_COMMON_TOKEN)LT(1);
22964 + if ( ((LA(1) >= AFTER) && (LA(1) <= BEFORE)) )
22967 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set25)));
22968 + PERRORRECOVERY=ANTLR3_FALSE;
22973 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
22974 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
22975 + EXCEPTION->expectingSet = &FOLLOW_set_in_crit170;
22976 + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_crit170); goto rulecritEx;
22979 + FOLLOWPUSH(FOLLOW_dateval_in_crit176);
22980 + dateval26=dateval(ctx);
22983 + if (HASEXCEPTION())
22988 + ADAPTOR->addChild(ADAPTOR, root_0, dateval26.tree);
22993 + // SMARTPL.g:44:6: ENUMTAG IS ENUMVAL
22995 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22997 + ENUMTAG27 = (pANTLR3_COMMON_TOKEN) MATCHT(ENUMTAG, &FOLLOW_ENUMTAG_in_crit183);
22998 + if (HASEXCEPTION())
23003 + ENUMTAG27_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, ENUMTAG27));
23004 + ADAPTOR->addChild(ADAPTOR, root_0, ENUMTAG27_tree);
23006 + IS28 = (pANTLR3_COMMON_TOKEN) MATCHT(IS, &FOLLOW_IS_in_crit185);
23007 + if (HASEXCEPTION())
23012 + IS28_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, IS28));
23013 + ADAPTOR->addChild(ADAPTOR, root_0, IS28_tree);
23015 + ENUMVAL29 = (pANTLR3_COMMON_TOKEN) MATCHT(ENUMVAL, &FOLLOW_ENUMVAL_in_crit187);
23016 + if (HASEXCEPTION())
23021 + ENUMVAL29_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, ENUMVAL29));
23022 + ADAPTOR->addChild(ADAPTOR, root_0, ENUMVAL29_tree);
23033 + // This is where rules clean up and exit
23035 + goto rulecritEx; /* Prevent compiler warnings */
23037 + retval.stop = LT(-1);
23039 + retval.stop = LT(-1);
23040 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
23041 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
23042 + if (stream_RPAR != NULL) stream_RPAR->free(stream_RPAR);
23043 + if (stream_LPAR != NULL) stream_LPAR->free(stream_LPAR);
23044 + if (stream_expression != NULL) stream_expression->free(stream_expression);
23046 + if (HASEXCEPTION())
23050 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
23056 +/* $ANTLR end crit */
23059 + * $ANTLR start dateval
23060 + * SMARTPL.g:47:1: dateval : ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO );
23062 +static SMARTPLParser_dateval_return
23063 +dateval(pSMARTPLParser ctx)
23065 + SMARTPLParser_dateval_return retval;
23067 + pANTLR3_BASE_TREE root_0;
23069 + pANTLR3_COMMON_TOKEN DATE30;
23070 + pANTLR3_COMMON_TOKEN BEFORE32;
23071 + pANTLR3_COMMON_TOKEN DATE33;
23072 + pANTLR3_COMMON_TOKEN AFTER35;
23073 + pANTLR3_COMMON_TOKEN DATE36;
23074 + pANTLR3_COMMON_TOKEN AGO38;
23075 + SMARTPLParser_interval_return interval31;
23076 + #undef RETURN_TYPE_interval31
23077 + #define RETURN_TYPE_interval31 SMARTPLParser_interval_return
23079 + SMARTPLParser_interval_return interval34;
23080 + #undef RETURN_TYPE_interval34
23081 + #define RETURN_TYPE_interval34 SMARTPLParser_interval_return
23083 + SMARTPLParser_interval_return interval37;
23084 + #undef RETURN_TYPE_interval37
23085 + #define RETURN_TYPE_interval37 SMARTPLParser_interval_return
23087 + pANTLR3_BASE_TREE DATE30_tree;
23088 + pANTLR3_BASE_TREE BEFORE32_tree;
23089 + pANTLR3_BASE_TREE DATE33_tree;
23090 + pANTLR3_BASE_TREE AFTER35_tree;
23091 + pANTLR3_BASE_TREE DATE36_tree;
23092 + pANTLR3_BASE_TREE AGO38_tree;
23094 + /* Initialize rule variables
23106 + interval31.tree = NULL;
23108 + interval34.tree = NULL;
23110 + interval37.tree = NULL;
23112 + retval.start = LT(1); retval.stop = retval.start;
23114 + DATE30_tree = NULL;
23115 + BEFORE32_tree = NULL;
23116 + DATE33_tree = NULL;
23117 + AFTER35_tree = NULL;
23118 + DATE36_tree = NULL;
23119 + AGO38_tree = NULL;
23122 + retval.tree = NULL;
23125 + // SMARTPL.g:47:10: ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO )
23127 + ANTLR3_UINT32 alt5;
23142 + case DATINTERVAL:
23164 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
23165 + EXCEPTION->message = (void *)"";
23166 + EXCEPTION->decisionNum = 5;
23167 + EXCEPTION->state = 3;
23170 + goto ruledatevalEx;
23178 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
23179 + EXCEPTION->message = (void *)"";
23180 + EXCEPTION->decisionNum = 5;
23181 + EXCEPTION->state = 2;
23184 + goto ruledatevalEx;
23192 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
23193 + EXCEPTION->message = (void *)"";
23194 + EXCEPTION->decisionNum = 5;
23195 + EXCEPTION->state = 0;
23198 + goto ruledatevalEx;
23204 + // SMARTPL.g:47:12: DATE
23206 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
23208 + DATE30 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval200);
23209 + if (HASEXCEPTION())
23211 + goto ruledatevalEx;
23214 + DATE30_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE30));
23215 + ADAPTOR->addChild(ADAPTOR, root_0, DATE30_tree);
23221 + // SMARTPL.g:48:6: interval BEFORE DATE
23223 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
23225 + FOLLOWPUSH(FOLLOW_interval_in_dateval207);
23226 + interval31=interval(ctx);
23229 + if (HASEXCEPTION())
23231 + goto ruledatevalEx;
23234 + ADAPTOR->addChild(ADAPTOR, root_0, interval31.tree);
23235 + BEFORE32 = (pANTLR3_COMMON_TOKEN) MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateval209);
23236 + if (HASEXCEPTION())
23238 + goto ruledatevalEx;
23241 + BEFORE32_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, BEFORE32));
23242 + ADAPTOR->addChild(ADAPTOR, root_0, BEFORE32_tree);
23244 + DATE33 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval211);
23245 + if (HASEXCEPTION())
23247 + goto ruledatevalEx;
23250 + DATE33_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE33));
23251 + ADAPTOR->addChild(ADAPTOR, root_0, DATE33_tree);
23257 + // SMARTPL.g:49:6: interval AFTER DATE
23259 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
23261 + FOLLOWPUSH(FOLLOW_interval_in_dateval218);
23262 + interval34=interval(ctx);
23265 + if (HASEXCEPTION())
23267 + goto ruledatevalEx;
23270 + ADAPTOR->addChild(ADAPTOR, root_0, interval34.tree);
23271 + AFTER35 = (pANTLR3_COMMON_TOKEN) MATCHT(AFTER, &FOLLOW_AFTER_in_dateval220);
23272 + if (HASEXCEPTION())
23274 + goto ruledatevalEx;
23277 + AFTER35_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AFTER35));
23278 + ADAPTOR->addChild(ADAPTOR, root_0, AFTER35_tree);
23280 + DATE36 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval222);
23281 + if (HASEXCEPTION())
23283 + goto ruledatevalEx;
23286 + DATE36_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE36));
23287 + ADAPTOR->addChild(ADAPTOR, root_0, DATE36_tree);
23293 + // SMARTPL.g:50:6: interval AGO
23295 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
23297 + FOLLOWPUSH(FOLLOW_interval_in_dateval229);
23298 + interval37=interval(ctx);
23301 + if (HASEXCEPTION())
23303 + goto ruledatevalEx;
23306 + ADAPTOR->addChild(ADAPTOR, root_0, interval37.tree);
23307 + AGO38 = (pANTLR3_COMMON_TOKEN) MATCHT(AGO, &FOLLOW_AGO_in_dateval231);
23308 + if (HASEXCEPTION())
23310 + goto ruledatevalEx;
23313 + AGO38_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AGO38));
23314 + ADAPTOR->addChild(ADAPTOR, root_0, AGO38_tree);
23325 + // This is where rules clean up and exit
23327 + goto ruledatevalEx; /* Prevent compiler warnings */
23329 + retval.stop = LT(-1);
23331 + retval.stop = LT(-1);
23332 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
23333 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
23335 + if (HASEXCEPTION())
23339 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
23345 +/* $ANTLR end dateval */
23348 + * $ANTLR start interval
23349 + * SMARTPL.g:53:1: interval : INT DATINTERVAL ;
23351 +static SMARTPLParser_interval_return
23352 +interval(pSMARTPLParser ctx)
23354 + SMARTPLParser_interval_return retval;
23356 + pANTLR3_BASE_TREE root_0;
23358 + pANTLR3_COMMON_TOKEN INT39;
23359 + pANTLR3_COMMON_TOKEN DATINTERVAL40;
23361 + pANTLR3_BASE_TREE INT39_tree;
23362 + pANTLR3_BASE_TREE DATINTERVAL40_tree;
23364 + /* Initialize rule variables
23371 + DATINTERVAL40 = NULL;
23372 + retval.start = LT(1); retval.stop = retval.start;
23374 + INT39_tree = NULL;
23375 + DATINTERVAL40_tree = NULL;
23378 + retval.tree = NULL;
23380 + // SMARTPL.g:53:10: ( INT DATINTERVAL )
23381 + // SMARTPL.g:53:12: INT DATINTERVAL
23383 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
23385 + INT39 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_interval243);
23386 + if (HASEXCEPTION())
23388 + goto ruleintervalEx;
23391 + INT39_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INT39));
23392 + ADAPTOR->addChild(ADAPTOR, root_0, INT39_tree);
23394 + DATINTERVAL40 = (pANTLR3_COMMON_TOKEN) MATCHT(DATINTERVAL, &FOLLOW_DATINTERVAL_in_interval245);
23395 + if (HASEXCEPTION())
23397 + goto ruleintervalEx;
23400 + DATINTERVAL40_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATINTERVAL40));
23401 + ADAPTOR->addChild(ADAPTOR, root_0, DATINTERVAL40_tree);
23409 + // This is where rules clean up and exit
23411 + goto ruleintervalEx; /* Prevent compiler warnings */
23412 + ruleintervalEx: ;
23413 + retval.stop = LT(-1);
23415 + retval.stop = LT(-1);
23416 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
23417 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
23419 + if (HASEXCEPTION())
23423 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
23429 +/* $ANTLR end interval */
23430 +/* End of parsing rules
23431 + * ==============================================
23434 +/* ==============================================
23435 + * Syntactic predicates
23437 +/* End of syntactic predicates
23438 + * ==============================================
23447 + * =============================================================================
23449 diff --git a/src/pregen/SMARTPLParser.h b/src/pregen/SMARTPLParser.h
23450 new file mode 100644
23451 index 0000000..38ef500
23453 +++ b/src/pregen/SMARTPLParser.h
23456 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
23458 + * - From the grammar source file : SMARTPL.g
23459 + * - On : 2016-01-01 12:23:40
23460 + * - for the parser : SMARTPLParserParser *
23461 + * Editing it, at least manually, is not wise.
23463 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
23466 + * The parser SMARTPLParser has the callable functions (rules) shown below,
23467 + * which will invoke the code for the associated rule in the source grammar
23468 + * assuming that the input stream is pointing to a token/text stream that could begin
23471 + * For instance if you call the first (topmost) rule in a parser grammar, you will
23472 + * get the results of a full parse, but calling a rule half way through the grammar will
23473 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
23474 + * in editors and so on.
23476 + * The parser entry points are called indirectly (by function pointer to function) via
23477 + * a parser context typedef pSMARTPLParser, which is returned from a call to SMARTPLParserNew().
23479 + * The methods in pSMARTPLParser are as follows:
23481 + * - SMARTPLParser_playlist_return pSMARTPLParser->playlist(pSMARTPLParser)
23482 + * - SMARTPLParser_expression_return pSMARTPLParser->expression(pSMARTPLParser)
23483 + * - SMARTPLParser_aexpr_return pSMARTPLParser->aexpr(pSMARTPLParser)
23484 + * - SMARTPLParser_nexpr_return pSMARTPLParser->nexpr(pSMARTPLParser)
23485 + * - SMARTPLParser_crit_return pSMARTPLParser->crit(pSMARTPLParser)
23486 + * - SMARTPLParser_dateval_return pSMARTPLParser->dateval(pSMARTPLParser)
23487 + * - SMARTPLParser_interval_return pSMARTPLParser->interval(pSMARTPLParser)
23489 + * The return type for any particular rule is of course determined by the source
23492 +// [The "BSD licence"]
23493 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
23494 +// http://www.temporal-wave.com
23495 +// http://www.linkedin.com/in/jimidle
23497 +// All rights reserved.
23499 +// Redistribution and use in source and binary forms, with or without
23500 +// modification, are permitted provided that the following conditions
23502 +// 1. Redistributions of source code must retain the above copyright
23503 +// notice, this list of conditions and the following disclaimer.
23504 +// 2. Redistributions in binary form must reproduce the above copyright
23505 +// notice, this list of conditions and the following disclaimer in the
23506 +// documentation and/or other materials provided with the distribution.
23507 +// 3. The name of the author may not be used to endorse or promote products
23508 +// derived from this software without specific prior written permission.
23510 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23511 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23512 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23513 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23514 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23515 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23516 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23517 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23518 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23519 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23521 +#ifndef _SMARTPLParser_H
23522 +#define _SMARTPLParser_H
23523 +/* =============================================================================
23524 + * Standard antlr3 C runtime definitions
23526 +#include <antlr3.h>
23528 +/* End of standard antlr 3 runtime definitions
23529 + * =============================================================================
23532 +#ifdef __cplusplus
23536 +// Forward declare the context typedef so that we can use it before it is
23537 +// properly defined. Delegators and delegates (from import statements) are
23538 +// interdependent and their context structures contain pointers to each other
23539 +// C only allows such things to be declared if you pre-declare the typedef.
23541 +typedef struct SMARTPLParser_Ctx_struct SMARTPLParser, * pSMARTPLParser;
23545 +#ifdef ANTLR3_WINDOWS
23546 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
23547 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
23548 +// initialized but unused variable - tree rewrite variables declared but not needed
23549 +// Unreferenced local variable - lexer rule declares but does not always use _type
23550 +// potentially unitialized variable used - retval always returned from a rule
23551 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
23553 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
23554 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
23555 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
23556 +// this is a matter of orthogonality hence I disable that one.
23558 +#pragma warning( disable : 4100 )
23559 +#pragma warning( disable : 4101 )
23560 +#pragma warning( disable : 4127 )
23561 +#pragma warning( disable : 4189 )
23562 +#pragma warning( disable : 4505 )
23563 +#pragma warning( disable : 4701 )
23565 +typedef struct SMARTPLParser_playlist_return_struct
23567 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23569 + pANTLR3_COMMON_TOKEN start;
23570 + pANTLR3_COMMON_TOKEN stop;
23571 + pANTLR3_BASE_TREE tree;
23574 + SMARTPLParser_playlist_return;
23576 +typedef struct SMARTPLParser_expression_return_struct
23578 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23580 + pANTLR3_COMMON_TOKEN start;
23581 + pANTLR3_COMMON_TOKEN stop;
23582 + pANTLR3_BASE_TREE tree;
23585 + SMARTPLParser_expression_return;
23587 +typedef struct SMARTPLParser_aexpr_return_struct
23589 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23591 + pANTLR3_COMMON_TOKEN start;
23592 + pANTLR3_COMMON_TOKEN stop;
23593 + pANTLR3_BASE_TREE tree;
23596 + SMARTPLParser_aexpr_return;
23598 +typedef struct SMARTPLParser_nexpr_return_struct
23600 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23602 + pANTLR3_COMMON_TOKEN start;
23603 + pANTLR3_COMMON_TOKEN stop;
23604 + pANTLR3_BASE_TREE tree;
23607 + SMARTPLParser_nexpr_return;
23609 +typedef struct SMARTPLParser_crit_return_struct
23611 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23613 + pANTLR3_COMMON_TOKEN start;
23614 + pANTLR3_COMMON_TOKEN stop;
23615 + pANTLR3_BASE_TREE tree;
23618 + SMARTPLParser_crit_return;
23620 +typedef struct SMARTPLParser_dateval_return_struct
23622 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23624 + pANTLR3_COMMON_TOKEN start;
23625 + pANTLR3_COMMON_TOKEN stop;
23626 + pANTLR3_BASE_TREE tree;
23629 + SMARTPLParser_dateval_return;
23631 +typedef struct SMARTPLParser_interval_return_struct
23633 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23635 + pANTLR3_COMMON_TOKEN start;
23636 + pANTLR3_COMMON_TOKEN stop;
23637 + pANTLR3_BASE_TREE tree;
23640 + SMARTPLParser_interval_return;
23644 +/** Context tracking structure for SMARTPLParser
23646 +struct SMARTPLParser_Ctx_struct
23648 + /** Built in ANTLR3 context tracker contains all the generic elements
23649 + * required for context tracking.
23651 + pANTLR3_PARSER pParser;
23654 + SMARTPLParser_playlist_return (*playlist) (struct SMARTPLParser_Ctx_struct * ctx);
23655 + SMARTPLParser_expression_return (*expression) (struct SMARTPLParser_Ctx_struct * ctx);
23656 + SMARTPLParser_aexpr_return (*aexpr) (struct SMARTPLParser_Ctx_struct * ctx);
23657 + SMARTPLParser_nexpr_return (*nexpr) (struct SMARTPLParser_Ctx_struct * ctx);
23658 + SMARTPLParser_crit_return (*crit) (struct SMARTPLParser_Ctx_struct * ctx);
23659 + SMARTPLParser_dateval_return (*dateval) (struct SMARTPLParser_Ctx_struct * ctx);
23660 + SMARTPLParser_interval_return (*interval) (struct SMARTPLParser_Ctx_struct * ctx);
23661 + // Delegated rules
23662 + const char * (*getGrammarFileName)();
23663 + void (*free) (struct SMARTPLParser_Ctx_struct * ctx);
23664 + /* @headerFile.members() */
23665 + pANTLR3_BASE_TREE_ADAPTOR adaptor;
23666 + pANTLR3_VECTOR_FACTORY vectors;
23667 + /* End @headerFile.members() */
23670 +// Function protoypes for the constructor functions that external translation units
23671 +// such as delegators and delegates may wish to call.
23673 +ANTLR3_API pSMARTPLParser SMARTPLParserNew (pANTLR3_COMMON_TOKEN_STREAM instream);
23674 +ANTLR3_API pSMARTPLParser SMARTPLParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
23676 +/** Symbolic definitions of all the tokens that the parser will work with.
23679 + * Antlr will define EOF, but we can't use that as it it is too common in
23680 + * in C header files and that would be confusing. There is no way to filter this out at the moment
23681 + * so we just undef it here for now. That isn't the value we get back from C recognizers
23682 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
23690 +#define INTBOOL 14
23693 +#define WHITESPACE 29
23694 +#define GREATEREQUAL 25
23696 +#define DATETAG 16
23702 +#define INCLUDES 11
23706 +#define GREATER 24
23708 +#define ENUMTAG 19
23710 +#define ENUMVAL 20
23716 +#define LESSEQUAL 27
23717 +#define DATINTERVAL 23
23721 +#define EOF ANTLR3_TOKEN_EOF
23724 +#ifndef TOKENSOURCE
23725 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
23728 +/* End of token definitions for SMARTPLParser
23729 + * =============================================================================
23733 +#ifdef __cplusplus
23739 +/* END - Note:Keep extra line feed to satisfy UNIX systems */