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..f13209c
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 : 2015-06-27 19:05:20
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..2b1e806
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 : 2015-06-27 19:05:20
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..b72f28a
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 : 2015-06-27 19:05:17
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..401b214
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 : 2015-06-27 19:05:17
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..7a9aae9
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 : 2015-06-27 19:05:16
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..82ce85e
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 : 2015-06-27 19:05:16
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..05b54d3
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 : 2015-06-27 19:05:19
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..a94e317
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 : 2015-06-27 19:05:19
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..bc4245a
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 : 2015-06-27 19:05:18
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..d93f93e
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 : 2015-06-27 19:05:18
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..c0f3e2a
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 : 2015-06-27 19:05:18
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_set_in_strop0 */
12218 +static ANTLR3_BITWORD FOLLOW_set_in_strop0_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12219 +static ANTLR3_BITSET_LIST FOLLOW_set_in_strop0 = { FOLLOW_set_in_strop0_bits, 1 };
12220 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_intcrit211 */
12221 +static ANTLR3_BITWORD FOLLOW_FIELD_in_intcrit211_bits[] = { ANTLR3_UINT64_LIT(0x00000000001E1000) };
12222 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_intcrit211 = { FOLLOW_FIELD_in_intcrit211_bits, 1 };
12223 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intop_in_intcrit213 */
12224 +static ANTLR3_BITWORD FOLLOW_intop_in_intcrit213_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) };
12225 +static ANTLR3_BITSET_LIST FOLLOW_intop_in_intcrit213 = { FOLLOW_intop_in_intcrit213_bits, 1 };
12226 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_intcrit215 */
12227 +static ANTLR3_BITWORD FOLLOW_INT_in_intcrit215_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12228 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_intcrit215 = { FOLLOW_INT_in_intcrit215_bits, 1 };
12229 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_intcrit232 */
12230 +static ANTLR3_BITWORD FOLLOW_FIELD_in_intcrit232_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000800) };
12231 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_intcrit232 = { FOLLOW_FIELD_in_intcrit232_bits, 1 };
12232 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_intcrit234 */
12233 +static ANTLR3_BITWORD FOLLOW_NOT_in_intcrit234_bits[] = { ANTLR3_UINT64_LIT(0x00000000001E1000) };
12234 +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_intcrit234 = { FOLLOW_NOT_in_intcrit234_bits, 1 };
12235 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intop_in_intcrit236 */
12236 +static ANTLR3_BITWORD FOLLOW_intop_in_intcrit236_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) };
12237 +static ANTLR3_BITSET_LIST FOLLOW_intop_in_intcrit236 = { FOLLOW_intop_in_intcrit236_bits, 1 };
12238 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_intcrit238 */
12239 +static ANTLR3_BITWORD FOLLOW_INT_in_intcrit238_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12240 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_intcrit238 = { FOLLOW_INT_in_intcrit238_bits, 1 };
12241 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_intop0 */
12242 +static ANTLR3_BITWORD FOLLOW_set_in_intop0_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12243 +static ANTLR3_BITSET_LIST FOLLOW_set_in_intop0 = { FOLLOW_set_in_intop0_bits, 1 };
12244 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_datecrit292 */
12245 +static ANTLR3_BITWORD FOLLOW_FIELD_in_datecrit292_bits[] = { ANTLR3_UINT64_LIT(0x0000000000600000) };
12246 +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_datecrit292 = { FOLLOW_FIELD_in_datecrit292_bits, 1 };
12247 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datecrit294 */
12248 +static ANTLR3_BITWORD FOLLOW_dateop_in_datecrit294_bits[] = { ANTLR3_UINT64_LIT(0x0000000001810000) };
12249 +static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datecrit294 = { FOLLOW_dateop_in_datecrit294_bits, 1 };
12250 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_datespec_in_datecrit296 */
12251 +static ANTLR3_BITWORD FOLLOW_datespec_in_datecrit296_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12252 +static ANTLR3_BITSET_LIST FOLLOW_datespec_in_datecrit296 = { FOLLOW_datespec_in_datecrit296_bits, 1 };
12253 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_dateop0 */
12254 +static ANTLR3_BITWORD FOLLOW_set_in_dateop0_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12255 +static ANTLR3_BITSET_LIST FOLLOW_set_in_dateop0 = { FOLLOW_set_in_dateop0_bits, 1 };
12256 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec331 */
12257 +static ANTLR3_BITWORD FOLLOW_dateref_in_datespec331_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12258 +static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec331 = { FOLLOW_dateref_in_datespec331_bits, 1 };
12259 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_datespec336 */
12260 +static ANTLR3_BITWORD FOLLOW_INT_in_datespec336_bits[] = { ANTLR3_UINT64_LIT(0x000000001E000000) };
12261 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_datespec336 = { FOLLOW_INT_in_datespec336_bits, 1 };
12262 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateintval_in_datespec338 */
12263 +static ANTLR3_BITWORD FOLLOW_dateintval_in_datespec338_bits[] = { ANTLR3_UINT64_LIT(0x0000000000600000) };
12264 +static ANTLR3_BITSET_LIST FOLLOW_dateintval_in_datespec338 = { FOLLOW_dateintval_in_datespec338_bits, 1 };
12265 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datespec340 */
12266 +static ANTLR3_BITWORD FOLLOW_dateop_in_datespec340_bits[] = { ANTLR3_UINT64_LIT(0x0000000001800000) };
12267 +static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datespec340 = { FOLLOW_dateop_in_datespec340_bits, 1 };
12268 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec342 */
12269 +static ANTLR3_BITWORD FOLLOW_dateref_in_datespec342_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12270 +static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec342 = { FOLLOW_dateref_in_datespec342_bits, 1 };
12271 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_dateref0 */
12272 +static ANTLR3_BITWORD FOLLOW_set_in_dateref0_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12273 +static ANTLR3_BITSET_LIST FOLLOW_set_in_dateref0 = { FOLLOW_set_in_dateref0_bits, 1 };
12274 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_dateintval0 */
12275 +static ANTLR3_BITWORD FOLLOW_set_in_dateintval0_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
12276 +static ANTLR3_BITSET_LIST FOLLOW_set_in_dateintval0 = { FOLLOW_set_in_dateintval0_bits, 1 };
12281 +/* ==============================================
12285 + * $ANTLR start query
12286 + * RSP.g:27:1: query : expr ( NEWLINE )? EOF -> expr ;
12288 +static RSPParser_query_return
12289 +query(pRSPParser ctx)
12291 + RSPParser_query_return retval;
12293 + pANTLR3_BASE_TREE root_0;
12295 + pANTLR3_COMMON_TOKEN NEWLINE2;
12296 + pANTLR3_COMMON_TOKEN EOF3;
12297 + RSPParser_expr_return expr1;
12298 + #undef RETURN_TYPE_expr1
12299 + #define RETURN_TYPE_expr1 RSPParser_expr_return
12301 + pANTLR3_BASE_TREE NEWLINE2_tree;
12302 + pANTLR3_BASE_TREE EOF3_tree;
12303 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NEWLINE;
12304 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_EOF;
12305 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr;
12306 + /* Initialize rule variables
12314 + expr1.tree = NULL;
12316 + retval.start = LT(1); retval.stop = retval.start;
12318 + NEWLINE2_tree = NULL;
12319 + EOF3_tree = NULL;
12321 + stream_NEWLINE = NULL;
12322 + #define CREATE_stream_NEWLINE if (stream_NEWLINE == NULL) {stream_NEWLINE = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NEWLINE"); }
12323 + stream_EOF = NULL;
12324 + #define CREATE_stream_EOF if (stream_EOF == NULL) {stream_EOF = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token EOF"); }
12325 + stream_expr = NULL;
12326 + #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); }
12328 + retval.tree = NULL;
12330 + // RSP.g:27:7: ( expr ( NEWLINE )? EOF -> expr )
12331 + // RSP.g:27:9: expr ( NEWLINE )? EOF
12333 + FOLLOWPUSH(FOLLOW_expr_in_query42);
12337 + if (HASEXCEPTION())
12339 + goto rulequeryEx;
12342 + CREATE_stream_expr; stream_expr->add(stream_expr, expr1.tree, NULL);
12344 + // RSP.g:27:14: ( NEWLINE )?
12359 + // RSP.g:27:14: NEWLINE
12361 + NEWLINE2 = (pANTLR3_COMMON_TOKEN) MATCHT(NEWLINE, &FOLLOW_NEWLINE_in_query44);
12362 + if (HASEXCEPTION())
12364 + goto rulequeryEx;
12367 + CREATE_stream_NEWLINE; stream_NEWLINE->add(stream_NEWLINE, NEWLINE2, NULL);
12375 + EOF3 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_query47);
12376 + if (HASEXCEPTION())
12378 + goto rulequeryEx;
12381 + CREATE_stream_EOF; stream_EOF->add(stream_EOF, EOF3, NULL);
12386 + * elements : expr
12388 + * rule labels : retval
12389 + * token list labels :
12390 + * rule list labels :
12393 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
12395 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
12397 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12398 + retval.tree = root_0;
12399 + // 27:28: -> expr
12401 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
12405 + retval.tree = root_0; // set result root
12406 + if (stream_retval != NULL) stream_retval->free(stream_retval);
12415 + // This is where rules clean up and exit
12417 + goto rulequeryEx; /* Prevent compiler warnings */
12419 + retval.stop = LT(-1);
12421 + retval.stop = LT(-1);
12422 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
12423 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
12424 + if (stream_NEWLINE != NULL) stream_NEWLINE->free(stream_NEWLINE);
12425 + if (stream_EOF != NULL) stream_EOF->free(stream_EOF);
12426 + if (stream_expr != NULL) stream_expr->free(stream_expr);
12428 + if (HASEXCEPTION())
12432 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
12438 +/* $ANTLR end query */
12441 + * $ANTLR start expr
12442 + * RSP.g:30:1: expr : aexpr ( OR aexpr )* ;
12444 +static RSPParser_expr_return
12445 +expr(pRSPParser ctx)
12447 + RSPParser_expr_return retval;
12449 + pANTLR3_BASE_TREE root_0;
12451 + pANTLR3_COMMON_TOKEN OR5;
12452 + RSPParser_aexpr_return aexpr4;
12453 + #undef RETURN_TYPE_aexpr4
12454 + #define RETURN_TYPE_aexpr4 RSPParser_aexpr_return
12456 + RSPParser_aexpr_return aexpr6;
12457 + #undef RETURN_TYPE_aexpr6
12458 + #define RETURN_TYPE_aexpr6 RSPParser_aexpr_return
12460 + pANTLR3_BASE_TREE OR5_tree;
12462 + /* Initialize rule variables
12469 + aexpr4.tree = NULL;
12471 + aexpr6.tree = NULL;
12473 + retval.start = LT(1); retval.stop = retval.start;
12478 + retval.tree = NULL;
12480 + // RSP.g:30:6: ( aexpr ( OR aexpr )* )
12481 + // RSP.g:30:8: aexpr ( OR aexpr )*
12483 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12485 + FOLLOWPUSH(FOLLOW_aexpr_in_expr63);
12486 + aexpr4=aexpr(ctx);
12489 + if (HASEXCEPTION())
12494 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr4.tree);
12496 + // RSP.g:30:14: ( OR aexpr )*
12514 + // RSP.g:30:15: OR aexpr
12516 + OR5 = (pANTLR3_COMMON_TOKEN) MATCHT(OR, &FOLLOW_OR_in_expr66);
12517 + if (HASEXCEPTION())
12522 + OR5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OR5));
12523 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OR5_tree, root_0));
12525 + FOLLOWPUSH(FOLLOW_aexpr_in_expr69);
12526 + aexpr6=aexpr(ctx);
12529 + if (HASEXCEPTION())
12534 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree);
12540 + goto loop2; /* break out of the loop */
12544 + loop2: ; /* Jump out to here if this rule does not match */
12552 + // This is where rules clean up and exit
12554 + goto ruleexprEx; /* Prevent compiler warnings */
12556 + retval.stop = LT(-1);
12558 + retval.stop = LT(-1);
12559 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
12560 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
12562 + if (HASEXCEPTION())
12566 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
12572 +/* $ANTLR end expr */
12575 + * $ANTLR start aexpr
12576 + * RSP.g:33:1: aexpr : crit ( AND crit )* ;
12578 +static RSPParser_aexpr_return
12579 +aexpr(pRSPParser ctx)
12581 + RSPParser_aexpr_return retval;
12583 + pANTLR3_BASE_TREE root_0;
12585 + pANTLR3_COMMON_TOKEN AND8;
12586 + RSPParser_crit_return crit7;
12587 + #undef RETURN_TYPE_crit7
12588 + #define RETURN_TYPE_crit7 RSPParser_crit_return
12590 + RSPParser_crit_return crit9;
12591 + #undef RETURN_TYPE_crit9
12592 + #define RETURN_TYPE_crit9 RSPParser_crit_return
12594 + pANTLR3_BASE_TREE AND8_tree;
12596 + /* Initialize rule variables
12603 + crit7.tree = NULL;
12605 + crit9.tree = NULL;
12607 + retval.start = LT(1); retval.stop = retval.start;
12609 + AND8_tree = NULL;
12612 + retval.tree = NULL;
12614 + // RSP.g:33:7: ( crit ( AND crit )* )
12615 + // RSP.g:33:9: crit ( AND crit )*
12617 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12619 + FOLLOWPUSH(FOLLOW_crit_in_aexpr81);
12623 + if (HASEXCEPTION())
12625 + goto ruleaexprEx;
12628 + ADAPTOR->addChild(ADAPTOR, root_0, crit7.tree);
12630 + // RSP.g:33:14: ( AND crit )*
12648 + // RSP.g:33:15: AND crit
12650 + AND8 = (pANTLR3_COMMON_TOKEN) MATCHT(AND, &FOLLOW_AND_in_aexpr84);
12651 + if (HASEXCEPTION())
12653 + goto ruleaexprEx;
12656 + AND8_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AND8));
12657 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, AND8_tree, root_0));
12659 + FOLLOWPUSH(FOLLOW_crit_in_aexpr87);
12663 + if (HASEXCEPTION())
12665 + goto ruleaexprEx;
12668 + ADAPTOR->addChild(ADAPTOR, root_0, crit9.tree);
12674 + goto loop3; /* break out of the loop */
12678 + loop3: ; /* Jump out to here if this rule does not match */
12686 + // This is where rules clean up and exit
12688 + goto ruleaexprEx; /* Prevent compiler warnings */
12690 + retval.stop = LT(-1);
12692 + retval.stop = LT(-1);
12693 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
12694 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
12696 + if (HASEXCEPTION())
12700 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
12706 +/* $ANTLR end aexpr */
12709 + * $ANTLR start crit
12710 + * RSP.g:36:1: crit : ( LPAR expr RPAR -> expr | strcrit | intcrit | datecrit );
12712 +static RSPParser_crit_return
12713 +crit(pRSPParser ctx)
12715 + RSPParser_crit_return retval;
12717 + pANTLR3_BASE_TREE root_0;
12719 + pANTLR3_COMMON_TOKEN LPAR10;
12720 + pANTLR3_COMMON_TOKEN RPAR12;
12721 + RSPParser_expr_return expr11;
12722 + #undef RETURN_TYPE_expr11
12723 + #define RETURN_TYPE_expr11 RSPParser_expr_return
12725 + RSPParser_strcrit_return strcrit13;
12726 + #undef RETURN_TYPE_strcrit13
12727 + #define RETURN_TYPE_strcrit13 RSPParser_strcrit_return
12729 + RSPParser_intcrit_return intcrit14;
12730 + #undef RETURN_TYPE_intcrit14
12731 + #define RETURN_TYPE_intcrit14 RSPParser_intcrit_return
12733 + RSPParser_datecrit_return datecrit15;
12734 + #undef RETURN_TYPE_datecrit15
12735 + #define RETURN_TYPE_datecrit15 RSPParser_datecrit_return
12737 + pANTLR3_BASE_TREE LPAR10_tree;
12738 + pANTLR3_BASE_TREE RPAR12_tree;
12739 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_RPAR;
12740 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_LPAR;
12741 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr;
12742 + /* Initialize rule variables
12750 + expr11.tree = NULL;
12752 + strcrit13.tree = NULL;
12754 + intcrit14.tree = NULL;
12756 + datecrit15.tree = NULL;
12758 + retval.start = LT(1); retval.stop = retval.start;
12760 + LPAR10_tree = NULL;
12761 + RPAR12_tree = NULL;
12763 + stream_RPAR = NULL;
12764 + #define CREATE_stream_RPAR if (stream_RPAR == NULL) {stream_RPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token RPAR"); }
12765 + stream_LPAR = NULL;
12766 + #define CREATE_stream_LPAR if (stream_LPAR == NULL) {stream_LPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token LPAR"); }
12767 + stream_expr = NULL;
12768 + #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); }
12770 + retval.tree = NULL;
12773 + // RSP.g:36:6: ( LPAR expr RPAR -> expr | strcrit | intcrit | datecrit )
12775 + ANTLR3_UINT32 alt4;
12811 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12812 + EXCEPTION->message = (void *)"";
12813 + EXCEPTION->decisionNum = 4;
12814 + EXCEPTION->state = 8;
12840 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12841 + EXCEPTION->message = (void *)"";
12842 + EXCEPTION->decisionNum = 4;
12843 + EXCEPTION->state = 3;
12868 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12869 + EXCEPTION->message = (void *)"";
12870 + EXCEPTION->decisionNum = 4;
12871 + EXCEPTION->state = 4;
12903 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12904 + EXCEPTION->message = (void *)"";
12905 + EXCEPTION->decisionNum = 4;
12906 + EXCEPTION->state = 2;
12917 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12918 + EXCEPTION->message = (void *)"";
12919 + EXCEPTION->decisionNum = 4;
12920 + EXCEPTION->state = 0;
12929 + // RSP.g:36:8: LPAR expr RPAR
12931 + LPAR10 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit99);
12932 + if (HASEXCEPTION())
12937 + CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR10, NULL);
12939 + FOLLOWPUSH(FOLLOW_expr_in_crit101);
12940 + expr11=expr(ctx);
12943 + if (HASEXCEPTION())
12948 + CREATE_stream_expr; stream_expr->add(stream_expr, expr11.tree, NULL);
12949 + RPAR12 = (pANTLR3_COMMON_TOKEN) MATCHT(RPAR, &FOLLOW_RPAR_in_crit103);
12950 + if (HASEXCEPTION())
12955 + CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR12, NULL);
12960 + * elements : expr
12962 + * rule labels : retval
12963 + * token list labels :
12964 + * rule list labels :
12967 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
12969 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
12971 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12972 + retval.tree = root_0;
12973 + // 36:25: -> expr
12975 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
12979 + retval.tree = root_0; // set result root
12980 + if (stream_retval != NULL) stream_retval->free(stream_retval);
12987 + // RSP.g:37:4: strcrit
12989 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12991 + FOLLOWPUSH(FOLLOW_strcrit_in_crit114);
12992 + strcrit13=strcrit(ctx);
12995 + if (HASEXCEPTION())
13000 + ADAPTOR->addChild(ADAPTOR, root_0, strcrit13.tree);
13005 + // RSP.g:38:4: intcrit
13007 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13009 + FOLLOWPUSH(FOLLOW_intcrit_in_crit119);
13010 + intcrit14=intcrit(ctx);
13013 + if (HASEXCEPTION())
13018 + ADAPTOR->addChild(ADAPTOR, root_0, intcrit14.tree);
13023 + // RSP.g:39:4: datecrit
13025 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13027 + FOLLOWPUSH(FOLLOW_datecrit_in_crit124);
13028 + datecrit15=datecrit(ctx);
13031 + if (HASEXCEPTION())
13036 + ADAPTOR->addChild(ADAPTOR, root_0, datecrit15.tree);
13046 + // This is where rules clean up and exit
13048 + goto rulecritEx; /* Prevent compiler warnings */
13050 + retval.stop = LT(-1);
13052 + retval.stop = LT(-1);
13053 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13054 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13055 + if (stream_RPAR != NULL) stream_RPAR->free(stream_RPAR);
13056 + if (stream_LPAR != NULL) stream_LPAR->free(stream_LPAR);
13057 + if (stream_expr != NULL) stream_expr->free(stream_expr);
13059 + if (HASEXCEPTION())
13063 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13069 +/* $ANTLR end crit */
13072 + * $ANTLR start strcrit
13073 + * RSP.g:42:1: strcrit : ( FIELD strop STR -> ^( strop FIELD STR ) | FIELD NOT strop STR -> ^( NOT ^( strop FIELD STR ) ) );
13075 +static RSPParser_strcrit_return
13076 +strcrit(pRSPParser ctx)
13078 + RSPParser_strcrit_return retval;
13080 + pANTLR3_BASE_TREE root_0;
13082 + pANTLR3_COMMON_TOKEN FIELD16;
13083 + pANTLR3_COMMON_TOKEN STR18;
13084 + pANTLR3_COMMON_TOKEN FIELD19;
13085 + pANTLR3_COMMON_TOKEN NOT20;
13086 + pANTLR3_COMMON_TOKEN STR22;
13087 + RSPParser_strop_return strop17;
13088 + #undef RETURN_TYPE_strop17
13089 + #define RETURN_TYPE_strop17 RSPParser_strop_return
13091 + RSPParser_strop_return strop21;
13092 + #undef RETURN_TYPE_strop21
13093 + #define RETURN_TYPE_strop21 RSPParser_strop_return
13095 + pANTLR3_BASE_TREE FIELD16_tree;
13096 + pANTLR3_BASE_TREE STR18_tree;
13097 + pANTLR3_BASE_TREE FIELD19_tree;
13098 + pANTLR3_BASE_TREE NOT20_tree;
13099 + pANTLR3_BASE_TREE STR22_tree;
13100 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_STR;
13101 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_FIELD;
13102 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NOT;
13103 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_strop;
13104 + /* Initialize rule variables
13115 + strop17.tree = NULL;
13117 + strop21.tree = NULL;
13119 + retval.start = LT(1); retval.stop = retval.start;
13121 + FIELD16_tree = NULL;
13122 + STR18_tree = NULL;
13123 + FIELD19_tree = NULL;
13124 + NOT20_tree = NULL;
13125 + STR22_tree = NULL;
13127 + stream_STR = NULL;
13128 + #define CREATE_stream_STR if (stream_STR == NULL) {stream_STR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token STR"); }
13129 + stream_FIELD = NULL;
13130 + #define CREATE_stream_FIELD if (stream_FIELD == NULL) {stream_FIELD = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token FIELD"); }
13131 + stream_NOT = NULL;
13132 + #define CREATE_stream_NOT if (stream_NOT == NULL) {stream_NOT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NOT"); }
13133 + stream_strop = NULL;
13134 + #define CREATE_stream_strop if (stream_strop == NULL) {stream_strop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule strop"); }
13136 + retval.tree = NULL;
13139 + // RSP.g:42:9: ( FIELD strop STR -> ^( strop FIELD STR ) | FIELD NOT strop STR -> ^( NOT ^( strop FIELD STR ) ) )
13141 + ANTLR3_UINT32 alt5;
13167 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13168 + EXCEPTION->message = (void *)"";
13169 + EXCEPTION->decisionNum = 5;
13170 + EXCEPTION->state = 1;
13173 + goto rulestrcritEx;
13181 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13182 + EXCEPTION->message = (void *)"";
13183 + EXCEPTION->decisionNum = 5;
13184 + EXCEPTION->state = 0;
13187 + goto rulestrcritEx;
13193 + // RSP.g:42:11: FIELD strop STR
13195 + FIELD16 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit134);
13196 + if (HASEXCEPTION())
13198 + goto rulestrcritEx;
13201 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD16, NULL);
13203 + FOLLOWPUSH(FOLLOW_strop_in_strcrit136);
13204 + strop17=strop(ctx);
13207 + if (HASEXCEPTION())
13209 + goto rulestrcritEx;
13212 + CREATE_stream_strop; stream_strop->add(stream_strop, strop17.tree, NULL);
13213 + STR18 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_strcrit138);
13214 + if (HASEXCEPTION())
13216 + goto rulestrcritEx;
13219 + CREATE_stream_STR; stream_STR->add(stream_STR, STR18, NULL);
13224 + * elements : strop, STR, FIELD
13226 + * rule labels : retval
13227 + * token list labels :
13228 + * rule list labels :
13231 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13233 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13235 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13236 + retval.tree = root_0;
13237 + // 42:29: -> ^( strop FIELD STR )
13239 + // RSP.g:42:32: ^( strop FIELD STR )
13241 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13242 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_strop == NULL ? NULL : stream_strop->nextNode(stream_strop), root_1));
13244 + ADAPTOR->addChild(ADAPTOR, root_1, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
13245 + ADAPTOR->addChild(ADAPTOR, root_1, stream_STR == NULL ? NULL : stream_STR->nextNode(stream_STR));
13247 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13252 + retval.tree = root_0; // set result root
13253 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13260 + // RSP.g:43:4: FIELD NOT strop STR
13262 + FIELD19 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit155);
13263 + if (HASEXCEPTION())
13265 + goto rulestrcritEx;
13268 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD19, NULL);
13270 + NOT20 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_strcrit157);
13271 + if (HASEXCEPTION())
13273 + goto rulestrcritEx;
13276 + CREATE_stream_NOT; stream_NOT->add(stream_NOT, NOT20, NULL);
13278 + FOLLOWPUSH(FOLLOW_strop_in_strcrit159);
13279 + strop21=strop(ctx);
13282 + if (HASEXCEPTION())
13284 + goto rulestrcritEx;
13287 + CREATE_stream_strop; stream_strop->add(stream_strop, strop21.tree, NULL);
13288 + STR22 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_strcrit161);
13289 + if (HASEXCEPTION())
13291 + goto rulestrcritEx;
13294 + CREATE_stream_STR; stream_STR->add(stream_STR, STR22, NULL);
13299 + * elements : NOT, strop, STR, FIELD
13301 + * rule labels : retval
13302 + * token list labels :
13303 + * rule list labels :
13306 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13308 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13310 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13311 + retval.tree = root_0;
13312 + // 43:25: -> ^( NOT ^( strop FIELD STR ) )
13314 + // RSP.g:43:28: ^( NOT ^( strop FIELD STR ) )
13316 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13317 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_NOT == NULL ? NULL : stream_NOT->nextNode(stream_NOT), root_1));
13319 + // RSP.g:43:34: ^( strop FIELD STR )
13321 + pANTLR3_BASE_TREE root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13322 + root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_strop == NULL ? NULL : stream_strop->nextNode(stream_strop), root_2));
13324 + ADAPTOR->addChild(ADAPTOR, root_2, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
13325 + ADAPTOR->addChild(ADAPTOR, root_2, stream_STR == NULL ? NULL : stream_STR->nextNode(stream_STR));
13327 + ADAPTOR->addChild(ADAPTOR, root_1, root_2);
13330 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13335 + retval.tree = root_0; // set result root
13336 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13348 + // This is where rules clean up and exit
13350 + goto rulestrcritEx; /* Prevent compiler warnings */
13352 + retval.stop = LT(-1);
13354 + retval.stop = LT(-1);
13355 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13356 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13357 + if (stream_STR != NULL) stream_STR->free(stream_STR);
13358 + if (stream_FIELD != NULL) stream_FIELD->free(stream_FIELD);
13359 + if (stream_NOT != NULL) stream_NOT->free(stream_NOT);
13360 + if (stream_strop != NULL) stream_strop->free(stream_strop);
13362 + if (HASEXCEPTION())
13366 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13372 +/* $ANTLR end strcrit */
13375 + * $ANTLR start strop
13376 + * RSP.g:46:1: strop : ( EQUAL | INCLUDES | STARTSW | ENDSW );
13378 +static RSPParser_strop_return
13379 +strop(pRSPParser ctx)
13381 + RSPParser_strop_return retval;
13383 + pANTLR3_BASE_TREE root_0;
13385 + pANTLR3_COMMON_TOKEN set23;
13387 + pANTLR3_BASE_TREE set23_tree;
13389 + /* Initialize rule variables
13396 + retval.start = LT(1); retval.stop = retval.start;
13398 + set23_tree = NULL;
13401 + retval.tree = NULL;
13403 + // RSP.g:46:7: ( EQUAL | INCLUDES | STARTSW | ENDSW )
13406 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13408 + set23=(pANTLR3_COMMON_TOKEN)LT(1);
13409 + if ( ((LA(1) >= EQUAL) && (LA(1) <= ENDSW)) )
13412 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set23)));
13413 + PERRORRECOVERY=ANTLR3_FALSE;
13418 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
13419 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
13420 + EXCEPTION->expectingSet = &FOLLOW_set_in_strop0;
13421 + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_strop0); goto rulestropEx;
13430 + // This is where rules clean up and exit
13432 + goto rulestropEx; /* Prevent compiler warnings */
13434 + retval.stop = LT(-1);
13436 + retval.stop = LT(-1);
13437 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13438 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13440 + if (HASEXCEPTION())
13444 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13450 +/* $ANTLR end strop */
13453 + * $ANTLR start intcrit
13454 + * RSP.g:52:1: intcrit : ( FIELD intop INT -> ^( intop FIELD INT ) | FIELD NOT intop INT -> ^( NOT ^( intop FIELD INT ) ) );
13456 +static RSPParser_intcrit_return
13457 +intcrit(pRSPParser ctx)
13459 + RSPParser_intcrit_return retval;
13461 + pANTLR3_BASE_TREE root_0;
13463 + pANTLR3_COMMON_TOKEN FIELD24;
13464 + pANTLR3_COMMON_TOKEN INT26;
13465 + pANTLR3_COMMON_TOKEN FIELD27;
13466 + pANTLR3_COMMON_TOKEN NOT28;
13467 + pANTLR3_COMMON_TOKEN INT30;
13468 + RSPParser_intop_return intop25;
13469 + #undef RETURN_TYPE_intop25
13470 + #define RETURN_TYPE_intop25 RSPParser_intop_return
13472 + RSPParser_intop_return intop29;
13473 + #undef RETURN_TYPE_intop29
13474 + #define RETURN_TYPE_intop29 RSPParser_intop_return
13476 + pANTLR3_BASE_TREE FIELD24_tree;
13477 + pANTLR3_BASE_TREE INT26_tree;
13478 + pANTLR3_BASE_TREE FIELD27_tree;
13479 + pANTLR3_BASE_TREE NOT28_tree;
13480 + pANTLR3_BASE_TREE INT30_tree;
13481 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_FIELD;
13482 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_INT;
13483 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NOT;
13484 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_intop;
13485 + /* Initialize rule variables
13496 + intop25.tree = NULL;
13498 + intop29.tree = NULL;
13500 + retval.start = LT(1); retval.stop = retval.start;
13502 + FIELD24_tree = NULL;
13503 + INT26_tree = NULL;
13504 + FIELD27_tree = NULL;
13505 + NOT28_tree = NULL;
13506 + INT30_tree = NULL;
13508 + stream_FIELD = NULL;
13509 + #define CREATE_stream_FIELD if (stream_FIELD == NULL) {stream_FIELD = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token FIELD"); }
13510 + stream_INT = NULL;
13511 + #define CREATE_stream_INT if (stream_INT == NULL) {stream_INT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token INT"); }
13512 + stream_NOT = NULL;
13513 + #define CREATE_stream_NOT if (stream_NOT == NULL) {stream_NOT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NOT"); }
13514 + stream_intop = NULL;
13515 + #define CREATE_stream_intop if (stream_intop == NULL) {stream_intop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule intop"); }
13517 + retval.tree = NULL;
13520 + // RSP.g:52:9: ( FIELD intop INT -> ^( intop FIELD INT ) | FIELD NOT intop INT -> ^( NOT ^( intop FIELD INT ) ) )
13522 + ANTLR3_UINT32 alt6;
13549 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13550 + EXCEPTION->message = (void *)"";
13551 + EXCEPTION->decisionNum = 6;
13552 + EXCEPTION->state = 1;
13555 + goto ruleintcritEx;
13563 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13564 + EXCEPTION->message = (void *)"";
13565 + EXCEPTION->decisionNum = 6;
13566 + EXCEPTION->state = 0;
13569 + goto ruleintcritEx;
13575 + // RSP.g:52:11: FIELD intop INT
13577 + FIELD24 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit211);
13578 + if (HASEXCEPTION())
13580 + goto ruleintcritEx;
13583 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD24, NULL);
13585 + FOLLOWPUSH(FOLLOW_intop_in_intcrit213);
13586 + intop25=intop(ctx);
13589 + if (HASEXCEPTION())
13591 + goto ruleintcritEx;
13594 + CREATE_stream_intop; stream_intop->add(stream_intop, intop25.tree, NULL);
13595 + INT26 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_intcrit215);
13596 + if (HASEXCEPTION())
13598 + goto ruleintcritEx;
13601 + CREATE_stream_INT; stream_INT->add(stream_INT, INT26, NULL);
13606 + * elements : intop, INT, FIELD
13608 + * rule labels : retval
13609 + * token list labels :
13610 + * rule list labels :
13613 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13615 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13617 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13618 + retval.tree = root_0;
13619 + // 52:29: -> ^( intop FIELD INT )
13621 + // RSP.g:52:32: ^( intop FIELD INT )
13623 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13624 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_intop == NULL ? NULL : stream_intop->nextNode(stream_intop), root_1));
13626 + ADAPTOR->addChild(ADAPTOR, root_1, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
13627 + ADAPTOR->addChild(ADAPTOR, root_1, stream_INT == NULL ? NULL : stream_INT->nextNode(stream_INT));
13629 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13634 + retval.tree = root_0; // set result root
13635 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13642 + // RSP.g:53:4: FIELD NOT intop INT
13644 + FIELD27 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit232);
13645 + if (HASEXCEPTION())
13647 + goto ruleintcritEx;
13650 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD27, NULL);
13652 + NOT28 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_intcrit234);
13653 + if (HASEXCEPTION())
13655 + goto ruleintcritEx;
13658 + CREATE_stream_NOT; stream_NOT->add(stream_NOT, NOT28, NULL);
13660 + FOLLOWPUSH(FOLLOW_intop_in_intcrit236);
13661 + intop29=intop(ctx);
13664 + if (HASEXCEPTION())
13666 + goto ruleintcritEx;
13669 + CREATE_stream_intop; stream_intop->add(stream_intop, intop29.tree, NULL);
13670 + INT30 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_intcrit238);
13671 + if (HASEXCEPTION())
13673 + goto ruleintcritEx;
13676 + CREATE_stream_INT; stream_INT->add(stream_INT, INT30, NULL);
13681 + * elements : INT, FIELD, intop, NOT
13683 + * rule labels : retval
13684 + * token list labels :
13685 + * rule list labels :
13688 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13690 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13692 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13693 + retval.tree = root_0;
13694 + // 53:25: -> ^( NOT ^( intop FIELD INT ) )
13696 + // RSP.g:53:28: ^( NOT ^( intop FIELD INT ) )
13698 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13699 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_NOT == NULL ? NULL : stream_NOT->nextNode(stream_NOT), root_1));
13701 + // RSP.g:53:34: ^( intop FIELD INT )
13703 + pANTLR3_BASE_TREE root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13704 + root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_intop == NULL ? NULL : stream_intop->nextNode(stream_intop), root_2));
13706 + ADAPTOR->addChild(ADAPTOR, root_2, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
13707 + ADAPTOR->addChild(ADAPTOR, root_2, stream_INT == NULL ? NULL : stream_INT->nextNode(stream_INT));
13709 + ADAPTOR->addChild(ADAPTOR, root_1, root_2);
13712 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13717 + retval.tree = root_0; // set result root
13718 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13730 + // This is where rules clean up and exit
13732 + goto ruleintcritEx; /* Prevent compiler warnings */
13734 + retval.stop = LT(-1);
13736 + retval.stop = LT(-1);
13737 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13738 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13739 + if (stream_FIELD != NULL) stream_FIELD->free(stream_FIELD);
13740 + if (stream_INT != NULL) stream_INT->free(stream_INT);
13741 + if (stream_NOT != NULL) stream_NOT->free(stream_NOT);
13742 + if (stream_intop != NULL) stream_intop->free(stream_intop);
13744 + if (HASEXCEPTION())
13748 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13754 +/* $ANTLR end intcrit */
13757 + * $ANTLR start intop
13758 + * RSP.g:56:1: intop : ( EQUAL | LESS | GREATER | LTE | GTE );
13760 +static RSPParser_intop_return
13761 +intop(pRSPParser ctx)
13763 + RSPParser_intop_return retval;
13765 + pANTLR3_BASE_TREE root_0;
13767 + pANTLR3_COMMON_TOKEN set31;
13769 + pANTLR3_BASE_TREE set31_tree;
13771 + /* Initialize rule variables
13778 + retval.start = LT(1); retval.stop = retval.start;
13780 + set31_tree = NULL;
13783 + retval.tree = NULL;
13785 + // RSP.g:56:7: ( EQUAL | LESS | GREATER | LTE | GTE )
13788 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13790 + set31=(pANTLR3_COMMON_TOKEN)LT(1);
13791 + if ( LA(1) == EQUAL || ((LA(1) >= LESS) && (LA(1) <= GTE)) )
13794 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set31)));
13795 + PERRORRECOVERY=ANTLR3_FALSE;
13800 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
13801 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
13802 + EXCEPTION->expectingSet = &FOLLOW_set_in_intop0;
13803 + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_intop0); goto ruleintopEx;
13812 + // This is where rules clean up and exit
13814 + goto ruleintopEx; /* Prevent compiler warnings */
13816 + retval.stop = LT(-1);
13818 + retval.stop = LT(-1);
13819 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13820 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13822 + if (HASEXCEPTION())
13826 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13832 +/* $ANTLR end intop */
13835 + * $ANTLR start datecrit
13836 + * RSP.g:63:1: datecrit : FIELD dateop datespec -> ^( dateop FIELD datespec ) ;
13838 +static RSPParser_datecrit_return
13839 +datecrit(pRSPParser ctx)
13841 + RSPParser_datecrit_return retval;
13843 + pANTLR3_BASE_TREE root_0;
13845 + pANTLR3_COMMON_TOKEN FIELD32;
13846 + RSPParser_dateop_return dateop33;
13847 + #undef RETURN_TYPE_dateop33
13848 + #define RETURN_TYPE_dateop33 RSPParser_dateop_return
13850 + RSPParser_datespec_return datespec34;
13851 + #undef RETURN_TYPE_datespec34
13852 + #define RETURN_TYPE_datespec34 RSPParser_datespec_return
13854 + pANTLR3_BASE_TREE FIELD32_tree;
13855 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_FIELD;
13856 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_datespec;
13857 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateop;
13858 + /* Initialize rule variables
13865 + dateop33.tree = NULL;
13867 + datespec34.tree = NULL;
13869 + retval.start = LT(1); retval.stop = retval.start;
13871 + FIELD32_tree = NULL;
13873 + stream_FIELD = NULL;
13874 + #define CREATE_stream_FIELD if (stream_FIELD == NULL) {stream_FIELD = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token FIELD"); }
13875 + stream_datespec = NULL;
13876 + #define CREATE_stream_datespec if (stream_datespec == NULL) {stream_datespec = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule datespec"); }
13877 + stream_dateop = NULL;
13878 + #define CREATE_stream_dateop if (stream_dateop == NULL) {stream_dateop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateop"); }
13880 + retval.tree = NULL;
13882 + // RSP.g:63:9: ( FIELD dateop datespec -> ^( dateop FIELD datespec ) )
13883 + // RSP.g:63:11: FIELD dateop datespec
13885 + FIELD32 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_datecrit292);
13886 + if (HASEXCEPTION())
13888 + goto ruledatecritEx;
13891 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD32, NULL);
13893 + FOLLOWPUSH(FOLLOW_dateop_in_datecrit294);
13894 + dateop33=dateop(ctx);
13897 + if (HASEXCEPTION())
13899 + goto ruledatecritEx;
13902 + CREATE_stream_dateop; stream_dateop->add(stream_dateop, dateop33.tree, NULL);
13903 + FOLLOWPUSH(FOLLOW_datespec_in_datecrit296);
13904 + datespec34=datespec(ctx);
13907 + if (HASEXCEPTION())
13909 + goto ruledatecritEx;
13912 + CREATE_stream_datespec; stream_datespec->add(stream_datespec, datespec34.tree, NULL);
13916 + * elements : datespec, FIELD, dateop
13918 + * rule labels : retval
13919 + * token list labels :
13920 + * rule list labels :
13923 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13925 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13927 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13928 + retval.tree = root_0;
13929 + // 63:34: -> ^( dateop FIELD datespec )
13931 + // RSP.g:63:37: ^( dateop FIELD datespec )
13933 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13934 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_dateop == NULL ? NULL : stream_dateop->nextNode(stream_dateop), root_1));
13936 + ADAPTOR->addChild(ADAPTOR, root_1, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
13937 + ADAPTOR->addChild(ADAPTOR, root_1, stream_datespec == NULL ? NULL : stream_datespec->nextTree(stream_datespec));
13939 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13944 + retval.tree = root_0; // set result root
13945 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13954 + // This is where rules clean up and exit
13956 + goto ruledatecritEx; /* Prevent compiler warnings */
13957 + ruledatecritEx: ;
13958 + retval.stop = LT(-1);
13960 + retval.stop = LT(-1);
13961 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
13962 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
13963 + if (stream_FIELD != NULL) stream_FIELD->free(stream_FIELD);
13964 + if (stream_datespec != NULL) stream_datespec->free(stream_datespec);
13965 + if (stream_dateop != NULL) stream_dateop->free(stream_dateop);
13967 + if (HASEXCEPTION())
13971 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13977 +/* $ANTLR end datecrit */
13980 + * $ANTLR start dateop
13981 + * RSP.g:66:1: dateop : ( BEFORE | AFTER );
13983 +static RSPParser_dateop_return
13984 +dateop(pRSPParser ctx)
13986 + RSPParser_dateop_return retval;
13988 + pANTLR3_BASE_TREE root_0;
13990 + pANTLR3_COMMON_TOKEN set35;
13992 + pANTLR3_BASE_TREE set35_tree;
13994 + /* Initialize rule variables
14001 + retval.start = LT(1); retval.stop = retval.start;
14003 + set35_tree = NULL;
14006 + retval.tree = NULL;
14008 + // RSP.g:66:8: ( BEFORE | AFTER )
14011 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14013 + set35=(pANTLR3_COMMON_TOKEN)LT(1);
14014 + if ( ((LA(1) >= BEFORE) && (LA(1) <= AFTER)) )
14017 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set35)));
14018 + PERRORRECOVERY=ANTLR3_FALSE;
14023 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
14024 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
14025 + EXCEPTION->expectingSet = &FOLLOW_set_in_dateop0;
14026 + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_dateop0); goto ruledateopEx;
14035 + // This is where rules clean up and exit
14037 + goto ruledateopEx; /* Prevent compiler warnings */
14039 + retval.stop = LT(-1);
14041 + retval.stop = LT(-1);
14042 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
14043 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
14045 + if (HASEXCEPTION())
14049 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14055 +/* $ANTLR end dateop */
14058 + * $ANTLR start datespec
14059 + * RSP.g:70:1: datespec : ( dateref | INT dateintval dateop dateref -> ^( dateop dateref INT dateintval ) );
14061 +static RSPParser_datespec_return
14062 +datespec(pRSPParser ctx)
14064 + RSPParser_datespec_return retval;
14066 + pANTLR3_BASE_TREE root_0;
14068 + pANTLR3_COMMON_TOKEN INT37;
14069 + RSPParser_dateref_return dateref36;
14070 + #undef RETURN_TYPE_dateref36
14071 + #define RETURN_TYPE_dateref36 RSPParser_dateref_return
14073 + RSPParser_dateintval_return dateintval38;
14074 + #undef RETURN_TYPE_dateintval38
14075 + #define RETURN_TYPE_dateintval38 RSPParser_dateintval_return
14077 + RSPParser_dateop_return dateop39;
14078 + #undef RETURN_TYPE_dateop39
14079 + #define RETURN_TYPE_dateop39 RSPParser_dateop_return
14081 + RSPParser_dateref_return dateref40;
14082 + #undef RETURN_TYPE_dateref40
14083 + #define RETURN_TYPE_dateref40 RSPParser_dateref_return
14085 + pANTLR3_BASE_TREE INT37_tree;
14086 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_INT;
14087 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateintval;
14088 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateref;
14089 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateop;
14090 + /* Initialize rule variables
14097 + dateref36.tree = NULL;
14099 + dateintval38.tree = NULL;
14101 + dateop39.tree = NULL;
14103 + dateref40.tree = NULL;
14105 + retval.start = LT(1); retval.stop = retval.start;
14107 + INT37_tree = NULL;
14109 + stream_INT = NULL;
14110 + #define CREATE_stream_INT if (stream_INT == NULL) {stream_INT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token INT"); }
14111 + stream_dateintval = NULL;
14112 + #define CREATE_stream_dateintval if (stream_dateintval == NULL) {stream_dateintval = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateintval"); }
14113 + stream_dateref = NULL;
14114 + #define CREATE_stream_dateref if (stream_dateref == NULL) {stream_dateref = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateref"); }
14115 + stream_dateop = NULL;
14116 + #define CREATE_stream_dateop if (stream_dateop == NULL) {stream_dateop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateop"); }
14118 + retval.tree = NULL;
14121 + // RSP.g:70:9: ( dateref | INT dateintval dateop dateref -> ^( dateop dateref INT dateintval ) )
14123 + ANTLR3_UINT32 alt7;
14143 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
14144 + EXCEPTION->message = (void *)"";
14145 + EXCEPTION->decisionNum = 7;
14146 + EXCEPTION->state = 0;
14149 + goto ruledatespecEx;
14155 + // RSP.g:70:11: dateref
14157 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14159 + FOLLOWPUSH(FOLLOW_dateref_in_datespec331);
14160 + dateref36=dateref(ctx);
14163 + if (HASEXCEPTION())
14165 + goto ruledatespecEx;
14168 + ADAPTOR->addChild(ADAPTOR, root_0, dateref36.tree);
14173 + // RSP.g:71:4: INT dateintval dateop dateref
14175 + INT37 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_datespec336);
14176 + if (HASEXCEPTION())
14178 + goto ruledatespecEx;
14181 + CREATE_stream_INT; stream_INT->add(stream_INT, INT37, NULL);
14183 + FOLLOWPUSH(FOLLOW_dateintval_in_datespec338);
14184 + dateintval38=dateintval(ctx);
14187 + if (HASEXCEPTION())
14189 + goto ruledatespecEx;
14192 + CREATE_stream_dateintval; stream_dateintval->add(stream_dateintval, dateintval38.tree, NULL);
14193 + FOLLOWPUSH(FOLLOW_dateop_in_datespec340);
14194 + dateop39=dateop(ctx);
14197 + if (HASEXCEPTION())
14199 + goto ruledatespecEx;
14202 + CREATE_stream_dateop; stream_dateop->add(stream_dateop, dateop39.tree, NULL);
14203 + FOLLOWPUSH(FOLLOW_dateref_in_datespec342);
14204 + dateref40=dateref(ctx);
14207 + if (HASEXCEPTION())
14209 + goto ruledatespecEx;
14212 + CREATE_stream_dateref; stream_dateref->add(stream_dateref, dateref40.tree, NULL);
14216 + * elements : INT, dateintval, dateop, dateref
14218 + * rule labels : retval
14219 + * token list labels :
14220 + * rule list labels :
14223 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
14225 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
14227 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14228 + retval.tree = root_0;
14229 + // 71:34: -> ^( dateop dateref INT dateintval )
14231 + // RSP.g:71:37: ^( dateop dateref INT dateintval )
14233 + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14234 + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_dateop == NULL ? NULL : stream_dateop->nextNode(stream_dateop), root_1));
14236 + ADAPTOR->addChild(ADAPTOR, root_1, stream_dateref == NULL ? NULL : stream_dateref->nextTree(stream_dateref));
14237 + ADAPTOR->addChild(ADAPTOR, root_1, stream_INT == NULL ? NULL : stream_INT->nextNode(stream_INT));
14238 + ADAPTOR->addChild(ADAPTOR, root_1, stream_dateintval == NULL ? NULL : stream_dateintval->nextTree(stream_dateintval));
14240 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
14245 + retval.tree = root_0; // set result root
14246 + if (stream_retval != NULL) stream_retval->free(stream_retval);
14258 + // This is where rules clean up and exit
14260 + goto ruledatespecEx; /* Prevent compiler warnings */
14261 + ruledatespecEx: ;
14262 + retval.stop = LT(-1);
14264 + retval.stop = LT(-1);
14265 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
14266 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
14267 + if (stream_INT != NULL) stream_INT->free(stream_INT);
14268 + if (stream_dateintval != NULL) stream_dateintval->free(stream_dateintval);
14269 + if (stream_dateref != NULL) stream_dateref->free(stream_dateref);
14270 + if (stream_dateop != NULL) stream_dateop->free(stream_dateop);
14272 + if (HASEXCEPTION())
14276 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14282 +/* $ANTLR end datespec */
14285 + * $ANTLR start dateref
14286 + * RSP.g:74:1: dateref : ( DATE | TODAY );
14288 +static RSPParser_dateref_return
14289 +dateref(pRSPParser ctx)
14291 + RSPParser_dateref_return retval;
14293 + pANTLR3_BASE_TREE root_0;
14295 + pANTLR3_COMMON_TOKEN set41;
14297 + pANTLR3_BASE_TREE set41_tree;
14299 + /* Initialize rule variables
14306 + retval.start = LT(1); retval.stop = retval.start;
14308 + set41_tree = NULL;
14311 + retval.tree = NULL;
14313 + // RSP.g:74:9: ( DATE | TODAY )
14316 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14318 + set41=(pANTLR3_COMMON_TOKEN)LT(1);
14319 + if ( ((LA(1) >= DATE) && (LA(1) <= TODAY)) )
14322 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set41)));
14323 + PERRORRECOVERY=ANTLR3_FALSE;
14328 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
14329 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
14330 + EXCEPTION->expectingSet = &FOLLOW_set_in_dateref0;
14331 + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_dateref0); goto ruledaterefEx;
14340 + // This is where rules clean up and exit
14342 + goto ruledaterefEx; /* Prevent compiler warnings */
14344 + retval.stop = LT(-1);
14346 + retval.stop = LT(-1);
14347 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
14348 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
14350 + if (HASEXCEPTION())
14354 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14360 +/* $ANTLR end dateref */
14363 + * $ANTLR start dateintval
14364 + * RSP.g:78:1: dateintval : ( DAY | WEEK | MONTH | YEAR );
14366 +static RSPParser_dateintval_return
14367 +dateintval(pRSPParser ctx)
14369 + RSPParser_dateintval_return retval;
14371 + pANTLR3_BASE_TREE root_0;
14373 + pANTLR3_COMMON_TOKEN set42;
14375 + pANTLR3_BASE_TREE set42_tree;
14377 + /* Initialize rule variables
14384 + retval.start = LT(1); retval.stop = retval.start;
14386 + set42_tree = NULL;
14389 + retval.tree = NULL;
14391 + // RSP.g:79:2: ( DAY | WEEK | MONTH | YEAR )
14394 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14396 + set42=(pANTLR3_COMMON_TOKEN)LT(1);
14397 + if ( ((LA(1) >= DAY) && (LA(1) <= YEAR)) )
14400 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set42)));
14401 + PERRORRECOVERY=ANTLR3_FALSE;
14406 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
14407 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
14408 + EXCEPTION->expectingSet = &FOLLOW_set_in_dateintval0;
14409 + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_dateintval0); goto ruledateintvalEx;
14418 + // This is where rules clean up and exit
14420 + goto ruledateintvalEx; /* Prevent compiler warnings */
14421 + ruledateintvalEx: ;
14422 + retval.stop = LT(-1);
14424 + retval.stop = LT(-1);
14425 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
14426 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
14428 + if (HASEXCEPTION())
14432 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14438 +/* $ANTLR end dateintval */
14439 +/* End of parsing rules
14440 + * ==============================================
14443 +/* ==============================================
14444 + * Syntactic predicates
14446 +/* End of syntactic predicates
14447 + * ==============================================
14456 + * =============================================================================
14458 diff --git a/src/pregen/RSPParser.h b/src/pregen/RSPParser.h
14459 new file mode 100644
14460 index 0000000..4b3bbfe
14462 +++ b/src/pregen/RSPParser.h
14465 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
14467 + * - From the grammar source file : RSP.g
14468 + * - On : 2015-06-27 19:05:18
14469 + * - for the parser : RSPParserParser *
14470 + * Editing it, at least manually, is not wise.
14472 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
14475 + * The parser RSPParser has the callable functions (rules) shown below,
14476 + * which will invoke the code for the associated rule in the source grammar
14477 + * assuming that the input stream is pointing to a token/text stream that could begin
14480 + * For instance if you call the first (topmost) rule in a parser grammar, you will
14481 + * get the results of a full parse, but calling a rule half way through the grammar will
14482 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
14483 + * in editors and so on.
14485 + * The parser entry points are called indirectly (by function pointer to function) via
14486 + * a parser context typedef pRSPParser, which is returned from a call to RSPParserNew().
14488 + * The methods in pRSPParser are as follows:
14490 + * - RSPParser_query_return pRSPParser->query(pRSPParser)
14491 + * - RSPParser_expr_return pRSPParser->expr(pRSPParser)
14492 + * - RSPParser_aexpr_return pRSPParser->aexpr(pRSPParser)
14493 + * - RSPParser_crit_return pRSPParser->crit(pRSPParser)
14494 + * - RSPParser_strcrit_return pRSPParser->strcrit(pRSPParser)
14495 + * - RSPParser_strop_return pRSPParser->strop(pRSPParser)
14496 + * - RSPParser_intcrit_return pRSPParser->intcrit(pRSPParser)
14497 + * - RSPParser_intop_return pRSPParser->intop(pRSPParser)
14498 + * - RSPParser_datecrit_return pRSPParser->datecrit(pRSPParser)
14499 + * - RSPParser_dateop_return pRSPParser->dateop(pRSPParser)
14500 + * - RSPParser_datespec_return pRSPParser->datespec(pRSPParser)
14501 + * - RSPParser_dateref_return pRSPParser->dateref(pRSPParser)
14502 + * - RSPParser_dateintval_return pRSPParser->dateintval(pRSPParser)
14504 + * The return type for any particular rule is of course determined by the source
14507 +// [The "BSD licence"]
14508 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
14509 +// http://www.temporal-wave.com
14510 +// http://www.linkedin.com/in/jimidle
14512 +// All rights reserved.
14514 +// Redistribution and use in source and binary forms, with or without
14515 +// modification, are permitted provided that the following conditions
14517 +// 1. Redistributions of source code must retain the above copyright
14518 +// notice, this list of conditions and the following disclaimer.
14519 +// 2. Redistributions in binary form must reproduce the above copyright
14520 +// notice, this list of conditions and the following disclaimer in the
14521 +// documentation and/or other materials provided with the distribution.
14522 +// 3. The name of the author may not be used to endorse or promote products
14523 +// derived from this software without specific prior written permission.
14525 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14526 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14527 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14528 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
14529 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
14530 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
14531 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
14532 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14533 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
14534 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14536 +#ifndef _RSPParser_H
14537 +#define _RSPParser_H
14538 +/* =============================================================================
14539 + * Standard antlr3 C runtime definitions
14541 +#include <antlr3.h>
14543 +/* End of standard antlr 3 runtime definitions
14544 + * =============================================================================
14547 +#ifdef __cplusplus
14551 +// Forward declare the context typedef so that we can use it before it is
14552 +// properly defined. Delegators and delegates (from import statements) are
14553 +// interdependent and their context structures contain pointers to each other
14554 +// C only allows such things to be declared if you pre-declare the typedef.
14556 +typedef struct RSPParser_Ctx_struct RSPParser, * pRSPParser;
14560 +#ifdef ANTLR3_WINDOWS
14561 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
14562 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
14563 +// initialized but unused variable - tree rewrite variables declared but not needed
14564 +// Unreferenced local variable - lexer rule declares but does not always use _type
14565 +// potentially unitialized variable used - retval always returned from a rule
14566 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
14568 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
14569 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
14570 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
14571 +// this is a matter of orthogonality hence I disable that one.
14573 +#pragma warning( disable : 4100 )
14574 +#pragma warning( disable : 4101 )
14575 +#pragma warning( disable : 4127 )
14576 +#pragma warning( disable : 4189 )
14577 +#pragma warning( disable : 4505 )
14578 +#pragma warning( disable : 4701 )
14580 +typedef struct RSPParser_query_return_struct
14582 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14584 + pANTLR3_COMMON_TOKEN start;
14585 + pANTLR3_COMMON_TOKEN stop;
14586 + pANTLR3_BASE_TREE tree;
14589 + RSPParser_query_return;
14591 +typedef struct RSPParser_expr_return_struct
14593 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14595 + pANTLR3_COMMON_TOKEN start;
14596 + pANTLR3_COMMON_TOKEN stop;
14597 + pANTLR3_BASE_TREE tree;
14600 + RSPParser_expr_return;
14602 +typedef struct RSPParser_aexpr_return_struct
14604 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14606 + pANTLR3_COMMON_TOKEN start;
14607 + pANTLR3_COMMON_TOKEN stop;
14608 + pANTLR3_BASE_TREE tree;
14611 + RSPParser_aexpr_return;
14613 +typedef struct RSPParser_crit_return_struct
14615 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14617 + pANTLR3_COMMON_TOKEN start;
14618 + pANTLR3_COMMON_TOKEN stop;
14619 + pANTLR3_BASE_TREE tree;
14622 + RSPParser_crit_return;
14624 +typedef struct RSPParser_strcrit_return_struct
14626 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14628 + pANTLR3_COMMON_TOKEN start;
14629 + pANTLR3_COMMON_TOKEN stop;
14630 + pANTLR3_BASE_TREE tree;
14633 + RSPParser_strcrit_return;
14635 +typedef struct RSPParser_strop_return_struct
14637 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14639 + pANTLR3_COMMON_TOKEN start;
14640 + pANTLR3_COMMON_TOKEN stop;
14641 + pANTLR3_BASE_TREE tree;
14644 + RSPParser_strop_return;
14646 +typedef struct RSPParser_intcrit_return_struct
14648 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14650 + pANTLR3_COMMON_TOKEN start;
14651 + pANTLR3_COMMON_TOKEN stop;
14652 + pANTLR3_BASE_TREE tree;
14655 + RSPParser_intcrit_return;
14657 +typedef struct RSPParser_intop_return_struct
14659 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14661 + pANTLR3_COMMON_TOKEN start;
14662 + pANTLR3_COMMON_TOKEN stop;
14663 + pANTLR3_BASE_TREE tree;
14666 + RSPParser_intop_return;
14668 +typedef struct RSPParser_datecrit_return_struct
14670 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14672 + pANTLR3_COMMON_TOKEN start;
14673 + pANTLR3_COMMON_TOKEN stop;
14674 + pANTLR3_BASE_TREE tree;
14677 + RSPParser_datecrit_return;
14679 +typedef struct RSPParser_dateop_return_struct
14681 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14683 + pANTLR3_COMMON_TOKEN start;
14684 + pANTLR3_COMMON_TOKEN stop;
14685 + pANTLR3_BASE_TREE tree;
14688 + RSPParser_dateop_return;
14690 +typedef struct RSPParser_datespec_return_struct
14692 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14694 + pANTLR3_COMMON_TOKEN start;
14695 + pANTLR3_COMMON_TOKEN stop;
14696 + pANTLR3_BASE_TREE tree;
14699 + RSPParser_datespec_return;
14701 +typedef struct RSPParser_dateref_return_struct
14703 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14705 + pANTLR3_COMMON_TOKEN start;
14706 + pANTLR3_COMMON_TOKEN stop;
14707 + pANTLR3_BASE_TREE tree;
14710 + RSPParser_dateref_return;
14712 +typedef struct RSPParser_dateintval_return_struct
14714 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14716 + pANTLR3_COMMON_TOKEN start;
14717 + pANTLR3_COMMON_TOKEN stop;
14718 + pANTLR3_BASE_TREE tree;
14721 + RSPParser_dateintval_return;
14725 +/** Context tracking structure for RSPParser
14727 +struct RSPParser_Ctx_struct
14729 + /** Built in ANTLR3 context tracker contains all the generic elements
14730 + * required for context tracking.
14732 + pANTLR3_PARSER pParser;
14735 + RSPParser_query_return (*query) (struct RSPParser_Ctx_struct * ctx);
14736 + RSPParser_expr_return (*expr) (struct RSPParser_Ctx_struct * ctx);
14737 + RSPParser_aexpr_return (*aexpr) (struct RSPParser_Ctx_struct * ctx);
14738 + RSPParser_crit_return (*crit) (struct RSPParser_Ctx_struct * ctx);
14739 + RSPParser_strcrit_return (*strcrit) (struct RSPParser_Ctx_struct * ctx);
14740 + RSPParser_strop_return (*strop) (struct RSPParser_Ctx_struct * ctx);
14741 + RSPParser_intcrit_return (*intcrit) (struct RSPParser_Ctx_struct * ctx);
14742 + RSPParser_intop_return (*intop) (struct RSPParser_Ctx_struct * ctx);
14743 + RSPParser_datecrit_return (*datecrit) (struct RSPParser_Ctx_struct * ctx);
14744 + RSPParser_dateop_return (*dateop) (struct RSPParser_Ctx_struct * ctx);
14745 + RSPParser_datespec_return (*datespec) (struct RSPParser_Ctx_struct * ctx);
14746 + RSPParser_dateref_return (*dateref) (struct RSPParser_Ctx_struct * ctx);
14747 + RSPParser_dateintval_return (*dateintval) (struct RSPParser_Ctx_struct * ctx);
14748 + // Delegated rules
14749 + const char * (*getGrammarFileName)();
14750 + void (*free) (struct RSPParser_Ctx_struct * ctx);
14751 + /* @headerFile.members() */
14752 + pANTLR3_BASE_TREE_ADAPTOR adaptor;
14753 + pANTLR3_VECTOR_FACTORY vectors;
14754 + /* End @headerFile.members() */
14757 +// Function protoypes for the constructor functions that external translation units
14758 +// such as delegators and delegates may wish to call.
14760 +ANTLR3_API pRSPParser RSPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream);
14761 +ANTLR3_API pRSPParser RSPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
14763 +/** Symbolic definitions of all the tokens that the parser will work with.
14766 + * Antlr will define EOF, but we can't use that as it it is too common in
14767 + * in C header files and that would be confusing. There is no way to filter this out at the moment
14768 + * so we just undef it here for now. That isn't the value we get back from C recognizers
14769 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
14777 +#define STARTSW 14
14792 +#define DIGIT19 31
14793 +#define INCLUDES 13
14797 +#define GREATER 18
14805 +#define ESCAPED 33
14807 +#define DIGIT09 32
14810 +#define EOF ANTLR3_TOKEN_EOF
14813 +#ifndef TOKENSOURCE
14814 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
14817 +/* End of token definitions for RSPParser
14818 + * =============================================================================
14822 +#ifdef __cplusplus
14828 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
14829 diff --git a/src/pregen/SMARTPL.u b/src/pregen/SMARTPL.u
14830 new file mode 100644
14831 index 0000000..2a66bf3
14833 +++ b/src/pregen/SMARTPL.u
14835 +SMARTPLParser.c : SMARTPL.g
14836 +./SMARTPL.tokens : SMARTPL.g
14837 +SMARTPLParser.h : SMARTPL.g
14838 +SMARTPLLexer.c : SMARTPL.g
14839 +SMARTPLLexer.h : SMARTPL.g
14840 +ANTLR_PRODUCTS += SMARTPLParser.c ./SMARTPL.tokens SMARTPLParser.h SMARTPLLexer.c SMARTPLLexer.h
14841 \ No newline at end of file
14842 diff --git a/src/pregen/SMARTPL2SQL.c b/src/pregen/SMARTPL2SQL.c
14843 new file mode 100644
14844 index 0000000..c435f37
14846 +++ b/src/pregen/SMARTPL2SQL.c
14849 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
14851 + * - From the grammar source file : SMARTPL2SQL.g
14852 + * - On : 2015-06-27 19:05:21
14853 + * - for the tree parser : SMARTPL2SQLTreeParser *
14854 + * Editing it, at least manually, is not wise.
14856 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
14860 +// [The "BSD licence"]
14861 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
14862 +// http://www.temporal-wave.com
14863 +// http://www.linkedin.com/in/jimidle
14865 +// All rights reserved.
14867 +// Redistribution and use in source and binary forms, with or without
14868 +// modification, are permitted provided that the following conditions
14870 +// 1. Redistributions of source code must retain the above copyright
14871 +// notice, this list of conditions and the following disclaimer.
14872 +// 2. Redistributions in binary form must reproduce the above copyright
14873 +// notice, this list of conditions and the following disclaimer in the
14874 +// documentation and/or other materials provided with the distribution.
14875 +// 3. The name of the author may not be used to endorse or promote products
14876 +// derived from this software without specific prior written permission.
14878 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14879 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14880 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14881 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
14882 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
14883 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
14884 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
14885 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14886 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
14887 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14890 +/* =============================================================================
14891 + * This is what the grammar programmer asked us to put at the top of every file.
14894 + #include <stdio.h>
14895 + #include <stdlib.h>
14896 + #include <string.h>
14897 + #include <limits.h>
14898 + #include <errno.h>
14899 + #include <time.h>
14900 + #include <sqlite3.h>
14902 + #include "logger.h"
14905 +/* End of Header action.
14906 + * =============================================================================
14908 +/* -----------------------------------------
14909 + * Include the ANTLR3 generated header file.
14911 +#include "SMARTPL2SQL.h"
14912 +/* ----------------------------------------- */
14918 +/* MACROS that hide the C interface implementations from the
14919 + * generated code, which makes it a little more understandable to the human eye.
14920 + * I am very much against using C pre-processor macros for function calls and bits
14921 + * of code as you cannot see what is happening when single stepping in debuggers
14922 + * and so on. The exception (in my book at least) is for generated code, where you are
14923 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
14924 + * hides some indirect calls, but is always referring to the input stream. This is
14925 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
14926 + * the runtime interfaces without changing the generated code too often, without
14927 + * confusing the reader of the generated output, who may not wish to know the gory
14928 + * details of the interface inheritance.
14933 +/* Aids in accessing scopes for grammar programmers
14936 +#undef SCOPE_STACK
14938 +#define SCOPE_TYPE(scope) pSMARTPL2SQL_##scope##_SCOPE
14939 +#define SCOPE_STACK(scope) pSMARTPL2SQL_##scope##Stack
14940 +#define SCOPE_TOP(scope) ctx->pSMARTPL2SQL_##scope##Top
14941 +#define SCOPE_SIZE(scope) ctx->pSMARTPL2SQL_##scope##Stack_limit
14942 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
14944 +/* Macros for accessing things in the parser
14949 +#undef HAVEPARSEDRULE
14952 +#undef HASEXCEPTION
14956 +#undef FOLLOWSTACK
14960 +#undef PREPORTERROR
14963 +#undef CONSTRUCTEX
14968 +#undef PERRORRECOVERY
14971 +#undef RECOVERFROMMISMATCHEDSET
14972 +#undef RECOVERFROMMISMATCHEDELEMENT
14973 +#undef BACKTRACKING
14980 +#define PARSER ctx->pTreeParser
14981 +#define RECOGNIZER PARSER->rec
14982 +#define PSRSTATE RECOGNIZER->state
14983 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
14984 +#define INPUT PARSER->ctnstream
14985 +#define ISTREAM INPUT->tnstream->istream
14986 +#define STRSTREAM INPUT->tnstream
14987 +#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE)
14988 +#define EXCEPTION PSRSTATE->exception
14989 +#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs)
14990 +#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER)
14991 +#define FOLLOWSTACK PSRSTATE->following
14992 +#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
14993 +#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK)
14994 +#define PRECOVER() RECOGNIZER->recover(RECOGNIZER)
14995 +#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER)
14996 +#define LA(n) ISTREAM->_LA(ISTREAM, n)
14997 +#define LT(n) INPUT->tnstream->_LT(INPUT->tnstream, n)
14998 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
14999 +#define CONSUME() ISTREAM->consume(ISTREAM)
15000 +#define MARK() ISTREAM->mark(ISTREAM)
15001 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
15002 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
15003 +#define PERRORRECOVERY PSRSTATE->errorRecovery
15004 +#define FAILEDFLAG PSRSTATE->failed
15005 +#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE)
15006 +#define BACKTRACKING PSRSTATE->backtracking
15007 +#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
15008 +#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
15009 +#define ADAPTOR INPUT->adaptor
15010 +#define RULEMEMO PSRSTATE->ruleMemo
15011 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
15012 +#define INDEX() ISTREAM->index(ISTREAM)
15013 +#define DBG RECOGNIZER->debugger
15016 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
15018 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
15019 + * then for the present you must use different names for your defines as these are hard coded
15020 + * in the code generator. It would be better not to use such names internally, and maybe
15021 + * we can change this in a forthcoming release. I deliberately do not #undef these
15022 + * here as this will at least give you a redefined error somewhere if they clash.
15024 +#define UP ANTLR3_TOKEN_UP
15025 +#define DOWN ANTLR3_TOKEN_DOWN
15026 +#define EOR ANTLR3_TOKEN_EOR
15027 +#define INVALID ANTLR3_TOKEN_INVALID
15030 +/* =============================================================================
15031 + * Functions to create and destroy scopes. First come the rule scopes, followed
15032 + * by the global declared scopes.
15037 +/* ============================================================================= */
15039 +/* =============================================================================
15040 + * Start of recognizer
15045 +/** \brief Table of all token names in symbolic order, mainly used for
15046 + * error reporting.
15048 +pANTLR3_UINT8 SMARTPL2SQLTokenNames[28+4]
15050 + (pANTLR3_UINT8) "<invalid>", /* String to print to indicate an invalid token */
15051 + (pANTLR3_UINT8) "<EOR>",
15052 + (pANTLR3_UINT8) "<DOWN>",
15053 + (pANTLR3_UINT8) "<UP>",
15054 + (pANTLR3_UINT8) "STR",
15055 + (pANTLR3_UINT8) "OR",
15056 + (pANTLR3_UINT8) "AND",
15057 + (pANTLR3_UINT8) "NOT",
15058 + (pANTLR3_UINT8) "LPAR",
15059 + (pANTLR3_UINT8) "RPAR",
15060 + (pANTLR3_UINT8) "STRTAG",
15061 + (pANTLR3_UINT8) "INCLUDES",
15062 + (pANTLR3_UINT8) "IS",
15063 + (pANTLR3_UINT8) "INTTAG",
15064 + (pANTLR3_UINT8) "INTBOOL",
15065 + (pANTLR3_UINT8) "INT",
15066 + (pANTLR3_UINT8) "DATETAG",
15067 + (pANTLR3_UINT8) "AFTER",
15068 + (pANTLR3_UINT8) "BEFORE",
15069 + (pANTLR3_UINT8) "ENUMTAG",
15070 + (pANTLR3_UINT8) "ENUMVAL",
15071 + (pANTLR3_UINT8) "DATE",
15072 + (pANTLR3_UINT8) "AGO",
15073 + (pANTLR3_UINT8) "DATINTERVAL",
15074 + (pANTLR3_UINT8) "GREATER",
15075 + (pANTLR3_UINT8) "GREATEREQUAL",
15076 + (pANTLR3_UINT8) "LESS",
15077 + (pANTLR3_UINT8) "LESSEQUAL",
15078 + (pANTLR3_UINT8) "EQUAL",
15079 + (pANTLR3_UINT8) "WHITESPACE",
15080 + (pANTLR3_UINT8) "'{'",
15081 + (pANTLR3_UINT8) "'}'"
15086 +// Forward declare the locally static matching functions we have generated.
15088 +static SMARTPL2SQL_playlist_return playlist (pSMARTPL2SQL ctx);
15089 +static pANTLR3_STRING expression (pSMARTPL2SQL ctx);
15090 +static int dateval (pSMARTPL2SQL ctx);
15091 +static int interval (pSMARTPL2SQL ctx);
15092 +static void SMARTPL2SQLFree(pSMARTPL2SQL ctx);
15093 +/* For use in tree output where we are accumulating rule labels via label += ruleRef
15094 + * we need a function that knows how to free a return scope when the list is destroyed.
15095 + * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
15097 +static void ANTLR3_CDECL freeScope(void * scope)
15099 + ANTLR3_FREE(scope);
15102 +/** \brief Name of the grammar file that generated this code
15104 +static const char fileName[] = "SMARTPL2SQL.g";
15106 +/** \brief Return the name of the grammar file that generated this code.
15108 +static const char * getGrammarFileName()
15112 +/** \brief Create a new SMARTPL2SQL parser and return a context for it.
15114 + * \param[in] instream Pointer to an input stream interface.
15116 + * \return Pointer to new parser context upon success.
15118 +ANTLR3_API pSMARTPL2SQL
15119 +SMARTPL2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream)
15121 + // See if we can create a new parser with the standard constructor
15123 + return SMARTPL2SQLNewSSD(instream, NULL);
15126 +/** \brief Create a new SMARTPL2SQL parser and return a context for it.
15128 + * \param[in] instream Pointer to an input stream interface.
15130 + * \return Pointer to new parser context upon success.
15132 +ANTLR3_API pSMARTPL2SQL
15133 +SMARTPL2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
15135 + pSMARTPL2SQL ctx; /* Context structure we will build and return */
15137 + ctx = (pSMARTPL2SQL) ANTLR3_CALLOC(1, sizeof(SMARTPL2SQL));
15141 + // Failed to allocate memory for parser context
15146 + /* -------------------------------------------------------------------
15147 + * Memory for basic structure is allocated, now to fill in
15148 + * the base ANTLR3 structures. We initialize the function pointers
15149 + * for the standard ANTLR3 parser function set, but upon return
15150 + * from here, the programmer may set the pointers to provide custom
15151 + * implementations of each function.
15153 + * We don't use the macros defined in SMARTPL2SQL.h here, in order that you can get a sense
15154 + * of what goes where.
15157 + /* Create a base Tree parser/recognizer, using the supplied tree node stream
15159 + ctx->pTreeParser = antlr3TreeParserNewStream(ANTLR3_SIZE_HINT, instream, state);
15160 + /* Install the implementation of our SMARTPL2SQL interface
15162 + ctx->playlist = playlist;
15163 + ctx->expression = expression;
15164 + ctx->dateval = dateval;
15165 + ctx->interval = interval;
15166 + ctx->free = SMARTPL2SQLFree;
15167 + ctx->getGrammarFileName = getGrammarFileName;
15169 + /* Install the scope pushing methods.
15176 + /* Install the token table
15178 + PSRSTATE->tokenNames = SMARTPL2SQLTokenNames;
15181 + /* Return the newly built parser to the caller
15186 +/** Free the parser resources
15189 + SMARTPL2SQLFree(pSMARTPL2SQL ctx)
15191 + /* Free any scope memory
15195 + // Free this parser
15197 + ctx->pTreeParser->free(ctx->pTreeParser);
15198 + ANTLR3_FREE(ctx);
15200 + /* Everything is released, so we can return
15205 +/** Return token names used by this tree parser
15207 + * The returned pointer is used as an index into the token names table (using the token
15208 + * number as the index).
15210 + * \return Pointer to first char * in the table.
15212 +static pANTLR3_UINT8 *getTokenNames()
15214 + return SMARTPL2SQLTokenNames;
15220 +/* Declare the bitsets
15223 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_playlist66 */
15224 +static ANTLR3_BITWORD FOLLOW_STR_in_playlist66_bits[] = { ANTLR3_UINT64_LIT(0x0000000040000000) };
15225 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_playlist66 = { FOLLOW_STR_in_playlist66_bits, 1 };
15226 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_30_in_playlist68 */
15227 +static ANTLR3_BITWORD FOLLOW_30_in_playlist68_bits[] = { ANTLR3_UINT64_LIT(0x00000000000924E0) };
15228 +static ANTLR3_BITSET_LIST FOLLOW_30_in_playlist68 = { FOLLOW_30_in_playlist68_bits, 1 };
15229 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_playlist74 */
15230 +static ANTLR3_BITWORD FOLLOW_expression_in_playlist74_bits[] = { ANTLR3_UINT64_LIT(0x0000000080000000) };
15231 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_playlist74 = { FOLLOW_expression_in_playlist74_bits, 1 };
15232 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_31_in_playlist76 */
15233 +static ANTLR3_BITWORD FOLLOW_31_in_playlist76_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15234 +static ANTLR3_BITSET_LIST FOLLOW_31_in_playlist76 = { FOLLOW_31_in_playlist76_bits, 1 };
15235 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_expression101 */
15236 +static ANTLR3_BITWORD FOLLOW_NOT_in_expression101_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
15237 +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_expression101 = { FOLLOW_NOT_in_expression101_bits, 1 };
15238 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression107 */
15239 +static ANTLR3_BITWORD FOLLOW_expression_in_expression107_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
15240 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression107 = { FOLLOW_expression_in_expression107_bits, 1 };
15241 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_expression118 */
15242 +static ANTLR3_BITWORD FOLLOW_AND_in_expression118_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
15243 +static ANTLR3_BITSET_LIST FOLLOW_AND_in_expression118 = { FOLLOW_AND_in_expression118_bits, 1 };
15244 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression124 */
15245 +static ANTLR3_BITWORD FOLLOW_expression_in_expression124_bits[] = { ANTLR3_UINT64_LIT(0x00000000000924E0) };
15246 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression124 = { FOLLOW_expression_in_expression124_bits, 1 };
15247 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression130 */
15248 +static ANTLR3_BITWORD FOLLOW_expression_in_expression130_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
15249 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression130 = { FOLLOW_expression_in_expression130_bits, 1 };
15250 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expression141 */
15251 +static ANTLR3_BITWORD FOLLOW_OR_in_expression141_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
15252 +static ANTLR3_BITSET_LIST FOLLOW_OR_in_expression141 = { FOLLOW_OR_in_expression141_bits, 1 };
15253 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression147 */
15254 +static ANTLR3_BITWORD FOLLOW_expression_in_expression147_bits[] = { ANTLR3_UINT64_LIT(0x00000000000924E0) };
15255 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression147 = { FOLLOW_expression_in_expression147_bits, 1 };
15256 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression153 */
15257 +static ANTLR3_BITWORD FOLLOW_expression_in_expression153_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
15258 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression153 = { FOLLOW_expression_in_expression153_bits, 1 };
15259 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STRTAG_in_expression163 */
15260 +static ANTLR3_BITWORD FOLLOW_STRTAG_in_expression163_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000800) };
15261 +static ANTLR3_BITSET_LIST FOLLOW_STRTAG_in_expression163 = { FOLLOW_STRTAG_in_expression163_bits, 1 };
15262 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INCLUDES_in_expression165 */
15263 +static ANTLR3_BITWORD FOLLOW_INCLUDES_in_expression165_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) };
15264 +static ANTLR3_BITSET_LIST FOLLOW_INCLUDES_in_expression165 = { FOLLOW_INCLUDES_in_expression165_bits, 1 };
15265 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_expression167 */
15266 +static ANTLR3_BITWORD FOLLOW_STR_in_expression167_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15267 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_expression167 = { FOLLOW_STR_in_expression167_bits, 1 };
15268 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STRTAG_in_expression176 */
15269 +static ANTLR3_BITWORD FOLLOW_STRTAG_in_expression176_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001000) };
15270 +static ANTLR3_BITSET_LIST FOLLOW_STRTAG_in_expression176 = { FOLLOW_STRTAG_in_expression176_bits, 1 };
15271 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_IS_in_expression178 */
15272 +static ANTLR3_BITWORD FOLLOW_IS_in_expression178_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) };
15273 +static ANTLR3_BITSET_LIST FOLLOW_IS_in_expression178 = { FOLLOW_IS_in_expression178_bits, 1 };
15274 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_expression180 */
15275 +static ANTLR3_BITWORD FOLLOW_STR_in_expression180_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15276 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_expression180 = { FOLLOW_STR_in_expression180_bits, 1 };
15277 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTTAG_in_expression189 */
15278 +static ANTLR3_BITWORD FOLLOW_INTTAG_in_expression189_bits[] = { ANTLR3_UINT64_LIT(0x0000000000004000) };
15279 +static ANTLR3_BITSET_LIST FOLLOW_INTTAG_in_expression189 = { FOLLOW_INTTAG_in_expression189_bits, 1 };
15280 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTBOOL_in_expression191 */
15281 +static ANTLR3_BITWORD FOLLOW_INTBOOL_in_expression191_bits[] = { ANTLR3_UINT64_LIT(0x0000000000008000) };
15282 +static ANTLR3_BITSET_LIST FOLLOW_INTBOOL_in_expression191 = { FOLLOW_INTBOOL_in_expression191_bits, 1 };
15283 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_expression193 */
15284 +static ANTLR3_BITWORD FOLLOW_INT_in_expression193_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15285 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_expression193 = { FOLLOW_INT_in_expression193_bits, 1 };
15286 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATETAG_in_expression202 */
15287 +static ANTLR3_BITWORD FOLLOW_DATETAG_in_expression202_bits[] = { ANTLR3_UINT64_LIT(0x0000000000020000) };
15288 +static ANTLR3_BITSET_LIST FOLLOW_DATETAG_in_expression202 = { FOLLOW_DATETAG_in_expression202_bits, 1 };
15289 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_expression204 */
15290 +static ANTLR3_BITWORD FOLLOW_AFTER_in_expression204_bits[] = { ANTLR3_UINT64_LIT(0x0000000000208000) };
15291 +static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_expression204 = { FOLLOW_AFTER_in_expression204_bits, 1 };
15292 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateval_in_expression206 */
15293 +static ANTLR3_BITWORD FOLLOW_dateval_in_expression206_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15294 +static ANTLR3_BITSET_LIST FOLLOW_dateval_in_expression206 = { FOLLOW_dateval_in_expression206_bits, 1 };
15295 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATETAG_in_expression215 */
15296 +static ANTLR3_BITWORD FOLLOW_DATETAG_in_expression215_bits[] = { ANTLR3_UINT64_LIT(0x0000000000040000) };
15297 +static ANTLR3_BITSET_LIST FOLLOW_DATETAG_in_expression215 = { FOLLOW_DATETAG_in_expression215_bits, 1 };
15298 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_expression217 */
15299 +static ANTLR3_BITWORD FOLLOW_BEFORE_in_expression217_bits[] = { ANTLR3_UINT64_LIT(0x0000000000208000) };
15300 +static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_expression217 = { FOLLOW_BEFORE_in_expression217_bits, 1 };
15301 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateval_in_expression219 */
15302 +static ANTLR3_BITWORD FOLLOW_dateval_in_expression219_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15303 +static ANTLR3_BITSET_LIST FOLLOW_dateval_in_expression219 = { FOLLOW_dateval_in_expression219_bits, 1 };
15304 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMTAG_in_expression228 */
15305 +static ANTLR3_BITWORD FOLLOW_ENUMTAG_in_expression228_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001000) };
15306 +static ANTLR3_BITSET_LIST FOLLOW_ENUMTAG_in_expression228 = { FOLLOW_ENUMTAG_in_expression228_bits, 1 };
15307 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_IS_in_expression230 */
15308 +static ANTLR3_BITWORD FOLLOW_IS_in_expression230_bits[] = { ANTLR3_UINT64_LIT(0x0000000000100000) };
15309 +static ANTLR3_BITSET_LIST FOLLOW_IS_in_expression230 = { FOLLOW_IS_in_expression230_bits, 1 };
15310 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMVAL_in_expression232 */
15311 +static ANTLR3_BITWORD FOLLOW_ENUMVAL_in_expression232_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15312 +static ANTLR3_BITSET_LIST FOLLOW_ENUMVAL_in_expression232 = { FOLLOW_ENUMVAL_in_expression232_bits, 1 };
15313 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval257 */
15314 +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval257_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15315 +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval257 = { FOLLOW_DATE_in_dateval257_bits, 1 };
15316 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval266 */
15317 +static ANTLR3_BITWORD FOLLOW_interval_in_dateval266_bits[] = { ANTLR3_UINT64_LIT(0x0000000000040000) };
15318 +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval266 = { FOLLOW_interval_in_dateval266_bits, 1 };
15319 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateval268 */
15320 +static ANTLR3_BITWORD FOLLOW_BEFORE_in_dateval268_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) };
15321 +static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateval268 = { FOLLOW_BEFORE_in_dateval268_bits, 1 };
15322 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval270 */
15323 +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval270_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15324 +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval270 = { FOLLOW_DATE_in_dateval270_bits, 1 };
15325 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval279 */
15326 +static ANTLR3_BITWORD FOLLOW_interval_in_dateval279_bits[] = { ANTLR3_UINT64_LIT(0x0000000000020000) };
15327 +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval279 = { FOLLOW_interval_in_dateval279_bits, 1 };
15328 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateval281 */
15329 +static ANTLR3_BITWORD FOLLOW_AFTER_in_dateval281_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) };
15330 +static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateval281 = { FOLLOW_AFTER_in_dateval281_bits, 1 };
15331 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval283 */
15332 +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval283_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15333 +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval283 = { FOLLOW_DATE_in_dateval283_bits, 1 };
15334 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval292 */
15335 +static ANTLR3_BITWORD FOLLOW_interval_in_dateval292_bits[] = { ANTLR3_UINT64_LIT(0x0000000000400000) };
15336 +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval292 = { FOLLOW_interval_in_dateval292_bits, 1 };
15337 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AGO_in_dateval294 */
15338 +static ANTLR3_BITWORD FOLLOW_AGO_in_dateval294_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15339 +static ANTLR3_BITSET_LIST FOLLOW_AGO_in_dateval294 = { FOLLOW_AGO_in_dateval294_bits, 1 };
15340 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_interval318 */
15341 +static ANTLR3_BITWORD FOLLOW_INT_in_interval318_bits[] = { ANTLR3_UINT64_LIT(0x0000000000800000) };
15342 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_interval318 = { FOLLOW_INT_in_interval318_bits, 1 };
15343 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATINTERVAL_in_interval320 */
15344 +static ANTLR3_BITWORD FOLLOW_DATINTERVAL_in_interval320_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
15345 +static ANTLR3_BITSET_LIST FOLLOW_DATINTERVAL_in_interval320 = { FOLLOW_DATINTERVAL_in_interval320_bits, 1 };
15350 +/* ==============================================
15354 + * $ANTLR start playlist
15355 + * SMARTPL2SQL.g:43:1: playlist returns [ pANTLR3_STRING title, pANTLR3_STRING query ] : STR '{' e= expression '}' ;
15357 +static SMARTPL2SQL_playlist_return
15358 +playlist(pSMARTPL2SQL ctx)
15360 + SMARTPL2SQL_playlist_return retval;
15362 + pANTLR3_BASE_TREE STR1;
15363 + pANTLR3_STRING e;
15364 + #undef RETURN_TYPE_e
15365 + #define RETURN_TYPE_e pANTLR3_STRING
15367 + /* Initialize rule variables
15371 + retval.title= NULL; retval.query= NULL;
15374 + retval.start = LT(1); retval.stop = retval.start;
15377 + // SMARTPL2SQL.g:45:2: ( STR '{' e= expression '}' )
15378 + // SMARTPL2SQL.g:45:4: STR '{' e= expression '}'
15380 + STR1 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_playlist66);
15381 + if (HASEXCEPTION())
15383 + goto ruleplaylistEx;
15386 + MATCHT(30, &FOLLOW_30_in_playlist68);
15387 + if (HASEXCEPTION())
15389 + goto ruleplaylistEx;
15392 + FOLLOWPUSH(FOLLOW_expression_in_playlist74);
15393 + e=expression(ctx);
15396 + if (HASEXCEPTION())
15398 + goto ruleplaylistEx;
15401 + MATCHT(31, &FOLLOW_31_in_playlist76);
15402 + if (HASEXCEPTION())
15404 + goto ruleplaylistEx;
15409 + pANTLR3_UINT8 val;
15410 + val = (STR1->getText(STR1))->toUTF8((STR1->getText(STR1)))->chars;
15412 + val[strlen((const char *)val) - 1] = '\0';
15414 + retval.title= (STR1->getText(STR1))->factory->newRaw((STR1->getText(STR1))->factory);
15415 + retval.title->append8(retval.title, (const char *)val);
15417 + retval.query= e->factory->newRaw(e->factory);
15418 + retval.query->append8(retval.query, "(");
15419 + retval.query->appendS(retval.query, e);
15420 + retval.query->append8(retval.query, ")");
15429 + // This is where rules clean up and exit
15431 + goto ruleplaylistEx; /* Prevent compiler warnings */
15432 + ruleplaylistEx: ;
15434 + if (HASEXCEPTION())
15443 +/* $ANTLR end playlist */
15446 + * $ANTLR start expression
15447 + * 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 );
15449 +static pANTLR3_STRING
15450 +expression(pSMARTPL2SQL ctx)
15452 + pANTLR3_STRING result = NULL;
15454 + pANTLR3_BASE_TREE STR2;
15455 + pANTLR3_BASE_TREE STRTAG3;
15456 + pANTLR3_BASE_TREE STR4;
15457 + pANTLR3_BASE_TREE STRTAG5;
15458 + pANTLR3_BASE_TREE INTTAG6;
15459 + pANTLR3_BASE_TREE INTBOOL7;
15460 + pANTLR3_BASE_TREE INT8;
15461 + pANTLR3_BASE_TREE DATETAG10;
15462 + pANTLR3_BASE_TREE DATETAG12;
15463 + pANTLR3_BASE_TREE ENUMTAG13;
15464 + pANTLR3_BASE_TREE ENUMVAL14;
15465 + pANTLR3_STRING a;
15466 + #undef RETURN_TYPE_a
15467 + #define RETURN_TYPE_a pANTLR3_STRING
15469 + pANTLR3_STRING b;
15470 + #undef RETURN_TYPE_b
15471 + #define RETURN_TYPE_b pANTLR3_STRING
15474 + #undef RETURN_TYPE_dateval9
15475 + #define RETURN_TYPE_dateval9 int
15478 + #undef RETURN_TYPE_dateval11
15479 + #define RETURN_TYPE_dateval11 int
15481 + /* Initialize rule variables
15493 + DATETAG10 = NULL;
15494 + DATETAG12 = NULL;
15495 + ENUMTAG13 = NULL;
15496 + ENUMVAL14 = NULL;
15504 + // 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 )
15506 + ANTLR3_UINT32 alt1;
15544 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
15545 + EXCEPTION->message = (void *)"";
15546 + EXCEPTION->decisionNum = 1;
15547 + EXCEPTION->state = 4;
15550 + goto ruleexpressionEx;
15577 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
15578 + EXCEPTION->message = (void *)"";
15579 + EXCEPTION->decisionNum = 1;
15580 + EXCEPTION->state = 6;
15583 + goto ruleexpressionEx;
15596 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
15597 + EXCEPTION->message = (void *)"";
15598 + EXCEPTION->decisionNum = 1;
15599 + EXCEPTION->state = 0;
15602 + goto ruleexpressionEx;
15608 + // SMARTPL2SQL.g:64:4: ^( NOT a= expression )
15610 + MATCHT(NOT, &FOLLOW_NOT_in_expression101);
15611 + if (HASEXCEPTION())
15613 + goto ruleexpressionEx;
15617 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
15618 + if (HASEXCEPTION())
15620 + goto ruleexpressionEx;
15623 + FOLLOWPUSH(FOLLOW_expression_in_expression107);
15624 + a=expression(ctx);
15627 + if (HASEXCEPTION())
15629 + goto ruleexpressionEx;
15633 + MATCHT(ANTLR3_TOKEN_UP, NULL);
15634 + if (HASEXCEPTION())
15636 + goto ruleexpressionEx;
15641 + result= a->factory->newRaw(a->factory);
15642 + result->append8(result, "NOT(");
15643 + result->appendS(result, a);
15644 + result->append8(result, ")");
15651 + // SMARTPL2SQL.g:71:4: ^( AND a= expression b= expression )
15653 + MATCHT(AND, &FOLLOW_AND_in_expression118);
15654 + if (HASEXCEPTION())
15656 + goto ruleexpressionEx;
15660 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
15661 + if (HASEXCEPTION())
15663 + goto ruleexpressionEx;
15666 + FOLLOWPUSH(FOLLOW_expression_in_expression124);
15667 + a=expression(ctx);
15670 + if (HASEXCEPTION())
15672 + goto ruleexpressionEx;
15675 + FOLLOWPUSH(FOLLOW_expression_in_expression130);
15676 + b=expression(ctx);
15679 + if (HASEXCEPTION())
15681 + goto ruleexpressionEx;
15685 + MATCHT(ANTLR3_TOKEN_UP, NULL);
15686 + if (HASEXCEPTION())
15688 + goto ruleexpressionEx;
15693 + result= a->factory->newRaw(a->factory);
15694 + result->append8(result, "(");
15695 + result->appendS(result, a);
15696 + result->append8(result, " AND ");
15697 + result->appendS(result, b);
15698 + result->append8(result, ")");
15705 + // SMARTPL2SQL.g:80:4: ^( OR a= expression b= expression )
15707 + MATCHT(OR, &FOLLOW_OR_in_expression141);
15708 + if (HASEXCEPTION())
15710 + goto ruleexpressionEx;
15714 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
15715 + if (HASEXCEPTION())
15717 + goto ruleexpressionEx;
15720 + FOLLOWPUSH(FOLLOW_expression_in_expression147);
15721 + a=expression(ctx);
15724 + if (HASEXCEPTION())
15726 + goto ruleexpressionEx;
15729 + FOLLOWPUSH(FOLLOW_expression_in_expression153);
15730 + b=expression(ctx);
15733 + if (HASEXCEPTION())
15735 + goto ruleexpressionEx;
15739 + MATCHT(ANTLR3_TOKEN_UP, NULL);
15740 + if (HASEXCEPTION())
15742 + goto ruleexpressionEx;
15747 + result= a->factory->newRaw(a->factory);
15748 + result->append8(result, "(");
15749 + result->appendS(result, a);
15750 + result->append8(result, " OR ");
15751 + result->appendS(result, b);
15752 + result->append8(result, ")");
15759 + // SMARTPL2SQL.g:89:4: STRTAG INCLUDES STR
15761 + STRTAG3 = (pANTLR3_BASE_TREE) MATCHT(STRTAG, &FOLLOW_STRTAG_in_expression163);
15762 + if (HASEXCEPTION())
15764 + goto ruleexpressionEx;
15767 + MATCHT(INCLUDES, &FOLLOW_INCLUDES_in_expression165);
15768 + if (HASEXCEPTION())
15770 + goto ruleexpressionEx;
15773 + STR2 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expression167);
15774 + if (HASEXCEPTION())
15776 + goto ruleexpressionEx;
15781 + pANTLR3_UINT8 val;
15782 + val = (STR2->getText(STR2))->toUTF8((STR2->getText(STR2)))->chars;
15784 + val[strlen((const char *)val) - 1] = '\0';
15786 + result= (STR2->getText(STR2))->factory->newRaw((STR2->getText(STR2))->factory);
15787 + result->append8(result, "f.");
15788 + result->appendS(result, (STRTAG3->getText(STRTAG3))->toUTF8((STRTAG3->getText(STRTAG3))));
15789 + result->append8(result, " LIKE '%");
15790 + result->append8(result, sqlite3_mprintf("%q", (const char *)val));
15791 + result->append8(result, "%'");
15798 + // SMARTPL2SQL.g:103:4: STRTAG IS STR
15800 + STRTAG5 = (pANTLR3_BASE_TREE) MATCHT(STRTAG, &FOLLOW_STRTAG_in_expression176);
15801 + if (HASEXCEPTION())
15803 + goto ruleexpressionEx;
15806 + MATCHT(IS, &FOLLOW_IS_in_expression178);
15807 + if (HASEXCEPTION())
15809 + goto ruleexpressionEx;
15812 + STR4 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expression180);
15813 + if (HASEXCEPTION())
15815 + goto ruleexpressionEx;
15820 + pANTLR3_UINT8 val;
15821 + val = (STR4->getText(STR4))->toUTF8((STR4->getText(STR4)))->chars;
15823 + val[strlen((const char *)val) - 1] = '\0';
15825 + result= (STR4->getText(STR4))->factory->newRaw((STR4->getText(STR4))->factory);
15826 + result->append8(result, "f.");
15827 + result->appendS(result, (STRTAG5->getText(STRTAG5))->toUTF8((STRTAG5->getText(STRTAG5))));
15828 + result->append8(result, " LIKE '");
15829 + result->append8(result, sqlite3_mprintf("%q", (const char *)val));
15830 + result->append8(result, "'");
15837 + // SMARTPL2SQL.g:117:4: INTTAG INTBOOL INT
15839 + INTTAG6 = (pANTLR3_BASE_TREE) MATCHT(INTTAG, &FOLLOW_INTTAG_in_expression189);
15840 + if (HASEXCEPTION())
15842 + goto ruleexpressionEx;
15845 + INTBOOL7 = (pANTLR3_BASE_TREE) MATCHT(INTBOOL, &FOLLOW_INTBOOL_in_expression191);
15846 + if (HASEXCEPTION())
15848 + goto ruleexpressionEx;
15851 + INT8 = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_expression193);
15852 + if (HASEXCEPTION())
15854 + goto ruleexpressionEx;
15859 + result= (INTTAG6->getText(INTTAG6))->factory->newRaw((INTTAG6->getText(INTTAG6))->factory);
15860 + result->append8(result, "f.");
15861 + result->appendS(result, (INTTAG6->getText(INTTAG6))->toUTF8((INTTAG6->getText(INTTAG6))));
15862 + result->append8(result, " ");
15863 + result->appendS(result, (INTBOOL7->getText(INTBOOL7))->toUTF8((INTBOOL7->getText(INTBOOL7))));
15864 + result->append8(result, " ");
15865 + result->appendS(result, (INT8->getText(INT8))->toUTF8((INT8->getText(INT8))));
15872 + // SMARTPL2SQL.g:127:4: DATETAG AFTER dateval
15874 + DATETAG10 = (pANTLR3_BASE_TREE) MATCHT(DATETAG, &FOLLOW_DATETAG_in_expression202);
15875 + if (HASEXCEPTION())
15877 + goto ruleexpressionEx;
15880 + MATCHT(AFTER, &FOLLOW_AFTER_in_expression204);
15881 + if (HASEXCEPTION())
15883 + goto ruleexpressionEx;
15886 + FOLLOWPUSH(FOLLOW_dateval_in_expression206);
15887 + dateval9=dateval(ctx);
15890 + if (HASEXCEPTION())
15892 + goto ruleexpressionEx;
15898 + sprintf(str, "%d", dateval9);
15900 + result= (DATETAG10->getText(DATETAG10))->factory->newRaw((DATETAG10->getText(DATETAG10))->factory);
15901 + result->append8(result, "f.");
15902 + result->appendS(result, (DATETAG10->getText(DATETAG10))->toUTF8((DATETAG10->getText(DATETAG10))));
15903 + result->append8(result, " > ");
15904 + result->append8(result, str);
15911 + // SMARTPL2SQL.g:138:4: DATETAG BEFORE dateval
15913 + DATETAG12 = (pANTLR3_BASE_TREE) MATCHT(DATETAG, &FOLLOW_DATETAG_in_expression215);
15914 + if (HASEXCEPTION())
15916 + goto ruleexpressionEx;
15919 + MATCHT(BEFORE, &FOLLOW_BEFORE_in_expression217);
15920 + if (HASEXCEPTION())
15922 + goto ruleexpressionEx;
15925 + FOLLOWPUSH(FOLLOW_dateval_in_expression219);
15926 + dateval11=dateval(ctx);
15929 + if (HASEXCEPTION())
15931 + goto ruleexpressionEx;
15937 + sprintf(str, "%d", dateval11);
15939 + result= (DATETAG12->getText(DATETAG12))->factory->newRaw((DATETAG12->getText(DATETAG12))->factory);
15940 + result->append8(result, "f.");
15941 + result->appendS(result, (DATETAG12->getText(DATETAG12))->toUTF8((DATETAG12->getText(DATETAG12))));
15942 + result->append8(result, " > ");
15943 + result->append8(result, str);
15950 + // SMARTPL2SQL.g:149:4: ENUMTAG IS ENUMVAL
15952 + ENUMTAG13 = (pANTLR3_BASE_TREE) MATCHT(ENUMTAG, &FOLLOW_ENUMTAG_in_expression228);
15953 + if (HASEXCEPTION())
15955 + goto ruleexpressionEx;
15958 + MATCHT(IS, &FOLLOW_IS_in_expression230);
15959 + if (HASEXCEPTION())
15961 + goto ruleexpressionEx;
15964 + ENUMVAL14 = (pANTLR3_BASE_TREE) MATCHT(ENUMVAL, &FOLLOW_ENUMVAL_in_expression232);
15965 + if (HASEXCEPTION())
15967 + goto ruleexpressionEx;
15972 + pANTLR3_UINT8 tag;
15973 + pANTLR3_UINT8 val;
15976 + sprintf(str, "1=1");
15978 + tag = (ENUMTAG13->getText(ENUMTAG13))->chars;
15979 + val = (ENUMVAL14->getText(ENUMVAL14))->chars;
15980 + if (strcmp((char *)tag, "media_kind") == 0)
15982 + if (strcmp((char *)val, "music") == 0)
15984 + sprintf(str, "f.media_kind = %d", MEDIA_KIND_MUSIC);
15986 + else if (strcmp((char *)val, "movie") == 0)
15988 + sprintf(str, "f.media_kind = %d", MEDIA_KIND_MOVIE);
15990 + else if (strcmp((char *)val, "podcast") == 0)
15992 + sprintf(str, "f.media_kind = %d", MEDIA_KIND_PODCAST);
15994 + else if (strcmp((char *)val, "audiobook") == 0)
15996 + sprintf(str, "f.media_kind = %d", MEDIA_KIND_AUDIOBOOK);
15998 + else if (strcmp((char *)val, "tvshow") == 0)
16000 + sprintf(str, "f.media_kind = %d", MEDIA_KIND_TVSHOW);
16003 + else if (strcmp((char *)tag, "data_kind") == 0)
16005 + if (strcmp((char *)val, "file") == 0)
16007 + sprintf(str, "f.data_kind = %d", DATA_KIND_FILE);
16009 + else if (strcmp((char *)val, "url") == 0)
16011 + sprintf(str, "f.data_kind = %d", DATA_KIND_URL);
16013 + else if (strcmp((char *)val, "spotify") == 0)
16015 + sprintf(str, "f.data_kind = %d", DATA_KIND_SPOTIFY);
16017 + else if (strcmp((char *)val, "pipe") == 0)
16019 + sprintf(str, "f.data_kind = %d", DATA_KIND_PIPE);
16023 + result= (ENUMTAG13->getText(ENUMTAG13))->factory->newRaw((ENUMTAG13->getText(ENUMTAG13))->factory);
16024 + result->append8(result, str);
16036 + // This is where rules clean up and exit
16038 + goto ruleexpressionEx; /* Prevent compiler warnings */
16039 + ruleexpressionEx: ;
16041 + if (HASEXCEPTION())
16050 +/* $ANTLR end expression */
16053 + * $ANTLR start dateval
16054 + * SMARTPL2SQL.g:207:1: dateval returns [ int result ] : ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO );
16057 +dateval(pSMARTPL2SQL ctx)
16061 + pANTLR3_BASE_TREE DATE15;
16062 + pANTLR3_BASE_TREE DATE16;
16063 + pANTLR3_BASE_TREE DATE18;
16065 + #undef RETURN_TYPE_interval17
16066 + #define RETURN_TYPE_interval17 int
16069 + #undef RETURN_TYPE_interval19
16070 + #define RETURN_TYPE_interval19 int
16073 + #undef RETURN_TYPE_interval20
16074 + #define RETURN_TYPE_interval20 int
16076 + /* Initialize rule variables
16090 + // SMARTPL2SQL.g:209:2: ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO )
16092 + ANTLR3_UINT32 alt2;
16107 + case DATINTERVAL:
16129 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
16130 + EXCEPTION->message = (void *)"";
16131 + EXCEPTION->decisionNum = 2;
16132 + EXCEPTION->state = 3;
16135 + goto ruledatevalEx;
16143 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
16144 + EXCEPTION->message = (void *)"";
16145 + EXCEPTION->decisionNum = 2;
16146 + EXCEPTION->state = 2;
16149 + goto ruledatevalEx;
16157 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
16158 + EXCEPTION->message = (void *)"";
16159 + EXCEPTION->decisionNum = 2;
16160 + EXCEPTION->state = 0;
16163 + goto ruledatevalEx;
16169 + // SMARTPL2SQL.g:209:4: DATE
16171 + DATE15 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval257);
16172 + if (HASEXCEPTION())
16174 + goto ruledatevalEx;
16179 + pANTLR3_UINT8 datval;
16181 + datval = (DATE15->getText(DATE15))->chars;
16183 + if (strcmp((char *)datval, "today") == 0)
16185 + result= time(NULL);
16187 + else if (strcmp((char *)datval, "yesterday") == 0)
16189 + result= time(NULL) - 24 * 3600;
16191 + else if (strcmp((char *)datval, "last week") == 0)
16193 + result= time(NULL) - 24 * 3600 * 7;
16195 + else if (strcmp((char *)datval, "last month") == 0)
16197 + result= time(NULL) - 24 * 3600 * 30;
16199 + else if (strcmp((char *)datval, "last year") == 0)
16201 + result= time(NULL) - 24 * 3600 * 365;
16210 + memset((void*)&tm,0,sizeof(tm));
16211 + memset(year, 0, sizeof(year));
16212 + memset(month, 0, sizeof(month));
16213 + memset(day, 0, sizeof(day));
16215 + strncpy(year, (const char *)datval, 4);
16216 + strncpy(month, (const char *)datval + 5, 2);
16217 + strncpy(day, (const char *)datval + 8, 2);
16219 + tm.tm_year = atoi(year) - 1900;
16220 + tm.tm_mon = atoi(month) - 1;
16221 + tm.tm_mday = atoi(day);
16223 + result= mktime(&tm);
16231 + // SMARTPL2SQL.g:258:4: interval BEFORE DATE
16233 + FOLLOWPUSH(FOLLOW_interval_in_dateval266);
16234 + interval17=interval(ctx);
16237 + if (HASEXCEPTION())
16239 + goto ruledatevalEx;
16242 + MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateval268);
16243 + if (HASEXCEPTION())
16245 + goto ruledatevalEx;
16248 + DATE16 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval270);
16249 + if (HASEXCEPTION())
16251 + goto ruledatevalEx;
16256 + pANTLR3_UINT8 datval;
16258 + datval = (DATE16->getText(DATE16))->chars;
16260 + if (strcmp((char *)datval, "yesterday") == 0)
16262 + result= time(NULL) - 24 * 3600;
16264 + else if (strcmp((char *)datval, "last week") == 0)
16266 + result= time(NULL) - 24 * 3600 * 7;
16268 + else if (strcmp((char *)datval, "last month") == 0)
16270 + result= time(NULL) - 24 * 3600 * 30;
16272 + else if (strcmp((char *)datval, "last year") == 0)
16274 + result= time(NULL) - 24 * 3600 * 365;
16278 + result= time(NULL);
16281 + result= result - interval17;
16288 + // SMARTPL2SQL.g:287:4: interval AFTER DATE
16290 + FOLLOWPUSH(FOLLOW_interval_in_dateval279);
16291 + interval19=interval(ctx);
16294 + if (HASEXCEPTION())
16296 + goto ruledatevalEx;
16299 + MATCHT(AFTER, &FOLLOW_AFTER_in_dateval281);
16300 + if (HASEXCEPTION())
16302 + goto ruledatevalEx;
16305 + DATE18 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval283);
16306 + if (HASEXCEPTION())
16308 + goto ruledatevalEx;
16313 + pANTLR3_UINT8 datval;
16315 + datval = (DATE18->getText(DATE18))->chars;
16317 + if (strcmp((char *)datval, "yesterday") == 0)
16319 + result= time(NULL) - 24 * 3600;
16321 + else if (strcmp((char *)datval, "last week") == 0)
16323 + result= time(NULL) - 24 * 3600 * 7;
16325 + else if (strcmp((char *)datval, "last month") == 0)
16327 + result= time(NULL) - 24 * 3600 * 30;
16329 + else if (strcmp((char *)datval, "last year") == 0)
16331 + result= time(NULL) - 24 * 3600 * 365;
16335 + result= time(NULL);
16338 + result= result + interval19;
16345 + // SMARTPL2SQL.g:316:4: interval AGO
16347 + FOLLOWPUSH(FOLLOW_interval_in_dateval292);
16348 + interval20=interval(ctx);
16351 + if (HASEXCEPTION())
16353 + goto ruledatevalEx;
16356 + MATCHT(AGO, &FOLLOW_AGO_in_dateval294);
16357 + if (HASEXCEPTION())
16359 + goto ruledatevalEx;
16364 + result= time(NULL) - interval20;
16376 + // This is where rules clean up and exit
16378 + goto ruledatevalEx; /* Prevent compiler warnings */
16381 + if (HASEXCEPTION())
16390 +/* $ANTLR end dateval */
16393 + * $ANTLR start interval
16394 + * SMARTPL2SQL.g:322:1: interval returns [ int result ] : INT DATINTERVAL ;
16397 +interval(pSMARTPL2SQL ctx)
16401 + pANTLR3_BASE_TREE INT21;
16402 + pANTLR3_BASE_TREE DATINTERVAL22;
16404 + /* Initialize rule variables
16410 + DATINTERVAL22 = NULL;
16413 + // SMARTPL2SQL.g:324:2: ( INT DATINTERVAL )
16414 + // SMARTPL2SQL.g:324:4: INT DATINTERVAL
16416 + INT21 = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_interval318);
16417 + if (HASEXCEPTION())
16419 + goto ruleintervalEx;
16422 + DATINTERVAL22 = (pANTLR3_BASE_TREE) MATCHT(DATINTERVAL, &FOLLOW_DATINTERVAL_in_interval320);
16423 + if (HASEXCEPTION())
16425 + goto ruleintervalEx;
16430 + pANTLR3_UINT8 interval;
16432 + result= atoi((const char *)(INT21->getText(INT21))->chars);
16433 + interval = (DATINTERVAL22->getText(DATINTERVAL22))->chars;
16435 + if (strcmp((char *)interval, "days") == 0)
16437 + result= result * 24 * 3600;
16439 + else if (strcmp((char *)interval, "weeks") == 0)
16441 + result= result * 24 * 3600 * 7;
16443 + else if (strcmp((char *)interval, "months") == 0)
16445 + result= result * 24 * 3600 * 30;
16447 + else if (strcmp((char *)interval, "weeks") == 0)
16449 + result= result * 24 * 3600 * 365;
16463 + // This is where rules clean up and exit
16465 + goto ruleintervalEx; /* Prevent compiler warnings */
16466 + ruleintervalEx: ;
16468 + if (HASEXCEPTION())
16477 +/* $ANTLR end interval */
16478 +/* End of parsing rules
16479 + * ==============================================
16482 +/* ==============================================
16483 + * Syntactic predicates
16485 +/* End of syntactic predicates
16486 + * ==============================================
16495 + * =============================================================================
16497 diff --git a/src/pregen/SMARTPL2SQL.h b/src/pregen/SMARTPL2SQL.h
16498 new file mode 100644
16499 index 0000000..322e8fd
16501 +++ b/src/pregen/SMARTPL2SQL.h
16504 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
16506 + * - From the grammar source file : SMARTPL2SQL.g
16507 + * - On : 2015-06-27 19:05:21
16508 + * - for the tree parser : SMARTPL2SQLTreeParser *
16509 + * Editing it, at least manually, is not wise.
16511 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
16514 + * The tree parser SMARTPL2SQL has the callable functions (rules) shown below,
16515 + * which will invoke the code for the associated rule in the source grammar
16516 + * assuming that the input stream is pointing to a token/text stream that could begin
16519 + * For instance if you call the first (topmost) rule in a parser grammar, you will
16520 + * get the results of a full parse, but calling a rule half way through the grammar will
16521 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
16522 + * in editors and so on.
16524 + * The parser entry points are called indirectly (by function pointer to function) via
16525 + * a parser context typedef pSMARTPL2SQL, which is returned from a call to SMARTPL2SQLNew().
16527 + * The methods in pSMARTPL2SQL are as follows:
16529 + * - SMARTPL2SQL_playlist_return pSMARTPL2SQL->playlist(pSMARTPL2SQL)
16530 + * - pANTLR3_STRING pSMARTPL2SQL->expression(pSMARTPL2SQL)
16531 + * - int pSMARTPL2SQL->dateval(pSMARTPL2SQL)
16532 + * - int pSMARTPL2SQL->interval(pSMARTPL2SQL)
16534 + * The return type for any particular rule is of course determined by the source
16537 +// [The "BSD licence"]
16538 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
16539 +// http://www.temporal-wave.com
16540 +// http://www.linkedin.com/in/jimidle
16542 +// All rights reserved.
16544 +// Redistribution and use in source and binary forms, with or without
16545 +// modification, are permitted provided that the following conditions
16547 +// 1. Redistributions of source code must retain the above copyright
16548 +// notice, this list of conditions and the following disclaimer.
16549 +// 2. Redistributions in binary form must reproduce the above copyright
16550 +// notice, this list of conditions and the following disclaimer in the
16551 +// documentation and/or other materials provided with the distribution.
16552 +// 3. The name of the author may not be used to endorse or promote products
16553 +// derived from this software without specific prior written permission.
16555 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16556 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16557 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16558 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16559 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16560 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
16561 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
16562 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
16563 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
16564 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16566 +#ifndef _SMARTPL2SQL_H
16567 +#define _SMARTPL2SQL_H
16568 +/* =============================================================================
16569 + * Standard antlr3 C runtime definitions
16571 +#include <antlr3.h>
16573 +/* End of standard antlr 3 runtime definitions
16574 + * =============================================================================
16577 +#ifdef __cplusplus
16581 +// Forward declare the context typedef so that we can use it before it is
16582 +// properly defined. Delegators and delegates (from import statements) are
16583 +// interdependent and their context structures contain pointers to each other
16584 +// C only allows such things to be declared if you pre-declare the typedef.
16586 +typedef struct SMARTPL2SQL_Ctx_struct SMARTPL2SQL, * pSMARTPL2SQL;
16590 + #include <stdio.h>
16591 + #include <stdlib.h>
16592 + #include <string.h>
16593 + #include <limits.h>
16594 + #include <errno.h>
16595 + #include <time.h>
16596 + #include <sqlite3.h>
16598 + #include "logger.h"
16602 +#ifdef ANTLR3_WINDOWS
16603 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
16604 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
16605 +// initialized but unused variable - tree rewrite variables declared but not needed
16606 +// Unreferenced local variable - lexer rule declares but does not always use _type
16607 +// potentially unitialized variable used - retval always returned from a rule
16608 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
16610 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
16611 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
16612 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
16613 +// this is a matter of orthogonality hence I disable that one.
16615 +#pragma warning( disable : 4100 )
16616 +#pragma warning( disable : 4101 )
16617 +#pragma warning( disable : 4127 )
16618 +#pragma warning( disable : 4189 )
16619 +#pragma warning( disable : 4505 )
16620 +#pragma warning( disable : 4701 )
16622 +typedef struct SMARTPL2SQL_playlist_return_struct
16624 + pANTLR3_BASE_TREE start;
16625 + pANTLR3_BASE_TREE stop;
16626 + pANTLR3_STRING title;
16627 + pANTLR3_STRING query;
16629 + SMARTPL2SQL_playlist_return;
16633 +/** Context tracking structure for SMARTPL2SQL
16635 +struct SMARTPL2SQL_Ctx_struct
16637 + /** Built in ANTLR3 context tracker contains all the generic elements
16638 + * required for context tracking.
16640 + pANTLR3_TREE_PARSER pTreeParser;
16643 + SMARTPL2SQL_playlist_return (*playlist) (struct SMARTPL2SQL_Ctx_struct * ctx);
16644 + pANTLR3_STRING (*expression) (struct SMARTPL2SQL_Ctx_struct * ctx);
16645 + int (*dateval) (struct SMARTPL2SQL_Ctx_struct * ctx);
16646 + int (*interval) (struct SMARTPL2SQL_Ctx_struct * ctx);
16647 + // Delegated rules
16648 + const char * (*getGrammarFileName)();
16649 + void (*free) (struct SMARTPL2SQL_Ctx_struct * ctx);
16653 +// Function protoypes for the constructor functions that external translation units
16654 +// such as delegators and delegates may wish to call.
16656 +ANTLR3_API pSMARTPL2SQL SMARTPL2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream);
16657 +ANTLR3_API pSMARTPL2SQL SMARTPL2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
16659 +/** Symbolic definitions of all the tokens that the tree parser will work with.
16662 + * Antlr will define EOF, but we can't use that as it it is too common in
16663 + * in C header files and that would be confusing. There is no way to filter this out at the moment
16664 + * so we just undef it here for now. That isn't the value we get back from C recognizers
16665 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
16673 +#define INTBOOL 14
16676 +#define WHITESPACE 29
16677 +#define GREATEREQUAL 25
16679 +#define DATETAG 16
16685 +#define INCLUDES 11
16689 +#define GREATER 24
16691 +#define ENUMTAG 19
16693 +#define ENUMVAL 20
16699 +#define LESSEQUAL 27
16701 +#define DATINTERVAL 23
16704 +#define EOF ANTLR3_TOKEN_EOF
16707 +#ifndef TOKENSOURCE
16708 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
16711 +/* End of token definitions for SMARTPL2SQL
16712 + * =============================================================================
16716 +#ifdef __cplusplus
16722 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
16723 diff --git a/src/pregen/SMARTPL2SQL.u b/src/pregen/SMARTPL2SQL.u
16724 new file mode 100644
16725 index 0000000..85567d1
16727 +++ b/src/pregen/SMARTPL2SQL.u
16729 +SMARTPL2SQL.g: SMARTPL.tokens
16730 +SMARTPL2SQL.c : SMARTPL2SQL.g
16731 +./SMARTPL2SQL.tokens : SMARTPL2SQL.g
16732 +SMARTPL2SQL.h : SMARTPL2SQL.g
16733 +ANTLR_PRODUCTS += SMARTPL2SQL.c ./SMARTPL2SQL.tokens SMARTPL2SQL.h
16734 \ No newline at end of file
16735 diff --git a/src/pregen/SMARTPLLexer.c b/src/pregen/SMARTPLLexer.c
16736 new file mode 100644
16737 index 0000000..9ea1a83
16739 +++ b/src/pregen/SMARTPLLexer.c
16742 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
16744 + * - From the grammar source file : SMARTPL.g
16745 + * - On : 2015-06-27 19:05:15
16746 + * - for the lexer : SMARTPLLexerLexer *
16747 + * Editing it, at least manually, is not wise.
16749 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
16753 +// [The "BSD licence"]
16754 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
16755 +// http://www.temporal-wave.com
16756 +// http://www.linkedin.com/in/jimidle
16758 +// All rights reserved.
16760 +// Redistribution and use in source and binary forms, with or without
16761 +// modification, are permitted provided that the following conditions
16763 +// 1. Redistributions of source code must retain the above copyright
16764 +// notice, this list of conditions and the following disclaimer.
16765 +// 2. Redistributions in binary form must reproduce the above copyright
16766 +// notice, this list of conditions and the following disclaimer in the
16767 +// documentation and/or other materials provided with the distribution.
16768 +// 3. The name of the author may not be used to endorse or promote products
16769 +// derived from this software without specific prior written permission.
16771 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16772 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16773 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16774 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16775 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16776 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
16777 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
16778 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
16779 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
16780 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16782 +/* -----------------------------------------
16783 + * Include the ANTLR3 generated header file.
16785 +#include "SMARTPLLexer.h"
16786 +/* ----------------------------------------- */
16789 +/** String literals used by SMARTPLLexer that we must do things like MATCHS() with.
16790 + * C will normally just lay down 8 bit characters, and you can use L"xxx" to
16791 + * get wchar_t, but wchar_t is 16 bits on Windows, which is not UTF32 and so
16792 + * we perform this little trick of defining the literals as arrays of UINT32
16793 + * and passing in the address of these.
16795 +static ANTLR3_UCHAR lit_1[] = { 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, ANTLR3_STRING_TERMINATOR};
16796 +static ANTLR3_UCHAR lit_2[] = { 0x61, 0x6C, 0x62, 0x75, 0x6D, 0x5F, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, ANTLR3_STRING_TERMINATOR};
16797 +static ANTLR3_UCHAR lit_3[] = { 0x61, 0x6C, 0x62, 0x75, 0x6D, ANTLR3_STRING_TERMINATOR};
16798 +static ANTLR3_UCHAR lit_4[] = { 0x74, 0x69, 0x74, 0x6C, 0x65, ANTLR3_STRING_TERMINATOR};
16799 +static ANTLR3_UCHAR lit_5[] = { 0x67, 0x65, 0x6E, 0x72, 0x65, ANTLR3_STRING_TERMINATOR};
16800 +static ANTLR3_UCHAR lit_6[] = { 0x63, 0x6F, 0x6D, 0x70, 0x6F, 0x73, 0x65, 0x72, ANTLR3_STRING_TERMINATOR};
16801 +static ANTLR3_UCHAR lit_7[] = { 0x70, 0x61, 0x74, 0x68, ANTLR3_STRING_TERMINATOR};
16802 +static ANTLR3_UCHAR lit_8[] = { 0x74, 0x79, 0x70, 0x65, ANTLR3_STRING_TERMINATOR};
16803 +static ANTLR3_UCHAR lit_9[] = { 0x67, 0x72, 0x6F, 0x75, 0x70, 0x69, 0x6E, 0x67, ANTLR3_STRING_TERMINATOR};
16804 +static ANTLR3_UCHAR lit_10[] = { 0x70, 0x6C, 0x61, 0x79, 0x5F, 0x63, 0x6F, 0x75, 0x6E, 0x74, ANTLR3_STRING_TERMINATOR};
16805 +static ANTLR3_UCHAR lit_11[] = { 0x72, 0x61, 0x74, 0x69, 0x6E, 0x67, ANTLR3_STRING_TERMINATOR};
16806 +static ANTLR3_UCHAR lit_12[] = { 0x79, 0x65, 0x61, 0x72, ANTLR3_STRING_TERMINATOR};
16807 +static ANTLR3_UCHAR lit_13[] = { 0x63, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x61, 0x74, 0x69, 0x6F, 0x6E, ANTLR3_STRING_TERMINATOR};
16808 +static ANTLR3_UCHAR lit_14[] = { 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x61, 0x64, 0x64, 0x65, 0x64, ANTLR3_STRING_TERMINATOR};
16809 +static ANTLR3_UCHAR lit_15[] = { 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x70, 0x6C, 0x61, 0x79, 0x65, 0x64, ANTLR3_STRING_TERMINATOR};
16810 +static ANTLR3_UCHAR lit_16[] = { 0x64, 0x61, 0x74, 0x61, 0x5F, 0x6B, 0x69, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR};
16811 +static ANTLR3_UCHAR lit_17[] = { 0x6D, 0x65, 0x64, 0x69, 0x61, 0x5F, 0x6B, 0x69, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR};
16812 +static ANTLR3_UCHAR lit_18[] = { 0x69, 0x6E, 0x63, 0x6C, 0x75, 0x64, 0x65, 0x73, ANTLR3_STRING_TERMINATOR};
16813 +static ANTLR3_UCHAR lit_19[] = { 0x69, 0x73, ANTLR3_STRING_TERMINATOR};
16814 +static ANTLR3_UCHAR lit_20[] = { 0x3E, 0x3D, ANTLR3_STRING_TERMINATOR};
16815 +static ANTLR3_UCHAR lit_21[] = { 0x3C, 0x3D, ANTLR3_STRING_TERMINATOR};
16816 +static ANTLR3_UCHAR lit_22[] = { 0x61, 0x66, 0x74, 0x65, 0x72, ANTLR3_STRING_TERMINATOR};
16817 +static ANTLR3_UCHAR lit_23[] = { 0x62, 0x65, 0x66, 0x6F, 0x72, 0x65, ANTLR3_STRING_TERMINATOR};
16818 +static ANTLR3_UCHAR lit_24[] = { 0x61, 0x67, 0x6F, ANTLR3_STRING_TERMINATOR};
16819 +static ANTLR3_UCHAR lit_25[] = { 0x41, 0x4E, 0x44, ANTLR3_STRING_TERMINATOR};
16820 +static ANTLR3_UCHAR lit_26[] = { 0x61, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR};
16821 +static ANTLR3_UCHAR lit_27[] = { 0x4F, 0x52, ANTLR3_STRING_TERMINATOR};
16822 +static ANTLR3_UCHAR lit_28[] = { 0x6F, 0x72, ANTLR3_STRING_TERMINATOR};
16823 +static ANTLR3_UCHAR lit_29[] = { 0x4E, 0x4F, 0x54, ANTLR3_STRING_TERMINATOR};
16824 +static ANTLR3_UCHAR lit_30[] = { 0x6E, 0x6F, 0x74, ANTLR3_STRING_TERMINATOR};
16825 +static ANTLR3_UCHAR lit_31[] = { 0x74, 0x6F, 0x64, 0x61, 0x79, ANTLR3_STRING_TERMINATOR};
16826 +static ANTLR3_UCHAR lit_32[] = { 0x79, 0x65, 0x73, 0x74, 0x65, 0x72, 0x64, 0x61, 0x79, ANTLR3_STRING_TERMINATOR};
16827 +static ANTLR3_UCHAR lit_33[] = { 0x6C, 0x61, 0x73, 0x74, 0x20, 0x77, 0x65, 0x65, 0x6B, ANTLR3_STRING_TERMINATOR};
16828 +static ANTLR3_UCHAR lit_34[] = { 0x6C, 0x61, 0x73, 0x74, 0x20, 0x6D, 0x6F, 0x6E, 0x74, 0x68, ANTLR3_STRING_TERMINATOR};
16829 +static ANTLR3_UCHAR lit_35[] = { 0x6C, 0x61, 0x73, 0x74, 0x20, 0x79, 0x65, 0x61, 0x72, ANTLR3_STRING_TERMINATOR};
16830 +static ANTLR3_UCHAR lit_36[] = { 0x64, 0x61, 0x79, 0x73, ANTLR3_STRING_TERMINATOR};
16831 +static ANTLR3_UCHAR lit_37[] = { 0x77, 0x65, 0x65, 0x6B, 0x73, ANTLR3_STRING_TERMINATOR};
16832 +static ANTLR3_UCHAR lit_38[] = { 0x6D, 0x6F, 0x6E, 0x74, 0x68, 0x73, ANTLR3_STRING_TERMINATOR};
16833 +static ANTLR3_UCHAR lit_39[] = { 0x79, 0x65, 0x61, 0x72, 0x73, ANTLR3_STRING_TERMINATOR};
16834 +static ANTLR3_UCHAR lit_40[] = { 0x6D, 0x75, 0x73, 0x69, 0x63, ANTLR3_STRING_TERMINATOR};
16835 +static ANTLR3_UCHAR lit_41[] = { 0x6D, 0x6F, 0x76, 0x69, 0x65, ANTLR3_STRING_TERMINATOR};
16836 +static ANTLR3_UCHAR lit_42[] = { 0x70, 0x6F, 0x64, 0x63, 0x61, 0x73, 0x74, ANTLR3_STRING_TERMINATOR};
16837 +static ANTLR3_UCHAR lit_43[] = { 0x61, 0x75, 0x64, 0x69, 0x6F, 0x62, 0x6F, 0x6F, 0x6B, ANTLR3_STRING_TERMINATOR};
16838 +static ANTLR3_UCHAR lit_44[] = { 0x74, 0x76, 0x73, 0x68, 0x6F, 0x77, ANTLR3_STRING_TERMINATOR};
16839 +static ANTLR3_UCHAR lit_45[] = { 0x66, 0x69, 0x6C, 0x65, ANTLR3_STRING_TERMINATOR};
16840 +static ANTLR3_UCHAR lit_46[] = { 0x75, 0x72, 0x6C, ANTLR3_STRING_TERMINATOR};
16841 +static ANTLR3_UCHAR lit_47[] = { 0x73, 0x70, 0x6F, 0x74, 0x69, 0x66, 0x79, ANTLR3_STRING_TERMINATOR};
16842 +static ANTLR3_UCHAR lit_48[] = { 0x70, 0x69, 0x70, 0x65, ANTLR3_STRING_TERMINATOR};
16847 +/* MACROS that hide the C interface implementations from the
16848 + * generated code, which makes it a little more understandable to the human eye.
16849 + * I am very much against using C pre-processor macros for function calls and bits
16850 + * of code as you cannot see what is happening when single stepping in debuggers
16851 + * and so on. The exception (in my book at least) is for generated code, where you are
16852 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
16853 + * hides some indirect calls, but is always referring to the input stream. This is
16854 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
16855 + * the runtime interfaces without changing the generated code too often, without
16856 + * confusing the reader of the generated output, who may not wish to know the gory
16857 + * details of the interface inheritance.
16862 +/* Aids in accessing scopes for grammar programmers
16865 +#undef SCOPE_STACK
16867 +#define SCOPE_TYPE(scope) pSMARTPLLexer_##scope##_SCOPE
16868 +#define SCOPE_STACK(scope) pSMARTPLLexer_##scope##Stack
16869 +#define SCOPE_TOP(scope) ctx->pSMARTPLLexer_##scope##Top
16870 +#define SCOPE_SIZE(scope) ctx->pSMARTPLLexer_##scope##Stack_limit
16871 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
16874 +/* Macros for accessing things in a lexer
16879 +#undef GETCHARINDEX
16881 +#undef GETCHARPOSITIONINLINE
16893 +#undef HASEXCEPTION
16895 +#undef CONSTRUCTEX
16901 +#undef BACKTRACKING
16904 +#undef HAVEPARSEDRULE
16913 +#define LEXER ctx->pLexer
16914 +#define RECOGNIZER LEXER->rec
16915 +#define LEXSTATE RECOGNIZER->state
16916 +#define TOKSOURCE LEXSTATE->tokSource
16917 +#define GETCHARINDEX() LEXER->getCharIndex(LEXER)
16918 +#define GETLINE() LEXER->getLine(LEXER)
16919 +#define GETTEXT() LEXER->getText(LEXER)
16920 +#define GETCHARPOSITIONINLINE() LEXER->getCharPositionInLine(LEXER)
16921 +#define EMIT() LEXSTATE->type = _type; LEXER->emit(LEXER)
16922 +#define EMITNEW(t) LEXER->emitNew(LEXER, t)
16923 +#define MATCHC(c) LEXER->matchc(LEXER, c)
16924 +#define MATCHS(s) LEXER->matchs(LEXER, s)
16925 +#define MATCHRANGE(c1,c2) LEXER->matchRange(LEXER, c1, c2)
16926 +#define MATCHANY() LEXER->matchAny(LEXER)
16927 +#define LTOKEN LEXSTATE->token
16928 +#define HASFAILED() (LEXSTATE->failed == ANTLR3_TRUE)
16929 +#define BACKTRACKING LEXSTATE->backtracking
16930 +#define FAILEDFLAG LEXSTATE->failed
16931 +#define INPUT LEXER->input
16932 +#define STRSTREAM INPUT
16933 +#define ISTREAM INPUT->istream
16934 +#define INDEX() ISTREAM->index(ISTREAM)
16935 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
16936 +#define EOF_TOKEN &(LEXSTATE->tokSource->eofToken)
16937 +#define HASEXCEPTION() (LEXSTATE->error == ANTLR3_TRUE)
16938 +#define EXCEPTION LEXSTATE->exception
16939 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
16940 +#define LRECOVER() LEXER->recover(LEXER)
16941 +#define MARK() ISTREAM->mark(ISTREAM)
16942 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
16943 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
16944 +#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si)
16945 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
16946 +#define PUSHSTREAM(str) LEXER->pushCharStream(LEXER, str)
16947 +#define POPSTREAM() LEXER->popCharStream(LEXER)
16948 +#define SETTEXT(str) LEXSTATE->text = str
16949 +#define SKIP() LEXSTATE->token = &(TOKSOURCE->skipToken)
16950 +#define USER1 LEXSTATE->user1
16951 +#define USER2 LEXSTATE->user2
16952 +#define USER3 LEXSTATE->user3
16953 +#define CUSTOM LEXSTATE->custom
16954 +#define RULEMEMO LEXSTATE->ruleMemo
16955 +#define DBG RECOGNIZER->debugger
16957 +/* If we have been told we can rely on the standard 8 bit or 16 bit input
16958 + * stream, then we can define our macros to use the direct pointers
16959 + * in the input object, which is much faster than indirect calls. This
16960 + * is really only significant to lexers with a lot of fragment rules (which
16961 + * do not place LA(1) in a temporary at the moment) and even then
16962 + * only if there is a lot of input (order of say 1M or so).
16964 +#if defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16)
16966 +# ifdef ANTLR3_INLINE_INPUT_ASCII
16968 +/* 8 bit "ASCII" (actually any 8 bit character set) */
16970 +# define NEXTCHAR ((pANTLR3_UINT8)(INPUT->nextChar))
16971 +# define DATAP ((pANTLR3_UINT8)(INPUT->data))
16975 +# define NEXTCHAR ((pANTLR3_UINT16)(INPUT->nextChar))
16976 +# define DATAP ((pANTLR3_UINT16)(INPUT->data))
16980 +# define LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1)))
16981 +# define CONSUME() \
16983 + if (NEXTCHAR < (DATAP + INPUT->sizeBuf)) \
16985 + INPUT->charPositionInLine++; \
16986 + if ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar) \
16989 + INPUT->charPositionInLine = 0; \
16990 + INPUT->currentLine = (void *)(NEXTCHAR + 1); \
16992 + INPUT->nextChar = (void *)(NEXTCHAR + 1); \
16998 +// Pick up the input character by calling the input stream implementation.
17000 +#define CONSUME() INPUT->istream->consume(INPUT->istream)
17001 +#define LA(n) INPUT->istream->_LA(INPUT->istream, n)
17004 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
17006 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
17007 + * then for the present you must use different names for your defines as these are hard coded
17008 + * in the code generator. It would be better not to use such names internally, and maybe
17009 + * we can change this in a forthcoming release. I deliberately do not #undef these
17010 + * here as this will at least give you a redefined error somewhere if they clash.
17012 +#define UP ANTLR3_TOKEN_UP
17013 +#define DOWN ANTLR3_TOKEN_DOWN
17014 +#define EOR ANTLR3_TOKEN_EOR
17015 +#define INVALID ANTLR3_TOKEN_INVALID
17018 +/* =============================================================================
17019 + * Functions to create and destroy scopes. First come the rule scopes, followed
17020 + * by the global declared scopes.
17025 +/* ============================================================================= */
17027 +/* =============================================================================
17028 + * Start of recognizer
17032 +/* Forward declare the locally static matching functions we have generated and any predicate functions.
17034 +static ANTLR3_INLINE void mT__30 (pSMARTPLLexer ctx);
17035 +static ANTLR3_INLINE void mT__31 (pSMARTPLLexer ctx);
17036 +static ANTLR3_INLINE void mSTRTAG (pSMARTPLLexer ctx);
17037 +static ANTLR3_INLINE void mINTTAG (pSMARTPLLexer ctx);
17038 +static ANTLR3_INLINE void mDATETAG (pSMARTPLLexer ctx);
17039 +static ANTLR3_INLINE void mENUMTAG (pSMARTPLLexer ctx);
17040 +static ANTLR3_INLINE void mINCLUDES (pSMARTPLLexer ctx);
17041 +static ANTLR3_INLINE void mIS (pSMARTPLLexer ctx);
17042 +static ANTLR3_INLINE void mINTBOOL (pSMARTPLLexer ctx);
17043 +static ANTLR3_INLINE void mGREATER (pSMARTPLLexer ctx);
17044 +static ANTLR3_INLINE void mGREATEREQUAL (pSMARTPLLexer ctx);
17045 +static ANTLR3_INLINE void mLESS (pSMARTPLLexer ctx);
17046 +static ANTLR3_INLINE void mLESSEQUAL (pSMARTPLLexer ctx);
17047 +static ANTLR3_INLINE void mEQUAL (pSMARTPLLexer ctx);
17048 +static ANTLR3_INLINE void mAFTER (pSMARTPLLexer ctx);
17049 +static ANTLR3_INLINE void mBEFORE (pSMARTPLLexer ctx);
17050 +static ANTLR3_INLINE void mAGO (pSMARTPLLexer ctx);
17051 +static ANTLR3_INLINE void mAND (pSMARTPLLexer ctx);
17052 +static ANTLR3_INLINE void mOR (pSMARTPLLexer ctx);
17053 +static ANTLR3_INLINE void mNOT (pSMARTPLLexer ctx);
17054 +static ANTLR3_INLINE void mLPAR (pSMARTPLLexer ctx);
17055 +static ANTLR3_INLINE void mRPAR (pSMARTPLLexer ctx);
17056 +static ANTLR3_INLINE void mDATE (pSMARTPLLexer ctx);
17057 +static ANTLR3_INLINE void mDATINTERVAL (pSMARTPLLexer ctx);
17058 +static ANTLR3_INLINE void mENUMVAL (pSMARTPLLexer ctx);
17059 +static ANTLR3_INLINE void mSTR (pSMARTPLLexer ctx);
17060 +static ANTLR3_INLINE void mINT (pSMARTPLLexer ctx);
17061 +static ANTLR3_INLINE void mWHITESPACE (pSMARTPLLexer ctx);
17062 +static ANTLR3_INLINE void mTokens (pSMARTPLLexer ctx);
17063 +static void SMARTPLLexerFree(pSMARTPLLexer ctx);
17065 +/* =========================================================================
17066 + * Lexer matching rules end.
17067 + * =========================================================================
17073 +SMARTPLLexerFree (pSMARTPLLexer ctx)
17075 + LEXER->free(LEXER);
17077 + ANTLR3_FREE(ctx);
17080 +/** \brief Name of the grammar file that generated this code
17082 +static const char fileName[] = "SMARTPL.g";
17084 +/** \brief Return the name of the grammar file that generated this code.
17086 +static const char * getGrammarFileName()
17091 +/** \brief Create a new lexer called SMARTPLLexer
17093 + * \param[in] instream Pointer to an initialized input stream
17095 + * - Success pSMARTPLLexer initialized for the lex start
17098 +ANTLR3_API pSMARTPLLexer SMARTPLLexerNew
17099 +(pANTLR3_INPUT_STREAM instream)
17101 + // See if we can create a new lexer with the standard constructor
17103 + return SMARTPLLexerNewSSD(instream, NULL);
17106 +/** \brief Create a new lexer called SMARTPLLexer
17108 + * \param[in] instream Pointer to an initialized input stream
17109 + * \param[state] state Previously created shared recognizer stat
17111 + * - Success pSMARTPLLexer initialized for the lex start
17114 +ANTLR3_API pSMARTPLLexer SMARTPLLexerNewSSD
17115 +(pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
17117 + pSMARTPLLexer ctx; // Context structure we will build and return
17119 + ctx = (pSMARTPLLexer) ANTLR3_CALLOC(1, sizeof(SMARTPLLexer));
17123 + // Failed to allocate memory for lexer context
17127 + /* -------------------------------------------------------------------
17128 + * Memory for basic structure is allocated, now to fill in
17129 + * in base ANTLR3 structures. We initialize the function pointers
17130 + * for the standard ANTLR3 lexer function set, but upon return
17131 + * from here, the programmer may set the pointers to provide custom
17132 + * implementations of each function.
17134 + * We don't use the macros defined in SMARTPLLexer.h here so you can get a sense
17135 + * of what goes where.
17138 + /* Create a base lexer, using the supplied input stream
17140 + ctx->pLexer = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state);
17142 + /* Check that we allocated the memory correctly
17144 + if (ctx->pLexer == NULL)
17146 + ANTLR3_FREE(ctx);
17149 + /* Install the implementation of our SMARTPLLexer interface
17151 + ctx->mT__30 = mT__30;
17152 + ctx->mT__31 = mT__31;
17153 + ctx->mSTRTAG = mSTRTAG;
17154 + ctx->mINTTAG = mINTTAG;
17155 + ctx->mDATETAG = mDATETAG;
17156 + ctx->mENUMTAG = mENUMTAG;
17157 + ctx->mINCLUDES = mINCLUDES;
17159 + ctx->mINTBOOL = mINTBOOL;
17160 + ctx->mGREATER = mGREATER;
17161 + ctx->mGREATEREQUAL = mGREATEREQUAL;
17162 + ctx->mLESS = mLESS;
17163 + ctx->mLESSEQUAL = mLESSEQUAL;
17164 + ctx->mEQUAL = mEQUAL;
17165 + ctx->mAFTER = mAFTER;
17166 + ctx->mBEFORE = mBEFORE;
17167 + ctx->mAGO = mAGO;
17168 + ctx->mAND = mAND;
17170 + ctx->mNOT = mNOT;
17171 + ctx->mLPAR = mLPAR;
17172 + ctx->mRPAR = mRPAR;
17173 + ctx->mDATE = mDATE;
17174 + ctx->mDATINTERVAL = mDATINTERVAL;
17175 + ctx->mENUMVAL = mENUMVAL;
17176 + ctx->mSTR = mSTR;
17177 + ctx->mINT = mINT;
17178 + ctx->mWHITESPACE = mWHITESPACE;
17179 + ctx->mTokens = mTokens;
17181 + /** When the nextToken() call is made to this lexer's pANTLR3_TOKEN_SOURCE
17182 + * it will call mTokens() in this generated code, and will pass it the ctx
17183 + * pointer of this lexer, not the context of the base lexer, so store that now.
17185 + ctx->pLexer->ctx = ctx;
17187 + /**Install the token matching function
17189 + ctx->pLexer->mTokens = (void (*) (void *))(mTokens);
17191 + ctx->getGrammarFileName = getGrammarFileName;
17192 + ctx->free = SMARTPLLexerFree;
17198 + /* Return the newly built lexer to the caller
17204 +/* =========================================================================
17205 + * Functions to match the lexer grammar defined tokens from the input stream
17208 +// Comes from: 7:7: ( '{' )
17209 +/** \brief Lexer rule generated by ANTLR3
17211 + * $ANTLR start T__30
17213 + * Looks to match the characters the constitute the token T__30
17214 + * from the attached input stream.
17218 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
17220 +static ANTLR3_INLINE
17221 +void mT__30(pSMARTPLLexer ctx)
17223 + ANTLR3_UINT32 _type;
17228 + // SMARTPL.g:7:7: ( '{' )
17229 + // SMARTPL.g:7:9: '{'
17232 + if (HASEXCEPTION())
17234 + goto ruleT__30Ex;
17240 + LEXSTATE->type = _type;
17242 + // This is where rules clean up and exit
17244 + goto ruleT__30Ex; /* Prevent compiler warnings */
17248 +// $ANTLR end T__30
17250 +// Comes from: 8:7: ( '}' )
17251 +/** \brief Lexer rule generated by ANTLR3
17253 + * $ANTLR start T__31
17255 + * Looks to match the characters the constitute the token T__31
17256 + * from the attached input stream.
17260 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
17262 +static ANTLR3_INLINE
17263 +void mT__31(pSMARTPLLexer ctx)
17265 + ANTLR3_UINT32 _type;
17270 + // SMARTPL.g:8:7: ( '}' )
17271 + // SMARTPL.g:8:9: '}'
17274 + if (HASEXCEPTION())
17276 + goto ruleT__31Ex;
17282 + LEXSTATE->type = _type;
17284 + // This is where rules clean up and exit
17286 + goto ruleT__31Ex; /* Prevent compiler warnings */
17290 +// $ANTLR end T__31
17292 +// Comes from: 56:9: ( 'artist' | 'album_artist' | 'album' | 'title' | 'genre' | 'composer' | 'path' | 'type' | 'grouping' )
17293 +/** \brief Lexer rule generated by ANTLR3
17295 + * $ANTLR start STRTAG
17297 + * Looks to match the characters the constitute the token STRTAG
17298 + * from the attached input stream.
17302 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
17304 +static ANTLR3_INLINE
17305 +void mSTRTAG(pSMARTPLLexer ctx)
17307 + ANTLR3_UINT32 _type;
17313 + // SMARTPL.g:56:9: ( 'artist' | 'album_artist' | 'album' | 'title' | 'genre' | 'composer' | 'path' | 'type' | 'grouping' )
17315 + ANTLR3_UINT32 alt1;
17360 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17361 + EXCEPTION->message = (void *)"";
17362 + EXCEPTION->decisionNum = 1;
17363 + EXCEPTION->state = 13;
17366 + goto ruleSTRTAGEx;
17374 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17375 + EXCEPTION->message = (void *)"";
17376 + EXCEPTION->decisionNum = 1;
17377 + EXCEPTION->state = 12;
17380 + goto ruleSTRTAGEx;
17388 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17389 + EXCEPTION->message = (void *)"";
17390 + EXCEPTION->decisionNum = 1;
17391 + EXCEPTION->state = 7;
17394 + goto ruleSTRTAGEx;
17402 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17403 + EXCEPTION->message = (void *)"";
17404 + EXCEPTION->decisionNum = 1;
17405 + EXCEPTION->state = 1;
17408 + goto ruleSTRTAGEx;
17430 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17431 + EXCEPTION->message = (void *)"";
17432 + EXCEPTION->decisionNum = 1;
17433 + EXCEPTION->state = 2;
17436 + goto ruleSTRTAGEx;
17458 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17459 + EXCEPTION->message = (void *)"";
17460 + EXCEPTION->decisionNum = 1;
17461 + EXCEPTION->state = 3;
17464 + goto ruleSTRTAGEx;
17482 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17483 + EXCEPTION->message = (void *)"";
17484 + EXCEPTION->decisionNum = 1;
17485 + EXCEPTION->state = 0;
17488 + goto ruleSTRTAGEx;
17494 + // SMARTPL.g:56:11: 'artist'
17497 + if (HASEXCEPTION())
17499 + goto ruleSTRTAGEx;
17507 + // SMARTPL.g:57:6: 'album_artist'
17510 + if (HASEXCEPTION())
17512 + goto ruleSTRTAGEx;
17520 + // SMARTPL.g:58:6: 'album'
17523 + if (HASEXCEPTION())
17525 + goto ruleSTRTAGEx;
17533 + // SMARTPL.g:59:6: 'title'
17536 + if (HASEXCEPTION())
17538 + goto ruleSTRTAGEx;
17546 + // SMARTPL.g:60:6: 'genre'
17549 + if (HASEXCEPTION())
17551 + goto ruleSTRTAGEx;
17559 + // SMARTPL.g:61:6: 'composer'
17562 + if (HASEXCEPTION())
17564 + goto ruleSTRTAGEx;
17572 + // SMARTPL.g:62:6: 'path'
17575 + if (HASEXCEPTION())
17577 + goto ruleSTRTAGEx;
17585 + // SMARTPL.g:63:6: 'type'
17588 + if (HASEXCEPTION())
17590 + goto ruleSTRTAGEx;
17598 + // SMARTPL.g:64:6: 'grouping'
17601 + if (HASEXCEPTION())
17603 + goto ruleSTRTAGEx;
17613 + LEXSTATE->type = _type;
17615 + // This is where rules clean up and exit
17617 + goto ruleSTRTAGEx; /* Prevent compiler warnings */
17621 +// $ANTLR end STRTAG
17623 +// Comes from: 67:9: ( 'play_count' | 'rating' | 'year' | 'compilation' )
17624 +/** \brief Lexer rule generated by ANTLR3
17626 + * $ANTLR start INTTAG
17628 + * Looks to match the characters the constitute the token INTTAG
17629 + * from the attached input stream.
17633 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
17635 +static ANTLR3_INLINE
17636 +void mINTTAG(pSMARTPLLexer ctx)
17638 + ANTLR3_UINT32 _type;
17644 + // SMARTPL.g:67:9: ( 'play_count' | 'rating' | 'year' | 'compilation' )
17646 + ANTLR3_UINT32 alt2;
17675 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17676 + EXCEPTION->message = (void *)"";
17677 + EXCEPTION->decisionNum = 2;
17678 + EXCEPTION->state = 0;
17681 + goto ruleINTTAGEx;
17687 + // SMARTPL.g:67:11: 'play_count'
17690 + if (HASEXCEPTION())
17692 + goto ruleINTTAGEx;
17700 + // SMARTPL.g:68:6: 'rating'
17703 + if (HASEXCEPTION())
17705 + goto ruleINTTAGEx;
17713 + // SMARTPL.g:69:6: 'year'
17716 + if (HASEXCEPTION())
17718 + goto ruleINTTAGEx;
17726 + // SMARTPL.g:70:6: 'compilation'
17729 + if (HASEXCEPTION())
17731 + goto ruleINTTAGEx;
17741 + LEXSTATE->type = _type;
17743 + // This is where rules clean up and exit
17745 + goto ruleINTTAGEx; /* Prevent compiler warnings */
17749 +// $ANTLR end INTTAG
17751 +// Comes from: 73:10: ( 'time_added' | 'time_played' )
17752 +/** \brief Lexer rule generated by ANTLR3
17754 + * $ANTLR start DATETAG
17756 + * Looks to match the characters the constitute the token DATETAG
17757 + * from the attached input stream.
17761 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
17763 +static ANTLR3_INLINE
17764 +void mDATETAG(pSMARTPLLexer ctx)
17766 + ANTLR3_UINT32 _type;
17772 + // SMARTPL.g:73:10: ( 'time_added' | 'time_played' )
17774 + ANTLR3_UINT32 alt3;
17813 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17814 + EXCEPTION->message = (void *)"";
17815 + EXCEPTION->decisionNum = 3;
17816 + EXCEPTION->state = 5;
17819 + goto ruleDATETAGEx;
17827 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17828 + EXCEPTION->message = (void *)"";
17829 + EXCEPTION->decisionNum = 3;
17830 + EXCEPTION->state = 4;
17833 + goto ruleDATETAGEx;
17841 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17842 + EXCEPTION->message = (void *)"";
17843 + EXCEPTION->decisionNum = 3;
17844 + EXCEPTION->state = 3;
17847 + goto ruleDATETAGEx;
17855 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17856 + EXCEPTION->message = (void *)"";
17857 + EXCEPTION->decisionNum = 3;
17858 + EXCEPTION->state = 2;
17861 + goto ruleDATETAGEx;
17869 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17870 + EXCEPTION->message = (void *)"";
17871 + EXCEPTION->decisionNum = 3;
17872 + EXCEPTION->state = 1;
17875 + goto ruleDATETAGEx;
17883 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17884 + EXCEPTION->message = (void *)"";
17885 + EXCEPTION->decisionNum = 3;
17886 + EXCEPTION->state = 0;
17889 + goto ruleDATETAGEx;
17895 + // SMARTPL.g:73:12: 'time_added'
17898 + if (HASEXCEPTION())
17900 + goto ruleDATETAGEx;
17908 + // SMARTPL.g:74:6: 'time_played'
17911 + if (HASEXCEPTION())
17913 + goto ruleDATETAGEx;
17923 + LEXSTATE->type = _type;
17925 + // This is where rules clean up and exit
17927 + goto ruleDATETAGEx; /* Prevent compiler warnings */
17931 +// $ANTLR end DATETAG
17933 +// Comes from: 77:10: ( 'data_kind' | 'media_kind' )
17934 +/** \brief Lexer rule generated by ANTLR3
17936 + * $ANTLR start ENUMTAG
17938 + * Looks to match the characters the constitute the token ENUMTAG
17939 + * from the attached input stream.
17943 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
17945 +static ANTLR3_INLINE
17946 +void mENUMTAG(pSMARTPLLexer ctx)
17948 + ANTLR3_UINT32 _type;
17954 + // SMARTPL.g:77:10: ( 'data_kind' | 'media_kind' )
17956 + ANTLR3_UINT32 alt4;
17975 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17976 + EXCEPTION->message = (void *)"";
17977 + EXCEPTION->decisionNum = 4;
17978 + EXCEPTION->state = 0;
17981 + goto ruleENUMTAGEx;
17987 + // SMARTPL.g:77:12: 'data_kind'
17990 + if (HASEXCEPTION())
17992 + goto ruleENUMTAGEx;
18000 + // SMARTPL.g:78:6: 'media_kind'
18003 + if (HASEXCEPTION())
18005 + goto ruleENUMTAGEx;
18015 + LEXSTATE->type = _type;
18017 + // This is where rules clean up and exit
18019 + goto ruleENUMTAGEx; /* Prevent compiler warnings */
18023 +// $ANTLR end ENUMTAG
18025 +// Comes from: 81:10: ( 'includes' )
18026 +/** \brief Lexer rule generated by ANTLR3
18028 + * $ANTLR start INCLUDES
18030 + * Looks to match the characters the constitute the token INCLUDES
18031 + * from the attached input stream.
18035 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18037 +static ANTLR3_INLINE
18038 +void mINCLUDES(pSMARTPLLexer ctx)
18040 + ANTLR3_UINT32 _type;
18042 + _type = INCLUDES;
18045 + // SMARTPL.g:81:10: ( 'includes' )
18046 + // SMARTPL.g:81:12: 'includes'
18049 + if (HASEXCEPTION())
18051 + goto ruleINCLUDESEx;
18058 + LEXSTATE->type = _type;
18060 + // This is where rules clean up and exit
18062 + goto ruleINCLUDESEx; /* Prevent compiler warnings */
18063 + ruleINCLUDESEx: ;
18066 +// $ANTLR end INCLUDES
18068 +// Comes from: 84:6: ( 'is' )
18069 +/** \brief Lexer rule generated by ANTLR3
18071 + * $ANTLR start IS
18073 + * Looks to match the characters the constitute the token IS
18074 + * from the attached input stream.
18078 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18080 +static ANTLR3_INLINE
18081 +void mIS(pSMARTPLLexer ctx)
18083 + ANTLR3_UINT32 _type;
18088 + // SMARTPL.g:84:6: ( 'is' )
18089 + // SMARTPL.g:84:8: 'is'
18092 + if (HASEXCEPTION())
18101 + LEXSTATE->type = _type;
18103 + // This is where rules clean up and exit
18105 + goto ruleISEx; /* Prevent compiler warnings */
18111 +// Comes from: 87:10: ( ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL ) )
18112 +/** \brief Lexer rule generated by ANTLR3
18114 + * $ANTLR start INTBOOL
18116 + * Looks to match the characters the constitute the token INTBOOL
18117 + * from the attached input stream.
18121 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18123 +static ANTLR3_INLINE
18124 +void mINTBOOL(pSMARTPLLexer ctx)
18126 + ANTLR3_UINT32 _type;
18131 + // SMARTPL.g:87:10: ( ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL ) )
18132 + // SMARTPL.g:87:12: ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL )
18135 + // SMARTPL.g:87:12: ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL )
18178 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18179 + EXCEPTION->message = (void *)"";
18180 + EXCEPTION->decisionNum = 5;
18181 + EXCEPTION->state = 0;
18184 + goto ruleINTBOOLEx;
18190 + // SMARTPL.g:87:13: GREATER
18192 + /* 87:13: GREATER */
18194 + if (HASEXCEPTION())
18196 + goto ruleINTBOOLEx;
18203 + // SMARTPL.g:87:21: GREATEREQUAL
18205 + /* 87:21: GREATEREQUAL */
18206 + mGREATEREQUAL(ctx );
18207 + if (HASEXCEPTION())
18209 + goto ruleINTBOOLEx;
18216 + // SMARTPL.g:87:34: LESS
18218 + /* 87:34: LESS */
18220 + if (HASEXCEPTION())
18222 + goto ruleINTBOOLEx;
18229 + // SMARTPL.g:87:39: LESSEQUAL
18231 + /* 87:39: LESSEQUAL */
18232 + mLESSEQUAL(ctx );
18233 + if (HASEXCEPTION())
18235 + goto ruleINTBOOLEx;
18242 + // SMARTPL.g:87:49: EQUAL
18244 + /* 87:49: EQUAL */
18246 + if (HASEXCEPTION())
18248 + goto ruleINTBOOLEx;
18260 + LEXSTATE->type = _type;
18262 + // This is where rules clean up and exit
18264 + goto ruleINTBOOLEx; /* Prevent compiler warnings */
18268 +// $ANTLR end INTBOOL
18270 +// Comes from: 91:10: ( '>' )
18271 +/** \brief Lexer rule generated by ANTLR3
18273 + * $ANTLR start GREATER
18275 + * Looks to match the characters the constitute the token GREATER
18276 + * from the attached input stream.
18280 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18282 +static ANTLR3_INLINE
18283 +void mGREATER(pSMARTPLLexer ctx)
18285 + ANTLR3_UINT32 _type;
18288 + // SMARTPL.g:91:10: ( '>' )
18289 + // SMARTPL.g:91:12: '>'
18292 + if (HASEXCEPTION())
18294 + goto ruleGREATEREx;
18302 + // This is where rules clean up and exit
18304 + goto ruleGREATEREx; /* Prevent compiler warnings */
18308 +// $ANTLR end GREATER
18310 +// Comes from: 95:13: ( '>=' )
18311 +/** \brief Lexer rule generated by ANTLR3
18313 + * $ANTLR start GREATEREQUAL
18315 + * Looks to match the characters the constitute the token GREATEREQUAL
18316 + * from the attached input stream.
18320 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18322 +static ANTLR3_INLINE
18323 +void mGREATEREQUAL(pSMARTPLLexer ctx)
18325 + ANTLR3_UINT32 _type;
18328 + // SMARTPL.g:95:13: ( '>=' )
18329 + // SMARTPL.g:95:15: '>='
18332 + if (HASEXCEPTION())
18334 + goto ruleGREATEREQUALEx;
18343 + // This is where rules clean up and exit
18345 + goto ruleGREATEREQUALEx; /* Prevent compiler warnings */
18346 + ruleGREATEREQUALEx: ;
18349 +// $ANTLR end GREATEREQUAL
18351 +// Comes from: 99:7: ( '<' )
18352 +/** \brief Lexer rule generated by ANTLR3
18354 + * $ANTLR start LESS
18356 + * Looks to match the characters the constitute the token LESS
18357 + * from the attached input stream.
18361 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18363 +static ANTLR3_INLINE
18364 +void mLESS(pSMARTPLLexer ctx)
18366 + ANTLR3_UINT32 _type;
18369 + // SMARTPL.g:99:7: ( '<' )
18370 + // SMARTPL.g:99:9: '<'
18373 + if (HASEXCEPTION())
18383 + // This is where rules clean up and exit
18385 + goto ruleLESSEx; /* Prevent compiler warnings */
18389 +// $ANTLR end LESS
18391 +// Comes from: 103:11: ( '<=' )
18392 +/** \brief Lexer rule generated by ANTLR3
18394 + * $ANTLR start LESSEQUAL
18396 + * Looks to match the characters the constitute the token LESSEQUAL
18397 + * from the attached input stream.
18401 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18403 +static ANTLR3_INLINE
18404 +void mLESSEQUAL(pSMARTPLLexer ctx)
18406 + ANTLR3_UINT32 _type;
18409 + // SMARTPL.g:103:11: ( '<=' )
18410 + // SMARTPL.g:103:13: '<='
18413 + if (HASEXCEPTION())
18415 + goto ruleLESSEQUALEx;
18424 + // This is where rules clean up and exit
18426 + goto ruleLESSEQUALEx; /* Prevent compiler warnings */
18427 + ruleLESSEQUALEx: ;
18430 +// $ANTLR end LESSEQUAL
18432 +// Comes from: 107:8: ( '=' )
18433 +/** \brief Lexer rule generated by ANTLR3
18435 + * $ANTLR start EQUAL
18437 + * Looks to match the characters the constitute the token EQUAL
18438 + * from the attached input stream.
18442 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18444 +static ANTLR3_INLINE
18445 +void mEQUAL(pSMARTPLLexer ctx)
18447 + ANTLR3_UINT32 _type;
18450 + // SMARTPL.g:107:8: ( '=' )
18451 + // SMARTPL.g:107:10: '='
18454 + if (HASEXCEPTION())
18456 + goto ruleEQUALEx;
18464 + // This is where rules clean up and exit
18466 + goto ruleEQUALEx; /* Prevent compiler warnings */
18470 +// $ANTLR end EQUAL
18472 +// Comes from: 110:8: ( 'after' )
18473 +/** \brief Lexer rule generated by ANTLR3
18475 + * $ANTLR start AFTER
18477 + * Looks to match the characters the constitute the token AFTER
18478 + * from the attached input stream.
18482 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18484 +static ANTLR3_INLINE
18485 +void mAFTER(pSMARTPLLexer ctx)
18487 + ANTLR3_UINT32 _type;
18492 + // SMARTPL.g:110:8: ( 'after' )
18493 + // SMARTPL.g:110:10: 'after'
18496 + if (HASEXCEPTION())
18498 + goto ruleAFTEREx;
18505 + LEXSTATE->type = _type;
18507 + // This is where rules clean up and exit
18509 + goto ruleAFTEREx; /* Prevent compiler warnings */
18513 +// $ANTLR end AFTER
18515 +// Comes from: 113:9: ( 'before' )
18516 +/** \brief Lexer rule generated by ANTLR3
18518 + * $ANTLR start BEFORE
18520 + * Looks to match the characters the constitute the token BEFORE
18521 + * from the attached input stream.
18525 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18527 +static ANTLR3_INLINE
18528 +void mBEFORE(pSMARTPLLexer ctx)
18530 + ANTLR3_UINT32 _type;
18535 + // SMARTPL.g:113:9: ( 'before' )
18536 + // SMARTPL.g:113:11: 'before'
18539 + if (HASEXCEPTION())
18541 + goto ruleBEFOREEx;
18548 + LEXSTATE->type = _type;
18550 + // This is where rules clean up and exit
18552 + goto ruleBEFOREEx; /* Prevent compiler warnings */
18556 +// $ANTLR end BEFORE
18558 +// Comes from: 116:7: ( 'ago' )
18559 +/** \brief Lexer rule generated by ANTLR3
18561 + * $ANTLR start AGO
18563 + * Looks to match the characters the constitute the token AGO
18564 + * from the attached input stream.
18568 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18570 +static ANTLR3_INLINE
18571 +void mAGO(pSMARTPLLexer ctx)
18573 + ANTLR3_UINT32 _type;
18578 + // SMARTPL.g:116:7: ( 'ago' )
18579 + // SMARTPL.g:116:9: 'ago'
18582 + if (HASEXCEPTION())
18591 + LEXSTATE->type = _type;
18593 + // This is where rules clean up and exit
18595 + goto ruleAGOEx; /* Prevent compiler warnings */
18601 +// Comes from: 119:7: ( 'AND' | 'and' )
18602 +/** \brief Lexer rule generated by ANTLR3
18604 + * $ANTLR start AND
18606 + * Looks to match the characters the constitute the token AND
18607 + * from the attached input stream.
18611 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18613 +static ANTLR3_INLINE
18614 +void mAND(pSMARTPLLexer ctx)
18616 + ANTLR3_UINT32 _type;
18622 + // SMARTPL.g:119:7: ( 'AND' | 'and' )
18624 + ANTLR3_UINT32 alt6;
18643 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18644 + EXCEPTION->message = (void *)"";
18645 + EXCEPTION->decisionNum = 6;
18646 + EXCEPTION->state = 0;
18655 + // SMARTPL.g:119:9: 'AND'
18658 + if (HASEXCEPTION())
18668 + // SMARTPL.g:120:6: 'and'
18671 + if (HASEXCEPTION())
18683 + LEXSTATE->type = _type;
18685 + // This is where rules clean up and exit
18687 + goto ruleANDEx; /* Prevent compiler warnings */
18693 +// Comes from: 123:6: ( 'OR' | 'or' )
18694 +/** \brief Lexer rule generated by ANTLR3
18696 + * $ANTLR start OR
18698 + * Looks to match the characters the constitute the token OR
18699 + * from the attached input stream.
18703 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18705 +static ANTLR3_INLINE
18706 +void mOR(pSMARTPLLexer ctx)
18708 + ANTLR3_UINT32 _type;
18714 + // SMARTPL.g:123:6: ( 'OR' | 'or' )
18716 + ANTLR3_UINT32 alt7;
18735 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18736 + EXCEPTION->message = (void *)"";
18737 + EXCEPTION->decisionNum = 7;
18738 + EXCEPTION->state = 0;
18747 + // SMARTPL.g:123:8: 'OR'
18750 + if (HASEXCEPTION())
18760 + // SMARTPL.g:124:6: 'or'
18763 + if (HASEXCEPTION())
18775 + LEXSTATE->type = _type;
18777 + // This is where rules clean up and exit
18779 + goto ruleOREx; /* Prevent compiler warnings */
18785 +// Comes from: 127:7: ( 'NOT' | 'not' )
18786 +/** \brief Lexer rule generated by ANTLR3
18788 + * $ANTLR start NOT
18790 + * Looks to match the characters the constitute the token NOT
18791 + * from the attached input stream.
18795 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18797 +static ANTLR3_INLINE
18798 +void mNOT(pSMARTPLLexer ctx)
18800 + ANTLR3_UINT32 _type;
18806 + // SMARTPL.g:127:7: ( 'NOT' | 'not' )
18808 + ANTLR3_UINT32 alt8;
18827 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18828 + EXCEPTION->message = (void *)"";
18829 + EXCEPTION->decisionNum = 8;
18830 + EXCEPTION->state = 0;
18839 + // SMARTPL.g:127:9: 'NOT'
18842 + if (HASEXCEPTION())
18852 + // SMARTPL.g:128:6: 'not'
18855 + if (HASEXCEPTION())
18867 + LEXSTATE->type = _type;
18869 + // This is where rules clean up and exit
18871 + goto ruleNOTEx; /* Prevent compiler warnings */
18877 +// Comes from: 131:7: ( '(' )
18878 +/** \brief Lexer rule generated by ANTLR3
18880 + * $ANTLR start LPAR
18882 + * Looks to match the characters the constitute the token LPAR
18883 + * from the attached input stream.
18887 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18889 +static ANTLR3_INLINE
18890 +void mLPAR(pSMARTPLLexer ctx)
18892 + ANTLR3_UINT32 _type;
18897 + // SMARTPL.g:131:7: ( '(' )
18898 + // SMARTPL.g:131:9: '('
18901 + if (HASEXCEPTION())
18909 + LEXSTATE->type = _type;
18911 + // This is where rules clean up and exit
18913 + goto ruleLPAREx; /* Prevent compiler warnings */
18917 +// $ANTLR end LPAR
18919 +// Comes from: 134:7: ( ')' )
18920 +/** \brief Lexer rule generated by ANTLR3
18922 + * $ANTLR start RPAR
18924 + * Looks to match the characters the constitute the token RPAR
18925 + * from the attached input stream.
18929 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18931 +static ANTLR3_INLINE
18932 +void mRPAR(pSMARTPLLexer ctx)
18934 + ANTLR3_UINT32 _type;
18939 + // SMARTPL.g:134:7: ( ')' )
18940 + // SMARTPL.g:134:9: ')'
18943 + if (HASEXCEPTION())
18951 + LEXSTATE->type = _type;
18953 + // This is where rules clean up and exit
18955 + goto ruleRPAREx; /* Prevent compiler warnings */
18959 +// $ANTLR end RPAR
18961 +// 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' )
18962 +/** \brief Lexer rule generated by ANTLR3
18964 + * $ANTLR start DATE
18966 + * Looks to match the characters the constitute the token DATE
18967 + * from the attached input stream.
18971 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18973 +static ANTLR3_INLINE
18974 +void mDATE(pSMARTPLLexer ctx)
18976 + ANTLR3_UINT32 _type;
18982 + // 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' )
18984 + ANTLR3_UINT32 alt9;
19052 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19053 + EXCEPTION->message = (void *)"";
19054 + EXCEPTION->decisionNum = 9;
19055 + EXCEPTION->state = 8;
19066 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19067 + EXCEPTION->message = (void *)"";
19068 + EXCEPTION->decisionNum = 9;
19069 + EXCEPTION->state = 7;
19080 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19081 + EXCEPTION->message = (void *)"";
19082 + EXCEPTION->decisionNum = 9;
19083 + EXCEPTION->state = 6;
19094 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19095 + EXCEPTION->message = (void *)"";
19096 + EXCEPTION->decisionNum = 9;
19097 + EXCEPTION->state = 5;
19108 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19109 + EXCEPTION->message = (void *)"";
19110 + EXCEPTION->decisionNum = 9;
19111 + EXCEPTION->state = 4;
19122 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19123 + EXCEPTION->message = (void *)"";
19124 + EXCEPTION->decisionNum = 9;
19125 + EXCEPTION->state = 0;
19134 + // SMARTPL.g:137:9: ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) '-' ( '0' .. '1' ) ( '0' .. '9' ) '-' ( '0' .. '3' ) ( '0' .. '9' )
19136 + // SMARTPL.g:137:9: ( '0' .. '9' )
19137 + // SMARTPL.g:137:10: '0' .. '9'
19139 + MATCHRANGE('0', '9');
19140 + if (HASEXCEPTION())
19148 + // SMARTPL.g:137:19: ( '0' .. '9' )
19149 + // SMARTPL.g:137:20: '0' .. '9'
19151 + MATCHRANGE('0', '9');
19152 + if (HASEXCEPTION())
19160 + // SMARTPL.g:137:29: ( '0' .. '9' )
19161 + // SMARTPL.g:137:30: '0' .. '9'
19163 + MATCHRANGE('0', '9');
19164 + if (HASEXCEPTION())
19172 + // SMARTPL.g:137:39: ( '0' .. '9' )
19173 + // SMARTPL.g:137:40: '0' .. '9'
19175 + MATCHRANGE('0', '9');
19176 + if (HASEXCEPTION())
19185 + if (HASEXCEPTION())
19190 + // SMARTPL.g:137:52: ( '0' .. '1' )
19191 + // SMARTPL.g:137:53: '0' .. '1'
19193 + MATCHRANGE('0', '1');
19194 + if (HASEXCEPTION())
19202 + // SMARTPL.g:137:62: ( '0' .. '9' )
19203 + // SMARTPL.g:137:63: '0' .. '9'
19205 + MATCHRANGE('0', '9');
19206 + if (HASEXCEPTION())
19215 + if (HASEXCEPTION())
19220 + // SMARTPL.g:137:75: ( '0' .. '3' )
19221 + // SMARTPL.g:137:76: '0' .. '3'
19223 + MATCHRANGE('0', '3');
19224 + if (HASEXCEPTION())
19232 + // SMARTPL.g:137:85: ( '0' .. '9' )
19233 + // SMARTPL.g:137:86: '0' .. '9'
19235 + MATCHRANGE('0', '9');
19236 + if (HASEXCEPTION())
19248 + // SMARTPL.g:138:6: 'today'
19251 + if (HASEXCEPTION())
19261 + // SMARTPL.g:139:6: 'yesterday'
19264 + if (HASEXCEPTION())
19274 + // SMARTPL.g:140:6: 'last week'
19277 + if (HASEXCEPTION())
19287 + // SMARTPL.g:141:6: 'last month'
19290 + if (HASEXCEPTION())
19300 + // SMARTPL.g:142:6: 'last year'
19303 + if (HASEXCEPTION())
19315 + LEXSTATE->type = _type;
19317 + // This is where rules clean up and exit
19319 + goto ruleDATEEx; /* Prevent compiler warnings */
19323 +// $ANTLR end DATE
19325 +// Comes from: 145:13: ( 'days' | 'weeks' | 'months' | 'years' )
19326 +/** \brief Lexer rule generated by ANTLR3
19328 + * $ANTLR start DATINTERVAL
19330 + * Looks to match the characters the constitute the token DATINTERVAL
19331 + * from the attached input stream.
19335 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19337 +static ANTLR3_INLINE
19338 +void mDATINTERVAL(pSMARTPLLexer ctx)
19340 + ANTLR3_UINT32 _type;
19342 + _type = DATINTERVAL;
19346 + // SMARTPL.g:145:13: ( 'days' | 'weeks' | 'months' | 'years' )
19348 + ANTLR3_UINT32 alt10;
19377 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19378 + EXCEPTION->message = (void *)"";
19379 + EXCEPTION->decisionNum = 10;
19380 + EXCEPTION->state = 0;
19383 + goto ruleDATINTERVALEx;
19389 + // SMARTPL.g:145:15: 'days'
19392 + if (HASEXCEPTION())
19394 + goto ruleDATINTERVALEx;
19402 + // SMARTPL.g:146:6: 'weeks'
19405 + if (HASEXCEPTION())
19407 + goto ruleDATINTERVALEx;
19415 + // SMARTPL.g:147:6: 'months'
19418 + if (HASEXCEPTION())
19420 + goto ruleDATINTERVALEx;
19428 + // SMARTPL.g:148:6: 'years'
19431 + if (HASEXCEPTION())
19433 + goto ruleDATINTERVALEx;
19443 + LEXSTATE->type = _type;
19445 + // This is where rules clean up and exit
19447 + goto ruleDATINTERVALEx; /* Prevent compiler warnings */
19448 + ruleDATINTERVALEx: ;
19451 +// $ANTLR end DATINTERVAL
19453 +// Comes from: 151:10: ( 'music' | 'movie' | 'podcast' | 'audiobook' | 'tvshow' | 'file' | 'url' | 'spotify' | 'pipe' )
19454 +/** \brief Lexer rule generated by ANTLR3
19456 + * $ANTLR start ENUMVAL
19458 + * Looks to match the characters the constitute the token ENUMVAL
19459 + * from the attached input stream.
19463 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19465 +static ANTLR3_INLINE
19466 +void mENUMVAL(pSMARTPLLexer ctx)
19468 + ANTLR3_UINT32 _type;
19474 + // SMARTPL.g:151:10: ( 'music' | 'movie' | 'podcast' | 'audiobook' | 'tvshow' | 'file' | 'url' | 'spotify' | 'pipe' )
19476 + ANTLR3_UINT32 alt11;
19499 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19500 + EXCEPTION->message = (void *)"";
19501 + EXCEPTION->decisionNum = 11;
19502 + EXCEPTION->state = 1;
19505 + goto ruleENUMVALEx;
19527 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19528 + EXCEPTION->message = (void *)"";
19529 + EXCEPTION->decisionNum = 11;
19530 + EXCEPTION->state = 2;
19533 + goto ruleENUMVALEx;
19566 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19567 + EXCEPTION->message = (void *)"";
19568 + EXCEPTION->decisionNum = 11;
19569 + EXCEPTION->state = 0;
19572 + goto ruleENUMVALEx;
19578 + // SMARTPL.g:151:12: 'music'
19581 + if (HASEXCEPTION())
19583 + goto ruleENUMVALEx;
19591 + // SMARTPL.g:152:6: 'movie'
19594 + if (HASEXCEPTION())
19596 + goto ruleENUMVALEx;
19604 + // SMARTPL.g:153:6: 'podcast'
19607 + if (HASEXCEPTION())
19609 + goto ruleENUMVALEx;
19617 + // SMARTPL.g:154:6: 'audiobook'
19620 + if (HASEXCEPTION())
19622 + goto ruleENUMVALEx;
19630 + // SMARTPL.g:155:6: 'tvshow'
19633 + if (HASEXCEPTION())
19635 + goto ruleENUMVALEx;
19643 + // SMARTPL.g:156:6: 'file'
19646 + if (HASEXCEPTION())
19648 + goto ruleENUMVALEx;
19656 + // SMARTPL.g:157:6: 'url'
19659 + if (HASEXCEPTION())
19661 + goto ruleENUMVALEx;
19669 + // SMARTPL.g:158:6: 'spotify'
19672 + if (HASEXCEPTION())
19674 + goto ruleENUMVALEx;
19682 + // SMARTPL.g:159:6: 'pipe'
19685 + if (HASEXCEPTION())
19687 + goto ruleENUMVALEx;
19697 + LEXSTATE->type = _type;
19699 + // This is where rules clean up and exit
19701 + goto ruleENUMVALEx; /* Prevent compiler warnings */
19705 +// $ANTLR end ENUMVAL
19707 +// Comes from: 162:7: ( '\"' (~ ( '\"' ) )+ '\"' )
19708 +/** \brief Lexer rule generated by ANTLR3
19710 + * $ANTLR start STR
19712 + * Looks to match the characters the constitute the token STR
19713 + * from the attached input stream.
19717 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19719 +static ANTLR3_INLINE
19720 +void mSTR(pSMARTPLLexer ctx)
19722 + ANTLR3_UINT32 _type;
19727 + // SMARTPL.g:162:7: ( '\"' (~ ( '\"' ) )+ '\"' )
19728 + // SMARTPL.g:162:9: '\"' (~ ( '\"' ) )+ '\"'
19731 + if (HASEXCEPTION())
19736 + // SMARTPL.g:162:13: (~ ( '\"' ) )+
19744 + /* dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState)
19746 + int LA12_0 = LA(1);
19747 + if ( (((LA12_0 >= 0x0000) && (LA12_0 <= '!')) || ((LA12_0 >= '#') && (LA12_0 <= 0xFFFF))) )
19756 + // SMARTPL.g:162:13: ~ ( '\"' )
19758 + if ( ((LA(1) >= 0x0000) && (LA(1) <= '!')) || ((LA(1) >= '#') && (LA(1) <= 0xFFFF)) )
19766 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
19767 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
19769 + LRECOVER(); goto ruleSTREx;
19778 + if ( cnt12 >= 1 )
19782 + /* mismatchedSetEx()
19785 + EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
19786 + EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
19793 + loop12: ; /* Jump to here if this rule does not match */
19796 + if (HASEXCEPTION())
19804 + LEXSTATE->type = _type;
19806 + // This is where rules clean up and exit
19808 + goto ruleSTREx; /* Prevent compiler warnings */
19814 +// Comes from: 165:7: ( ( '0' .. '9' )+ )
19815 +/** \brief Lexer rule generated by ANTLR3
19817 + * $ANTLR start INT
19819 + * Looks to match the characters the constitute the token INT
19820 + * from the attached input stream.
19824 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19826 +static ANTLR3_INLINE
19827 +void mINT(pSMARTPLLexer ctx)
19829 + ANTLR3_UINT32 _type;
19834 + // SMARTPL.g:165:7: ( ( '0' .. '9' )+ )
19835 + // SMARTPL.g:165:9: ( '0' .. '9' )+
19837 + // SMARTPL.g:165:9: ( '0' .. '9' )+
19866 + // SMARTPL.g:165:10: '0' .. '9'
19868 + MATCHRANGE('0', '9');
19869 + if (HASEXCEPTION())
19880 + if ( cnt13 >= 1 )
19884 + /* mismatchedSetEx()
19887 + EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
19888 + EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
19895 + loop13: ; /* Jump to here if this rule does not match */
19900 + LEXSTATE->type = _type;
19902 + // This is where rules clean up and exit
19904 + goto ruleINTEx; /* Prevent compiler warnings */
19910 +// Comes from: 168:12: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' ) )
19911 +/** \brief Lexer rule generated by ANTLR3
19913 + * $ANTLR start WHITESPACE
19915 + * Looks to match the characters the constitute the token WHITESPACE
19916 + * from the attached input stream.
19920 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19922 +static ANTLR3_INLINE
19923 +void mWHITESPACE(pSMARTPLLexer ctx)
19925 + ANTLR3_UINT32 _type;
19927 + _type = WHITESPACE;
19930 + // SMARTPL.g:168:12: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' ) )
19931 + // SMARTPL.g:168:14: ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' )
19933 + if ( ((LA(1) >= '\t') && (LA(1) <= '\n')) || ((LA(1) >= '\f') && (LA(1) <= '\r')) || LA(1) == ' ' )
19941 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
19942 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
19944 + LRECOVER(); goto ruleWHITESPACEEx;
19948 + LEXSTATE->channel = HIDDEN;
19953 + LEXSTATE->type = _type;
19955 + // This is where rules clean up and exit
19957 + goto ruleWHITESPACEEx; /* Prevent compiler warnings */
19958 + ruleWHITESPACEEx: ;
19961 +// $ANTLR end WHITESPACE
19963 +/** This is the entry point in to the lexer from an object that
19964 + * wants to generate the next token, such as a pCOMMON_TOKEN_STREAM
19967 +mTokens(pSMARTPLLexer ctx)
19970 + // 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 )
19972 + ANTLR3_UINT32 alt14;
20021 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20022 + EXCEPTION->message = (void *)"";
20023 + EXCEPTION->decisionNum = 14;
20024 + EXCEPTION->state = 3;
20027 + goto ruleTokensEx;
20053 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20054 + EXCEPTION->message = (void *)"";
20055 + EXCEPTION->decisionNum = 14;
20056 + EXCEPTION->state = 28;
20059 + goto ruleTokensEx;
20082 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20083 + EXCEPTION->message = (void *)"";
20084 + EXCEPTION->decisionNum = 14;
20085 + EXCEPTION->state = 4;
20088 + goto ruleTokensEx;
20127 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20128 + EXCEPTION->message = (void *)"";
20129 + EXCEPTION->decisionNum = 14;
20130 + EXCEPTION->state = 42;
20133 + goto ruleTokensEx;
20141 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20142 + EXCEPTION->message = (void *)"";
20143 + EXCEPTION->decisionNum = 14;
20144 + EXCEPTION->state = 39;
20147 + goto ruleTokensEx;
20155 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20156 + EXCEPTION->message = (void *)"";
20157 + EXCEPTION->decisionNum = 14;
20158 + EXCEPTION->state = 29;
20161 + goto ruleTokensEx;
20169 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20170 + EXCEPTION->message = (void *)"";
20171 + EXCEPTION->decisionNum = 14;
20172 + EXCEPTION->state = 6;
20175 + goto ruleTokensEx;
20203 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20204 + EXCEPTION->message = (void *)"";
20205 + EXCEPTION->decisionNum = 14;
20206 + EXCEPTION->state = 7;
20209 + goto ruleTokensEx;
20249 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20250 + EXCEPTION->message = (void *)"";
20251 + EXCEPTION->decisionNum = 14;
20252 + EXCEPTION->state = 40;
20255 + goto ruleTokensEx;
20268 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20269 + EXCEPTION->message = (void *)"";
20270 + EXCEPTION->decisionNum = 14;
20271 + EXCEPTION->state = 30;
20274 + goto ruleTokensEx;
20282 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20283 + EXCEPTION->message = (void *)"";
20284 + EXCEPTION->decisionNum = 14;
20285 + EXCEPTION->state = 9;
20288 + goto ruleTokensEx;
20314 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20315 + EXCEPTION->message = (void *)"";
20316 + EXCEPTION->decisionNum = 14;
20317 + EXCEPTION->state = 31;
20320 + goto ruleTokensEx;
20328 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20329 + EXCEPTION->message = (void *)"";
20330 + EXCEPTION->decisionNum = 14;
20331 + EXCEPTION->state = 10;
20334 + goto ruleTokensEx;
20365 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20366 + EXCEPTION->message = (void *)"";
20367 + EXCEPTION->decisionNum = 14;
20368 + EXCEPTION->state = 33;
20371 + goto ruleTokensEx;
20384 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20385 + EXCEPTION->message = (void *)"";
20386 + EXCEPTION->decisionNum = 14;
20387 + EXCEPTION->state = 11;
20390 + goto ruleTokensEx;
20412 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20413 + EXCEPTION->message = (void *)"";
20414 + EXCEPTION->decisionNum = 14;
20415 + EXCEPTION->state = 12;
20418 + goto ruleTokensEx;
20577 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20578 + EXCEPTION->message = (void *)"";
20579 + EXCEPTION->decisionNum = 14;
20580 + EXCEPTION->state = 0;
20583 + goto ruleTokensEx;
20589 + // SMARTPL.g:1:10: T__30
20591 + /* 1:10: T__30 */
20593 + if (HASEXCEPTION())
20595 + goto ruleTokensEx;
20602 + // SMARTPL.g:1:16: T__31
20604 + /* 1:16: T__31 */
20606 + if (HASEXCEPTION())
20608 + goto ruleTokensEx;
20615 + // SMARTPL.g:1:22: STRTAG
20617 + /* 1:22: STRTAG */
20619 + if (HASEXCEPTION())
20621 + goto ruleTokensEx;
20628 + // SMARTPL.g:1:29: INTTAG
20630 + /* 1:29: INTTAG */
20632 + if (HASEXCEPTION())
20634 + goto ruleTokensEx;
20641 + // SMARTPL.g:1:36: DATETAG
20643 + /* 1:36: DATETAG */
20645 + if (HASEXCEPTION())
20647 + goto ruleTokensEx;
20654 + // SMARTPL.g:1:44: ENUMTAG
20656 + /* 1:44: ENUMTAG */
20658 + if (HASEXCEPTION())
20660 + goto ruleTokensEx;
20667 + // SMARTPL.g:1:52: INCLUDES
20669 + /* 1:52: INCLUDES */
20671 + if (HASEXCEPTION())
20673 + goto ruleTokensEx;
20680 + // SMARTPL.g:1:61: IS
20684 + if (HASEXCEPTION())
20686 + goto ruleTokensEx;
20693 + // SMARTPL.g:1:64: INTBOOL
20695 + /* 1:64: INTBOOL */
20697 + if (HASEXCEPTION())
20699 + goto ruleTokensEx;
20706 + // SMARTPL.g:1:72: AFTER
20708 + /* 1:72: AFTER */
20710 + if (HASEXCEPTION())
20712 + goto ruleTokensEx;
20719 + // SMARTPL.g:1:78: BEFORE
20721 + /* 1:78: BEFORE */
20723 + if (HASEXCEPTION())
20725 + goto ruleTokensEx;
20732 + // SMARTPL.g:1:85: AGO
20736 + if (HASEXCEPTION())
20738 + goto ruleTokensEx;
20745 + // SMARTPL.g:1:89: AND
20749 + if (HASEXCEPTION())
20751 + goto ruleTokensEx;
20758 + // SMARTPL.g:1:93: OR
20762 + if (HASEXCEPTION())
20764 + goto ruleTokensEx;
20771 + // SMARTPL.g:1:96: NOT
20775 + if (HASEXCEPTION())
20777 + goto ruleTokensEx;
20784 + // SMARTPL.g:1:100: LPAR
20786 + /* 1:100: LPAR */
20788 + if (HASEXCEPTION())
20790 + goto ruleTokensEx;
20797 + // SMARTPL.g:1:105: RPAR
20799 + /* 1:105: RPAR */
20801 + if (HASEXCEPTION())
20803 + goto ruleTokensEx;
20810 + // SMARTPL.g:1:110: DATE
20812 + /* 1:110: DATE */
20814 + if (HASEXCEPTION())
20816 + goto ruleTokensEx;
20823 + // SMARTPL.g:1:115: DATINTERVAL
20825 + /* 1:115: DATINTERVAL */
20826 + mDATINTERVAL(ctx );
20827 + if (HASEXCEPTION())
20829 + goto ruleTokensEx;
20836 + // SMARTPL.g:1:127: ENUMVAL
20838 + /* 1:127: ENUMVAL */
20840 + if (HASEXCEPTION())
20842 + goto ruleTokensEx;
20849 + // SMARTPL.g:1:135: STR
20853 + if (HASEXCEPTION())
20855 + goto ruleTokensEx;
20862 + // SMARTPL.g:1:139: INT
20866 + if (HASEXCEPTION())
20868 + goto ruleTokensEx;
20875 + // SMARTPL.g:1:143: WHITESPACE
20877 + /* 1:143: WHITESPACE */
20878 + mWHITESPACE(ctx );
20879 + if (HASEXCEPTION())
20881 + goto ruleTokensEx;
20892 + goto ruleTokensEx; /* Prevent compiler warnings */
20896 +/* =========================================================================
20897 + * Lexer matching rules end.
20898 + * =========================================================================
20900 +/* End of Lexer code
20901 + * ================================================
20902 + * ================================================
20907 + * =============================================================================
20909 diff --git a/src/pregen/SMARTPLLexer.h b/src/pregen/SMARTPLLexer.h
20910 new file mode 100644
20911 index 0000000..9d73721
20913 +++ b/src/pregen/SMARTPLLexer.h
20916 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
20918 + * - From the grammar source file : SMARTPL.g
20919 + * - On : 2015-06-27 19:05:15
20920 + * - for the lexer : SMARTPLLexerLexer *
20921 + * Editing it, at least manually, is not wise.
20923 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
20926 + * The lexer SMARTPLLexer has the callable functions (rules) shown below,
20927 + * which will invoke the code for the associated rule in the source grammar
20928 + * assuming that the input stream is pointing to a token/text stream that could begin
20931 + * For instance if you call the first (topmost) rule in a parser grammar, you will
20932 + * get the results of a full parse, but calling a rule half way through the grammar will
20933 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
20934 + * in editors and so on.
20936 + * The parser entry points are called indirectly (by function pointer to function) via
20937 + * a parser context typedef pSMARTPLLexer, which is returned from a call to SMARTPLLexerNew().
20939 + * As this is a generated lexer, it is unlikely you will call it 'manually'. However
20940 + * the methods are provided anyway.
20941 + * * The methods in pSMARTPLLexer are as follows:
20943 + * - void pSMARTPLLexer->T__30(pSMARTPLLexer)
20944 + * - void pSMARTPLLexer->T__31(pSMARTPLLexer)
20945 + * - void pSMARTPLLexer->STRTAG(pSMARTPLLexer)
20946 + * - void pSMARTPLLexer->INTTAG(pSMARTPLLexer)
20947 + * - void pSMARTPLLexer->DATETAG(pSMARTPLLexer)
20948 + * - void pSMARTPLLexer->ENUMTAG(pSMARTPLLexer)
20949 + * - void pSMARTPLLexer->INCLUDES(pSMARTPLLexer)
20950 + * - void pSMARTPLLexer->IS(pSMARTPLLexer)
20951 + * - void pSMARTPLLexer->INTBOOL(pSMARTPLLexer)
20952 + * - void pSMARTPLLexer->GREATER(pSMARTPLLexer)
20953 + * - void pSMARTPLLexer->GREATEREQUAL(pSMARTPLLexer)
20954 + * - void pSMARTPLLexer->LESS(pSMARTPLLexer)
20955 + * - void pSMARTPLLexer->LESSEQUAL(pSMARTPLLexer)
20956 + * - void pSMARTPLLexer->EQUAL(pSMARTPLLexer)
20957 + * - void pSMARTPLLexer->AFTER(pSMARTPLLexer)
20958 + * - void pSMARTPLLexer->BEFORE(pSMARTPLLexer)
20959 + * - void pSMARTPLLexer->AGO(pSMARTPLLexer)
20960 + * - void pSMARTPLLexer->AND(pSMARTPLLexer)
20961 + * - void pSMARTPLLexer->OR(pSMARTPLLexer)
20962 + * - void pSMARTPLLexer->NOT(pSMARTPLLexer)
20963 + * - void pSMARTPLLexer->LPAR(pSMARTPLLexer)
20964 + * - void pSMARTPLLexer->RPAR(pSMARTPLLexer)
20965 + * - void pSMARTPLLexer->DATE(pSMARTPLLexer)
20966 + * - void pSMARTPLLexer->DATINTERVAL(pSMARTPLLexer)
20967 + * - void pSMARTPLLexer->ENUMVAL(pSMARTPLLexer)
20968 + * - void pSMARTPLLexer->STR(pSMARTPLLexer)
20969 + * - void pSMARTPLLexer->INT(pSMARTPLLexer)
20970 + * - void pSMARTPLLexer->WHITESPACE(pSMARTPLLexer)
20971 + * - void pSMARTPLLexer->Tokens(pSMARTPLLexer)
20973 + * The return type for any particular rule is of course determined by the source
20976 +// [The "BSD licence"]
20977 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
20978 +// http://www.temporal-wave.com
20979 +// http://www.linkedin.com/in/jimidle
20981 +// All rights reserved.
20983 +// Redistribution and use in source and binary forms, with or without
20984 +// modification, are permitted provided that the following conditions
20986 +// 1. Redistributions of source code must retain the above copyright
20987 +// notice, this list of conditions and the following disclaimer.
20988 +// 2. Redistributions in binary form must reproduce the above copyright
20989 +// notice, this list of conditions and the following disclaimer in the
20990 +// documentation and/or other materials provided with the distribution.
20991 +// 3. The name of the author may not be used to endorse or promote products
20992 +// derived from this software without specific prior written permission.
20994 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20995 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20996 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20997 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20998 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20999 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21000 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21001 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21002 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21003 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21005 +#ifndef _SMARTPLLexer_H
21006 +#define _SMARTPLLexer_H
21007 +/* =============================================================================
21008 + * Standard antlr3 C runtime definitions
21010 +#include <antlr3.h>
21012 +/* End of standard antlr 3 runtime definitions
21013 + * =============================================================================
21016 +#ifdef __cplusplus
21020 +// Forward declare the context typedef so that we can use it before it is
21021 +// properly defined. Delegators and delegates (from import statements) are
21022 +// interdependent and their context structures contain pointers to each other
21023 +// C only allows such things to be declared if you pre-declare the typedef.
21025 +typedef struct SMARTPLLexer_Ctx_struct SMARTPLLexer, * pSMARTPLLexer;
21029 +#ifdef ANTLR3_WINDOWS
21030 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
21031 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
21032 +// initialized but unused variable - tree rewrite variables declared but not needed
21033 +// Unreferenced local variable - lexer rule declares but does not always use _type
21034 +// potentially unitialized variable used - retval always returned from a rule
21035 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
21037 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
21038 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
21039 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
21040 +// this is a matter of orthogonality hence I disable that one.
21042 +#pragma warning( disable : 4100 )
21043 +#pragma warning( disable : 4101 )
21044 +#pragma warning( disable : 4127 )
21045 +#pragma warning( disable : 4189 )
21046 +#pragma warning( disable : 4505 )
21047 +#pragma warning( disable : 4701 )
21050 +/** Context tracking structure for SMARTPLLexer
21052 +struct SMARTPLLexer_Ctx_struct
21054 + /** Built in ANTLR3 context tracker contains all the generic elements
21055 + * required for context tracking.
21057 + pANTLR3_LEXER pLexer;
21060 + void (*mT__30) (struct SMARTPLLexer_Ctx_struct * ctx);
21061 + void (*mT__31) (struct SMARTPLLexer_Ctx_struct * ctx);
21062 + void (*mSTRTAG) (struct SMARTPLLexer_Ctx_struct * ctx);
21063 + void (*mINTTAG) (struct SMARTPLLexer_Ctx_struct * ctx);
21064 + void (*mDATETAG) (struct SMARTPLLexer_Ctx_struct * ctx);
21065 + void (*mENUMTAG) (struct SMARTPLLexer_Ctx_struct * ctx);
21066 + void (*mINCLUDES) (struct SMARTPLLexer_Ctx_struct * ctx);
21067 + void (*mIS) (struct SMARTPLLexer_Ctx_struct * ctx);
21068 + void (*mINTBOOL) (struct SMARTPLLexer_Ctx_struct * ctx);
21069 + void (*mGREATER) (struct SMARTPLLexer_Ctx_struct * ctx);
21070 + void (*mGREATEREQUAL) (struct SMARTPLLexer_Ctx_struct * ctx);
21071 + void (*mLESS) (struct SMARTPLLexer_Ctx_struct * ctx);
21072 + void (*mLESSEQUAL) (struct SMARTPLLexer_Ctx_struct * ctx);
21073 + void (*mEQUAL) (struct SMARTPLLexer_Ctx_struct * ctx);
21074 + void (*mAFTER) (struct SMARTPLLexer_Ctx_struct * ctx);
21075 + void (*mBEFORE) (struct SMARTPLLexer_Ctx_struct * ctx);
21076 + void (*mAGO) (struct SMARTPLLexer_Ctx_struct * ctx);
21077 + void (*mAND) (struct SMARTPLLexer_Ctx_struct * ctx);
21078 + void (*mOR) (struct SMARTPLLexer_Ctx_struct * ctx);
21079 + void (*mNOT) (struct SMARTPLLexer_Ctx_struct * ctx);
21080 + void (*mLPAR) (struct SMARTPLLexer_Ctx_struct * ctx);
21081 + void (*mRPAR) (struct SMARTPLLexer_Ctx_struct * ctx);
21082 + void (*mDATE) (struct SMARTPLLexer_Ctx_struct * ctx);
21083 + void (*mDATINTERVAL) (struct SMARTPLLexer_Ctx_struct * ctx);
21084 + void (*mENUMVAL) (struct SMARTPLLexer_Ctx_struct * ctx);
21085 + void (*mSTR) (struct SMARTPLLexer_Ctx_struct * ctx);
21086 + void (*mINT) (struct SMARTPLLexer_Ctx_struct * ctx);
21087 + void (*mWHITESPACE) (struct SMARTPLLexer_Ctx_struct * ctx);
21088 + void (*mTokens) (struct SMARTPLLexer_Ctx_struct * ctx); const char * (*getGrammarFileName)();
21089 + void (*free) (struct SMARTPLLexer_Ctx_struct * ctx);
21093 +// Function protoypes for the constructor functions that external translation units
21094 +// such as delegators and delegates may wish to call.
21096 +ANTLR3_API pSMARTPLLexer SMARTPLLexerNew (pANTLR3_INPUT_STREAM instream);
21097 +ANTLR3_API pSMARTPLLexer SMARTPLLexerNewSSD (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
21099 +/** Symbolic definitions of all the tokens that the lexer will work with.
21102 + * Antlr will define EOF, but we can't use that as it it is too common in
21103 + * in C header files and that would be confusing. There is no way to filter this out at the moment
21104 + * so we just undef it here for now. That isn't the value we get back from C recognizers
21105 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
21113 +#define INTBOOL 14
21116 +#define WHITESPACE 29
21117 +#define GREATEREQUAL 25
21119 +#define DATETAG 16
21125 +#define INCLUDES 11
21129 +#define GREATER 24
21131 +#define ENUMTAG 19
21133 +#define ENUMVAL 20
21139 +#define LESSEQUAL 27
21141 +#define DATINTERVAL 23
21144 +#define EOF ANTLR3_TOKEN_EOF
21147 +#ifndef TOKENSOURCE
21148 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
21151 +/* End of token definitions for SMARTPLLexer
21152 + * =============================================================================
21156 +#ifdef __cplusplus
21162 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
21163 diff --git a/src/pregen/SMARTPLParser.c b/src/pregen/SMARTPLParser.c
21164 new file mode 100644
21165 index 0000000..afe9f99
21167 +++ b/src/pregen/SMARTPLParser.c
21170 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
21172 + * - From the grammar source file : SMARTPL.g
21173 + * - On : 2015-06-27 19:05:15
21174 + * - for the parser : SMARTPLParserParser *
21175 + * Editing it, at least manually, is not wise.
21177 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
21181 +// [The "BSD licence"]
21182 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
21183 +// http://www.temporal-wave.com
21184 +// http://www.linkedin.com/in/jimidle
21186 +// All rights reserved.
21188 +// Redistribution and use in source and binary forms, with or without
21189 +// modification, are permitted provided that the following conditions
21191 +// 1. Redistributions of source code must retain the above copyright
21192 +// notice, this list of conditions and the following disclaimer.
21193 +// 2. Redistributions in binary form must reproduce the above copyright
21194 +// notice, this list of conditions and the following disclaimer in the
21195 +// documentation and/or other materials provided with the distribution.
21196 +// 3. The name of the author may not be used to endorse or promote products
21197 +// derived from this software without specific prior written permission.
21199 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21200 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21201 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21202 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21203 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21204 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21205 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21206 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21207 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21208 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21210 +/* -----------------------------------------
21211 + * Include the ANTLR3 generated header file.
21213 +#include "SMARTPLParser.h"
21214 +/* ----------------------------------------- */
21220 +/* MACROS that hide the C interface implementations from the
21221 + * generated code, which makes it a little more understandable to the human eye.
21222 + * I am very much against using C pre-processor macros for function calls and bits
21223 + * of code as you cannot see what is happening when single stepping in debuggers
21224 + * and so on. The exception (in my book at least) is for generated code, where you are
21225 + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
21226 + * hides some indirect calls, but is always referring to the input stream. This is
21227 + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
21228 + * the runtime interfaces without changing the generated code too often, without
21229 + * confusing the reader of the generated output, who may not wish to know the gory
21230 + * details of the interface inheritance.
21235 +/* Aids in accessing scopes for grammar programmers
21238 +#undef SCOPE_STACK
21240 +#define SCOPE_TYPE(scope) pSMARTPLParser_##scope##_SCOPE
21241 +#define SCOPE_STACK(scope) pSMARTPLParser_##scope##Stack
21242 +#define SCOPE_TOP(scope) ctx->pSMARTPLParser_##scope##Top
21243 +#define SCOPE_SIZE(scope) ctx->pSMARTPLParser_##scope##Stack_limit
21244 +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
21246 +/* Macros for accessing things in the parser
21251 +#undef HAVEPARSEDRULE
21255 +#undef HASEXCEPTION
21259 +#undef FOLLOWSTACK
21263 +#undef PREPORTERROR
21266 +#undef CONSTRUCTEX
21271 +#undef PERRORRECOVERY
21274 +#undef RECOVERFROMMISMATCHEDSET
21275 +#undef RECOVERFROMMISMATCHEDELEMENT
21282 +#define PARSER ctx->pParser
21283 +#define RECOGNIZER PARSER->rec
21284 +#define PSRSTATE RECOGNIZER->state
21285 +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
21286 +#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si)
21287 +#define INPUT PARSER->tstream
21288 +#define STRSTREAM INPUT
21289 +#define ISTREAM INPUT->istream
21290 +#define INDEX() ISTREAM->index(INPUT->istream)
21291 +#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE)
21292 +#define EXCEPTION PSRSTATE->exception
21293 +#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs)
21294 +#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER)
21295 +#define FOLLOWSTACK PSRSTATE->following
21296 +#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
21297 +#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK)
21298 +#define PRECOVER() RECOGNIZER->recover(RECOGNIZER)
21299 +#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER)
21300 +#define LA(n) INPUT->istream->_LA(ISTREAM, n)
21301 +#define LT(n) INPUT->_LT(INPUT, n)
21302 +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
21303 +#define CONSUME() ISTREAM->consume(ISTREAM)
21304 +#define MARK() ISTREAM->mark(ISTREAM)
21305 +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
21306 +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
21307 +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
21308 +#define PERRORRECOVERY PSRSTATE->errorRecovery
21309 +#define FAILEDFLAG PSRSTATE->failed
21310 +#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE)
21311 +#define BACKTRACKING PSRSTATE->backtracking
21312 +#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
21313 +#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
21314 +#define ADAPTOR ctx->adaptor
21315 +#define RULEMEMO PSRSTATE->ruleMemo
21316 +#define DBG RECOGNIZER->debugger
21318 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
21320 +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
21321 + * then for the present you must use different names for your defines as these are hard coded
21322 + * in the code generator. It would be better not to use such names internally, and maybe
21323 + * we can change this in a forthcoming release. I deliberately do not #undef these
21324 + * here as this will at least give you a redefined error somewhere if they clash.
21326 +#define UP ANTLR3_TOKEN_UP
21327 +#define DOWN ANTLR3_TOKEN_DOWN
21328 +#define EOR ANTLR3_TOKEN_EOR
21329 +#define INVALID ANTLR3_TOKEN_INVALID
21332 +/* =============================================================================
21333 + * Functions to create and destroy scopes. First come the rule scopes, followed
21334 + * by the global declared scopes.
21339 +/* ============================================================================= */
21341 +/* =============================================================================
21342 + * Start of recognizer
21347 +/** \brief Table of all token names in symbolic order, mainly used for
21348 + * error reporting.
21350 +pANTLR3_UINT8 SMARTPLParserTokenNames[28+4]
21352 + (pANTLR3_UINT8) "<invalid>", /* String to print to indicate an invalid token */
21353 + (pANTLR3_UINT8) "<EOR>",
21354 + (pANTLR3_UINT8) "<DOWN>",
21355 + (pANTLR3_UINT8) "<UP>",
21356 + (pANTLR3_UINT8) "STR",
21357 + (pANTLR3_UINT8) "OR",
21358 + (pANTLR3_UINT8) "AND",
21359 + (pANTLR3_UINT8) "NOT",
21360 + (pANTLR3_UINT8) "LPAR",
21361 + (pANTLR3_UINT8) "RPAR",
21362 + (pANTLR3_UINT8) "STRTAG",
21363 + (pANTLR3_UINT8) "INCLUDES",
21364 + (pANTLR3_UINT8) "IS",
21365 + (pANTLR3_UINT8) "INTTAG",
21366 + (pANTLR3_UINT8) "INTBOOL",
21367 + (pANTLR3_UINT8) "INT",
21368 + (pANTLR3_UINT8) "DATETAG",
21369 + (pANTLR3_UINT8) "AFTER",
21370 + (pANTLR3_UINT8) "BEFORE",
21371 + (pANTLR3_UINT8) "ENUMTAG",
21372 + (pANTLR3_UINT8) "ENUMVAL",
21373 + (pANTLR3_UINT8) "DATE",
21374 + (pANTLR3_UINT8) "AGO",
21375 + (pANTLR3_UINT8) "DATINTERVAL",
21376 + (pANTLR3_UINT8) "GREATER",
21377 + (pANTLR3_UINT8) "GREATEREQUAL",
21378 + (pANTLR3_UINT8) "LESS",
21379 + (pANTLR3_UINT8) "LESSEQUAL",
21380 + (pANTLR3_UINT8) "EQUAL",
21381 + (pANTLR3_UINT8) "WHITESPACE",
21382 + (pANTLR3_UINT8) "'{'",
21383 + (pANTLR3_UINT8) "'}'"
21388 +// Forward declare the locally static matching functions we have generated.
21390 +static SMARTPLParser_playlist_return playlist (pSMARTPLParser ctx);
21391 +static SMARTPLParser_expression_return expression (pSMARTPLParser ctx);
21392 +static SMARTPLParser_aexpr_return aexpr (pSMARTPLParser ctx);
21393 +static SMARTPLParser_nexpr_return nexpr (pSMARTPLParser ctx);
21394 +static SMARTPLParser_crit_return crit (pSMARTPLParser ctx);
21395 +static SMARTPLParser_dateval_return dateval (pSMARTPLParser ctx);
21396 +static SMARTPLParser_interval_return interval (pSMARTPLParser ctx);
21397 +static void SMARTPLParserFree(pSMARTPLParser ctx);
21398 +/* For use in tree output where we are accumulating rule labels via label += ruleRef
21399 + * we need a function that knows how to free a return scope when the list is destroyed.
21400 + * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
21402 +static void ANTLR3_CDECL freeScope(void * scope)
21404 + ANTLR3_FREE(scope);
21407 +/** \brief Name of the grammar file that generated this code
21409 +static const char fileName[] = "SMARTPL.g";
21411 +/** \brief Return the name of the grammar file that generated this code.
21413 +static const char * getGrammarFileName()
21417 +/** \brief Create a new SMARTPLParser parser and return a context for it.
21419 + * \param[in] instream Pointer to an input stream interface.
21421 + * \return Pointer to new parser context upon success.
21423 +ANTLR3_API pSMARTPLParser
21424 +SMARTPLParserNew (pANTLR3_COMMON_TOKEN_STREAM instream)
21426 + // See if we can create a new parser with the standard constructor
21428 + return SMARTPLParserNewSSD(instream, NULL);
21431 +/** \brief Create a new SMARTPLParser parser and return a context for it.
21433 + * \param[in] instream Pointer to an input stream interface.
21435 + * \return Pointer to new parser context upon success.
21437 +ANTLR3_API pSMARTPLParser
21438 +SMARTPLParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
21440 + pSMARTPLParser ctx; /* Context structure we will build and return */
21442 + ctx = (pSMARTPLParser) ANTLR3_CALLOC(1, sizeof(SMARTPLParser));
21446 + // Failed to allocate memory for parser context
21451 + /* -------------------------------------------------------------------
21452 + * Memory for basic structure is allocated, now to fill in
21453 + * the base ANTLR3 structures. We initialize the function pointers
21454 + * for the standard ANTLR3 parser function set, but upon return
21455 + * from here, the programmer may set the pointers to provide custom
21456 + * implementations of each function.
21458 + * We don't use the macros defined in SMARTPLParser.h here, in order that you can get a sense
21459 + * of what goes where.
21462 + /* Create a base parser/recognizer, using the supplied token stream
21464 + ctx->pParser = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state);
21465 + /* Install the implementation of our SMARTPLParser interface
21467 + ctx->playlist = playlist;
21468 + ctx->expression = expression;
21469 + ctx->aexpr = aexpr;
21470 + ctx->nexpr = nexpr;
21471 + ctx->crit = crit;
21472 + ctx->dateval = dateval;
21473 + ctx->interval = interval;
21474 + ctx->free = SMARTPLParserFree;
21475 + ctx->getGrammarFileName = getGrammarFileName;
21477 + /* Install the scope pushing methods.
21479 + ADAPTOR = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory);
21480 + ctx->vectors = antlr3VectorFactoryNew(0);
21484 + /* Install the token table
21486 + PSRSTATE->tokenNames = SMARTPLParserTokenNames;
21489 + /* Return the newly built parser to the caller
21494 +/** Free the parser resources
21497 + SMARTPLParserFree(pSMARTPLParser ctx)
21499 + /* Free any scope memory
21502 + ctx->vectors->close(ctx->vectors);
21503 + /* We created the adaptor so we must free it
21505 + ADAPTOR->free(ADAPTOR);
21506 + // Free this parser
21508 + ctx->pParser->free(ctx->pParser);
21509 + ANTLR3_FREE(ctx);
21511 + /* Everything is released, so we can return
21516 +/** Return token names used by this parser
21518 + * The returned pointer is used as an index into the token names table (using the token
21519 + * number as the index).
21521 + * \return Pointer to first char * in the table.
21523 +static pANTLR3_UINT8 *getTokenNames()
21525 + return SMARTPLParserTokenNames;
21529 +/* Declare the bitsets
21532 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_playlist42 */
21533 +static ANTLR3_BITWORD FOLLOW_STR_in_playlist42_bits[] = { ANTLR3_UINT64_LIT(0x0000000040000000) };
21534 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_playlist42 = { FOLLOW_STR_in_playlist42_bits, 1 };
21535 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_30_in_playlist44 */
21536 +static ANTLR3_BITWORD FOLLOW_30_in_playlist44_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
21537 +static ANTLR3_BITSET_LIST FOLLOW_30_in_playlist44 = { FOLLOW_30_in_playlist44_bits, 1 };
21538 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_playlist46 */
21539 +static ANTLR3_BITWORD FOLLOW_expression_in_playlist46_bits[] = { ANTLR3_UINT64_LIT(0x0000000080000000) };
21540 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_playlist46 = { FOLLOW_expression_in_playlist46_bits, 1 };
21541 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_31_in_playlist48 */
21542 +static ANTLR3_BITWORD FOLLOW_31_in_playlist48_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000000) };
21543 +static ANTLR3_BITSET_LIST FOLLOW_31_in_playlist48 = { FOLLOW_31_in_playlist48_bits, 1 };
21544 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_EOF_in_playlist50 */
21545 +static ANTLR3_BITWORD FOLLOW_EOF_in_playlist50_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
21546 +static ANTLR3_BITSET_LIST FOLLOW_EOF_in_playlist50 = { FOLLOW_EOF_in_playlist50_bits, 1 };
21547 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expression62 */
21548 +static ANTLR3_BITWORD FOLLOW_aexpr_in_expression62_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) };
21549 +static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expression62 = { FOLLOW_aexpr_in_expression62_bits, 1 };
21550 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expression65 */
21551 +static ANTLR3_BITWORD FOLLOW_OR_in_expression65_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
21552 +static ANTLR3_BITSET_LIST FOLLOW_OR_in_expression65 = { FOLLOW_OR_in_expression65_bits, 1 };
21553 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expression68 */
21554 +static ANTLR3_BITWORD FOLLOW_aexpr_in_expression68_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) };
21555 +static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expression68 = { FOLLOW_aexpr_in_expression68_bits, 1 };
21556 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_nexpr_in_aexpr83 */
21557 +static ANTLR3_BITWORD FOLLOW_nexpr_in_aexpr83_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) };
21558 +static ANTLR3_BITSET_LIST FOLLOW_nexpr_in_aexpr83 = { FOLLOW_nexpr_in_aexpr83_bits, 1 };
21559 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_aexpr86 */
21560 +static ANTLR3_BITWORD FOLLOW_AND_in_aexpr86_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
21561 +static ANTLR3_BITSET_LIST FOLLOW_AND_in_aexpr86 = { FOLLOW_AND_in_aexpr86_bits, 1 };
21562 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_nexpr_in_aexpr89 */
21563 +static ANTLR3_BITWORD FOLLOW_nexpr_in_aexpr89_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) };
21564 +static ANTLR3_BITSET_LIST FOLLOW_nexpr_in_aexpr89 = { FOLLOW_nexpr_in_aexpr89_bits, 1 };
21565 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_nexpr104 */
21566 +static ANTLR3_BITWORD FOLLOW_NOT_in_nexpr104_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
21567 +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_nexpr104 = { FOLLOW_NOT_in_nexpr104_bits, 1 };
21568 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_nexpr107 */
21569 +static ANTLR3_BITWORD FOLLOW_crit_in_nexpr107_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
21570 +static ANTLR3_BITSET_LIST FOLLOW_crit_in_nexpr107 = { FOLLOW_crit_in_nexpr107_bits, 1 };
21571 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_nexpr114 */
21572 +static ANTLR3_BITWORD FOLLOW_crit_in_nexpr114_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
21573 +static ANTLR3_BITSET_LIST FOLLOW_crit_in_nexpr114 = { FOLLOW_crit_in_nexpr114_bits, 1 };
21574 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_LPAR_in_crit127 */
21575 +static ANTLR3_BITWORD FOLLOW_LPAR_in_crit127_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
21576 +static ANTLR3_BITSET_LIST FOLLOW_LPAR_in_crit127 = { FOLLOW_LPAR_in_crit127_bits, 1 };
21577 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_crit129 */
21578 +static ANTLR3_BITWORD FOLLOW_expression_in_crit129_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000200) };
21579 +static ANTLR3_BITSET_LIST FOLLOW_expression_in_crit129 = { FOLLOW_expression_in_crit129_bits, 1 };
21580 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_RPAR_in_crit131 */
21581 +static ANTLR3_BITWORD FOLLOW_RPAR_in_crit131_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
21582 +static ANTLR3_BITSET_LIST FOLLOW_RPAR_in_crit131 = { FOLLOW_RPAR_in_crit131_bits, 1 };
21583 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STRTAG_in_crit142 */
21584 +static ANTLR3_BITWORD FOLLOW_STRTAG_in_crit142_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001800) };
21585 +static ANTLR3_BITSET_LIST FOLLOW_STRTAG_in_crit142 = { FOLLOW_STRTAG_in_crit142_bits, 1 };
21586 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_crit144 */
21587 +static ANTLR3_BITWORD FOLLOW_set_in_crit144_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) };
21588 +static ANTLR3_BITSET_LIST FOLLOW_set_in_crit144 = { FOLLOW_set_in_crit144_bits, 1 };
21589 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_crit150 */
21590 +static ANTLR3_BITWORD FOLLOW_STR_in_crit150_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
21591 +static ANTLR3_BITSET_LIST FOLLOW_STR_in_crit150 = { FOLLOW_STR_in_crit150_bits, 1 };
21592 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTTAG_in_crit157 */
21593 +static ANTLR3_BITWORD FOLLOW_INTTAG_in_crit157_bits[] = { ANTLR3_UINT64_LIT(0x0000000000004000) };
21594 +static ANTLR3_BITSET_LIST FOLLOW_INTTAG_in_crit157 = { FOLLOW_INTTAG_in_crit157_bits, 1 };
21595 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTBOOL_in_crit159 */
21596 +static ANTLR3_BITWORD FOLLOW_INTBOOL_in_crit159_bits[] = { ANTLR3_UINT64_LIT(0x0000000000008000) };
21597 +static ANTLR3_BITSET_LIST FOLLOW_INTBOOL_in_crit159 = { FOLLOW_INTBOOL_in_crit159_bits, 1 };
21598 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_crit161 */
21599 +static ANTLR3_BITWORD FOLLOW_INT_in_crit161_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
21600 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_crit161 = { FOLLOW_INT_in_crit161_bits, 1 };
21601 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATETAG_in_crit168 */
21602 +static ANTLR3_BITWORD FOLLOW_DATETAG_in_crit168_bits[] = { ANTLR3_UINT64_LIT(0x0000000000060000) };
21603 +static ANTLR3_BITSET_LIST FOLLOW_DATETAG_in_crit168 = { FOLLOW_DATETAG_in_crit168_bits, 1 };
21604 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_crit170 */
21605 +static ANTLR3_BITWORD FOLLOW_set_in_crit170_bits[] = { ANTLR3_UINT64_LIT(0x0000000000208000) };
21606 +static ANTLR3_BITSET_LIST FOLLOW_set_in_crit170 = { FOLLOW_set_in_crit170_bits, 1 };
21607 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateval_in_crit176 */
21608 +static ANTLR3_BITWORD FOLLOW_dateval_in_crit176_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
21609 +static ANTLR3_BITSET_LIST FOLLOW_dateval_in_crit176 = { FOLLOW_dateval_in_crit176_bits, 1 };
21610 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMTAG_in_crit183 */
21611 +static ANTLR3_BITWORD FOLLOW_ENUMTAG_in_crit183_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001000) };
21612 +static ANTLR3_BITSET_LIST FOLLOW_ENUMTAG_in_crit183 = { FOLLOW_ENUMTAG_in_crit183_bits, 1 };
21613 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_IS_in_crit185 */
21614 +static ANTLR3_BITWORD FOLLOW_IS_in_crit185_bits[] = { ANTLR3_UINT64_LIT(0x0000000000100000) };
21615 +static ANTLR3_BITSET_LIST FOLLOW_IS_in_crit185 = { FOLLOW_IS_in_crit185_bits, 1 };
21616 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMVAL_in_crit187 */
21617 +static ANTLR3_BITWORD FOLLOW_ENUMVAL_in_crit187_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
21618 +static ANTLR3_BITSET_LIST FOLLOW_ENUMVAL_in_crit187 = { FOLLOW_ENUMVAL_in_crit187_bits, 1 };
21619 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval200 */
21620 +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval200_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
21621 +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval200 = { FOLLOW_DATE_in_dateval200_bits, 1 };
21622 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval207 */
21623 +static ANTLR3_BITWORD FOLLOW_interval_in_dateval207_bits[] = { ANTLR3_UINT64_LIT(0x0000000000040000) };
21624 +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval207 = { FOLLOW_interval_in_dateval207_bits, 1 };
21625 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateval209 */
21626 +static ANTLR3_BITWORD FOLLOW_BEFORE_in_dateval209_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) };
21627 +static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateval209 = { FOLLOW_BEFORE_in_dateval209_bits, 1 };
21628 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval211 */
21629 +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval211_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
21630 +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval211 = { FOLLOW_DATE_in_dateval211_bits, 1 };
21631 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval218 */
21632 +static ANTLR3_BITWORD FOLLOW_interval_in_dateval218_bits[] = { ANTLR3_UINT64_LIT(0x0000000000020000) };
21633 +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval218 = { FOLLOW_interval_in_dateval218_bits, 1 };
21634 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateval220 */
21635 +static ANTLR3_BITWORD FOLLOW_AFTER_in_dateval220_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) };
21636 +static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateval220 = { FOLLOW_AFTER_in_dateval220_bits, 1 };
21637 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval222 */
21638 +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval222_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
21639 +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval222 = { FOLLOW_DATE_in_dateval222_bits, 1 };
21640 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval229 */
21641 +static ANTLR3_BITWORD FOLLOW_interval_in_dateval229_bits[] = { ANTLR3_UINT64_LIT(0x0000000000400000) };
21642 +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval229 = { FOLLOW_interval_in_dateval229_bits, 1 };
21643 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AGO_in_dateval231 */
21644 +static ANTLR3_BITWORD FOLLOW_AGO_in_dateval231_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
21645 +static ANTLR3_BITSET_LIST FOLLOW_AGO_in_dateval231 = { FOLLOW_AGO_in_dateval231_bits, 1 };
21646 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_interval243 */
21647 +static ANTLR3_BITWORD FOLLOW_INT_in_interval243_bits[] = { ANTLR3_UINT64_LIT(0x0000000000800000) };
21648 +static ANTLR3_BITSET_LIST FOLLOW_INT_in_interval243 = { FOLLOW_INT_in_interval243_bits, 1 };
21649 +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATINTERVAL_in_interval245 */
21650 +static ANTLR3_BITWORD FOLLOW_DATINTERVAL_in_interval245_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
21651 +static ANTLR3_BITSET_LIST FOLLOW_DATINTERVAL_in_interval245 = { FOLLOW_DATINTERVAL_in_interval245_bits, 1 };
21656 +/* ==============================================
21660 + * $ANTLR start playlist
21661 + * SMARTPL.g:27:1: playlist : STR '{' expression '}' EOF ;
21663 +static SMARTPLParser_playlist_return
21664 +playlist(pSMARTPLParser ctx)
21666 + SMARTPLParser_playlist_return retval;
21668 + pANTLR3_BASE_TREE root_0;
21670 + pANTLR3_COMMON_TOKEN STR1;
21671 + pANTLR3_COMMON_TOKEN char_literal2;
21672 + pANTLR3_COMMON_TOKEN char_literal4;
21673 + pANTLR3_COMMON_TOKEN EOF5;
21674 + SMARTPLParser_expression_return expression3;
21675 + #undef RETURN_TYPE_expression3
21676 + #define RETURN_TYPE_expression3 SMARTPLParser_expression_return
21678 + pANTLR3_BASE_TREE STR1_tree;
21679 + pANTLR3_BASE_TREE char_literal2_tree;
21680 + pANTLR3_BASE_TREE char_literal4_tree;
21681 + pANTLR3_BASE_TREE EOF5_tree;
21683 + /* Initialize rule variables
21690 + char_literal2 = NULL;
21691 + char_literal4 = NULL;
21693 + expression3.tree = NULL;
21695 + retval.start = LT(1); retval.stop = retval.start;
21697 + STR1_tree = NULL;
21698 + char_literal2_tree = NULL;
21699 + char_literal4_tree = NULL;
21700 + EOF5_tree = NULL;
21703 + retval.tree = NULL;
21705 + // SMARTPL.g:27:10: ( STR '{' expression '}' EOF )
21706 + // SMARTPL.g:27:12: STR '{' expression '}' EOF
21708 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
21710 + STR1 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_playlist42);
21711 + if (HASEXCEPTION())
21713 + goto ruleplaylistEx;
21716 + STR1_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR1));
21717 + ADAPTOR->addChild(ADAPTOR, root_0, STR1_tree);
21719 + char_literal2 = (pANTLR3_COMMON_TOKEN) MATCHT(30, &FOLLOW_30_in_playlist44);
21720 + if (HASEXCEPTION())
21722 + goto ruleplaylistEx;
21725 + char_literal2_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, char_literal2));
21726 + ADAPTOR->addChild(ADAPTOR, root_0, char_literal2_tree);
21728 + FOLLOWPUSH(FOLLOW_expression_in_playlist46);
21729 + expression3=expression(ctx);
21732 + if (HASEXCEPTION())
21734 + goto ruleplaylistEx;
21737 + ADAPTOR->addChild(ADAPTOR, root_0, expression3.tree);
21738 + char_literal4 = (pANTLR3_COMMON_TOKEN) MATCHT(31, &FOLLOW_31_in_playlist48);
21739 + if (HASEXCEPTION())
21741 + goto ruleplaylistEx;
21744 + char_literal4_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, char_literal4));
21745 + ADAPTOR->addChild(ADAPTOR, root_0, char_literal4_tree);
21747 + EOF5 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_playlist50);
21748 + if (HASEXCEPTION())
21750 + goto ruleplaylistEx;
21753 + EOF5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, EOF5));
21754 + ADAPTOR->addChild(ADAPTOR, root_0, EOF5_tree);
21762 + // This is where rules clean up and exit
21764 + goto ruleplaylistEx; /* Prevent compiler warnings */
21765 + ruleplaylistEx: ;
21766 + retval.stop = LT(-1);
21768 + retval.stop = LT(-1);
21769 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
21770 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
21772 + if (HASEXCEPTION())
21776 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
21782 +/* $ANTLR end playlist */
21785 + * $ANTLR start expression
21786 + * SMARTPL.g:30:1: expression : aexpr ( OR aexpr )* ;
21788 +static SMARTPLParser_expression_return
21789 +expression(pSMARTPLParser ctx)
21791 + SMARTPLParser_expression_return retval;
21793 + pANTLR3_BASE_TREE root_0;
21795 + pANTLR3_COMMON_TOKEN OR7;
21796 + SMARTPLParser_aexpr_return aexpr6;
21797 + #undef RETURN_TYPE_aexpr6
21798 + #define RETURN_TYPE_aexpr6 SMARTPLParser_aexpr_return
21800 + SMARTPLParser_aexpr_return aexpr8;
21801 + #undef RETURN_TYPE_aexpr8
21802 + #define RETURN_TYPE_aexpr8 SMARTPLParser_aexpr_return
21804 + pANTLR3_BASE_TREE OR7_tree;
21806 + /* Initialize rule variables
21813 + aexpr6.tree = NULL;
21815 + aexpr8.tree = NULL;
21817 + retval.start = LT(1); retval.stop = retval.start;
21822 + retval.tree = NULL;
21824 + // SMARTPL.g:30:12: ( aexpr ( OR aexpr )* )
21825 + // SMARTPL.g:30:14: aexpr ( OR aexpr )*
21827 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
21829 + FOLLOWPUSH(FOLLOW_aexpr_in_expression62);
21830 + aexpr6=aexpr(ctx);
21833 + if (HASEXCEPTION())
21835 + goto ruleexpressionEx;
21838 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree);
21840 + // SMARTPL.g:30:20: ( OR aexpr )*
21858 + // SMARTPL.g:30:21: OR aexpr
21860 + OR7 = (pANTLR3_COMMON_TOKEN) MATCHT(OR, &FOLLOW_OR_in_expression65);
21861 + if (HASEXCEPTION())
21863 + goto ruleexpressionEx;
21866 + OR7_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OR7));
21867 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OR7_tree, root_0));
21869 + FOLLOWPUSH(FOLLOW_aexpr_in_expression68);
21870 + aexpr8=aexpr(ctx);
21873 + if (HASEXCEPTION())
21875 + goto ruleexpressionEx;
21878 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr8.tree);
21884 + goto loop1; /* break out of the loop */
21888 + loop1: ; /* Jump out to here if this rule does not match */
21896 + // This is where rules clean up and exit
21898 + goto ruleexpressionEx; /* Prevent compiler warnings */
21899 + ruleexpressionEx: ;
21900 + retval.stop = LT(-1);
21902 + retval.stop = LT(-1);
21903 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
21904 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
21906 + if (HASEXCEPTION())
21910 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
21916 +/* $ANTLR end expression */
21919 + * $ANTLR start aexpr
21920 + * SMARTPL.g:33:1: aexpr : nexpr ( AND nexpr )* ;
21922 +static SMARTPLParser_aexpr_return
21923 +aexpr(pSMARTPLParser ctx)
21925 + SMARTPLParser_aexpr_return retval;
21927 + pANTLR3_BASE_TREE root_0;
21929 + pANTLR3_COMMON_TOKEN AND10;
21930 + SMARTPLParser_nexpr_return nexpr9;
21931 + #undef RETURN_TYPE_nexpr9
21932 + #define RETURN_TYPE_nexpr9 SMARTPLParser_nexpr_return
21934 + SMARTPLParser_nexpr_return nexpr11;
21935 + #undef RETURN_TYPE_nexpr11
21936 + #define RETURN_TYPE_nexpr11 SMARTPLParser_nexpr_return
21938 + pANTLR3_BASE_TREE AND10_tree;
21940 + /* Initialize rule variables
21947 + nexpr9.tree = NULL;
21949 + nexpr11.tree = NULL;
21951 + retval.start = LT(1); retval.stop = retval.start;
21953 + AND10_tree = NULL;
21956 + retval.tree = NULL;
21958 + // SMARTPL.g:33:8: ( nexpr ( AND nexpr )* )
21959 + // SMARTPL.g:33:10: nexpr ( AND nexpr )*
21961 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
21963 + FOLLOWPUSH(FOLLOW_nexpr_in_aexpr83);
21964 + nexpr9=nexpr(ctx);
21967 + if (HASEXCEPTION())
21969 + goto ruleaexprEx;
21972 + ADAPTOR->addChild(ADAPTOR, root_0, nexpr9.tree);
21974 + // SMARTPL.g:33:16: ( AND nexpr )*
21992 + // SMARTPL.g:33:17: AND nexpr
21994 + AND10 = (pANTLR3_COMMON_TOKEN) MATCHT(AND, &FOLLOW_AND_in_aexpr86);
21995 + if (HASEXCEPTION())
21997 + goto ruleaexprEx;
22000 + AND10_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AND10));
22001 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, AND10_tree, root_0));
22003 + FOLLOWPUSH(FOLLOW_nexpr_in_aexpr89);
22004 + nexpr11=nexpr(ctx);
22007 + if (HASEXCEPTION())
22009 + goto ruleaexprEx;
22012 + ADAPTOR->addChild(ADAPTOR, root_0, nexpr11.tree);
22018 + goto loop2; /* break out of the loop */
22022 + loop2: ; /* Jump out to here if this rule does not match */
22030 + // This is where rules clean up and exit
22032 + goto ruleaexprEx; /* Prevent compiler warnings */
22034 + retval.stop = LT(-1);
22036 + retval.stop = LT(-1);
22037 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
22038 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
22040 + if (HASEXCEPTION())
22044 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
22050 +/* $ANTLR end aexpr */
22053 + * $ANTLR start nexpr
22054 + * SMARTPL.g:36:1: nexpr : ( NOT crit | crit );
22056 +static SMARTPLParser_nexpr_return
22057 +nexpr(pSMARTPLParser ctx)
22059 + SMARTPLParser_nexpr_return retval;
22061 + pANTLR3_BASE_TREE root_0;
22063 + pANTLR3_COMMON_TOKEN NOT12;
22064 + SMARTPLParser_crit_return crit13;
22065 + #undef RETURN_TYPE_crit13
22066 + #define RETURN_TYPE_crit13 SMARTPLParser_crit_return
22068 + SMARTPLParser_crit_return crit14;
22069 + #undef RETURN_TYPE_crit14
22070 + #define RETURN_TYPE_crit14 SMARTPLParser_crit_return
22072 + pANTLR3_BASE_TREE NOT12_tree;
22074 + /* Initialize rule variables
22081 + crit13.tree = NULL;
22083 + crit14.tree = NULL;
22085 + retval.start = LT(1); retval.stop = retval.start;
22087 + NOT12_tree = NULL;
22090 + retval.tree = NULL;
22093 + // SMARTPL.g:36:8: ( NOT crit | crit )
22095 + ANTLR3_UINT32 alt3;
22118 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
22119 + EXCEPTION->message = (void *)"";
22120 + EXCEPTION->decisionNum = 3;
22121 + EXCEPTION->state = 0;
22124 + goto rulenexprEx;
22130 + // SMARTPL.g:36:10: NOT crit
22132 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22134 + NOT12 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_nexpr104);
22135 + if (HASEXCEPTION())
22137 + goto rulenexprEx;
22140 + NOT12_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, NOT12));
22141 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, NOT12_tree, root_0));
22143 + FOLLOWPUSH(FOLLOW_crit_in_nexpr107);
22144 + crit13=crit(ctx);
22147 + if (HASEXCEPTION())
22149 + goto rulenexprEx;
22152 + ADAPTOR->addChild(ADAPTOR, root_0, crit13.tree);
22157 + // SMARTPL.g:37:6: crit
22159 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22161 + FOLLOWPUSH(FOLLOW_crit_in_nexpr114);
22162 + crit14=crit(ctx);
22165 + if (HASEXCEPTION())
22167 + goto rulenexprEx;
22170 + ADAPTOR->addChild(ADAPTOR, root_0, crit14.tree);
22180 + // This is where rules clean up and exit
22182 + goto rulenexprEx; /* Prevent compiler warnings */
22184 + retval.stop = LT(-1);
22186 + retval.stop = LT(-1);
22187 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
22188 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
22190 + if (HASEXCEPTION())
22194 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
22200 +/* $ANTLR end nexpr */
22203 + * $ANTLR start crit
22204 + * SMARTPL.g:40:1: crit : ( LPAR expression RPAR -> expression | STRTAG ( INCLUDES | IS ) STR | INTTAG INTBOOL INT | DATETAG ( AFTER | BEFORE ) dateval | ENUMTAG IS ENUMVAL );
22206 +static SMARTPLParser_crit_return
22207 +crit(pSMARTPLParser ctx)
22209 + SMARTPLParser_crit_return retval;
22211 + pANTLR3_BASE_TREE root_0;
22213 + pANTLR3_COMMON_TOKEN LPAR15;
22214 + pANTLR3_COMMON_TOKEN RPAR17;
22215 + pANTLR3_COMMON_TOKEN STRTAG18;
22216 + pANTLR3_COMMON_TOKEN set19;
22217 + pANTLR3_COMMON_TOKEN STR20;
22218 + pANTLR3_COMMON_TOKEN INTTAG21;
22219 + pANTLR3_COMMON_TOKEN INTBOOL22;
22220 + pANTLR3_COMMON_TOKEN INT23;
22221 + pANTLR3_COMMON_TOKEN DATETAG24;
22222 + pANTLR3_COMMON_TOKEN set25;
22223 + pANTLR3_COMMON_TOKEN ENUMTAG27;
22224 + pANTLR3_COMMON_TOKEN IS28;
22225 + pANTLR3_COMMON_TOKEN ENUMVAL29;
22226 + SMARTPLParser_expression_return expression16;
22227 + #undef RETURN_TYPE_expression16
22228 + #define RETURN_TYPE_expression16 SMARTPLParser_expression_return
22230 + SMARTPLParser_dateval_return dateval26;
22231 + #undef RETURN_TYPE_dateval26
22232 + #define RETURN_TYPE_dateval26 SMARTPLParser_dateval_return
22234 + pANTLR3_BASE_TREE LPAR15_tree;
22235 + pANTLR3_BASE_TREE RPAR17_tree;
22236 + pANTLR3_BASE_TREE STRTAG18_tree;
22237 + pANTLR3_BASE_TREE set19_tree;
22238 + pANTLR3_BASE_TREE STR20_tree;
22239 + pANTLR3_BASE_TREE INTTAG21_tree;
22240 + pANTLR3_BASE_TREE INTBOOL22_tree;
22241 + pANTLR3_BASE_TREE INT23_tree;
22242 + pANTLR3_BASE_TREE DATETAG24_tree;
22243 + pANTLR3_BASE_TREE set25_tree;
22244 + pANTLR3_BASE_TREE ENUMTAG27_tree;
22245 + pANTLR3_BASE_TREE IS28_tree;
22246 + pANTLR3_BASE_TREE ENUMVAL29_tree;
22247 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_RPAR;
22248 + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_LPAR;
22249 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expression;
22250 + /* Initialize rule variables
22262 + INTBOOL22 = NULL;
22264 + DATETAG24 = NULL;
22266 + ENUMTAG27 = NULL;
22268 + ENUMVAL29 = NULL;
22269 + expression16.tree = NULL;
22271 + dateval26.tree = NULL;
22273 + retval.start = LT(1); retval.stop = retval.start;
22275 + LPAR15_tree = NULL;
22276 + RPAR17_tree = NULL;
22277 + STRTAG18_tree = NULL;
22278 + set19_tree = NULL;
22279 + STR20_tree = NULL;
22280 + INTTAG21_tree = NULL;
22281 + INTBOOL22_tree = NULL;
22282 + INT23_tree = NULL;
22283 + DATETAG24_tree = NULL;
22284 + set25_tree = NULL;
22285 + ENUMTAG27_tree = NULL;
22286 + IS28_tree = NULL;
22287 + ENUMVAL29_tree = NULL;
22289 + stream_RPAR = NULL;
22290 + #define CREATE_stream_RPAR if (stream_RPAR == NULL) {stream_RPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token RPAR"); }
22291 + stream_LPAR = NULL;
22292 + #define CREATE_stream_LPAR if (stream_LPAR == NULL) {stream_LPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token LPAR"); }
22293 + stream_expression = NULL;
22294 + #define CREATE_stream_expression if (stream_expression == NULL) {stream_expression = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expression"); }
22296 + retval.tree = NULL;
22299 + // SMARTPL.g:40:7: ( LPAR expression RPAR -> expression | STRTAG ( INCLUDES | IS ) STR | INTTAG INTBOOL INT | DATETAG ( AFTER | BEFORE ) dateval | ENUMTAG IS ENUMVAL )
22301 + ANTLR3_UINT32 alt4;
22335 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
22336 + EXCEPTION->message = (void *)"";
22337 + EXCEPTION->decisionNum = 4;
22338 + EXCEPTION->state = 0;
22347 + // SMARTPL.g:40:9: LPAR expression RPAR
22349 + LPAR15 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit127);
22350 + if (HASEXCEPTION())
22355 + CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR15, NULL);
22357 + FOLLOWPUSH(FOLLOW_expression_in_crit129);
22358 + expression16=expression(ctx);
22361 + if (HASEXCEPTION())
22366 + CREATE_stream_expression; stream_expression->add(stream_expression, expression16.tree, NULL);
22367 + RPAR17 = (pANTLR3_COMMON_TOKEN) MATCHT(RPAR, &FOLLOW_RPAR_in_crit131);
22368 + if (HASEXCEPTION())
22373 + CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR17, NULL);
22378 + * elements : expression
22380 + * rule labels : retval
22381 + * token list labels :
22382 + * rule list labels :
22385 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
22387 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
22389 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22390 + retval.tree = root_0;
22391 + // 40:30: -> expression
22393 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expression == NULL ? NULL : stream_expression->nextTree(stream_expression));
22397 + retval.tree = root_0; // set result root
22398 + if (stream_retval != NULL) stream_retval->free(stream_retval);
22405 + // SMARTPL.g:41:6: STRTAG ( INCLUDES | IS ) STR
22407 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22409 + STRTAG18 = (pANTLR3_COMMON_TOKEN) MATCHT(STRTAG, &FOLLOW_STRTAG_in_crit142);
22410 + if (HASEXCEPTION())
22415 + STRTAG18_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STRTAG18));
22416 + ADAPTOR->addChild(ADAPTOR, root_0, STRTAG18_tree);
22418 + set19=(pANTLR3_COMMON_TOKEN)LT(1);
22419 + if ( ((LA(1) >= INCLUDES) && (LA(1) <= IS)) )
22422 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set19)));
22423 + PERRORRECOVERY=ANTLR3_FALSE;
22428 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
22429 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
22430 + EXCEPTION->expectingSet = &FOLLOW_set_in_crit144;
22431 + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_crit144); goto rulecritEx;
22434 + STR20 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_crit150);
22435 + if (HASEXCEPTION())
22440 + STR20_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR20));
22441 + ADAPTOR->addChild(ADAPTOR, root_0, STR20_tree);
22447 + // SMARTPL.g:42:6: INTTAG INTBOOL INT
22449 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22451 + INTTAG21 = (pANTLR3_COMMON_TOKEN) MATCHT(INTTAG, &FOLLOW_INTTAG_in_crit157);
22452 + if (HASEXCEPTION())
22457 + INTTAG21_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INTTAG21));
22458 + ADAPTOR->addChild(ADAPTOR, root_0, INTTAG21_tree);
22460 + INTBOOL22 = (pANTLR3_COMMON_TOKEN) MATCHT(INTBOOL, &FOLLOW_INTBOOL_in_crit159);
22461 + if (HASEXCEPTION())
22466 + INTBOOL22_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INTBOOL22));
22467 + ADAPTOR->addChild(ADAPTOR, root_0, INTBOOL22_tree);
22469 + INT23 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_crit161);
22470 + if (HASEXCEPTION())
22475 + INT23_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INT23));
22476 + ADAPTOR->addChild(ADAPTOR, root_0, INT23_tree);
22482 + // SMARTPL.g:43:6: DATETAG ( AFTER | BEFORE ) dateval
22484 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22486 + DATETAG24 = (pANTLR3_COMMON_TOKEN) MATCHT(DATETAG, &FOLLOW_DATETAG_in_crit168);
22487 + if (HASEXCEPTION())
22492 + DATETAG24_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATETAG24));
22493 + ADAPTOR->addChild(ADAPTOR, root_0, DATETAG24_tree);
22495 + set25=(pANTLR3_COMMON_TOKEN)LT(1);
22496 + if ( ((LA(1) >= AFTER) && (LA(1) <= BEFORE)) )
22499 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set25)));
22500 + PERRORRECOVERY=ANTLR3_FALSE;
22505 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
22506 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
22507 + EXCEPTION->expectingSet = &FOLLOW_set_in_crit170;
22508 + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_crit170); goto rulecritEx;
22511 + FOLLOWPUSH(FOLLOW_dateval_in_crit176);
22512 + dateval26=dateval(ctx);
22515 + if (HASEXCEPTION())
22520 + ADAPTOR->addChild(ADAPTOR, root_0, dateval26.tree);
22525 + // SMARTPL.g:44:6: ENUMTAG IS ENUMVAL
22527 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22529 + ENUMTAG27 = (pANTLR3_COMMON_TOKEN) MATCHT(ENUMTAG, &FOLLOW_ENUMTAG_in_crit183);
22530 + if (HASEXCEPTION())
22535 + ENUMTAG27_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, ENUMTAG27));
22536 + ADAPTOR->addChild(ADAPTOR, root_0, ENUMTAG27_tree);
22538 + IS28 = (pANTLR3_COMMON_TOKEN) MATCHT(IS, &FOLLOW_IS_in_crit185);
22539 + if (HASEXCEPTION())
22544 + IS28_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, IS28));
22545 + ADAPTOR->addChild(ADAPTOR, root_0, IS28_tree);
22547 + ENUMVAL29 = (pANTLR3_COMMON_TOKEN) MATCHT(ENUMVAL, &FOLLOW_ENUMVAL_in_crit187);
22548 + if (HASEXCEPTION())
22553 + ENUMVAL29_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, ENUMVAL29));
22554 + ADAPTOR->addChild(ADAPTOR, root_0, ENUMVAL29_tree);
22565 + // This is where rules clean up and exit
22567 + goto rulecritEx; /* Prevent compiler warnings */
22569 + retval.stop = LT(-1);
22571 + retval.stop = LT(-1);
22572 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
22573 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
22574 + if (stream_RPAR != NULL) stream_RPAR->free(stream_RPAR);
22575 + if (stream_LPAR != NULL) stream_LPAR->free(stream_LPAR);
22576 + if (stream_expression != NULL) stream_expression->free(stream_expression);
22578 + if (HASEXCEPTION())
22582 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
22588 +/* $ANTLR end crit */
22591 + * $ANTLR start dateval
22592 + * SMARTPL.g:47:1: dateval : ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO );
22594 +static SMARTPLParser_dateval_return
22595 +dateval(pSMARTPLParser ctx)
22597 + SMARTPLParser_dateval_return retval;
22599 + pANTLR3_BASE_TREE root_0;
22601 + pANTLR3_COMMON_TOKEN DATE30;
22602 + pANTLR3_COMMON_TOKEN BEFORE32;
22603 + pANTLR3_COMMON_TOKEN DATE33;
22604 + pANTLR3_COMMON_TOKEN AFTER35;
22605 + pANTLR3_COMMON_TOKEN DATE36;
22606 + pANTLR3_COMMON_TOKEN AGO38;
22607 + SMARTPLParser_interval_return interval31;
22608 + #undef RETURN_TYPE_interval31
22609 + #define RETURN_TYPE_interval31 SMARTPLParser_interval_return
22611 + SMARTPLParser_interval_return interval34;
22612 + #undef RETURN_TYPE_interval34
22613 + #define RETURN_TYPE_interval34 SMARTPLParser_interval_return
22615 + SMARTPLParser_interval_return interval37;
22616 + #undef RETURN_TYPE_interval37
22617 + #define RETURN_TYPE_interval37 SMARTPLParser_interval_return
22619 + pANTLR3_BASE_TREE DATE30_tree;
22620 + pANTLR3_BASE_TREE BEFORE32_tree;
22621 + pANTLR3_BASE_TREE DATE33_tree;
22622 + pANTLR3_BASE_TREE AFTER35_tree;
22623 + pANTLR3_BASE_TREE DATE36_tree;
22624 + pANTLR3_BASE_TREE AGO38_tree;
22626 + /* Initialize rule variables
22638 + interval31.tree = NULL;
22640 + interval34.tree = NULL;
22642 + interval37.tree = NULL;
22644 + retval.start = LT(1); retval.stop = retval.start;
22646 + DATE30_tree = NULL;
22647 + BEFORE32_tree = NULL;
22648 + DATE33_tree = NULL;
22649 + AFTER35_tree = NULL;
22650 + DATE36_tree = NULL;
22651 + AGO38_tree = NULL;
22654 + retval.tree = NULL;
22657 + // SMARTPL.g:47:10: ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO )
22659 + ANTLR3_UINT32 alt5;
22674 + case DATINTERVAL:
22696 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
22697 + EXCEPTION->message = (void *)"";
22698 + EXCEPTION->decisionNum = 5;
22699 + EXCEPTION->state = 3;
22702 + goto ruledatevalEx;
22710 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
22711 + EXCEPTION->message = (void *)"";
22712 + EXCEPTION->decisionNum = 5;
22713 + EXCEPTION->state = 2;
22716 + goto ruledatevalEx;
22724 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
22725 + EXCEPTION->message = (void *)"";
22726 + EXCEPTION->decisionNum = 5;
22727 + EXCEPTION->state = 0;
22730 + goto ruledatevalEx;
22736 + // SMARTPL.g:47:12: DATE
22738 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22740 + DATE30 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval200);
22741 + if (HASEXCEPTION())
22743 + goto ruledatevalEx;
22746 + DATE30_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE30));
22747 + ADAPTOR->addChild(ADAPTOR, root_0, DATE30_tree);
22753 + // SMARTPL.g:48:6: interval BEFORE DATE
22755 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22757 + FOLLOWPUSH(FOLLOW_interval_in_dateval207);
22758 + interval31=interval(ctx);
22761 + if (HASEXCEPTION())
22763 + goto ruledatevalEx;
22766 + ADAPTOR->addChild(ADAPTOR, root_0, interval31.tree);
22767 + BEFORE32 = (pANTLR3_COMMON_TOKEN) MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateval209);
22768 + if (HASEXCEPTION())
22770 + goto ruledatevalEx;
22773 + BEFORE32_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, BEFORE32));
22774 + ADAPTOR->addChild(ADAPTOR, root_0, BEFORE32_tree);
22776 + DATE33 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval211);
22777 + if (HASEXCEPTION())
22779 + goto ruledatevalEx;
22782 + DATE33_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE33));
22783 + ADAPTOR->addChild(ADAPTOR, root_0, DATE33_tree);
22789 + // SMARTPL.g:49:6: interval AFTER DATE
22791 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22793 + FOLLOWPUSH(FOLLOW_interval_in_dateval218);
22794 + interval34=interval(ctx);
22797 + if (HASEXCEPTION())
22799 + goto ruledatevalEx;
22802 + ADAPTOR->addChild(ADAPTOR, root_0, interval34.tree);
22803 + AFTER35 = (pANTLR3_COMMON_TOKEN) MATCHT(AFTER, &FOLLOW_AFTER_in_dateval220);
22804 + if (HASEXCEPTION())
22806 + goto ruledatevalEx;
22809 + AFTER35_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AFTER35));
22810 + ADAPTOR->addChild(ADAPTOR, root_0, AFTER35_tree);
22812 + DATE36 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval222);
22813 + if (HASEXCEPTION())
22815 + goto ruledatevalEx;
22818 + DATE36_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE36));
22819 + ADAPTOR->addChild(ADAPTOR, root_0, DATE36_tree);
22825 + // SMARTPL.g:50:6: interval AGO
22827 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22829 + FOLLOWPUSH(FOLLOW_interval_in_dateval229);
22830 + interval37=interval(ctx);
22833 + if (HASEXCEPTION())
22835 + goto ruledatevalEx;
22838 + ADAPTOR->addChild(ADAPTOR, root_0, interval37.tree);
22839 + AGO38 = (pANTLR3_COMMON_TOKEN) MATCHT(AGO, &FOLLOW_AGO_in_dateval231);
22840 + if (HASEXCEPTION())
22842 + goto ruledatevalEx;
22845 + AGO38_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AGO38));
22846 + ADAPTOR->addChild(ADAPTOR, root_0, AGO38_tree);
22857 + // This is where rules clean up and exit
22859 + goto ruledatevalEx; /* Prevent compiler warnings */
22861 + retval.stop = LT(-1);
22863 + retval.stop = LT(-1);
22864 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
22865 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
22867 + if (HASEXCEPTION())
22871 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
22877 +/* $ANTLR end dateval */
22880 + * $ANTLR start interval
22881 + * SMARTPL.g:53:1: interval : INT DATINTERVAL ;
22883 +static SMARTPLParser_interval_return
22884 +interval(pSMARTPLParser ctx)
22886 + SMARTPLParser_interval_return retval;
22888 + pANTLR3_BASE_TREE root_0;
22890 + pANTLR3_COMMON_TOKEN INT39;
22891 + pANTLR3_COMMON_TOKEN DATINTERVAL40;
22893 + pANTLR3_BASE_TREE INT39_tree;
22894 + pANTLR3_BASE_TREE DATINTERVAL40_tree;
22896 + /* Initialize rule variables
22903 + DATINTERVAL40 = NULL;
22904 + retval.start = LT(1); retval.stop = retval.start;
22906 + INT39_tree = NULL;
22907 + DATINTERVAL40_tree = NULL;
22910 + retval.tree = NULL;
22912 + // SMARTPL.g:53:10: ( INT DATINTERVAL )
22913 + // SMARTPL.g:53:12: INT DATINTERVAL
22915 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22917 + INT39 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_interval243);
22918 + if (HASEXCEPTION())
22920 + goto ruleintervalEx;
22923 + INT39_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INT39));
22924 + ADAPTOR->addChild(ADAPTOR, root_0, INT39_tree);
22926 + DATINTERVAL40 = (pANTLR3_COMMON_TOKEN) MATCHT(DATINTERVAL, &FOLLOW_DATINTERVAL_in_interval245);
22927 + if (HASEXCEPTION())
22929 + goto ruleintervalEx;
22932 + DATINTERVAL40_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATINTERVAL40));
22933 + ADAPTOR->addChild(ADAPTOR, root_0, DATINTERVAL40_tree);
22941 + // This is where rules clean up and exit
22943 + goto ruleintervalEx; /* Prevent compiler warnings */
22944 + ruleintervalEx: ;
22945 + retval.stop = LT(-1);
22947 + retval.stop = LT(-1);
22948 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
22949 + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
22951 + if (HASEXCEPTION())
22955 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
22961 +/* $ANTLR end interval */
22962 +/* End of parsing rules
22963 + * ==============================================
22966 +/* ==============================================
22967 + * Syntactic predicates
22969 +/* End of syntactic predicates
22970 + * ==============================================
22979 + * =============================================================================
22981 diff --git a/src/pregen/SMARTPLParser.h b/src/pregen/SMARTPLParser.h
22982 new file mode 100644
22983 index 0000000..5360136
22985 +++ b/src/pregen/SMARTPLParser.h
22988 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
22990 + * - From the grammar source file : SMARTPL.g
22991 + * - On : 2015-06-27 19:05:15
22992 + * - for the parser : SMARTPLParserParser *
22993 + * Editing it, at least manually, is not wise.
22995 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
22998 + * The parser SMARTPLParser has the callable functions (rules) shown below,
22999 + * which will invoke the code for the associated rule in the source grammar
23000 + * assuming that the input stream is pointing to a token/text stream that could begin
23003 + * For instance if you call the first (topmost) rule in a parser grammar, you will
23004 + * get the results of a full parse, but calling a rule half way through the grammar will
23005 + * allow you to pass part of a full token stream to the parser, such as for syntax checking
23006 + * in editors and so on.
23008 + * The parser entry points are called indirectly (by function pointer to function) via
23009 + * a parser context typedef pSMARTPLParser, which is returned from a call to SMARTPLParserNew().
23011 + * The methods in pSMARTPLParser are as follows:
23013 + * - SMARTPLParser_playlist_return pSMARTPLParser->playlist(pSMARTPLParser)
23014 + * - SMARTPLParser_expression_return pSMARTPLParser->expression(pSMARTPLParser)
23015 + * - SMARTPLParser_aexpr_return pSMARTPLParser->aexpr(pSMARTPLParser)
23016 + * - SMARTPLParser_nexpr_return pSMARTPLParser->nexpr(pSMARTPLParser)
23017 + * - SMARTPLParser_crit_return pSMARTPLParser->crit(pSMARTPLParser)
23018 + * - SMARTPLParser_dateval_return pSMARTPLParser->dateval(pSMARTPLParser)
23019 + * - SMARTPLParser_interval_return pSMARTPLParser->interval(pSMARTPLParser)
23021 + * The return type for any particular rule is of course determined by the source
23024 +// [The "BSD licence"]
23025 +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
23026 +// http://www.temporal-wave.com
23027 +// http://www.linkedin.com/in/jimidle
23029 +// All rights reserved.
23031 +// Redistribution and use in source and binary forms, with or without
23032 +// modification, are permitted provided that the following conditions
23034 +// 1. Redistributions of source code must retain the above copyright
23035 +// notice, this list of conditions and the following disclaimer.
23036 +// 2. Redistributions in binary form must reproduce the above copyright
23037 +// notice, this list of conditions and the following disclaimer in the
23038 +// documentation and/or other materials provided with the distribution.
23039 +// 3. The name of the author may not be used to endorse or promote products
23040 +// derived from this software without specific prior written permission.
23042 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23043 +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23044 +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23045 +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23046 +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23047 +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23048 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23049 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23050 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23051 +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23053 +#ifndef _SMARTPLParser_H
23054 +#define _SMARTPLParser_H
23055 +/* =============================================================================
23056 + * Standard antlr3 C runtime definitions
23058 +#include <antlr3.h>
23060 +/* End of standard antlr 3 runtime definitions
23061 + * =============================================================================
23064 +#ifdef __cplusplus
23068 +// Forward declare the context typedef so that we can use it before it is
23069 +// properly defined. Delegators and delegates (from import statements) are
23070 +// interdependent and their context structures contain pointers to each other
23071 +// C only allows such things to be declared if you pre-declare the typedef.
23073 +typedef struct SMARTPLParser_Ctx_struct SMARTPLParser, * pSMARTPLParser;
23077 +#ifdef ANTLR3_WINDOWS
23078 +// Disable: Unreferenced parameter, - Rules with parameters that are not used
23079 +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
23080 +// initialized but unused variable - tree rewrite variables declared but not needed
23081 +// Unreferenced local variable - lexer rule declares but does not always use _type
23082 +// potentially unitialized variable used - retval always returned from a rule
23083 +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
23085 +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
23086 +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
23087 +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
23088 +// this is a matter of orthogonality hence I disable that one.
23090 +#pragma warning( disable : 4100 )
23091 +#pragma warning( disable : 4101 )
23092 +#pragma warning( disable : 4127 )
23093 +#pragma warning( disable : 4189 )
23094 +#pragma warning( disable : 4505 )
23095 +#pragma warning( disable : 4701 )
23097 +typedef struct SMARTPLParser_playlist_return_struct
23099 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23101 + pANTLR3_COMMON_TOKEN start;
23102 + pANTLR3_COMMON_TOKEN stop;
23103 + pANTLR3_BASE_TREE tree;
23106 + SMARTPLParser_playlist_return;
23108 +typedef struct SMARTPLParser_expression_return_struct
23110 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23112 + pANTLR3_COMMON_TOKEN start;
23113 + pANTLR3_COMMON_TOKEN stop;
23114 + pANTLR3_BASE_TREE tree;
23117 + SMARTPLParser_expression_return;
23119 +typedef struct SMARTPLParser_aexpr_return_struct
23121 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23123 + pANTLR3_COMMON_TOKEN start;
23124 + pANTLR3_COMMON_TOKEN stop;
23125 + pANTLR3_BASE_TREE tree;
23128 + SMARTPLParser_aexpr_return;
23130 +typedef struct SMARTPLParser_nexpr_return_struct
23132 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23134 + pANTLR3_COMMON_TOKEN start;
23135 + pANTLR3_COMMON_TOKEN stop;
23136 + pANTLR3_BASE_TREE tree;
23139 + SMARTPLParser_nexpr_return;
23141 +typedef struct SMARTPLParser_crit_return_struct
23143 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23145 + pANTLR3_COMMON_TOKEN start;
23146 + pANTLR3_COMMON_TOKEN stop;
23147 + pANTLR3_BASE_TREE tree;
23150 + SMARTPLParser_crit_return;
23152 +typedef struct SMARTPLParser_dateval_return_struct
23154 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23156 + pANTLR3_COMMON_TOKEN start;
23157 + pANTLR3_COMMON_TOKEN stop;
23158 + pANTLR3_BASE_TREE tree;
23161 + SMARTPLParser_dateval_return;
23163 +typedef struct SMARTPLParser_interval_return_struct
23165 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23167 + pANTLR3_COMMON_TOKEN start;
23168 + pANTLR3_COMMON_TOKEN stop;
23169 + pANTLR3_BASE_TREE tree;
23172 + SMARTPLParser_interval_return;
23176 +/** Context tracking structure for SMARTPLParser
23178 +struct SMARTPLParser_Ctx_struct
23180 + /** Built in ANTLR3 context tracker contains all the generic elements
23181 + * required for context tracking.
23183 + pANTLR3_PARSER pParser;
23186 + SMARTPLParser_playlist_return (*playlist) (struct SMARTPLParser_Ctx_struct * ctx);
23187 + SMARTPLParser_expression_return (*expression) (struct SMARTPLParser_Ctx_struct * ctx);
23188 + SMARTPLParser_aexpr_return (*aexpr) (struct SMARTPLParser_Ctx_struct * ctx);
23189 + SMARTPLParser_nexpr_return (*nexpr) (struct SMARTPLParser_Ctx_struct * ctx);
23190 + SMARTPLParser_crit_return (*crit) (struct SMARTPLParser_Ctx_struct * ctx);
23191 + SMARTPLParser_dateval_return (*dateval) (struct SMARTPLParser_Ctx_struct * ctx);
23192 + SMARTPLParser_interval_return (*interval) (struct SMARTPLParser_Ctx_struct * ctx);
23193 + // Delegated rules
23194 + const char * (*getGrammarFileName)();
23195 + void (*free) (struct SMARTPLParser_Ctx_struct * ctx);
23196 + /* @headerFile.members() */
23197 + pANTLR3_BASE_TREE_ADAPTOR adaptor;
23198 + pANTLR3_VECTOR_FACTORY vectors;
23199 + /* End @headerFile.members() */
23202 +// Function protoypes for the constructor functions that external translation units
23203 +// such as delegators and delegates may wish to call.
23205 +ANTLR3_API pSMARTPLParser SMARTPLParserNew (pANTLR3_COMMON_TOKEN_STREAM instream);
23206 +ANTLR3_API pSMARTPLParser SMARTPLParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
23208 +/** Symbolic definitions of all the tokens that the parser will work with.
23211 + * Antlr will define EOF, but we can't use that as it it is too common in
23212 + * in C header files and that would be confusing. There is no way to filter this out at the moment
23213 + * so we just undef it here for now. That isn't the value we get back from C recognizers
23214 + * anyway. We are looking for ANTLR3_TOKEN_EOF.
23222 +#define INTBOOL 14
23225 +#define WHITESPACE 29
23226 +#define GREATEREQUAL 25
23228 +#define DATETAG 16
23234 +#define INCLUDES 11
23238 +#define GREATER 24
23240 +#define ENUMTAG 19
23242 +#define ENUMVAL 20
23248 +#define LESSEQUAL 27
23249 +#define DATINTERVAL 23
23253 +#define EOF ANTLR3_TOKEN_EOF
23256 +#ifndef TOKENSOURCE
23257 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
23260 +/* End of token definitions for SMARTPLParser
23261 + * =============================================================================
23265 +#ifdef __cplusplus
23271 +/* END - Note:Keep extra line feed to satisfy UNIX systems */