Merge pull request #1509 from jow-/ctorrent-musl-compat
[feed/packages.git] / sound / forked-daapd / patches / 010-include_pregen.patch
1 diff --git a/src/pregen/DAAP.u b/src/pregen/DAAP.u
2 new file mode 100644
3 index 0000000..3de527b
4 --- /dev/null
5 +++ b/src/pregen/DAAP.u
6 @@ -0,0 +1,6 @@
7 +DAAPParser.c : DAAP.g
8 +./DAAP.tokens : DAAP.g
9 +DAAPParser.h : DAAP.g
10 +DAAPLexer.c : DAAP.g
11 +DAAPLexer.h : 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
15 new file mode 100644
16 index 0000000..f13209c
17 --- /dev/null
18 +++ b/src/pregen/DAAP2SQL.c
19 @@ -0,0 +1,975 @@
20 +/** \file
21 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
22 + *
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.
27 + *
28 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
29 + *
30 + *
31 +*/
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
36 +//
37 +// All rights reserved.
38 +//
39 +// Redistribution and use in source and binary forms, with or without
40 +// modification, are permitted provided that the following conditions
41 +// are met:
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.
49 +//
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.
60 +
61 +
62 +/* =============================================================================
63 + * This is what the grammar programmer asked us to put at the top of every file.
64 + */
65 +
66 + #include <stdio.h>
67 + #include <stdlib.h>
68 + #include <string.h>
69 + #include <limits.h>
70 + #include <errno.h>
71 +
72 + #include "logger.h"
73 + #include "db.h"
74 + #include "daap_query.h"
75 +
76 +/* End of Header action.
77 + * =============================================================================
78 + */
79 +/* -----------------------------------------
80 + * Include the ANTLR3 generated header file.
81 + */
82 +#include "DAAP2SQL.h"
83 +/* ----------------------------------------- */
84 +
85 +
86 +
87 +
88 +
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.
100 + */
101 +
102 +#define CTX ctx
103 +
104 +/* Aids in accessing scopes for grammar programmers
105 + */
106 +#undef SCOPE_TYPE
107 +#undef SCOPE_STACK
108 +#undef SCOPE_TOP
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))
114 +
115 +/* Macros for accessing things in the parser
116 + */
117 +
118 +#undef PARSER
119 +#undef RECOGNIZER
120 +#undef HAVEPARSEDRULE
121 +#undef INPUT
122 +#undef STRSTREAM
123 +#undef HASEXCEPTION
124 +#undef EXCEPTION
125 +#undef MATCHT
126 +#undef MATCHANYT
127 +#undef FOLLOWSTACK
128 +#undef FOLLOWPUSH
129 +#undef FOLLOWPOP
130 +#undef PRECOVER
131 +#undef PREPORTERROR
132 +#undef LA
133 +#undef LT
134 +#undef CONSTRUCTEX
135 +#undef CONSUME
136 +#undef MARK
137 +#undef REWIND
138 +#undef REWINDLAST
139 +#undef PERRORRECOVERY
140 +#undef HASFAILED
141 +#undef FAILEDFLAG
142 +#undef RECOVERFROMMISMATCHEDSET
143 +#undef RECOVERFROMMISMATCHEDELEMENT
144 +#undef BACKTRACKING
145 +#undef ADAPTOR
146 +#undef RULEMEMO
147 +#undef SEEK
148 +#undef INDEX
149 +#undef DBG
150 +
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
185 +
186 +
187 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
188 +
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.
194 + */
195 +#define UP ANTLR3_TOKEN_UP
196 +#define DOWN ANTLR3_TOKEN_DOWN
197 +#define EOR ANTLR3_TOKEN_EOR
198 +#define INVALID ANTLR3_TOKEN_INVALID
199 +
200 +
201 +/* =============================================================================
202 + * Functions to create and destroy scopes. First come the rule scopes, followed
203 + * by the global declared scopes.
204 + */
205 +
206 +
207 +
208 +/* ============================================================================= */
209 +
210 +/* =============================================================================
211 + * Start of recognizer
212 + */
213 +
214 +
215 +
216 +/** \brief Table of all token names in symbolic order, mainly used for
217 + * error reporting.
218 + */
219 +pANTLR3_UINT8 DAAP2SQLTokenNames[8+4]
220 + = {
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"
233 + };
234 +
235 +
236 +
237 +// Forward declare the locally static matching functions we have generated.
238 +//
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.
245 + */
246 +static void ANTLR3_CDECL freeScope(void * scope)
247 +{
248 + ANTLR3_FREE(scope);
249 +}
250 +
251 +/** \brief Name of the grammar file that generated this code
252 + */
253 +static const char fileName[] = "DAAP2SQL.g";
254 +
255 +/** \brief Return the name of the grammar file that generated this code.
256 + */
257 +static const char * getGrammarFileName()
258 +{
259 + return fileName;
260 +}
261 +/** \brief Create a new DAAP2SQL parser and return a context for it.
262 + *
263 + * \param[in] instream Pointer to an input stream interface.
264 + *
265 + * \return Pointer to new parser context upon success.
266 + */
267 +ANTLR3_API pDAAP2SQL
268 +DAAP2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream)
269 +{
270 + // See if we can create a new parser with the standard constructor
271 + //
272 + return DAAP2SQLNewSSD(instream, NULL);
273 +}
274 +
275 +/** \brief Create a new DAAP2SQL parser and return a context for it.
276 + *
277 + * \param[in] instream Pointer to an input stream interface.
278 + *
279 + * \return Pointer to new parser context upon success.
280 + */
281 +ANTLR3_API pDAAP2SQL
282 +DAAP2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
283 +{
284 + pDAAP2SQL ctx; /* Context structure we will build and return */
285 +
286 + ctx = (pDAAP2SQL) ANTLR3_CALLOC(1, sizeof(DAAP2SQL));
287 +
288 + if (ctx == NULL)
289 + {
290 + // Failed to allocate memory for parser context
291 + //
292 + return NULL;
293 + }
294 +
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.
301 + *
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.
304 + */
305 +
306 + /* Create a base Tree parser/recognizer, using the supplied tree node stream
307 + */
308 + ctx->pTreeParser = antlr3TreeParserNewStream(ANTLR3_SIZE_HINT, instream, state);
309 + /* Install the implementation of our DAAP2SQL interface
310 + */
311 + ctx->query = query;
312 + ctx->expr = expr;
313 + ctx->free = DAAP2SQLFree;
314 + ctx->getGrammarFileName = getGrammarFileName;
315 +
316 + /* Install the scope pushing methods.
317 + */
318 +
319 +
320 +
321 +
322 +
323 + /* Install the token table
324 + */
325 + PSRSTATE->tokenNames = DAAP2SQLTokenNames;
326 +
327 +
328 + /* Return the newly built parser to the caller
329 + */
330 + return ctx;
331 +}
332 +
333 +/** Free the parser resources
334 + */
335 + static void
336 + DAAP2SQLFree(pDAAP2SQL ctx)
337 + {
338 + /* Free any scope memory
339 + */
340 +
341 +
342 + // Free this parser
343 + //
344 + ctx->pTreeParser->free(ctx->pTreeParser);
345 + ANTLR3_FREE(ctx);
346 +
347 + /* Everything is released, so we can return
348 + */
349 + return;
350 + }
351 +
352 +/** Return token names used by this tree parser
353 + *
354 + * The returned pointer is used as an index into the token names table (using the token
355 + * number as the index).
356 + *
357 + * \return Pointer to first char * in the table.
358 + */
359 +static pANTLR3_UINT8 *getTokenNames()
360 +{
361 + return DAAP2SQLTokenNames;
362 +}
363 +
364 +
365 + struct dmap_query_field_map {
366 + char *dmap_field;
367 + char *db_col;
368 + int as_int;
369 + };
370 +
371 + /* gperf static hash, daap_query.gperf */
372 + #include "daap_query_hash.c"
373 +
374 +
375 +/* Declare the bitsets
376 + */
377 +
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 };
402 +
403 +
404 +
405 +
406 +/* ==============================================
407 + * Parsing rules
408 + */
409 +/**
410 + * $ANTLR start query
411 + * DAAP2SQL.g:50:1: query returns [ pANTLR3_STRING result ] : e= expr ;
412 + */
413 +static pANTLR3_STRING
414 +query(pDAAP2SQL ctx)
415 +{
416 + pANTLR3_STRING result = NULL;
417 +
418 + DAAP2SQL_expr_return e;
419 + #undef RETURN_TYPE_e
420 + #define RETURN_TYPE_e DAAP2SQL_expr_return
421 +
422 + /* Initialize rule variables
423 + */
424 +
425 +
426 + result= NULL;
427 + {
428 + // DAAP2SQL.g:52:2: (e= expr )
429 + // DAAP2SQL.g:52:4: e= expr
430 + {
431 + FOLLOWPUSH(FOLLOW_expr_in_query70);
432 + e=expr(ctx);
433 +
434 + FOLLOWPOP();
435 + if (HASEXCEPTION())
436 + {
437 + goto rulequeryEx;
438 + }
439 +
440 + {
441 +
442 + if (!e.valid)
443 + {
444 + result= NULL;
445 + }
446 + else
447 + {
448 + result= e.result->factory->newRaw(e.result->factory);
449 + result->append8(result, "(");
450 + result->appendS(result, e.result);
451 + result->append8(result, ")");
452 + }
453 +
454 + }
455 +
456 + }
457 +
458 + }
459 +
460 +
461 + // This is where rules clean up and exit
462 + //
463 + goto rulequeryEx; /* Prevent compiler warnings */
464 + rulequeryEx: ;
465 +
466 + if (HASEXCEPTION())
467 + {
468 + PREPORTERROR();
469 + PRECOVER();
470 + }
471 +
472 +
473 + return result;
474 +}
475 +/* $ANTLR end query */
476 +
477 +/**
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 );
480 + */
481 +static DAAP2SQL_expr_return
482 +expr(pDAAP2SQL ctx)
483 +{
484 + DAAP2SQL_expr_return retval;
485 +
486 + pANTLR3_BASE_TREE STR1;
487 + DAAP2SQL_expr_return a;
488 + #undef RETURN_TYPE_a
489 + #define RETURN_TYPE_a DAAP2SQL_expr_return
490 +
491 + DAAP2SQL_expr_return b;
492 + #undef RETURN_TYPE_b
493 + #define RETURN_TYPE_b DAAP2SQL_expr_return
494 +
495 + /* Initialize rule variables
496 + */
497 +
498 +
499 + retval.result= NULL; retval.valid= 1;
500 + STR1 = NULL;
501 + retval.start = LT(1); retval.stop = retval.start;
502 +
503 + {
504 + {
505 + // DAAP2SQL.g:70:2: ( ^( OPAND a= expr b= expr ) | ^( OPOR a= expr b= expr ) | STR )
506 +
507 + ANTLR3_UINT32 alt1;
508 +
509 + alt1=3;
510 +
511 + switch ( LA(1) )
512 + {
513 + case OPAND:
514 + {
515 + alt1=1;
516 + }
517 + break;
518 + case OPOR:
519 + {
520 + alt1=2;
521 + }
522 + break;
523 + case STR:
524 + {
525 + alt1=3;
526 + }
527 + break;
528 +
529 + default:
530 + CONSTRUCTEX();
531 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
532 + EXCEPTION->message = (void *)"";
533 + EXCEPTION->decisionNum = 1;
534 + EXCEPTION->state = 0;
535 +
536 +
537 + goto ruleexprEx;
538 + }
539 +
540 + switch (alt1)
541 + {
542 + case 1:
543 + // DAAP2SQL.g:70:4: ^( OPAND a= expr b= expr )
544 + {
545 + MATCHT(OPAND, &FOLLOW_OPAND_in_expr95);
546 + if (HASEXCEPTION())
547 + {
548 + goto ruleexprEx;
549 + }
550 +
551 +
552 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
553 + if (HASEXCEPTION())
554 + {
555 + goto ruleexprEx;
556 + }
557 +
558 + FOLLOWPUSH(FOLLOW_expr_in_expr101);
559 + a=expr(ctx);
560 +
561 + FOLLOWPOP();
562 + if (HASEXCEPTION())
563 + {
564 + goto ruleexprEx;
565 + }
566 +
567 + FOLLOWPUSH(FOLLOW_expr_in_expr107);
568 + b=expr(ctx);
569 +
570 + FOLLOWPOP();
571 + if (HASEXCEPTION())
572 + {
573 + goto ruleexprEx;
574 + }
575 +
576 +
577 + MATCHT(ANTLR3_TOKEN_UP, NULL);
578 + if (HASEXCEPTION())
579 + {
580 + goto ruleexprEx;
581 + }
582 +
583 + {
584 +
585 + if (a.valid && b.valid)
586 + {
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, ")");
593 + }
594 + else if (a.valid)
595 + {
596 + retval.result= a.result->factory->newRaw(a.result->factory);
597 + retval.result->appendS(retval.result, a.result);
598 + }
599 + else if (b.valid)
600 + {
601 + retval.result= b.result->factory->newRaw(b.result->factory);
602 + retval.result->appendS(retval.result, b.result);
603 + }
604 + else
605 + {
606 + retval.valid= 0;
607 + }
608 +
609 + }
610 +
611 + }
612 + break;
613 + case 2:
614 + // DAAP2SQL.g:96:4: ^( OPOR a= expr b= expr )
615 + {
616 + MATCHT(OPOR, &FOLLOW_OPOR_in_expr118);
617 + if (HASEXCEPTION())
618 + {
619 + goto ruleexprEx;
620 + }
621 +
622 +
623 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
624 + if (HASEXCEPTION())
625 + {
626 + goto ruleexprEx;
627 + }
628 +
629 + FOLLOWPUSH(FOLLOW_expr_in_expr124);
630 + a=expr(ctx);
631 +
632 + FOLLOWPOP();
633 + if (HASEXCEPTION())
634 + {
635 + goto ruleexprEx;
636 + }
637 +
638 + FOLLOWPUSH(FOLLOW_expr_in_expr130);
639 + b=expr(ctx);
640 +
641 + FOLLOWPOP();
642 + if (HASEXCEPTION())
643 + {
644 + goto ruleexprEx;
645 + }
646 +
647 +
648 + MATCHT(ANTLR3_TOKEN_UP, NULL);
649 + if (HASEXCEPTION())
650 + {
651 + goto ruleexprEx;
652 + }
653 +
654 + {
655 +
656 + if (a.valid && b.valid)
657 + {
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, ")");
664 + }
665 + else if (a.valid)
666 + {
667 + retval.result= a.result->factory->newRaw(a.result->factory);
668 + retval.result->appendS(retval.result, a.result);
669 + }
670 + else if (b.valid)
671 + {
672 + retval.result= b.result->factory->newRaw(b.result->factory);
673 + retval.result->appendS(retval.result, b.result);
674 + }
675 + else
676 + {
677 + retval.valid= 0;
678 + }
679 +
680 + }
681 +
682 + }
683 + break;
684 + case 3:
685 + // DAAP2SQL.g:122:4: STR
686 + {
687 + STR1 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expr140);
688 + if (HASEXCEPTION())
689 + {
690 + goto ruleexprEx;
691 + }
692 +
693 + {
694 +
695 + pANTLR3_STRING str;
696 + pANTLR3_UINT8 field;
697 + pANTLR3_UINT8 val;
698 + pANTLR3_UINT8 escaped;
699 + ANTLR3_UINT8 op;
700 + int neg_op;
701 + const struct dmap_query_field_map *dqfm;
702 + char *end;
703 + long long llval;
704 +
705 + escaped = NULL;
706 +
707 + retval.result= (STR1->getText(STR1))->factory->newRaw((STR1->getText(STR1))->factory);
708 +
709 + str = (STR1->getText(STR1))->toUTF8((STR1->getText(STR1)));
710 +
711 + /* NOTE: the lexer delivers the string without quotes
712 + which may not be obvious from the grammar due to embedded code
713 + */
714 +
715 + /* Make daap.songalbumid:0 a no-op */
716 + if (strcmp((char *)str->chars, "daap.songalbumid:0") == 0)
717 + {
718 + retval.result->append8(retval.result, "1 = 1");
719 +
720 + goto STR_out;
721 + }
722 +
723 + field = str->chars;
724 +
725 + val = field;
726 + while ((*val != '\0') && ((*val == '.')
727 + || (*val == '-')
728 + || ((*val >= 'a') && (*val <= 'z'))
729 + || ((*val >= 'A') && (*val <= 'Z'))
730 + || ((*val >= '0') && (*val <= '9'))))
731 + {
732 + val++;
733 + }
734 +
735 + if (*field == '\0')
736 + {
737 + DPRINTF(E_LOG, L_DAAP, "No field name found in clause '%s'\n", field);
738 + retval.valid= 0;
739 + goto STR_result_valid_0; /* ABORT */
740 + }
741 +
742 + if (*val == '\0')
743 + {
744 + DPRINTF(E_LOG, L_DAAP, "No operator found in clause '%s'\n", field);
745 + retval.valid= 0;
746 + goto STR_result_valid_0; /* ABORT */
747 + }
748 +
749 + op = *val;
750 + *val = '\0';
751 + val++;
752 +
753 + if (op == '!')
754 + {
755 + if (*val == '\0')
756 + {
757 + DPRINTF(E_LOG, L_DAAP, "Negation found but operator missing in clause '%s%c'\n", field, op);
758 + retval.valid= 0;
759 + goto STR_result_valid_0; /* ABORT */
760 + }
761 +
762 + neg_op = 1;
763 + op = *val;
764 + val++;
765 + }
766 + else
767 + neg_op = 0;
768 +
769 + /* Lookup DMAP field in the query field map */
770 + dqfm = daap_query_field_lookup((char *)field, strlen((char *)field));
771 + if (!dqfm)
772 + {
773 + DPRINTF(E_LOG, L_DAAP, "DMAP field '%s' is not a valid field in queries\n", field);
774 + retval.valid= 0;
775 + goto STR_result_valid_0; /* ABORT */
776 + }
777 +
778 + /* Empty values OK for string fields, NOK for integer */
779 + if (*val == '\0')
780 + {
781 + if (dqfm->as_int)
782 + {
783 + DPRINTF(E_LOG, L_DAAP, "No value given in clause '%s%s%c'\n", field, (neg_op) ? "!" : "", op);
784 + retval.valid= 0;
785 + goto STR_result_valid_0; /* ABORT */
786 + }
787 +
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))
793 + {
794 + DPRINTF(E_DBG, L_DAAP, "Ignoring clause '%s%s%c'\n", field, (neg_op) ? "!" : "", op);
795 + retval.valid= 0;
796 + goto STR_result_valid_0;
797 + }
798 +
799 + /* Need to check against NULL too */
800 + if (op == ':')
801 + retval.result->append8(retval.result, "(");
802 + }
803 +
804 + /* Int field: check integer conversion */
805 + if (dqfm->as_int)
806 + {
807 + errno = 0;
808 + llval = strtoll((const char *)val, &end, 10);
809 +
810 + if (((errno == ERANGE) && ((llval == LLONG_MAX) || (llval == LLONG_MIN)))
811 + || ((errno != 0) && (llval == 0)))
812 + {
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);
815 + retval.valid= 0;
816 + goto STR_result_valid_0; /* ABORT */
817 + }
818 +
819 + if (end == (char *)val)
820 + {
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);
823 + retval.valid= 0;
824 + goto STR_result_valid_0; /* ABORT */
825 + }
826 +
827 + *end = '\0'; /* Cut out potential garbage - we're being kind */
828 +
829 + /* forked-daapd only has media_kind = 1 for music - so remove media_kind = 32 to imporve select query performance. */
830 + if (llval == 32
831 + && (strcmp((char *)field, "com.apple.itunes.mediakind") == 0
832 + || strcmp((char *)field, "com.apple.itunes.extended-media-kind") == 0))
833 + {
834 + DPRINTF(E_DBG, L_DAAP, "Ignoring clause '%s%s%c%s'\n", field, (neg_op) ? "!" : "", op, val);
835 +
836 + if (neg_op)
837 + retval.result->append8(retval.result, "1 = 1");
838 + else
839 + retval.result->append8(retval.result, "1 = 0");
840 +
841 + goto STR_out;
842 + }
843 + }
844 + /* String field: escape string, check for '*' */
845 + else
846 + {
847 + if (op != ':')
848 + {
849 + DPRINTF(E_LOG, L_DAAP, "Operation '%c' not valid for string values\n", op);
850 + retval.valid= 0;
851 + goto STR_result_valid_0; /* ABORT */
852 + }
853 +
854 + escaped = (pANTLR3_UINT8)db_escape_string((char *)val);
855 + if (!escaped)
856 + {
857 + DPRINTF(E_LOG, L_DAAP, "Could not escape value\n");
858 + retval.valid= 0;
859 + goto STR_result_valid_0; /* ABORT */
860 + }
861 +
862 + val = escaped;
863 +
864 + if (val[0] == '*')
865 + {
866 + op = '%';
867 + val[0] = '%';
868 + }
869 +
870 + if (val[0] && val[1] && val[strlen((char *)val) - 1] == '*')
871 + {
872 + op = '%';
873 + val[strlen((char *)val) - 1] = '%';
874 + }
875 + }
876 +
877 + retval.result->append8(retval.result, dqfm->db_col);
878 +
879 + switch(op)
880 + {
881 + case ':':
882 + if (neg_op)
883 + retval.result->append8(retval.result, " <> ");
884 + else
885 + retval.result->append8(retval.result, " = ");
886 + break;
887 +
888 + case '+':
889 + if (neg_op)
890 + retval.result->append8(retval.result, " <= ");
891 + else
892 + retval.result->append8(retval.result, " > ");
893 + break;
894 +
895 + case '-':
896 + if (neg_op)
897 + retval.result->append8(retval.result, " >= ");
898 + else
899 + retval.result->append8(retval.result, " < ");
900 + break;
901 +
902 + case '%':
903 + retval.result->append8(retval.result, " LIKE ");
904 + break;
905 +
906 + default:
907 + if (neg_op)
908 + DPRINTF(E_LOG, L_DAAP, "Missing or unknown operator '%c' in clause '%s!%c%s'\n", op, field, op, val);
909 + else
910 + DPRINTF(E_LOG, L_DAAP, "Unknown operator '%c' in clause '%s%c%s'\n", op, field, op, val);
911 + retval.valid= 0;
912 + goto STR_result_valid_0; /* ABORT */
913 + break;
914 + }
915 +
916 + if (!dqfm->as_int)
917 + retval.result->append8(retval.result, "'");
918 +
919 + retval.result->append8(retval.result, (const char *)val);
920 +
921 + if (!dqfm->as_int)
922 + retval.result->append8(retval.result, "'");
923 +
924 + /* For empty string value, we need to check against NULL too */
925 + if ((*val == '\0') && (op == ':'))
926 + {
927 + if (neg_op)
928 + retval.result->append8(retval.result, " AND ");
929 + else
930 + retval.result->append8(retval.result, " OR ");
931 +
932 + retval.result->append8(retval.result, dqfm->db_col);
933 +
934 + if (neg_op)
935 + retval.result->append8(retval.result, " IS NOT NULL");
936 + else
937 + retval.result->append8(retval.result, " IS NULL");
938 +
939 + retval.result->append8(retval.result, ")");
940 + }
941 +
942 + STR_result_valid_0: /* bail out label */
943 + ;
944 +
945 + if (escaped)
946 + free(escaped);
947 +
948 + STR_out: /* get out of here */
949 + ;
950 +
951 + }
952 +
953 + }
954 + break;
955 +
956 + }
957 + }
958 + }
959 +
960 +
961 + // This is where rules clean up and exit
962 + //
963 + goto ruleexprEx; /* Prevent compiler warnings */
964 + ruleexprEx: ;
965 +
966 + if (HASEXCEPTION())
967 + {
968 + PREPORTERROR();
969 + PRECOVER();
970 + }
971 +
972 +
973 + return retval;
974 +}
975 +/* $ANTLR end expr */
976 +/* End of parsing rules
977 + * ==============================================
978 + */
979 +
980 +/* ==============================================
981 + * Syntactic predicates
982 + */
983 +/* End of syntactic predicates
984 + * ==============================================
985 + */
986 +
987 +
988 +
989 +
990 +
991 +
992 +/* End of code
993 + * =============================================================================
994 + */
995 diff --git a/src/pregen/DAAP2SQL.h b/src/pregen/DAAP2SQL.h
996 new file mode 100644
997 index 0000000..2b1e806
998 --- /dev/null
999 +++ b/src/pregen/DAAP2SQL.h
1000 @@ -0,0 +1,195 @@
1001 +/** \file
1002 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
1003 + *
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.
1008 + *
1009 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
1010 + *
1011 + *
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
1015 + * this rule.
1016 + *
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.
1021 + *
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().
1024 + *
1025 + * The methods in pDAAP2SQL are as follows:
1026 + *
1027 + * - pANTLR3_STRING pDAAP2SQL->query(pDAAP2SQL)
1028 + * - DAAP2SQL_expr_return pDAAP2SQL->expr(pDAAP2SQL)
1029 + *
1030 + * The return type for any particular rule is of course determined by the source
1031 + * grammar file.
1032 + */
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
1037 +//
1038 +// All rights reserved.
1039 +//
1040 +// Redistribution and use in source and binary forms, with or without
1041 +// modification, are permitted provided that the following conditions
1042 +// are met:
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.
1050 +//
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.
1061 +
1062 +#ifndef _DAAP2SQL_H
1063 +#define _DAAP2SQL_H
1064 +/* =============================================================================
1065 + * Standard antlr3 C runtime definitions
1066 + */
1067 +#include <antlr3.h>
1068 +
1069 +/* End of standard antlr 3 runtime definitions
1070 + * =============================================================================
1071 + */
1072 +
1073 +#ifdef __cplusplus
1074 +extern "C" {
1075 +#endif
1076 +
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.
1081 +//
1082 +typedef struct DAAP2SQL_Ctx_struct DAAP2SQL, * pDAAP2SQL;
1083 +
1084 +
1085 +
1086 + #include <stdio.h>
1087 + #include <stdlib.h>
1088 + #include <string.h>
1089 + #include <limits.h>
1090 + #include <errno.h>
1091 +
1092 + #include "logger.h"
1093 + #include "db.h"
1094 + #include "daap_query.h"
1095 +
1096 +
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
1104 +//
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.
1109 +//
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 )
1116 +#endif
1117 +typedef struct DAAP2SQL_expr_return_struct
1118 +{
1119 + pANTLR3_BASE_TREE start;
1120 + pANTLR3_BASE_TREE stop;
1121 + pANTLR3_STRING result;
1122 + int valid;
1123 +}
1124 + DAAP2SQL_expr_return;
1125 +
1126 +
1127 +
1128 +/** Context tracking structure for DAAP2SQL
1129 + */
1130 +struct DAAP2SQL_Ctx_struct
1131 +{
1132 + /** Built in ANTLR3 context tracker contains all the generic elements
1133 + * required for context tracking.
1134 + */
1135 + pANTLR3_TREE_PARSER pTreeParser;
1136 +
1137 +
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);
1143 +
1144 +};
1145 +
1146 +// Function protoypes for the constructor functions that external translation units
1147 +// such as delegators and delegates may wish to call.
1148 +//
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);
1151 +
1152 +/** Symbolic definitions of all the tokens that the tree parser will work with.
1153 + * \{
1154 + *
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.
1159 + */
1160 +#ifdef EOF
1161 +#undef EOF
1162 +#endif
1163 +#ifdef Tokens
1164 +#undef Tokens
1165 +#endif
1166 +#define STR 9
1167 +#define QUOTE 10
1168 +#define NEWLINE 4
1169 +#define LPAR 7
1170 +#define OPOR 5
1171 +#define RPAR 8
1172 +#define ESCAPED 11
1173 +#define OPAND 6
1174 +#define EOF -1
1175 +#ifdef EOF
1176 +#undef EOF
1177 +#define EOF ANTLR3_TOKEN_EOF
1178 +#endif
1179 +
1180 +#ifndef TOKENSOURCE
1181 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
1182 +#endif
1183 +
1184 +/* End of token definitions for DAAP2SQL
1185 + * =============================================================================
1186 + */
1187 +/** \} */
1188 +
1189 +#ifdef __cplusplus
1190 +}
1191 +#endif
1192 +
1193 +#endif
1194 +
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
1199 --- /dev/null
1200 +++ b/src/pregen/DAAP2SQL.u
1201 @@ -0,0 +1,5 @@
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
1211 --- /dev/null
1212 +++ b/src/pregen/DAAPLexer.c
1213 @@ -0,0 +1,1101 @@
1214 +/** \file
1215 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
1216 + *
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.
1221 + *
1222 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
1223 + *
1224 + *
1225 +*/
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
1230 +//
1231 +// All rights reserved.
1232 +//
1233 +// Redistribution and use in source and binary forms, with or without
1234 +// modification, are permitted provided that the following conditions
1235 +// are met:
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.
1243 +//
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.
1254 +
1255 +/* -----------------------------------------
1256 + * Include the ANTLR3 generated header file.
1257 + */
1258 +#include "DAAPLexer.h"
1259 +/* ----------------------------------------- */
1260 +
1261 +
1262 +
1263 +
1264 +
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.
1276 + */
1277 +
1278 +#define CTX ctx
1279 +
1280 +/* Aids in accessing scopes for grammar programmers
1281 + */
1282 +#undef SCOPE_TYPE
1283 +#undef SCOPE_STACK
1284 +#undef SCOPE_TOP
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))
1290 +
1291 +
1292 +/* Macros for accessing things in a lexer
1293 + */
1294 +#undef LEXER
1295 +#undef RECOGNIZER
1296 +#undef RULEMEMO
1297 +#undef GETCHARINDEX
1298 +#undef GETLINE
1299 +#undef GETCHARPOSITIONINLINE
1300 +#undef EMIT
1301 +#undef EMITNEW
1302 +#undef MATCHC
1303 +#undef MATCHS
1304 +#undef MATCHRANGE
1305 +#undef LTOKEN
1306 +#undef HASFAILED
1307 +#undef FAILEDFLAG
1308 +#undef INPUT
1309 +#undef STRSTREAM
1310 +#undef LA
1311 +#undef HASEXCEPTION
1312 +#undef EXCEPTION
1313 +#undef CONSTRUCTEX
1314 +#undef CONSUME
1315 +#undef LRECOVER
1316 +#undef MARK
1317 +#undef REWIND
1318 +#undef REWINDLAST
1319 +#undef BACKTRACKING
1320 +#undef MATCHANY
1321 +#undef MEMOIZE
1322 +#undef HAVEPARSEDRULE
1323 +#undef GETTEXT
1324 +#undef INDEX
1325 +#undef SEEK
1326 +#undef PUSHSTREAM
1327 +#undef POPSTREAM
1328 +#undef SETTEXT
1329 +#undef SETTEXT8
1330 +
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
1374 +
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).
1381 + */
1382 +#if defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16)
1383 +
1384 +# ifdef ANTLR3_INLINE_INPUT_ASCII
1385 +
1386 +/* 8 bit "ASCII" (actually any 8 bit character set) */
1387 +
1388 +# define NEXTCHAR ((pANTLR3_UINT8)(INPUT->nextChar))
1389 +# define DATAP ((pANTLR3_UINT8)(INPUT->data))
1390 +
1391 +# else
1392 +
1393 +# define NEXTCHAR ((pANTLR3_UINT16)(INPUT->nextChar))
1394 +# define DATAP ((pANTLR3_UINT16)(INPUT->data))
1395 +
1396 +# endif
1397 +
1398 +# define LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1)))
1399 +# define CONSUME() \
1400 +{ \
1401 + if (NEXTCHAR < (DATAP + INPUT->sizeBuf)) \
1402 + { \
1403 + INPUT->charPositionInLine++; \
1404 + if ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar) \
1405 + { \
1406 + INPUT->line++; \
1407 + INPUT->charPositionInLine = 0; \
1408 + INPUT->currentLine = (void *)(NEXTCHAR + 1); \
1409 + } \
1410 + INPUT->nextChar = (void *)(NEXTCHAR + 1); \
1411 + } \
1412 +}
1413 +
1414 +#else
1415 +
1416 +// Pick up the input character by calling the input stream implementation.
1417 +//
1418 +#define CONSUME() INPUT->istream->consume(INPUT->istream)
1419 +#define LA(n) INPUT->istream->_LA(INPUT->istream, n)
1420 +
1421 +#endif
1422 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
1423 +
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.
1429 + */
1430 +#define UP ANTLR3_TOKEN_UP
1431 +#define DOWN ANTLR3_TOKEN_DOWN
1432 +#define EOR ANTLR3_TOKEN_EOR
1433 +#define INVALID ANTLR3_TOKEN_INVALID
1434 +
1435 +
1436 +/* =============================================================================
1437 + * Functions to create and destroy scopes. First come the rule scopes, followed
1438 + * by the global declared scopes.
1439 + */
1440 +
1441 +
1442 +
1443 +/* ============================================================================= */
1444 +
1445 +/* =============================================================================
1446 + * Start of recognizer
1447 + */
1448 +
1449 +
1450 +/* Forward declare the locally static matching functions we have generated and any predicate functions.
1451 + */
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);
1462 +
1463 +/* =========================================================================
1464 + * Lexer matching rules end.
1465 + * =========================================================================
1466 + */
1467 +
1468 +
1469 +
1470 +static void
1471 +DAAPLexerFree (pDAAPLexer ctx)
1472 +{
1473 + LEXER->free(LEXER);
1474 +
1475 + ANTLR3_FREE(ctx);
1476 +}
1477 +
1478 +/** \brief Name of the grammar file that generated this code
1479 + */
1480 +static const char fileName[] = "DAAP.g";
1481 +
1482 +/** \brief Return the name of the grammar file that generated this code.
1483 + */
1484 +static const char * getGrammarFileName()
1485 +{
1486 + return fileName;
1487 +}
1488 +
1489 +/** \brief Create a new lexer called DAAPLexer
1490 + *
1491 + * \param[in] instream Pointer to an initialized input stream
1492 + * \return
1493 + * - Success pDAAPLexer initialized for the lex start
1494 + * - Fail NULL
1495 + */
1496 +ANTLR3_API pDAAPLexer DAAPLexerNew
1497 +(pANTLR3_INPUT_STREAM instream)
1498 +{
1499 + // See if we can create a new lexer with the standard constructor
1500 + //
1501 + return DAAPLexerNewSSD(instream, NULL);
1502 +}
1503 +
1504 +/** \brief Create a new lexer called DAAPLexer
1505 + *
1506 + * \param[in] instream Pointer to an initialized input stream
1507 + * \param[state] state Previously created shared recognizer stat
1508 + * \return
1509 + * - Success pDAAPLexer initialized for the lex start
1510 + * - Fail NULL
1511 + */
1512 +ANTLR3_API pDAAPLexer DAAPLexerNewSSD
1513 +(pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
1514 +{
1515 + pDAAPLexer ctx; // Context structure we will build and return
1516 +
1517 + ctx = (pDAAPLexer) ANTLR3_CALLOC(1, sizeof(DAAPLexer));
1518 +
1519 + if (ctx == NULL)
1520 + {
1521 + // Failed to allocate memory for lexer context
1522 + return NULL;
1523 + }
1524 +
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.
1531 + *
1532 + * We don't use the macros defined in DAAPLexer.h here so you can get a sense
1533 + * of what goes where.
1534 + */
1535 +
1536 + /* Create a base lexer, using the supplied input stream
1537 + */
1538 + ctx->pLexer = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state);
1539 +
1540 + /* Check that we allocated the memory correctly
1541 + */
1542 + if (ctx->pLexer == NULL)
1543 + {
1544 + ANTLR3_FREE(ctx);
1545 + return NULL;
1546 + }
1547 + /* Install the implementation of our DAAPLexer interface
1548 + */
1549 + ctx->mQUOTE = mQUOTE;
1550 + ctx->mLPAR = mLPAR;
1551 + ctx->mRPAR = mRPAR;
1552 + ctx->mOPAND = mOPAND;
1553 + ctx->mOPOR = mOPOR;
1554 + ctx->mNEWLINE = mNEWLINE;
1555 + ctx->mSTR = mSTR;
1556 + ctx->mESCAPED = mESCAPED;
1557 + ctx->mTokens = mTokens;
1558 +
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.
1562 + */
1563 + ctx->pLexer->ctx = ctx;
1564 +
1565 + /**Install the token matching function
1566 + */
1567 + ctx->pLexer->mTokens = (void (*) (void *))(mTokens);
1568 +
1569 + ctx->getGrammarFileName = getGrammarFileName;
1570 + ctx->free = DAAPLexerFree;
1571 +
1572 +
1573 +
1574 +
1575 +
1576 + /* Return the newly built lexer to the caller
1577 + */
1578 + return ctx;
1579 +}
1580 +
1581 +
1582 +/* =========================================================================
1583 + * Functions to match the lexer grammar defined tokens from the input stream
1584 + */
1585 +
1586 +// Comes from: 40:7: ( '\\'' )
1587 +/** \brief Lexer rule generated by ANTLR3
1588 + *
1589 + * $ANTLR start QUOTE
1590 + *
1591 + * Looks to match the characters the constitute the token QUOTE
1592 + * from the attached input stream.
1593 + *
1594 + *
1595 + * \remark
1596 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1597 + */
1598 +static ANTLR3_INLINE
1599 +void mQUOTE(pDAAPLexer ctx)
1600 +{
1601 + ANTLR3_UINT32 _type;
1602 +
1603 + _type = QUOTE;
1604 +
1605 +
1606 + // DAAP.g:40:7: ( '\\'' )
1607 + // DAAP.g:40:9: '\\''
1608 + {
1609 + MATCHC('\'');
1610 + if (HASEXCEPTION())
1611 + {
1612 + goto ruleQUOTEEx;
1613 + }
1614 +
1615 +
1616 + }
1617 +
1618 + LEXSTATE->type = _type;
1619 +
1620 + // This is where rules clean up and exit
1621 + //
1622 + goto ruleQUOTEEx; /* Prevent compiler warnings */
1623 + ruleQUOTEEx: ;
1624 +
1625 +}
1626 +// $ANTLR end QUOTE
1627 +
1628 +// Comes from: 41:6: ( '(' )
1629 +/** \brief Lexer rule generated by ANTLR3
1630 + *
1631 + * $ANTLR start LPAR
1632 + *
1633 + * Looks to match the characters the constitute the token LPAR
1634 + * from the attached input stream.
1635 + *
1636 + *
1637 + * \remark
1638 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1639 + */
1640 +static ANTLR3_INLINE
1641 +void mLPAR(pDAAPLexer ctx)
1642 +{
1643 + ANTLR3_UINT32 _type;
1644 +
1645 + _type = LPAR;
1646 +
1647 +
1648 + // DAAP.g:41:6: ( '(' )
1649 + // DAAP.g:41:8: '('
1650 + {
1651 + MATCHC('(');
1652 + if (HASEXCEPTION())
1653 + {
1654 + goto ruleLPAREx;
1655 + }
1656 +
1657 +
1658 + }
1659 +
1660 + LEXSTATE->type = _type;
1661 +
1662 + // This is where rules clean up and exit
1663 + //
1664 + goto ruleLPAREx; /* Prevent compiler warnings */
1665 + ruleLPAREx: ;
1666 +
1667 +}
1668 +// $ANTLR end LPAR
1669 +
1670 +// Comes from: 42:6: ( ')' )
1671 +/** \brief Lexer rule generated by ANTLR3
1672 + *
1673 + * $ANTLR start RPAR
1674 + *
1675 + * Looks to match the characters the constitute the token RPAR
1676 + * from the attached input stream.
1677 + *
1678 + *
1679 + * \remark
1680 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1681 + */
1682 +static ANTLR3_INLINE
1683 +void mRPAR(pDAAPLexer ctx)
1684 +{
1685 + ANTLR3_UINT32 _type;
1686 +
1687 + _type = RPAR;
1688 +
1689 +
1690 + // DAAP.g:42:6: ( ')' )
1691 + // DAAP.g:42:8: ')'
1692 + {
1693 + MATCHC(')');
1694 + if (HASEXCEPTION())
1695 + {
1696 + goto ruleRPAREx;
1697 + }
1698 +
1699 +
1700 + }
1701 +
1702 + LEXSTATE->type = _type;
1703 +
1704 + // This is where rules clean up and exit
1705 + //
1706 + goto ruleRPAREx; /* Prevent compiler warnings */
1707 + ruleRPAREx: ;
1708 +
1709 +}
1710 +// $ANTLR end RPAR
1711 +
1712 +// Comes from: 44:7: ( '+' | ' ' )
1713 +/** \brief Lexer rule generated by ANTLR3
1714 + *
1715 + * $ANTLR start OPAND
1716 + *
1717 + * Looks to match the characters the constitute the token OPAND
1718 + * from the attached input stream.
1719 + *
1720 + *
1721 + * \remark
1722 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1723 + */
1724 +static ANTLR3_INLINE
1725 +void mOPAND(pDAAPLexer ctx)
1726 +{
1727 + ANTLR3_UINT32 _type;
1728 +
1729 + _type = OPAND;
1730 +
1731 +
1732 + // DAAP.g:44:7: ( '+' | ' ' )
1733 + // DAAP.g:
1734 + {
1735 + if ( LA(1) == ' ' || LA(1) == '+' )
1736 + {
1737 + CONSUME();
1738 +
1739 + }
1740 + else
1741 + {
1742 + CONSTRUCTEX();
1743 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
1744 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
1745 +
1746 + LRECOVER(); goto ruleOPANDEx;
1747 + }
1748 +
1749 +
1750 + }
1751 +
1752 + LEXSTATE->type = _type;
1753 +
1754 + // This is where rules clean up and exit
1755 + //
1756 + goto ruleOPANDEx; /* Prevent compiler warnings */
1757 + ruleOPANDEx: ;
1758 +
1759 +}
1760 +// $ANTLR end OPAND
1761 +
1762 +// Comes from: 45:6: ( ',' )
1763 +/** \brief Lexer rule generated by ANTLR3
1764 + *
1765 + * $ANTLR start OPOR
1766 + *
1767 + * Looks to match the characters the constitute the token OPOR
1768 + * from the attached input stream.
1769 + *
1770 + *
1771 + * \remark
1772 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1773 + */
1774 +static ANTLR3_INLINE
1775 +void mOPOR(pDAAPLexer ctx)
1776 +{
1777 + ANTLR3_UINT32 _type;
1778 +
1779 + _type = OPOR;
1780 +
1781 +
1782 + // DAAP.g:45:6: ( ',' )
1783 + // DAAP.g:45:8: ','
1784 + {
1785 + MATCHC(',');
1786 + if (HASEXCEPTION())
1787 + {
1788 + goto ruleOPOREx;
1789 + }
1790 +
1791 +
1792 + }
1793 +
1794 + LEXSTATE->type = _type;
1795 +
1796 + // This is where rules clean up and exit
1797 + //
1798 + goto ruleOPOREx; /* Prevent compiler warnings */
1799 + ruleOPOREx: ;
1800 +
1801 +}
1802 +// $ANTLR end OPOR
1803 +
1804 +// Comes from: 47:9: ( ( '\\r' )? '\\n' )
1805 +/** \brief Lexer rule generated by ANTLR3
1806 + *
1807 + * $ANTLR start NEWLINE
1808 + *
1809 + * Looks to match the characters the constitute the token NEWLINE
1810 + * from the attached input stream.
1811 + *
1812 + *
1813 + * \remark
1814 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1815 + */
1816 +static ANTLR3_INLINE
1817 +void mNEWLINE(pDAAPLexer ctx)
1818 +{
1819 + ANTLR3_UINT32 _type;
1820 +
1821 + _type = NEWLINE;
1822 +
1823 +
1824 + // DAAP.g:47:9: ( ( '\\r' )? '\\n' )
1825 + // DAAP.g:47:11: ( '\\r' )? '\\n'
1826 + {
1827 +
1828 + // DAAP.g:47:11: ( '\\r' )?
1829 + {
1830 + int alt1=2;
1831 + switch ( LA(1) )
1832 + {
1833 + case '\r':
1834 + {
1835 + alt1=1;
1836 + }
1837 + break;
1838 + }
1839 +
1840 + switch (alt1)
1841 + {
1842 + case 1:
1843 + // DAAP.g:47:11: '\\r'
1844 + {
1845 + MATCHC('\r');
1846 + if (HASEXCEPTION())
1847 + {
1848 + goto ruleNEWLINEEx;
1849 + }
1850 +
1851 +
1852 + }
1853 + break;
1854 +
1855 + }
1856 + }
1857 + MATCHC('\n');
1858 + if (HASEXCEPTION())
1859 + {
1860 + goto ruleNEWLINEEx;
1861 + }
1862 +
1863 +
1864 + }
1865 +
1866 + LEXSTATE->type = _type;
1867 +
1868 + // This is where rules clean up and exit
1869 + //
1870 + goto ruleNEWLINEEx; /* Prevent compiler warnings */
1871 + ruleNEWLINEEx: ;
1872 +
1873 +}
1874 +// $ANTLR end NEWLINE
1875 +
1876 +// Comes from: 55:2: ( QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE )
1877 +/** \brief Lexer rule generated by ANTLR3
1878 + *
1879 + * $ANTLR start STR
1880 + *
1881 + * Looks to match the characters the constitute the token STR
1882 + * from the attached input stream.
1883 + *
1884 + *
1885 + * \remark
1886 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
1887 + */
1888 +static ANTLR3_INLINE
1889 +void mSTR(pDAAPLexer ctx)
1890 +{
1891 + ANTLR3_UINT32 _type;
1892 + pANTLR3_COMMON_TOKEN esc;
1893 + ANTLR3_UINT32 reg;
1894 +
1895 +
1896 + esc = NULL;
1897 +
1898 + _type = STR;
1899 +
1900 + pANTLR3_STRING unesc = GETTEXT()->factory->newRaw(GETTEXT()->factory);
1901 +
1902 + // DAAP.g:55:2: ( QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE )
1903 + // DAAP.g:55:4: QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE
1904 + {
1905 + /* 55:4: QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE */
1906 + mQUOTE(ctx );
1907 + if (HASEXCEPTION())
1908 + {
1909 + goto ruleSTREx;
1910 + }
1911 +
1912 + // DAAP.g:55:10: (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+
1913 + {
1914 + int cnt2=0;
1915 +
1916 + for (;;)
1917 + {
1918 + int alt2=3;
1919 + {
1920 + /* dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState)
1921 + */
1922 + int LA2_0 = LA(1);
1923 + if ( (((LA2_0 >= 0x0000) && (LA2_0 <= '&')) || ((LA2_0 >= '(') && (LA2_0 <= '[')) || ((LA2_0 >= ']') && (LA2_0 <= 0xFFFF))) )
1924 + {
1925 + alt2=1;
1926 + }
1927 + else if ( (LA2_0 == '\\') )
1928 + {
1929 + alt2=2;
1930 + }
1931 +
1932 + }
1933 + switch (alt2)
1934 + {
1935 + case 1:
1936 + // DAAP.g:55:12: reg=~ ( '\\\\' | '\\'' )
1937 + {
1938 + reg= LA(1);
1939 + if ( ((LA(1) >= 0x0000) && (LA(1) <= '&')) || ((LA(1) >= '(') && (LA(1) <= '[')) || ((LA(1) >= ']') && (LA(1) <= 0xFFFF)) )
1940 + {
1941 + CONSUME();
1942 +
1943 + }
1944 + else
1945 + {
1946 + CONSTRUCTEX();
1947 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
1948 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
1949 +
1950 + LRECOVER(); goto ruleSTREx;
1951 + }
1952 +
1953 + {
1954 + unesc->addc(unesc, reg);
1955 + }
1956 +
1957 + }
1958 + break;
1959 + case 2:
1960 + // DAAP.g:56:6: esc= ESCAPED
1961 + {
1962 + /* 56:6: esc= ESCAPED */
1963 + {
1964 + ANTLR3_MARKER escStart118 = GETCHARINDEX();
1965 + mESCAPED(ctx );
1966 + if (HASEXCEPTION())
1967 + {
1968 + goto ruleSTREx;
1969 + }
1970 +
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;
1976 + }
1977 + {
1978 + unesc->appendS(unesc, GETTEXT());
1979 + }
1980 +
1981 + }
1982 + break;
1983 +
1984 + default:
1985 +
1986 + if ( cnt2 >= 1 )
1987 + {
1988 + goto loop2;
1989 + }
1990 + /* mismatchedSetEx()
1991 + */
1992 + CONSTRUCTEX();
1993 + EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
1994 + EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
1995 +
1996 +
1997 + goto ruleSTREx;
1998 + }
1999 + cnt2++;
2000 + }
2001 + loop2: ; /* Jump to here if this rule does not match */
2002 + }
2003 + /* 55:4: QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE */
2004 + mQUOTE(ctx );
2005 + if (HASEXCEPTION())
2006 + {
2007 + goto ruleSTREx;
2008 + }
2009 +
2010 + {
2011 + SETTEXT(unesc);
2012 + }
2013 +
2014 + }
2015 +
2016 + LEXSTATE->type = _type;
2017 +
2018 + // This is where rules clean up and exit
2019 + //
2020 + goto ruleSTREx; /* Prevent compiler warnings */
2021 + ruleSTREx: ;
2022 +
2023 + esc = NULL;
2024 +
2025 +}
2026 +// $ANTLR end STR
2027 +
2028 +// Comes from: 59:9: ( '\\\\' ( '\\\\' | '\\'' ) )
2029 +/** \brief Lexer rule generated by ANTLR3
2030 + *
2031 + * $ANTLR start ESCAPED
2032 + *
2033 + * Looks to match the characters the constitute the token ESCAPED
2034 + * from the attached input stream.
2035 + *
2036 + *
2037 + * \remark
2038 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
2039 + */
2040 +static ANTLR3_INLINE
2041 +void mESCAPED(pDAAPLexer ctx)
2042 +{
2043 + ANTLR3_UINT32 _type;
2044 +
2045 +
2046 + // DAAP.g:59:9: ( '\\\\' ( '\\\\' | '\\'' ) )
2047 + // DAAP.g:59:11: '\\\\' ( '\\\\' | '\\'' )
2048 + {
2049 + MATCHC('\\');
2050 + if (HASEXCEPTION())
2051 + {
2052 + goto ruleESCAPEDEx;
2053 + }
2054 +
2055 +
2056 + // DAAP.g:60:3: ( '\\\\' | '\\'' )
2057 + {
2058 + int alt3=2;
2059 + switch ( LA(1) )
2060 + {
2061 + case '\\':
2062 + {
2063 + alt3=1;
2064 + }
2065 + break;
2066 + case '\'':
2067 + {
2068 + alt3=2;
2069 + }
2070 + break;
2071 +
2072 + default:
2073 + CONSTRUCTEX();
2074 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
2075 + EXCEPTION->message = (void *)"";
2076 + EXCEPTION->decisionNum = 3;
2077 + EXCEPTION->state = 0;
2078 +
2079 +
2080 + goto ruleESCAPEDEx;
2081 + }
2082 +
2083 + switch (alt3)
2084 + {
2085 + case 1:
2086 + // DAAP.g:60:5: '\\\\'
2087 + {
2088 + MATCHC('\\');
2089 + if (HASEXCEPTION())
2090 + {
2091 + goto ruleESCAPEDEx;
2092 + }
2093 +
2094 + {
2095 + SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\\"));
2096 + }
2097 +
2098 + }
2099 + break;
2100 + case 2:
2101 + // DAAP.g:61:5: '\\''
2102 + {
2103 + MATCHC('\'');
2104 + if (HASEXCEPTION())
2105 + {
2106 + goto ruleESCAPEDEx;
2107 + }
2108 +
2109 + {
2110 + SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\'"));
2111 + }
2112 +
2113 + }
2114 + break;
2115 +
2116 + }
2117 + }
2118 +
2119 + }
2120 +
2121 +
2122 +
2123 + // This is where rules clean up and exit
2124 + //
2125 + goto ruleESCAPEDEx; /* Prevent compiler warnings */
2126 + ruleESCAPEDEx: ;
2127 +
2128 +}
2129 +// $ANTLR end ESCAPED
2130 +
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
2133 + */
2134 +static void
2135 +mTokens(pDAAPLexer ctx)
2136 +{
2137 + {
2138 + // DAAP.g:1:8: ( QUOTE | LPAR | RPAR | OPAND | OPOR | NEWLINE | STR )
2139 +
2140 + ANTLR3_UINT32 alt4;
2141 +
2142 + alt4=7;
2143 +
2144 + switch ( LA(1) )
2145 + {
2146 + case '\'':
2147 + {
2148 +
2149 + {
2150 + int LA4_1 = LA(2);
2151 + if ( (((LA4_1 >= 0x0000) && (LA4_1 <= '&')) || ((LA4_1 >= '(') && (LA4_1 <= 0xFFFF))) )
2152 + {
2153 + alt4=7;
2154 + }
2155 + else
2156 + {
2157 + alt4=1; }
2158 + }
2159 + }
2160 + break;
2161 + case '(':
2162 + {
2163 + alt4=2;
2164 + }
2165 + break;
2166 + case ')':
2167 + {
2168 + alt4=3;
2169 + }
2170 + break;
2171 + case ' ':
2172 + case '+':
2173 + {
2174 + alt4=4;
2175 + }
2176 + break;
2177 + case ',':
2178 + {
2179 + alt4=5;
2180 + }
2181 + break;
2182 + case '\n':
2183 + case '\r':
2184 + {
2185 + alt4=6;
2186 + }
2187 + break;
2188 +
2189 + default:
2190 + CONSTRUCTEX();
2191 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
2192 + EXCEPTION->message = (void *)"";
2193 + EXCEPTION->decisionNum = 4;
2194 + EXCEPTION->state = 0;
2195 +
2196 +
2197 + goto ruleTokensEx;
2198 + }
2199 +
2200 + switch (alt4)
2201 + {
2202 + case 1:
2203 + // DAAP.g:1:10: QUOTE
2204 + {
2205 + /* 1:10: QUOTE */
2206 + mQUOTE(ctx );
2207 + if (HASEXCEPTION())
2208 + {
2209 + goto ruleTokensEx;
2210 + }
2211 +
2212 +
2213 + }
2214 + break;
2215 + case 2:
2216 + // DAAP.g:1:16: LPAR
2217 + {
2218 + /* 1:16: LPAR */
2219 + mLPAR(ctx );
2220 + if (HASEXCEPTION())
2221 + {
2222 + goto ruleTokensEx;
2223 + }
2224 +
2225 +
2226 + }
2227 + break;
2228 + case 3:
2229 + // DAAP.g:1:21: RPAR
2230 + {
2231 + /* 1:21: RPAR */
2232 + mRPAR(ctx );
2233 + if (HASEXCEPTION())
2234 + {
2235 + goto ruleTokensEx;
2236 + }
2237 +
2238 +
2239 + }
2240 + break;
2241 + case 4:
2242 + // DAAP.g:1:26: OPAND
2243 + {
2244 + /* 1:26: OPAND */
2245 + mOPAND(ctx );
2246 + if (HASEXCEPTION())
2247 + {
2248 + goto ruleTokensEx;
2249 + }
2250 +
2251 +
2252 + }
2253 + break;
2254 + case 5:
2255 + // DAAP.g:1:32: OPOR
2256 + {
2257 + /* 1:32: OPOR */
2258 + mOPOR(ctx );
2259 + if (HASEXCEPTION())
2260 + {
2261 + goto ruleTokensEx;
2262 + }
2263 +
2264 +
2265 + }
2266 + break;
2267 + case 6:
2268 + // DAAP.g:1:37: NEWLINE
2269 + {
2270 + /* 1:37: NEWLINE */
2271 + mNEWLINE(ctx );
2272 + if (HASEXCEPTION())
2273 + {
2274 + goto ruleTokensEx;
2275 + }
2276 +
2277 +
2278 + }
2279 + break;
2280 + case 7:
2281 + // DAAP.g:1:45: STR
2282 + {
2283 + /* 1:45: STR */
2284 + mSTR(ctx );
2285 + if (HASEXCEPTION())
2286 + {
2287 + goto ruleTokensEx;
2288 + }
2289 +
2290 +
2291 + }
2292 + break;
2293 +
2294 + }
2295 + }
2296 +
2297 +
2298 + goto ruleTokensEx; /* Prevent compiler warnings */
2299 +ruleTokensEx: ;
2300 +}
2301 +
2302 +/* =========================================================================
2303 + * Lexer matching rules end.
2304 + * =========================================================================
2305 + */
2306 +/* End of Lexer code
2307 + * ================================================
2308 + * ================================================
2309 + */
2310 +
2311 +
2312 +/* End of code
2313 + * =============================================================================
2314 + */
2315 diff --git a/src/pregen/DAAPLexer.h b/src/pregen/DAAPLexer.h
2316 new file mode 100644
2317 index 0000000..401b214
2318 --- /dev/null
2319 +++ b/src/pregen/DAAPLexer.h
2320 @@ -0,0 +1,188 @@
2321 +/** \file
2322 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
2323 + *
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.
2328 + *
2329 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
2330 + *
2331 + *
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
2335 + * this rule.
2336 + *
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.
2341 + *
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().
2344 + *
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:
2348 + *
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)
2358 + *
2359 + * The return type for any particular rule is of course determined by the source
2360 + * grammar file.
2361 + */
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
2366 +//
2367 +// All rights reserved.
2368 +//
2369 +// Redistribution and use in source and binary forms, with or without
2370 +// modification, are permitted provided that the following conditions
2371 +// are met:
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.
2379 +//
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.
2390 +
2391 +#ifndef _DAAPLexer_H
2392 +#define _DAAPLexer_H
2393 +/* =============================================================================
2394 + * Standard antlr3 C runtime definitions
2395 + */
2396 +#include <antlr3.h>
2397 +
2398 +/* End of standard antlr 3 runtime definitions
2399 + * =============================================================================
2400 + */
2401 +
2402 +#ifdef __cplusplus
2403 +extern "C" {
2404 +#endif
2405 +
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.
2410 +//
2411 +typedef struct DAAPLexer_Ctx_struct DAAPLexer, * pDAAPLexer;
2412 +
2413 +
2414 +
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
2422 +//
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.
2427 +//
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 )
2434 +#endif
2435 +
2436 +/** Context tracking structure for DAAPLexer
2437 + */
2438 +struct DAAPLexer_Ctx_struct
2439 +{
2440 + /** Built in ANTLR3 context tracker contains all the generic elements
2441 + * required for context tracking.
2442 + */
2443 + pANTLR3_LEXER pLexer;
2444 +
2445 +
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);
2456 +
2457 +};
2458 +
2459 +// Function protoypes for the constructor functions that external translation units
2460 +// such as delegators and delegates may wish to call.
2461 +//
2462 +ANTLR3_API pDAAPLexer DAAPLexerNew (pANTLR3_INPUT_STREAM instream);
2463 +ANTLR3_API pDAAPLexer DAAPLexerNewSSD (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
2464 +
2465 +/** Symbolic definitions of all the tokens that the lexer will work with.
2466 + * \{
2467 + *
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.
2472 + */
2473 +#ifdef EOF
2474 +#undef EOF
2475 +#endif
2476 +#ifdef Tokens
2477 +#undef Tokens
2478 +#endif
2479 +#define STR 9
2480 +#define QUOTE 10
2481 +#define NEWLINE 4
2482 +#define LPAR 7
2483 +#define OPOR 5
2484 +#define RPAR 8
2485 +#define ESCAPED 11
2486 +#define OPAND 6
2487 +#define EOF -1
2488 +#ifdef EOF
2489 +#undef EOF
2490 +#define EOF ANTLR3_TOKEN_EOF
2491 +#endif
2492 +
2493 +#ifndef TOKENSOURCE
2494 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
2495 +#endif
2496 +
2497 +/* End of token definitions for DAAPLexer
2498 + * =============================================================================
2499 + */
2500 +/** \} */
2501 +
2502 +#ifdef __cplusplus
2503 +}
2504 +#endif
2505 +
2506 +#endif
2507 +
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
2512 --- /dev/null
2513 +++ b/src/pregen/DAAPParser.c
2514 @@ -0,0 +1,1014 @@
2515 +/** \file
2516 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
2517 + *
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.
2522 + *
2523 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
2524 + *
2525 + *
2526 +*/
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
2531 +//
2532 +// All rights reserved.
2533 +//
2534 +// Redistribution and use in source and binary forms, with or without
2535 +// modification, are permitted provided that the following conditions
2536 +// are met:
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.
2544 +//
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.
2555 +
2556 +/* -----------------------------------------
2557 + * Include the ANTLR3 generated header file.
2558 + */
2559 +#include "DAAPParser.h"
2560 +/* ----------------------------------------- */
2561 +
2562 +
2563 +
2564 +
2565 +
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.
2577 + */
2578 +
2579 +#define CTX ctx
2580 +
2581 +/* Aids in accessing scopes for grammar programmers
2582 + */
2583 +#undef SCOPE_TYPE
2584 +#undef SCOPE_STACK
2585 +#undef SCOPE_TOP
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))
2591 +
2592 +/* Macros for accessing things in the parser
2593 + */
2594 +
2595 +#undef PARSER
2596 +#undef RECOGNIZER
2597 +#undef HAVEPARSEDRULE
2598 +#undef MEMOIZE
2599 +#undef INPUT
2600 +#undef STRSTREAM
2601 +#undef HASEXCEPTION
2602 +#undef EXCEPTION
2603 +#undef MATCHT
2604 +#undef MATCHANYT
2605 +#undef FOLLOWSTACK
2606 +#undef FOLLOWPUSH
2607 +#undef FOLLOWPOP
2608 +#undef PRECOVER
2609 +#undef PREPORTERROR
2610 +#undef LA
2611 +#undef LT
2612 +#undef CONSTRUCTEX
2613 +#undef CONSUME
2614 +#undef MARK
2615 +#undef REWIND
2616 +#undef REWINDLAST
2617 +#undef PERRORRECOVERY
2618 +#undef HASFAILED
2619 +#undef FAILEDFLAG
2620 +#undef RECOVERFROMMISMATCHEDSET
2621 +#undef RECOVERFROMMISMATCHEDELEMENT
2622 +#undef INDEX
2623 +#undef ADAPTOR
2624 +#undef SEEK
2625 +#undef RULEMEMO
2626 +#undef DBG
2627 +
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
2663 +
2664 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
2665 +
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.
2671 + */
2672 +#define UP ANTLR3_TOKEN_UP
2673 +#define DOWN ANTLR3_TOKEN_DOWN
2674 +#define EOR ANTLR3_TOKEN_EOR
2675 +#define INVALID ANTLR3_TOKEN_INVALID
2676 +
2677 +
2678 +/* =============================================================================
2679 + * Functions to create and destroy scopes. First come the rule scopes, followed
2680 + * by the global declared scopes.
2681 + */
2682 +
2683 +
2684 +
2685 +/* ============================================================================= */
2686 +
2687 +/* =============================================================================
2688 + * Start of recognizer
2689 + */
2690 +
2691 +
2692 +
2693 +/** \brief Table of all token names in symbolic order, mainly used for
2694 + * error reporting.
2695 + */
2696 +pANTLR3_UINT8 DAAPParserTokenNames[8+4]
2697 + = {
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"
2710 + };
2711 +
2712 +
2713 +
2714 +// Forward declare the locally static matching functions we have generated.
2715 +//
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.
2724 + */
2725 +static void ANTLR3_CDECL freeScope(void * scope)
2726 +{
2727 + ANTLR3_FREE(scope);
2728 +}
2729 +
2730 +/** \brief Name of the grammar file that generated this code
2731 + */
2732 +static const char fileName[] = "DAAP.g";
2733 +
2734 +/** \brief Return the name of the grammar file that generated this code.
2735 + */
2736 +static const char * getGrammarFileName()
2737 +{
2738 + return fileName;
2739 +}
2740 +/** \brief Create a new DAAPParser parser and return a context for it.
2741 + *
2742 + * \param[in] instream Pointer to an input stream interface.
2743 + *
2744 + * \return Pointer to new parser context upon success.
2745 + */
2746 +ANTLR3_API pDAAPParser
2747 +DAAPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream)
2748 +{
2749 + // See if we can create a new parser with the standard constructor
2750 + //
2751 + return DAAPParserNewSSD(instream, NULL);
2752 +}
2753 +
2754 +/** \brief Create a new DAAPParser parser and return a context for it.
2755 + *
2756 + * \param[in] instream Pointer to an input stream interface.
2757 + *
2758 + * \return Pointer to new parser context upon success.
2759 + */
2760 +ANTLR3_API pDAAPParser
2761 +DAAPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
2762 +{
2763 + pDAAPParser ctx; /* Context structure we will build and return */
2764 +
2765 + ctx = (pDAAPParser) ANTLR3_CALLOC(1, sizeof(DAAPParser));
2766 +
2767 + if (ctx == NULL)
2768 + {
2769 + // Failed to allocate memory for parser context
2770 + //
2771 + return NULL;
2772 + }
2773 +
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.
2780 + *
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.
2783 + */
2784 +
2785 + /* Create a base parser/recognizer, using the supplied token stream
2786 + */
2787 + ctx->pParser = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state);
2788 + /* Install the implementation of our DAAPParser interface
2789 + */
2790 + ctx->query = query;
2791 + ctx->expr = expr;
2792 + ctx->aexpr = aexpr;
2793 + ctx->crit = crit;
2794 + ctx->free = DAAPParserFree;
2795 + ctx->getGrammarFileName = getGrammarFileName;
2796 +
2797 + /* Install the scope pushing methods.
2798 + */
2799 + ADAPTOR = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory);
2800 + ctx->vectors = antlr3VectorFactoryNew(0);
2801 +
2802 +
2803 +
2804 + /* Install the token table
2805 + */
2806 + PSRSTATE->tokenNames = DAAPParserTokenNames;
2807 +
2808 +
2809 + /* Return the newly built parser to the caller
2810 + */
2811 + return ctx;
2812 +}
2813 +
2814 +/** Free the parser resources
2815 + */
2816 + static void
2817 + DAAPParserFree(pDAAPParser ctx)
2818 + {
2819 + /* Free any scope memory
2820 + */
2821 +
2822 + ctx->vectors->close(ctx->vectors);
2823 + /* We created the adaptor so we must free it
2824 + */
2825 + ADAPTOR->free(ADAPTOR);
2826 + // Free this parser
2827 + //
2828 + ctx->pParser->free(ctx->pParser);
2829 + ANTLR3_FREE(ctx);
2830 +
2831 + /* Everything is released, so we can return
2832 + */
2833 + return;
2834 + }
2835 +
2836 +/** Return token names used by this parser
2837 + *
2838 + * The returned pointer is used as an index into the token names table (using the token
2839 + * number as the index).
2840 + *
2841 + * \return Pointer to first char * in the table.
2842 + */
2843 +static pANTLR3_UINT8 *getTokenNames()
2844 +{
2845 + return DAAPParserTokenNames;
2846 +}
2847 +
2848 +
2849 +/* Declare the bitsets
2850 + */
2851 +
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 };
2891 +
2892 +
2893 +
2894 +
2895 +/* ==============================================
2896 + * Parsing rules
2897 + */
2898 +/**
2899 + * $ANTLR start query
2900 + * DAAP.g:27:1: query : expr ( NEWLINE )? EOF -> expr ;
2901 + */
2902 +static DAAPParser_query_return
2903 +query(pDAAPParser ctx)
2904 +{
2905 + DAAPParser_query_return retval;
2906 +
2907 + pANTLR3_BASE_TREE root_0;
2908 +
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
2914 +
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
2921 + */
2922 +
2923 +
2924 + root_0 = NULL;
2925 +
2926 + NEWLINE2 = NULL;
2927 + EOF3 = NULL;
2928 + expr1.tree = NULL;
2929 +
2930 + retval.start = LT(1); retval.stop = retval.start;
2931 +
2932 + NEWLINE2_tree = NULL;
2933 + EOF3_tree = NULL;
2934 +
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"); }
2941 +
2942 + retval.tree = NULL;
2943 + {
2944 + // DAAP.g:27:7: ( expr ( NEWLINE )? EOF -> expr )
2945 + // DAAP.g:27:9: expr ( NEWLINE )? EOF
2946 + {
2947 + FOLLOWPUSH(FOLLOW_expr_in_query42);
2948 + expr1=expr(ctx);
2949 +
2950 + FOLLOWPOP();
2951 + if (HASEXCEPTION())
2952 + {
2953 + goto rulequeryEx;
2954 + }
2955 +
2956 + CREATE_stream_expr; stream_expr->add(stream_expr, expr1.tree, NULL);
2957 +
2958 + // DAAP.g:27:14: ( NEWLINE )?
2959 + {
2960 + int alt1=2;
2961 + switch ( LA(1) )
2962 + {
2963 + case NEWLINE:
2964 + {
2965 + alt1=1;
2966 + }
2967 + break;
2968 + }
2969 +
2970 + switch (alt1)
2971 + {
2972 + case 1:
2973 + // DAAP.g:27:14: NEWLINE
2974 + {
2975 + NEWLINE2 = (pANTLR3_COMMON_TOKEN) MATCHT(NEWLINE, &FOLLOW_NEWLINE_in_query44);
2976 + if (HASEXCEPTION())
2977 + {
2978 + goto rulequeryEx;
2979 + }
2980 +
2981 + CREATE_stream_NEWLINE; stream_NEWLINE->add(stream_NEWLINE, NEWLINE2, NULL);
2982 +
2983 +
2984 + }
2985 + break;
2986 +
2987 + }
2988 + }
2989 + EOF3 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_query47);
2990 + if (HASEXCEPTION())
2991 + {
2992 + goto rulequeryEx;
2993 + }
2994 +
2995 + CREATE_stream_EOF; stream_EOF->add(stream_EOF, EOF3, NULL);
2996 +
2997 +
2998 +
2999 + /* AST REWRITE
3000 + * elements : expr
3001 + * token labels :
3002 + * rule labels : retval
3003 + * token list labels :
3004 + * rule list labels :
3005 + */
3006 + {
3007 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
3008 +
3009 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
3010 +
3011 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
3012 + retval.tree = root_0;
3013 + // 27:27: -> expr
3014 + {
3015 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
3016 +
3017 + }
3018 +
3019 + retval.tree = root_0; // set result root
3020 + if (stream_retval != NULL) stream_retval->free(stream_retval);
3021 +
3022 +
3023 + }
3024 + }
3025 +
3026 + }
3027 +
3028 +
3029 + // This is where rules clean up and exit
3030 + //
3031 + goto rulequeryEx; /* Prevent compiler warnings */
3032 + rulequeryEx: ;
3033 + retval.stop = LT(-1);
3034 +
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);
3041 +
3042 + if (HASEXCEPTION())
3043 + {
3044 + PREPORTERROR();
3045 + PRECOVER();
3046 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
3047 + }
3048 +
3049 +
3050 + return retval;
3051 +}
3052 +/* $ANTLR end query */
3053 +
3054 +/**
3055 + * $ANTLR start expr
3056 + * DAAP.g:30:1: expr : aexpr ( OPOR aexpr )* ;
3057 + */
3058 +static DAAPParser_expr_return
3059 +expr(pDAAPParser ctx)
3060 +{
3061 + DAAPParser_expr_return retval;
3062 +
3063 + pANTLR3_BASE_TREE root_0;
3064 +
3065 + pANTLR3_COMMON_TOKEN OPOR5;
3066 + DAAPParser_aexpr_return aexpr4;
3067 + #undef RETURN_TYPE_aexpr4
3068 + #define RETURN_TYPE_aexpr4 DAAPParser_aexpr_return
3069 +
3070 + DAAPParser_aexpr_return aexpr6;
3071 + #undef RETURN_TYPE_aexpr6
3072 + #define RETURN_TYPE_aexpr6 DAAPParser_aexpr_return
3073 +
3074 + pANTLR3_BASE_TREE OPOR5_tree;
3075 +
3076 + /* Initialize rule variables
3077 + */
3078 +
3079 +
3080 + root_0 = NULL;
3081 +
3082 + OPOR5 = NULL;
3083 + aexpr4.tree = NULL;
3084 +
3085 + aexpr6.tree = NULL;
3086 +
3087 + retval.start = LT(1); retval.stop = retval.start;
3088 +
3089 + OPOR5_tree = NULL;
3090 +
3091 +
3092 + retval.tree = NULL;
3093 + {
3094 + // DAAP.g:30:6: ( aexpr ( OPOR aexpr )* )
3095 + // DAAP.g:30:8: aexpr ( OPOR aexpr )*
3096 + {
3097 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
3098 +
3099 + FOLLOWPUSH(FOLLOW_aexpr_in_expr62);
3100 + aexpr4=aexpr(ctx);
3101 +
3102 + FOLLOWPOP();
3103 + if (HASEXCEPTION())
3104 + {
3105 + goto ruleexprEx;
3106 + }
3107 +
3108 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr4.tree);
3109 +
3110 + // DAAP.g:30:14: ( OPOR aexpr )*
3111 +
3112 + for (;;)
3113 + {
3114 + int alt2=2;
3115 + switch ( LA(1) )
3116 + {
3117 + case OPOR:
3118 + {
3119 + alt2=1;
3120 + }
3121 + break;
3122 +
3123 + }
3124 +
3125 + switch (alt2)
3126 + {
3127 + case 1:
3128 + // DAAP.g:30:15: OPOR aexpr
3129 + {
3130 + OPOR5 = (pANTLR3_COMMON_TOKEN) MATCHT(OPOR, &FOLLOW_OPOR_in_expr65);
3131 + if (HASEXCEPTION())
3132 + {
3133 + goto ruleexprEx;
3134 + }
3135 +
3136 + OPOR5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OPOR5));
3137 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OPOR5_tree, root_0));
3138 +
3139 + FOLLOWPUSH(FOLLOW_aexpr_in_expr68);
3140 + aexpr6=aexpr(ctx);
3141 +
3142 + FOLLOWPOP();
3143 + if (HASEXCEPTION())
3144 + {
3145 + goto ruleexprEx;
3146 + }
3147 +
3148 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree);
3149 +
3150 + }
3151 + break;
3152 +
3153 + default:
3154 + goto loop2; /* break out of the loop */
3155 + break;
3156 + }
3157 + }
3158 + loop2: ; /* Jump out to here if this rule does not match */
3159 +
3160 +
3161 + }
3162 +
3163 + }
3164 +
3165 +
3166 + // This is where rules clean up and exit
3167 + //
3168 + goto ruleexprEx; /* Prevent compiler warnings */
3169 + ruleexprEx: ;
3170 + retval.stop = LT(-1);
3171 +
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);
3175 +
3176 + if (HASEXCEPTION())
3177 + {
3178 + PREPORTERROR();
3179 + PRECOVER();
3180 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
3181 + }
3182 +
3183 +
3184 + return retval;
3185 +}
3186 +/* $ANTLR end expr */
3187 +
3188 +/**
3189 + * $ANTLR start aexpr
3190 + * DAAP.g:33:1: aexpr : crit ( OPAND crit )* ;
3191 + */
3192 +static DAAPParser_aexpr_return
3193 +aexpr(pDAAPParser ctx)
3194 +{
3195 + DAAPParser_aexpr_return retval;
3196 +
3197 + pANTLR3_BASE_TREE root_0;
3198 +
3199 + pANTLR3_COMMON_TOKEN OPAND8;
3200 + DAAPParser_crit_return crit7;
3201 + #undef RETURN_TYPE_crit7
3202 + #define RETURN_TYPE_crit7 DAAPParser_crit_return
3203 +
3204 + DAAPParser_crit_return crit9;
3205 + #undef RETURN_TYPE_crit9
3206 + #define RETURN_TYPE_crit9 DAAPParser_crit_return
3207 +
3208 + pANTLR3_BASE_TREE OPAND8_tree;
3209 +
3210 + /* Initialize rule variables
3211 + */
3212 +
3213 +
3214 + root_0 = NULL;
3215 +
3216 + OPAND8 = NULL;
3217 + crit7.tree = NULL;
3218 +
3219 + crit9.tree = NULL;
3220 +
3221 + retval.start = LT(1); retval.stop = retval.start;
3222 +
3223 + OPAND8_tree = NULL;
3224 +
3225 +
3226 + retval.tree = NULL;
3227 + {
3228 + // DAAP.g:33:7: ( crit ( OPAND crit )* )
3229 + // DAAP.g:33:9: crit ( OPAND crit )*
3230 + {
3231 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
3232 +
3233 + FOLLOWPUSH(FOLLOW_crit_in_aexpr80);
3234 + crit7=crit(ctx);
3235 +
3236 + FOLLOWPOP();
3237 + if (HASEXCEPTION())
3238 + {
3239 + goto ruleaexprEx;
3240 + }
3241 +
3242 + ADAPTOR->addChild(ADAPTOR, root_0, crit7.tree);
3243 +
3244 + // DAAP.g:33:14: ( OPAND crit )*
3245 +
3246 + for (;;)
3247 + {
3248 + int alt3=2;
3249 + switch ( LA(1) )
3250 + {
3251 + case OPAND:
3252 + {
3253 + alt3=1;
3254 + }
3255 + break;
3256 +
3257 + }
3258 +
3259 + switch (alt3)
3260 + {
3261 + case 1:
3262 + // DAAP.g:33:15: OPAND crit
3263 + {
3264 + OPAND8 = (pANTLR3_COMMON_TOKEN) MATCHT(OPAND, &FOLLOW_OPAND_in_aexpr83);
3265 + if (HASEXCEPTION())
3266 + {
3267 + goto ruleaexprEx;
3268 + }
3269 +
3270 + OPAND8_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OPAND8));
3271 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OPAND8_tree, root_0));
3272 +
3273 + FOLLOWPUSH(FOLLOW_crit_in_aexpr86);
3274 + crit9=crit(ctx);
3275 +
3276 + FOLLOWPOP();
3277 + if (HASEXCEPTION())
3278 + {
3279 + goto ruleaexprEx;
3280 + }
3281 +
3282 + ADAPTOR->addChild(ADAPTOR, root_0, crit9.tree);
3283 +
3284 + }
3285 + break;
3286 +
3287 + default:
3288 + goto loop3; /* break out of the loop */
3289 + break;
3290 + }
3291 + }
3292 + loop3: ; /* Jump out to here if this rule does not match */
3293 +
3294 +
3295 + }
3296 +
3297 + }
3298 +
3299 +
3300 + // This is where rules clean up and exit
3301 + //
3302 + goto ruleaexprEx; /* Prevent compiler warnings */
3303 + ruleaexprEx: ;
3304 + retval.stop = LT(-1);
3305 +
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);
3309 +
3310 + if (HASEXCEPTION())
3311 + {
3312 + PREPORTERROR();
3313 + PRECOVER();
3314 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
3315 + }
3316 +
3317 +
3318 + return retval;
3319 +}
3320 +/* $ANTLR end aexpr */
3321 +
3322 +/**
3323 + * $ANTLR start crit
3324 + * DAAP.g:36:1: crit : ( LPAR expr RPAR -> expr | STR );
3325 + */
3326 +static DAAPParser_crit_return
3327 +crit(pDAAPParser ctx)
3328 +{
3329 + DAAPParser_crit_return retval;
3330 +
3331 + pANTLR3_BASE_TREE root_0;
3332 +
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
3339 +
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
3347 + */
3348 +
3349 +
3350 + root_0 = NULL;
3351 +
3352 + LPAR10 = NULL;
3353 + RPAR12 = NULL;
3354 + STR13 = NULL;
3355 + expr11.tree = NULL;
3356 +
3357 + retval.start = LT(1); retval.stop = retval.start;
3358 +
3359 + LPAR10_tree = NULL;
3360 + RPAR12_tree = NULL;
3361 + STR13_tree = NULL;
3362 +
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"); }
3369 +
3370 + retval.tree = NULL;
3371 + {
3372 + {
3373 + // DAAP.g:36:6: ( LPAR expr RPAR -> expr | STR )
3374 +
3375 + ANTLR3_UINT32 alt4;
3376 +
3377 + alt4=2;
3378 +
3379 + switch ( LA(1) )
3380 + {
3381 + case LPAR:
3382 + {
3383 + alt4=1;
3384 + }
3385 + break;
3386 + case STR:
3387 + {
3388 + alt4=2;
3389 + }
3390 + break;
3391 +
3392 + default:
3393 + CONSTRUCTEX();
3394 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
3395 + EXCEPTION->message = (void *)"";
3396 + EXCEPTION->decisionNum = 4;
3397 + EXCEPTION->state = 0;
3398 +
3399 +
3400 + goto rulecritEx;
3401 + }
3402 +
3403 + switch (alt4)
3404 + {
3405 + case 1:
3406 + // DAAP.g:36:8: LPAR expr RPAR
3407 + {
3408 + LPAR10 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit98);
3409 + if (HASEXCEPTION())
3410 + {
3411 + goto rulecritEx;
3412 + }
3413 +
3414 + CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR10, NULL);
3415 +
3416 + FOLLOWPUSH(FOLLOW_expr_in_crit100);
3417 + expr11=expr(ctx);
3418 +
3419 + FOLLOWPOP();
3420 + if (HASEXCEPTION())
3421 + {
3422 + goto rulecritEx;
3423 + }
3424 +
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())
3428 + {
3429 + goto rulecritEx;
3430 + }
3431 +
3432 + CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR12, NULL);
3433 +
3434 +
3435 +
3436 + /* AST REWRITE
3437 + * elements : expr
3438 + * token labels :
3439 + * rule labels : retval
3440 + * token list labels :
3441 + * rule list labels :
3442 + */
3443 + {
3444 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
3445 +
3446 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
3447 +
3448 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
3449 + retval.tree = root_0;
3450 + // 36:24: -> expr
3451 + {
3452 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
3453 +
3454 + }
3455 +
3456 + retval.tree = root_0; // set result root
3457 + if (stream_retval != NULL) stream_retval->free(stream_retval);
3458 +
3459 +
3460 + }
3461 + }
3462 + break;
3463 + case 2:
3464 + // DAAP.g:37:4: STR
3465 + {
3466 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
3467 +
3468 + STR13 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_crit112);
3469 + if (HASEXCEPTION())
3470 + {
3471 + goto rulecritEx;
3472 + }
3473 +
3474 + STR13_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR13));
3475 + ADAPTOR->addChild(ADAPTOR, root_0, STR13_tree);
3476 +
3477 +
3478 + }
3479 + break;
3480 +
3481 + }
3482 + }
3483 + }
3484 +
3485 +
3486 + // This is where rules clean up and exit
3487 + //
3488 + goto rulecritEx; /* Prevent compiler warnings */
3489 + rulecritEx: ;
3490 + retval.stop = LT(-1);
3491 +
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);
3498 +
3499 + if (HASEXCEPTION())
3500 + {
3501 + PREPORTERROR();
3502 + PRECOVER();
3503 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
3504 + }
3505 +
3506 +
3507 + return retval;
3508 +}
3509 +/* $ANTLR end crit */
3510 +/* End of parsing rules
3511 + * ==============================================
3512 + */
3513 +
3514 +/* ==============================================
3515 + * Syntactic predicates
3516 + */
3517 +/* End of syntactic predicates
3518 + * ==============================================
3519 + */
3520 +
3521 +
3522 +
3523 +
3524 +
3525 +
3526 +/* End of code
3527 + * =============================================================================
3528 + */
3529 diff --git a/src/pregen/DAAPParser.h b/src/pregen/DAAPParser.h
3530 new file mode 100644
3531 index 0000000..82ce85e
3532 --- /dev/null
3533 +++ b/src/pregen/DAAPParser.h
3534 @@ -0,0 +1,226 @@
3535 +/** \file
3536 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
3537 + *
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.
3542 + *
3543 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
3544 + *
3545 + *
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
3549 + * this rule.
3550 + *
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.
3555 + *
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().
3558 + *
3559 + * The methods in pDAAPParser are as follows:
3560 + *
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)
3565 + *
3566 + * The return type for any particular rule is of course determined by the source
3567 + * grammar file.
3568 + */
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
3573 +//
3574 +// All rights reserved.
3575 +//
3576 +// Redistribution and use in source and binary forms, with or without
3577 +// modification, are permitted provided that the following conditions
3578 +// are met:
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.
3586 +//
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.
3597 +
3598 +#ifndef _DAAPParser_H
3599 +#define _DAAPParser_H
3600 +/* =============================================================================
3601 + * Standard antlr3 C runtime definitions
3602 + */
3603 +#include <antlr3.h>
3604 +
3605 +/* End of standard antlr 3 runtime definitions
3606 + * =============================================================================
3607 + */
3608 +
3609 +#ifdef __cplusplus
3610 +extern "C" {
3611 +#endif
3612 +
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.
3617 +//
3618 +typedef struct DAAPParser_Ctx_struct DAAPParser, * pDAAPParser;
3619 +
3620 +
3621 +
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
3629 +//
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.
3634 +//
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 )
3641 +#endif
3642 +typedef struct DAAPParser_query_return_struct
3643 +{
3644 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
3645 + */
3646 + pANTLR3_COMMON_TOKEN start;
3647 + pANTLR3_COMMON_TOKEN stop;
3648 + pANTLR3_BASE_TREE tree;
3649 +
3650 +}
3651 + DAAPParser_query_return;
3652 +
3653 +typedef struct DAAPParser_expr_return_struct
3654 +{
3655 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
3656 + */
3657 + pANTLR3_COMMON_TOKEN start;
3658 + pANTLR3_COMMON_TOKEN stop;
3659 + pANTLR3_BASE_TREE tree;
3660 +
3661 +}
3662 + DAAPParser_expr_return;
3663 +
3664 +typedef struct DAAPParser_aexpr_return_struct
3665 +{
3666 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
3667 + */
3668 + pANTLR3_COMMON_TOKEN start;
3669 + pANTLR3_COMMON_TOKEN stop;
3670 + pANTLR3_BASE_TREE tree;
3671 +
3672 +}
3673 + DAAPParser_aexpr_return;
3674 +
3675 +typedef struct DAAPParser_crit_return_struct
3676 +{
3677 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
3678 + */
3679 + pANTLR3_COMMON_TOKEN start;
3680 + pANTLR3_COMMON_TOKEN stop;
3681 + pANTLR3_BASE_TREE tree;
3682 +
3683 +}
3684 + DAAPParser_crit_return;
3685 +
3686 +
3687 +
3688 +/** Context tracking structure for DAAPParser
3689 + */
3690 +struct DAAPParser_Ctx_struct
3691 +{
3692 + /** Built in ANTLR3 context tracker contains all the generic elements
3693 + * required for context tracking.
3694 + */
3695 + pANTLR3_PARSER pParser;
3696 +
3697 +
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() */
3709 +};
3710 +
3711 +// Function protoypes for the constructor functions that external translation units
3712 +// such as delegators and delegates may wish to call.
3713 +//
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);
3716 +
3717 +/** Symbolic definitions of all the tokens that the parser will work with.
3718 + * \{
3719 + *
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.
3724 + */
3725 +#ifdef EOF
3726 +#undef EOF
3727 +#endif
3728 +#ifdef Tokens
3729 +#undef Tokens
3730 +#endif
3731 +#define STR 9
3732 +#define QUOTE 10
3733 +#define LPAR 7
3734 +#define NEWLINE 4
3735 +#define OPOR 5
3736 +#define RPAR 8
3737 +#define ESCAPED 11
3738 +#define OPAND 6
3739 +#define EOF -1
3740 +#ifdef EOF
3741 +#undef EOF
3742 +#define EOF ANTLR3_TOKEN_EOF
3743 +#endif
3744 +
3745 +#ifndef TOKENSOURCE
3746 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
3747 +#endif
3748 +
3749 +/* End of token definitions for DAAPParser
3750 + * =============================================================================
3751 + */
3752 +/** \} */
3753 +
3754 +#ifdef __cplusplus
3755 +}
3756 +#endif
3757 +
3758 +#endif
3759 +
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
3764 --- /dev/null
3765 +++ b/src/pregen/RSP.u
3766 @@ -0,0 +1,6 @@
3767 +RSPParser.c : RSP.g
3768 +./RSP.tokens : RSP.g
3769 +RSPParser.h : RSP.g
3770 +RSPLexer.c : RSP.g
3771 +RSPLexer.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
3777 --- /dev/null
3778 +++ b/src/pregen/RSP2SQL.c
3779 @@ -0,0 +1,2546 @@
3780 +/** \file
3781 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
3782 + *
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.
3787 + *
3788 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
3789 + *
3790 + *
3791 +*/
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
3796 +//
3797 +// All rights reserved.
3798 +//
3799 +// Redistribution and use in source and binary forms, with or without
3800 +// modification, are permitted provided that the following conditions
3801 +// are met:
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.
3809 +//
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.
3820 +
3821 +
3822 +/* =============================================================================
3823 + * This is what the grammar programmer asked us to put at the top of every file.
3824 + */
3825 +
3826 + /* Needs #define _GNU_SOURCE for strptime() */
3827 +
3828 + #include <stdio.h>
3829 + #include <string.h>
3830 + #include <time.h>
3831 + #include <stdint.h>
3832 +
3833 + #include "logger.h"
3834 + #include "db.h"
3835 + #include "misc.h"
3836 + #include "rsp_query.h"
3837 +
3838 +/* End of Header action.
3839 + * =============================================================================
3840 + */
3841 +/* -----------------------------------------
3842 + * Include the ANTLR3 generated header file.
3843 + */
3844 +#include "RSP2SQL.h"
3845 +/* ----------------------------------------- */
3846 +
3847 +
3848 +
3849 +
3850 +
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.
3862 + */
3863 +
3864 +#define CTX ctx
3865 +
3866 +/* Aids in accessing scopes for grammar programmers
3867 + */
3868 +#undef SCOPE_TYPE
3869 +#undef SCOPE_STACK
3870 +#undef SCOPE_TOP
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))
3876 +
3877 +/* Macros for accessing things in the parser
3878 + */
3879 +
3880 +#undef PARSER
3881 +#undef RECOGNIZER
3882 +#undef HAVEPARSEDRULE
3883 +#undef INPUT
3884 +#undef STRSTREAM
3885 +#undef HASEXCEPTION
3886 +#undef EXCEPTION
3887 +#undef MATCHT
3888 +#undef MATCHANYT
3889 +#undef FOLLOWSTACK
3890 +#undef FOLLOWPUSH
3891 +#undef FOLLOWPOP
3892 +#undef PRECOVER
3893 +#undef PREPORTERROR
3894 +#undef LA
3895 +#undef LT
3896 +#undef CONSTRUCTEX
3897 +#undef CONSUME
3898 +#undef MARK
3899 +#undef REWIND
3900 +#undef REWINDLAST
3901 +#undef PERRORRECOVERY
3902 +#undef HASFAILED
3903 +#undef FAILEDFLAG
3904 +#undef RECOVERFROMMISMATCHEDSET
3905 +#undef RECOVERFROMMISMATCHEDELEMENT
3906 +#undef BACKTRACKING
3907 +#undef ADAPTOR
3908 +#undef RULEMEMO
3909 +#undef SEEK
3910 +#undef INDEX
3911 +#undef DBG
3912 +
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
3947 +
3948 +
3949 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
3950 +
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.
3956 + */
3957 +#define UP ANTLR3_TOKEN_UP
3958 +#define DOWN ANTLR3_TOKEN_DOWN
3959 +#define EOR ANTLR3_TOKEN_EOR
3960 +#define INVALID ANTLR3_TOKEN_INVALID
3961 +
3962 +
3963 +/* =============================================================================
3964 + * Functions to create and destroy scopes. First come the rule scopes, followed
3965 + * by the global declared scopes.
3966 + */
3967 +
3968 +
3969 +
3970 +/* ============================================================================= */
3971 +
3972 +/* =============================================================================
3973 + * Start of recognizer
3974 + */
3975 +
3976 +
3977 +
3978 +/** \brief Table of all token names in symbolic order, mainly used for
3979 + * error reporting.
3980 + */
3981 +pANTLR3_UINT8 RSP2SQLTokenNames[30+4]
3982 + = {
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"
4017 + };
4018 +
4019 +
4020 +
4021 +// Forward declare the locally static matching functions we have generated.
4022 +//
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.
4038 + */
4039 +static void ANTLR3_CDECL freeScope(void * scope)
4040 +{
4041 + ANTLR3_FREE(scope);
4042 +}
4043 +
4044 +/** \brief Name of the grammar file that generated this code
4045 + */
4046 +static const char fileName[] = "RSP2SQL.g";
4047 +
4048 +/** \brief Return the name of the grammar file that generated this code.
4049 + */
4050 +static const char * getGrammarFileName()
4051 +{
4052 + return fileName;
4053 +}
4054 +/** \brief Create a new RSP2SQL parser and return a context for it.
4055 + *
4056 + * \param[in] instream Pointer to an input stream interface.
4057 + *
4058 + * \return Pointer to new parser context upon success.
4059 + */
4060 +ANTLR3_API pRSP2SQL
4061 +RSP2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream)
4062 +{
4063 + // See if we can create a new parser with the standard constructor
4064 + //
4065 + return RSP2SQLNewSSD(instream, NULL);
4066 +}
4067 +
4068 +/** \brief Create a new RSP2SQL parser and return a context for it.
4069 + *
4070 + * \param[in] instream Pointer to an input stream interface.
4071 + *
4072 + * \return Pointer to new parser context upon success.
4073 + */
4074 +ANTLR3_API pRSP2SQL
4075 +RSP2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
4076 +{
4077 + pRSP2SQL ctx; /* Context structure we will build and return */
4078 +
4079 + ctx = (pRSP2SQL) ANTLR3_CALLOC(1, sizeof(RSP2SQL));
4080 +
4081 + if (ctx == NULL)
4082 + {
4083 + // Failed to allocate memory for parser context
4084 + //
4085 + return NULL;
4086 + }
4087 +
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.
4094 + *
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.
4097 + */
4098 +
4099 + /* Create a base Tree parser/recognizer, using the supplied tree node stream
4100 + */
4101 + ctx->pTreeParser = antlr3TreeParserNewStream(ANTLR3_SIZE_HINT, instream, state);
4102 + /* Install the implementation of our RSP2SQL interface
4103 + */
4104 + ctx->query = query;
4105 + ctx->expr = expr;
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;
4117 +
4118 + /* Install the scope pushing methods.
4119 + */
4120 +
4121 +
4122 +
4123 +
4124 +
4125 + /* Install the token table
4126 + */
4127 + PSRSTATE->tokenNames = RSP2SQLTokenNames;
4128 +
4129 +
4130 + /* Return the newly built parser to the caller
4131 + */
4132 + return ctx;
4133 +}
4134 +
4135 +/** Free the parser resources
4136 + */
4137 + static void
4138 + RSP2SQLFree(pRSP2SQL ctx)
4139 + {
4140 + /* Free any scope memory
4141 + */
4142 +
4143 +
4144 + // Free this parser
4145 + //
4146 + ctx->pTreeParser->free(ctx->pTreeParser);
4147 + ANTLR3_FREE(ctx);
4148 +
4149 + /* Everything is released, so we can return
4150 + */
4151 + return;
4152 + }
4153 +
4154 +/** Return token names used by this tree parser
4155 + *
4156 + * The returned pointer is used as an index into the token names table (using the token
4157 + * number as the index).
4158 + *
4159 + * \return Pointer to first char * in the table.
4160 + */
4161 +static pANTLR3_UINT8 *getTokenNames()
4162 +{
4163 + return RSP2SQLTokenNames;
4164 +}
4165 +
4166 +
4167 + #define RSP_TYPE_STRING 0
4168 + #define RSP_TYPE_INT 1
4169 + #define RSP_TYPE_DATE 2
4170 +
4171 + struct rsp_query_field_map {
4172 + char *rsp_field;
4173 + int field_type;
4174 + /* RSP fields are named after the DB columns - or vice versa */
4175 + };
4176 +
4177 + /* gperf static hash, rsp_query.gperf */
4178 + #include "rsp_query_hash.c"
4179 +
4180 +
4181 +/* Declare the bitsets
4182 + */
4183 +
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 };
4319 +
4320 +
4321 +
4322 +
4323 +/* ==============================================
4324 + * Parsing rules
4325 + */
4326 +/**
4327 + * $ANTLR start query
4328 + * RSP2SQL.g:56:1: query returns [ pANTLR3_STRING result ] : e= expr ;
4329 + */
4330 +static pANTLR3_STRING
4331 +query(pRSP2SQL ctx)
4332 +{
4333 + pANTLR3_STRING result = NULL;
4334 +
4335 + RSP2SQL_expr_return e;
4336 + #undef RETURN_TYPE_e
4337 + #define RETURN_TYPE_e RSP2SQL_expr_return
4338 +
4339 + /* Initialize rule variables
4340 + */
4341 +
4342 +
4343 + result= NULL;
4344 + {
4345 + // RSP2SQL.g:58:2: (e= expr )
4346 + // RSP2SQL.g:58:4: e= expr
4347 + {
4348 + FOLLOWPUSH(FOLLOW_expr_in_query70);
4349 + e=expr(ctx);
4350 +
4351 + FOLLOWPOP();
4352 + if (HASEXCEPTION())
4353 + {
4354 + goto rulequeryEx;
4355 + }
4356 +
4357 + {
4358 +
4359 + if (!e.valid)
4360 + {
4361 + result= NULL;
4362 + }
4363 + else
4364 + {
4365 + result= e.result->factory->newRaw(e.result->factory);
4366 + result->append8(result, "(");
4367 + result->appendS(result, e.result);
4368 + result->append8(result, ")");
4369 + }
4370 +
4371 + }
4372 +
4373 + }
4374 +
4375 + }
4376 +
4377 +
4378 + // This is where rules clean up and exit
4379 + //
4380 + goto rulequeryEx; /* Prevent compiler warnings */
4381 + rulequeryEx: ;
4382 +
4383 + if (HASEXCEPTION())
4384 + {
4385 + PREPORTERROR();
4386 + PRECOVER();
4387 + }
4388 +
4389 +
4390 + return result;
4391 +}
4392 +/* $ANTLR end query */
4393 +
4394 +/**
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 );
4397 + */
4398 +static RSP2SQL_expr_return
4399 +expr(pRSP2SQL ctx)
4400 +{
4401 + RSP2SQL_expr_return retval;
4402 +
4403 + RSP2SQL_expr_return a;
4404 + #undef RETURN_TYPE_a
4405 + #define RETURN_TYPE_a RSP2SQL_expr_return
4406 +
4407 + RSP2SQL_expr_return b;
4408 + #undef RETURN_TYPE_b
4409 + #define RETURN_TYPE_b RSP2SQL_expr_return
4410 +
4411 + RSP2SQL_strcrit_return c;
4412 + #undef RETURN_TYPE_c
4413 + #define RETURN_TYPE_c RSP2SQL_strcrit_return
4414 +
4415 + RSP2SQL_intcrit_return i;
4416 + #undef RETURN_TYPE_i
4417 + #define RETURN_TYPE_i RSP2SQL_intcrit_return
4418 +
4419 + RSP2SQL_datecrit_return d;
4420 + #undef RETURN_TYPE_d
4421 + #define RETURN_TYPE_d RSP2SQL_datecrit_return
4422 +
4423 + /* Initialize rule variables
4424 + */
4425 +
4426 +
4427 + retval.result= NULL; retval.valid= 1;
4428 + retval.start = LT(1); retval.stop = retval.start;
4429 +
4430 + {
4431 + {
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 )
4433 +
4434 + ANTLR3_UINT32 alt1;
4435 +
4436 + alt1=7;
4437 +
4438 + switch ( LA(1) )
4439 + {
4440 + case AND:
4441 + {
4442 + alt1=1;
4443 + }
4444 + break;
4445 + case OR:
4446 + {
4447 + alt1=2;
4448 + }
4449 + break;
4450 + case EQUAL:
4451 + {
4452 + switch ( LA(2) )
4453 + {
4454 + case DOWN:
4455 + {
4456 + switch ( LA(3) )
4457 + {
4458 + case FIELD:
4459 + {
4460 + switch ( LA(4) )
4461 + {
4462 + case INT:
4463 + {
4464 + alt1=5;
4465 + }
4466 + break;
4467 + case STR:
4468 + {
4469 + alt1=3;
4470 + }
4471 + break;
4472 +
4473 + default:
4474 + CONSTRUCTEX();
4475 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4476 + EXCEPTION->message = (void *)"";
4477 + EXCEPTION->decisionNum = 1;
4478 + EXCEPTION->state = 10;
4479 +
4480 +
4481 + goto ruleexprEx;
4482 + }
4483 +
4484 + }
4485 + break;
4486 +
4487 + default:
4488 + CONSTRUCTEX();
4489 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4490 + EXCEPTION->message = (void *)"";
4491 + EXCEPTION->decisionNum = 1;
4492 + EXCEPTION->state = 8;
4493 +
4494 +
4495 + goto ruleexprEx;
4496 + }
4497 +
4498 + }
4499 + break;
4500 +
4501 + default:
4502 + CONSTRUCTEX();
4503 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4504 + EXCEPTION->message = (void *)"";
4505 + EXCEPTION->decisionNum = 1;
4506 + EXCEPTION->state = 3;
4507 +
4508 +
4509 + goto ruleexprEx;
4510 + }
4511 +
4512 + }
4513 + break;
4514 + case INCLUDES:
4515 + case STARTSW:
4516 + case ENDSW:
4517 + {
4518 + alt1=3;
4519 + }
4520 + break;
4521 + case NOT:
4522 + {
4523 + switch ( LA(2) )
4524 + {
4525 + case DOWN:
4526 + {
4527 + switch ( LA(3) )
4528 + {
4529 + case EQUAL:
4530 + {
4531 + switch ( LA(4) )
4532 + {
4533 + case DOWN:
4534 + {
4535 + switch ( LA(5) )
4536 + {
4537 + case FIELD:
4538 + {
4539 + switch ( LA(6) )
4540 + {
4541 + case STR:
4542 + {
4543 + alt1=4;
4544 + }
4545 + break;
4546 + case INT:
4547 + {
4548 + alt1=6;
4549 + }
4550 + break;
4551 +
4552 + default:
4553 + CONSTRUCTEX();
4554 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4555 + EXCEPTION->message = (void *)"";
4556 + EXCEPTION->decisionNum = 1;
4557 + EXCEPTION->state = 15;
4558 +
4559 +
4560 + goto ruleexprEx;
4561 + }
4562 +
4563 + }
4564 + break;
4565 +
4566 + default:
4567 + CONSTRUCTEX();
4568 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4569 + EXCEPTION->message = (void *)"";
4570 + EXCEPTION->decisionNum = 1;
4571 + EXCEPTION->state = 14;
4572 +
4573 +
4574 + goto ruleexprEx;
4575 + }
4576 +
4577 + }
4578 + break;
4579 +
4580 + default:
4581 + CONSTRUCTEX();
4582 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4583 + EXCEPTION->message = (void *)"";
4584 + EXCEPTION->decisionNum = 1;
4585 + EXCEPTION->state = 11;
4586 +
4587 +
4588 + goto ruleexprEx;
4589 + }
4590 +
4591 + }
4592 + break;
4593 + case LESS:
4594 + case GREATER:
4595 + case LTE:
4596 + case GTE:
4597 + {
4598 + alt1=6;
4599 + }
4600 + break;
4601 + case INCLUDES:
4602 + case STARTSW:
4603 + case ENDSW:
4604 + {
4605 + alt1=4;
4606 + }
4607 + break;
4608 +
4609 + default:
4610 + CONSTRUCTEX();
4611 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4612 + EXCEPTION->message = (void *)"";
4613 + EXCEPTION->decisionNum = 1;
4614 + EXCEPTION->state = 9;
4615 +
4616 +
4617 + goto ruleexprEx;
4618 + }
4619 +
4620 + }
4621 + break;
4622 +
4623 + default:
4624 + CONSTRUCTEX();
4625 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4626 + EXCEPTION->message = (void *)"";
4627 + EXCEPTION->decisionNum = 1;
4628 + EXCEPTION->state = 5;
4629 +
4630 +
4631 + goto ruleexprEx;
4632 + }
4633 +
4634 + }
4635 + break;
4636 + case LESS:
4637 + case GREATER:
4638 + case LTE:
4639 + case GTE:
4640 + {
4641 + alt1=5;
4642 + }
4643 + break;
4644 + case BEFORE:
4645 + case AFTER:
4646 + {
4647 + alt1=7;
4648 + }
4649 + break;
4650 +
4651 + default:
4652 + CONSTRUCTEX();
4653 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
4654 + EXCEPTION->message = (void *)"";
4655 + EXCEPTION->decisionNum = 1;
4656 + EXCEPTION->state = 0;
4657 +
4658 +
4659 + goto ruleexprEx;
4660 + }
4661 +
4662 + switch (alt1)
4663 + {
4664 + case 1:
4665 + // RSP2SQL.g:76:4: ^( AND a= expr b= expr )
4666 + {
4667 + MATCHT(AND, &FOLLOW_AND_in_expr95);
4668 + if (HASEXCEPTION())
4669 + {
4670 + goto ruleexprEx;
4671 + }
4672 +
4673 +
4674 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
4675 + if (HASEXCEPTION())
4676 + {
4677 + goto ruleexprEx;
4678 + }
4679 +
4680 + FOLLOWPUSH(FOLLOW_expr_in_expr101);
4681 + a=expr(ctx);
4682 +
4683 + FOLLOWPOP();
4684 + if (HASEXCEPTION())
4685 + {
4686 + goto ruleexprEx;
4687 + }
4688 +
4689 + FOLLOWPUSH(FOLLOW_expr_in_expr107);
4690 + b=expr(ctx);
4691 +
4692 + FOLLOWPOP();
4693 + if (HASEXCEPTION())
4694 + {
4695 + goto ruleexprEx;
4696 + }
4697 +
4698 +
4699 + MATCHT(ANTLR3_TOKEN_UP, NULL);
4700 + if (HASEXCEPTION())
4701 + {
4702 + goto ruleexprEx;
4703 + }
4704 +
4705 + {
4706 +
4707 + if (!a.valid || !b.valid)
4708 + {
4709 + retval.valid= 0;
4710 + }
4711 + else
4712 + {
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, ")");
4719 + }
4720 +
4721 + }
4722 +
4723 + }
4724 + break;
4725 + case 2:
4726 + // RSP2SQL.g:92:4: ^( OR a= expr b= expr )
4727 + {
4728 + MATCHT(OR, &FOLLOW_OR_in_expr118);
4729 + if (HASEXCEPTION())
4730 + {
4731 + goto ruleexprEx;
4732 + }
4733 +
4734 +
4735 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
4736 + if (HASEXCEPTION())
4737 + {
4738 + goto ruleexprEx;
4739 + }
4740 +
4741 + FOLLOWPUSH(FOLLOW_expr_in_expr124);
4742 + a=expr(ctx);
4743 +
4744 + FOLLOWPOP();
4745 + if (HASEXCEPTION())
4746 + {
4747 + goto ruleexprEx;
4748 + }
4749 +
4750 + FOLLOWPUSH(FOLLOW_expr_in_expr130);
4751 + b=expr(ctx);
4752 +
4753 + FOLLOWPOP();
4754 + if (HASEXCEPTION())
4755 + {
4756 + goto ruleexprEx;
4757 + }
4758 +
4759 +
4760 + MATCHT(ANTLR3_TOKEN_UP, NULL);
4761 + if (HASEXCEPTION())
4762 + {
4763 + goto ruleexprEx;
4764 + }
4765 +
4766 + {
4767 +
4768 + if (!a.valid || !b.valid)
4769 + {
4770 + retval.valid= 0;
4771 + }
4772 + else
4773 + {
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, ")");
4780 + }
4781 +
4782 + }
4783 +
4784 + }
4785 + break;
4786 + case 3:
4787 + // RSP2SQL.g:108:4: c= strcrit
4788 + {
4789 + FOLLOWPUSH(FOLLOW_strcrit_in_expr144);
4790 + c=strcrit(ctx);
4791 +
4792 + FOLLOWPOP();
4793 + if (HASEXCEPTION())
4794 + {
4795 + goto ruleexprEx;
4796 + }
4797 +
4798 + {
4799 +
4800 + retval.valid= c.valid;
4801 + retval.result= c.result;
4802 +
4803 + }
4804 +
4805 + }
4806 + break;
4807 + case 4:
4808 + // RSP2SQL.g:113:4: ^( NOT c= strcrit )
4809 + {
4810 + MATCHT(NOT, &FOLLOW_NOT_in_expr154);
4811 + if (HASEXCEPTION())
4812 + {
4813 + goto ruleexprEx;
4814 + }
4815 +
4816 +
4817 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
4818 + if (HASEXCEPTION())
4819 + {
4820 + goto ruleexprEx;
4821 + }
4822 +
4823 + FOLLOWPUSH(FOLLOW_strcrit_in_expr160);
4824 + c=strcrit(ctx);
4825 +
4826 + FOLLOWPOP();
4827 + if (HASEXCEPTION())
4828 + {
4829 + goto ruleexprEx;
4830 + }
4831 +
4832 +
4833 + MATCHT(ANTLR3_TOKEN_UP, NULL);
4834 + if (HASEXCEPTION())
4835 + {
4836 + goto ruleexprEx;
4837 + }
4838 +
4839 + {
4840 +
4841 + if (!c.valid)
4842 + {
4843 + retval.valid= 0;
4844 + }
4845 + else
4846 + {
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, ")");
4851 + }
4852 +
4853 + }
4854 +
4855 + }
4856 + break;
4857 + case 5:
4858 + // RSP2SQL.g:127:4: i= intcrit
4859 + {
4860 + FOLLOWPUSH(FOLLOW_intcrit_in_expr174);
4861 + i=intcrit(ctx);
4862 +
4863 + FOLLOWPOP();
4864 + if (HASEXCEPTION())
4865 + {
4866 + goto ruleexprEx;
4867 + }
4868 +
4869 + {
4870 +
4871 + retval.valid= i.valid;
4872 + retval.result= i.result;
4873 +
4874 + }
4875 +
4876 + }
4877 + break;
4878 + case 6:
4879 + // RSP2SQL.g:132:4: ^( NOT i= intcrit )
4880 + {
4881 + MATCHT(NOT, &FOLLOW_NOT_in_expr184);
4882 + if (HASEXCEPTION())
4883 + {
4884 + goto ruleexprEx;
4885 + }
4886 +
4887 +
4888 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
4889 + if (HASEXCEPTION())
4890 + {
4891 + goto ruleexprEx;
4892 + }
4893 +
4894 + FOLLOWPUSH(FOLLOW_intcrit_in_expr190);
4895 + i=intcrit(ctx);
4896 +
4897 + FOLLOWPOP();
4898 + if (HASEXCEPTION())
4899 + {
4900 + goto ruleexprEx;
4901 + }
4902 +
4903 +
4904 + MATCHT(ANTLR3_TOKEN_UP, NULL);
4905 + if (HASEXCEPTION())
4906 + {
4907 + goto ruleexprEx;
4908 + }
4909 +
4910 + {
4911 +
4912 + if (!i.valid)
4913 + {
4914 + retval.valid= 0;
4915 + }
4916 + else
4917 + {
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, ")");
4922 + }
4923 +
4924 + }
4925 +
4926 + }
4927 + break;
4928 + case 7:
4929 + // RSP2SQL.g:146:4: d= datecrit
4930 + {
4931 + FOLLOWPUSH(FOLLOW_datecrit_in_expr204);
4932 + d=datecrit(ctx);
4933 +
4934 + FOLLOWPOP();
4935 + if (HASEXCEPTION())
4936 + {
4937 + goto ruleexprEx;
4938 + }
4939 +
4940 + {
4941 +
4942 + retval.valid= d.valid;
4943 + retval.result= d.result;
4944 +
4945 + }
4946 +
4947 + }
4948 + break;
4949 +
4950 + }
4951 + }
4952 + }
4953 +
4954 +
4955 + // This is where rules clean up and exit
4956 + //
4957 + goto ruleexprEx; /* Prevent compiler warnings */
4958 + ruleexprEx: ;
4959 +
4960 + if (HASEXCEPTION())
4961 + {
4962 + PREPORTERROR();
4963 + PRECOVER();
4964 + }
4965 +
4966 +
4967 + return retval;
4968 +}
4969 +/* $ANTLR end expr */
4970 +
4971 +/**
4972 + * $ANTLR start strcrit
4973 + * RSP2SQL.g:153:1: strcrit returns [ pANTLR3_STRING result, int valid ] : ^(o= strop f= FIELD s= STR ) ;
4974 + */
4975 +static RSP2SQL_strcrit_return
4976 +strcrit(pRSP2SQL ctx)
4977 +{
4978 + RSP2SQL_strcrit_return retval;
4979 +
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
4985 +
4986 + /* Initialize rule variables
4987 + */
4988 +
4989 +
4990 + retval.result= NULL; retval.valid= 1;
4991 + f = NULL;
4992 + s = NULL;
4993 + o = NULL;
4994 + retval.start = LT(1); retval.stop = retval.start;
4995 +
4996 + {
4997 + // RSP2SQL.g:155:2: ( ^(o= strop f= FIELD s= STR ) )
4998 + // RSP2SQL.g:155:4: ^(o= strop f= FIELD s= STR )
4999 + {
5000 + FOLLOWPUSH(FOLLOW_strop_in_strcrit233);
5001 + o=strop(ctx);
5002 +
5003 + FOLLOWPOP();
5004 + if (HASEXCEPTION())
5005 + {
5006 + goto rulestrcritEx;
5007 + }
5008 +
5009 +
5010 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
5011 + if (HASEXCEPTION())
5012 + {
5013 + goto rulestrcritEx;
5014 + }
5015 +
5016 + f = (pANTLR3_BASE_TREE) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit239);
5017 + if (HASEXCEPTION())
5018 + {
5019 + goto rulestrcritEx;
5020 + }
5021 +
5022 + s = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_strcrit245);
5023 + if (HASEXCEPTION())
5024 + {
5025 + goto rulestrcritEx;
5026 + }
5027 +
5028 +
5029 + MATCHT(ANTLR3_TOKEN_UP, NULL);
5030 + if (HASEXCEPTION())
5031 + {
5032 + goto rulestrcritEx;
5033 + }
5034 +
5035 + {
5036 +
5037 + char *op;
5038 + const struct rsp_query_field_map *rqfp;
5039 + pANTLR3_STRING field;
5040 + char *escaped;
5041 + ANTLR3_UINT32 optok;
5042 +
5043 + escaped = NULL;
5044 +
5045 + op = NULL;
5046 + optok = o->getType(o);
5047 + switch (optok)
5048 + {
5049 + case EQUAL:
5050 + op = " = ";
5051 + break;
5052 +
5053 + case INCLUDES:
5054 + case STARTSW:
5055 + case ENDSW:
5056 + op = " LIKE ";
5057 + break;
5058 + }
5059 +
5060 + field = f->getText(f);
5061 +
5062 + /* Field lookup */
5063 + rqfp = rsp_query_field_lookup((char *)field->chars, strlen((char *)field->chars));
5064 + if (!rqfp)
5065 + {
5066 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not a valid field in queries\n", field->chars);
5067 + retval.valid= 0;
5068 + goto strcrit_valid_0; /* ABORT */
5069 + }
5070 +
5071 + /* Check field type */
5072 + if (rqfp->field_type != RSP_TYPE_STRING)
5073 + {
5074 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not a string field\n", field->chars);
5075 + retval.valid= 0;
5076 + goto strcrit_valid_0; /* ABORT */
5077 + }
5078 +
5079 + escaped = db_escape_string((char *)s->getText(s)->chars);
5080 + if (!escaped)
5081 + {
5082 + DPRINTF(E_LOG, L_RSP, "Could not escape value\n");
5083 + retval.valid= 0;
5084 + goto strcrit_valid_0; /* ABORT */
5085 + }
5086 +
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, "%");
5094 +
5095 + retval.result->append8(retval.result, escaped);
5096 +
5097 + if ((optok == INCLUDES) || (optok == ENDSW))
5098 + retval.result->append8(retval.result, "%");
5099 + retval.result->append8(retval.result, "'");
5100 +
5101 + strcrit_valid_0:
5102 + ;
5103 +
5104 + if (escaped)
5105 + free(escaped);
5106 +
5107 + }
5108 +
5109 + }
5110 +
5111 + }
5112 +
5113 +
5114 + // This is where rules clean up and exit
5115 + //
5116 + goto rulestrcritEx; /* Prevent compiler warnings */
5117 + rulestrcritEx: ;
5118 +
5119 + if (HASEXCEPTION())
5120 + {
5121 + PREPORTERROR();
5122 + PRECOVER();
5123 + }
5124 +
5125 +
5126 + return retval;
5127 +}
5128 +/* $ANTLR end strcrit */
5129 +
5130 +/**
5131 + * $ANTLR start strop
5132 + * RSP2SQL.g:229:1: strop returns [ pANTLR3_COMMON_TOKEN op ] : (n= EQUAL | n= INCLUDES | n= STARTSW | n= ENDSW );
5133 + */
5134 +static pANTLR3_COMMON_TOKEN
5135 +strop(pRSP2SQL ctx)
5136 +{
5137 + pANTLR3_COMMON_TOKEN op = NULL;
5138 +
5139 + pANTLR3_BASE_TREE n;
5140 +
5141 + /* Initialize rule variables
5142 + */
5143 +
5144 +
5145 + op= NULL;
5146 + n = NULL;
5147 +
5148 + {
5149 + {
5150 + // RSP2SQL.g:231:2: (n= EQUAL | n= INCLUDES | n= STARTSW | n= ENDSW )
5151 +
5152 + ANTLR3_UINT32 alt2;
5153 +
5154 + alt2=4;
5155 +
5156 + switch ( LA(1) )
5157 + {
5158 + case EQUAL:
5159 + {
5160 + alt2=1;
5161 + }
5162 + break;
5163 + case INCLUDES:
5164 + {
5165 + alt2=2;
5166 + }
5167 + break;
5168 + case STARTSW:
5169 + {
5170 + alt2=3;
5171 + }
5172 + break;
5173 + case ENDSW:
5174 + {
5175 + alt2=4;
5176 + }
5177 + break;
5178 +
5179 + default:
5180 + CONSTRUCTEX();
5181 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
5182 + EXCEPTION->message = (void *)"";
5183 + EXCEPTION->decisionNum = 2;
5184 + EXCEPTION->state = 0;
5185 +
5186 +
5187 + goto rulestropEx;
5188 + }
5189 +
5190 + switch (alt2)
5191 + {
5192 + case 1:
5193 + // RSP2SQL.g:231:4: n= EQUAL
5194 + {
5195 + n = (pANTLR3_BASE_TREE) MATCHT(EQUAL, &FOLLOW_EQUAL_in_strop274);
5196 + if (HASEXCEPTION())
5197 + {
5198 + goto rulestropEx;
5199 + }
5200 +
5201 + {
5202 + op= n->getToken(n);
5203 + }
5204 +
5205 + }
5206 + break;
5207 + case 2:
5208 + // RSP2SQL.g:233:4: n= INCLUDES
5209 + {
5210 + n = (pANTLR3_BASE_TREE) MATCHT(INCLUDES, &FOLLOW_INCLUDES_in_strop287);
5211 + if (HASEXCEPTION())
5212 + {
5213 + goto rulestropEx;
5214 + }
5215 +
5216 + {
5217 + op= n->getToken(n);
5218 + }
5219 +
5220 + }
5221 + break;
5222 + case 3:
5223 + // RSP2SQL.g:235:4: n= STARTSW
5224 + {
5225 + n = (pANTLR3_BASE_TREE) MATCHT(STARTSW, &FOLLOW_STARTSW_in_strop300);
5226 + if (HASEXCEPTION())
5227 + {
5228 + goto rulestropEx;
5229 + }
5230 +
5231 + {
5232 + op= n->getToken(n);
5233 + }
5234 +
5235 + }
5236 + break;
5237 + case 4:
5238 + // RSP2SQL.g:237:4: n= ENDSW
5239 + {
5240 + n = (pANTLR3_BASE_TREE) MATCHT(ENDSW, &FOLLOW_ENDSW_in_strop313);
5241 + if (HASEXCEPTION())
5242 + {
5243 + goto rulestropEx;
5244 + }
5245 +
5246 + {
5247 + op= n->getToken(n);
5248 + }
5249 +
5250 + }
5251 + break;
5252 +
5253 + }
5254 + }
5255 + }
5256 +
5257 +
5258 + // This is where rules clean up and exit
5259 + //
5260 + goto rulestropEx; /* Prevent compiler warnings */
5261 + rulestropEx: ;
5262 +
5263 + if (HASEXCEPTION())
5264 + {
5265 + PREPORTERROR();
5266 + PRECOVER();
5267 + }
5268 +
5269 +
5270 + return op;
5271 +}
5272 +/* $ANTLR end strop */
5273 +
5274 +/**
5275 + * $ANTLR start intcrit
5276 + * RSP2SQL.g:241:1: intcrit returns [ pANTLR3_STRING result, int valid ] : ^(o= intop f= FIELD i= INT ) ;
5277 + */
5278 +static RSP2SQL_intcrit_return
5279 +intcrit(pRSP2SQL ctx)
5280 +{
5281 + RSP2SQL_intcrit_return retval;
5282 +
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
5288 +
5289 + /* Initialize rule variables
5290 + */
5291 +
5292 +
5293 + retval.result= NULL; retval.valid= 1;
5294 + f = NULL;
5295 + i = NULL;
5296 + o = NULL;
5297 + retval.start = LT(1); retval.stop = retval.start;
5298 +
5299 + {
5300 + // RSP2SQL.g:243:2: ( ^(o= intop f= FIELD i= INT ) )
5301 + // RSP2SQL.g:243:4: ^(o= intop f= FIELD i= INT )
5302 + {
5303 + FOLLOWPUSH(FOLLOW_intop_in_intcrit342);
5304 + o=intop(ctx);
5305 +
5306 + FOLLOWPOP();
5307 + if (HASEXCEPTION())
5308 + {
5309 + goto ruleintcritEx;
5310 + }
5311 +
5312 +
5313 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
5314 + if (HASEXCEPTION())
5315 + {
5316 + goto ruleintcritEx;
5317 + }
5318 +
5319 + f = (pANTLR3_BASE_TREE) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit348);
5320 + if (HASEXCEPTION())
5321 + {
5322 + goto ruleintcritEx;
5323 + }
5324 +
5325 + i = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_intcrit354);
5326 + if (HASEXCEPTION())
5327 + {
5328 + goto ruleintcritEx;
5329 + }
5330 +
5331 +
5332 + MATCHT(ANTLR3_TOKEN_UP, NULL);
5333 + if (HASEXCEPTION())
5334 + {
5335 + goto ruleintcritEx;
5336 + }
5337 +
5338 + {
5339 +
5340 + char *op;
5341 + const struct rsp_query_field_map *rqfp;
5342 + pANTLR3_STRING field;
5343 +
5344 + op = NULL;
5345 + switch (o->getType(o))
5346 + {
5347 + case EQUAL:
5348 + op = " = ";
5349 + break;
5350 +
5351 + case LESS:
5352 + op = " < ";
5353 + break;
5354 +
5355 + case GREATER:
5356 + op = " > ";
5357 + break;
5358 +
5359 + case LTE:
5360 + op = " <= ";
5361 + break;
5362 +
5363 + case GTE:
5364 + op = " >= ";
5365 + break;
5366 + }
5367 +
5368 + field = f->getText(f);
5369 +
5370 + /* Field lookup */
5371 + rqfp = rsp_query_field_lookup((char *)field->chars, strlen((char *)field->chars));
5372 + if (!rqfp)
5373 + {
5374 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not a valid field in queries\n", field->chars);
5375 + retval.valid= 0;
5376 + goto intcrit_valid_0; /* ABORT */
5377 + }
5378 +
5379 + /* Check field type */
5380 + if (rqfp->field_type != RSP_TYPE_INT)
5381 + {
5382 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not an integer field\n", field->chars);
5383 + retval.valid= 0;
5384 + goto intcrit_valid_0; /* ABORT */
5385 + }
5386 +
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));
5392 +
5393 + intcrit_valid_0:
5394 + ;
5395 +
5396 + }
5397 +
5398 + }
5399 +
5400 + }
5401 +
5402 +
5403 + // This is where rules clean up and exit
5404 + //
5405 + goto ruleintcritEx; /* Prevent compiler warnings */
5406 + ruleintcritEx: ;
5407 +
5408 + if (HASEXCEPTION())
5409 + {
5410 + PREPORTERROR();
5411 + PRECOVER();
5412 + }
5413 +
5414 +
5415 + return retval;
5416 +}
5417 +/* $ANTLR end intcrit */
5418 +
5419 +/**
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 );
5422 + */
5423 +static pANTLR3_COMMON_TOKEN
5424 +intop(pRSP2SQL ctx)
5425 +{
5426 + pANTLR3_COMMON_TOKEN op = NULL;
5427 +
5428 + pANTLR3_BASE_TREE n;
5429 +
5430 + /* Initialize rule variables
5431 + */
5432 +
5433 +
5434 + op= NULL;
5435 + n = NULL;
5436 +
5437 + {
5438 + {
5439 + // RSP2SQL.g:305:2: (n= EQUAL | n= LESS | n= GREATER | n= LTE | n= GTE )
5440 +
5441 + ANTLR3_UINT32 alt3;
5442 +
5443 + alt3=5;
5444 +
5445 + switch ( LA(1) )
5446 + {
5447 + case EQUAL:
5448 + {
5449 + alt3=1;
5450 + }
5451 + break;
5452 + case LESS:
5453 + {
5454 + alt3=2;
5455 + }
5456 + break;
5457 + case GREATER:
5458 + {
5459 + alt3=3;
5460 + }
5461 + break;
5462 + case LTE:
5463 + {
5464 + alt3=4;
5465 + }
5466 + break;
5467 + case GTE:
5468 + {
5469 + alt3=5;
5470 + }
5471 + break;
5472 +
5473 + default:
5474 + CONSTRUCTEX();
5475 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
5476 + EXCEPTION->message = (void *)"";
5477 + EXCEPTION->decisionNum = 3;
5478 + EXCEPTION->state = 0;
5479 +
5480 +
5481 + goto ruleintopEx;
5482 + }
5483 +
5484 + switch (alt3)
5485 + {
5486 + case 1:
5487 + // RSP2SQL.g:305:4: n= EQUAL
5488 + {
5489 + n = (pANTLR3_BASE_TREE) MATCHT(EQUAL, &FOLLOW_EQUAL_in_intop383);
5490 + if (HASEXCEPTION())
5491 + {
5492 + goto ruleintopEx;
5493 + }
5494 +
5495 + {
5496 + op= n->getToken(n);
5497 + }
5498 +
5499 + }
5500 + break;
5501 + case 2:
5502 + // RSP2SQL.g:307:4: n= LESS
5503 + {
5504 + n = (pANTLR3_BASE_TREE) MATCHT(LESS, &FOLLOW_LESS_in_intop396);
5505 + if (HASEXCEPTION())
5506 + {
5507 + goto ruleintopEx;
5508 + }
5509 +
5510 + {
5511 + op= n->getToken(n);
5512 + }
5513 +
5514 + }
5515 + break;
5516 + case 3:
5517 + // RSP2SQL.g:309:4: n= GREATER
5518 + {
5519 + n = (pANTLR3_BASE_TREE) MATCHT(GREATER, &FOLLOW_GREATER_in_intop409);
5520 + if (HASEXCEPTION())
5521 + {
5522 + goto ruleintopEx;
5523 + }
5524 +
5525 + {
5526 + op= n->getToken(n);
5527 + }
5528 +
5529 + }
5530 + break;
5531 + case 4:
5532 + // RSP2SQL.g:311:4: n= LTE
5533 + {
5534 + n = (pANTLR3_BASE_TREE) MATCHT(LTE, &FOLLOW_LTE_in_intop422);
5535 + if (HASEXCEPTION())
5536 + {
5537 + goto ruleintopEx;
5538 + }
5539 +
5540 + {
5541 + op= n->getToken(n);
5542 + }
5543 +
5544 + }
5545 + break;
5546 + case 5:
5547 + // RSP2SQL.g:313:4: n= GTE
5548 + {
5549 + n = (pANTLR3_BASE_TREE) MATCHT(GTE, &FOLLOW_GTE_in_intop435);
5550 + if (HASEXCEPTION())
5551 + {
5552 + goto ruleintopEx;
5553 + }
5554 +
5555 + {
5556 + op= n->getToken(n);
5557 + }
5558 +
5559 + }
5560 + break;
5561 +
5562 + }
5563 + }
5564 + }
5565 +
5566 +
5567 + // This is where rules clean up and exit
5568 + //
5569 + goto ruleintopEx; /* Prevent compiler warnings */
5570 + ruleintopEx: ;
5571 +
5572 + if (HASEXCEPTION())
5573 + {
5574 + PREPORTERROR();
5575 + PRECOVER();
5576 + }
5577 +
5578 +
5579 + return op;
5580 +}
5581 +/* $ANTLR end intop */
5582 +
5583 +/**
5584 + * $ANTLR start datecrit
5585 + * RSP2SQL.g:317:1: datecrit returns [ pANTLR3_STRING result, int valid ] : ^(o= dateop f= FIELD d= datespec ) ;
5586 + */
5587 +static RSP2SQL_datecrit_return
5588 +datecrit(pRSP2SQL ctx)
5589 +{
5590 + RSP2SQL_datecrit_return retval;
5591 +
5592 + pANTLR3_BASE_TREE f;
5593 + pANTLR3_COMMON_TOKEN o;
5594 + #undef RETURN_TYPE_o
5595 + #define RETURN_TYPE_o pANTLR3_COMMON_TOKEN
5596 +
5597 + RSP2SQL_datespec_return d;
5598 + #undef RETURN_TYPE_d
5599 + #define RETURN_TYPE_d RSP2SQL_datespec_return
5600 +
5601 + /* Initialize rule variables
5602 + */
5603 +
5604 +
5605 + retval.result= NULL; retval.valid= 1;
5606 + f = NULL;
5607 + o = NULL;
5608 + retval.start = LT(1); retval.stop = retval.start;
5609 +
5610 + {
5611 + // RSP2SQL.g:319:2: ( ^(o= dateop f= FIELD d= datespec ) )
5612 + // RSP2SQL.g:319:4: ^(o= dateop f= FIELD d= datespec )
5613 + {
5614 + FOLLOWPUSH(FOLLOW_dateop_in_datecrit464);
5615 + o=dateop(ctx);
5616 +
5617 + FOLLOWPOP();
5618 + if (HASEXCEPTION())
5619 + {
5620 + goto ruledatecritEx;
5621 + }
5622 +
5623 +
5624 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
5625 + if (HASEXCEPTION())
5626 + {
5627 + goto ruledatecritEx;
5628 + }
5629 +
5630 + f = (pANTLR3_BASE_TREE) MATCHT(FIELD, &FOLLOW_FIELD_in_datecrit470);
5631 + if (HASEXCEPTION())
5632 + {
5633 + goto ruledatecritEx;
5634 + }
5635 +
5636 + FOLLOWPUSH(FOLLOW_datespec_in_datecrit476);
5637 + d=datespec(ctx);
5638 +
5639 + FOLLOWPOP();
5640 + if (HASEXCEPTION())
5641 + {
5642 + goto ruledatecritEx;
5643 + }
5644 +
5645 +
5646 + MATCHT(ANTLR3_TOKEN_UP, NULL);
5647 + if (HASEXCEPTION())
5648 + {
5649 + goto ruledatecritEx;
5650 + }
5651 +
5652 + {
5653 +
5654 + char *op;
5655 + const struct rsp_query_field_map *rqfp;
5656 + pANTLR3_STRING field;
5657 + char buf[32];
5658 + int ret;
5659 +
5660 + op = NULL;
5661 + switch (o->getType(o))
5662 + {
5663 + case BEFORE:
5664 + op = " < ";
5665 + break;
5666 +
5667 + case AFTER:
5668 + op = " > ";
5669 + break;
5670 + }
5671 +
5672 + field = f->getText(f);
5673 +
5674 + /* Field lookup */
5675 + rqfp = rsp_query_field_lookup((char *)field->chars, strlen((char *)field->chars));
5676 + if (!rqfp)
5677 + {
5678 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not a valid field in queries\n", field->chars);
5679 + retval.valid= 0;
5680 + goto datecrit_valid_0; /* ABORT */
5681 + }
5682 +
5683 + /* Check field type */
5684 + if (rqfp->field_type != RSP_TYPE_DATE)
5685 + {
5686 + DPRINTF(E_LOG, L_RSP, "Field '%s' is not a date field\n", field->chars);
5687 + retval.valid= 0;
5688 + goto datecrit_valid_0; /* ABORT */
5689 + }
5690 +
5691 + ret = snprintf(buf, sizeof(buf), "%ld", d.date);
5692 + if ((ret < 0) || (ret >= sizeof(buf)))
5693 + {
5694 + DPRINTF(E_LOG, L_RSP, "Date %ld too large for buffer, oops!\n", d.date);
5695 + retval.valid= 0;
5696 + goto datecrit_valid_0; /* ABORT */
5697 + }
5698 +
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);
5704 +
5705 + datecrit_valid_0:
5706 + ;
5707 +
5708 + }
5709 +
5710 + }
5711 +
5712 + }
5713 +
5714 +
5715 + // This is where rules clean up and exit
5716 + //
5717 + goto ruledatecritEx; /* Prevent compiler warnings */
5718 + ruledatecritEx: ;
5719 +
5720 + if (HASEXCEPTION())
5721 + {
5722 + PREPORTERROR();
5723 + PRECOVER();
5724 + }
5725 +
5726 +
5727 + return retval;
5728 +}
5729 +/* $ANTLR end datecrit */
5730 +
5731 +/**
5732 + * $ANTLR start dateop
5733 + * RSP2SQL.g:377:1: dateop returns [ pANTLR3_COMMON_TOKEN op ] : (n= BEFORE | n= AFTER );
5734 + */
5735 +static pANTLR3_COMMON_TOKEN
5736 +dateop(pRSP2SQL ctx)
5737 +{
5738 + pANTLR3_COMMON_TOKEN op = NULL;
5739 +
5740 + pANTLR3_BASE_TREE n;
5741 +
5742 + /* Initialize rule variables
5743 + */
5744 +
5745 +
5746 + op= NULL;
5747 + n = NULL;
5748 +
5749 + {
5750 + {
5751 + // RSP2SQL.g:379:2: (n= BEFORE | n= AFTER )
5752 +
5753 + ANTLR3_UINT32 alt4;
5754 +
5755 + alt4=2;
5756 +
5757 + switch ( LA(1) )
5758 + {
5759 + case BEFORE:
5760 + {
5761 + alt4=1;
5762 + }
5763 + break;
5764 + case AFTER:
5765 + {
5766 + alt4=2;
5767 + }
5768 + break;
5769 +
5770 + default:
5771 + CONSTRUCTEX();
5772 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
5773 + EXCEPTION->message = (void *)"";
5774 + EXCEPTION->decisionNum = 4;
5775 + EXCEPTION->state = 0;
5776 +
5777 +
5778 + goto ruledateopEx;
5779 + }
5780 +
5781 + switch (alt4)
5782 + {
5783 + case 1:
5784 + // RSP2SQL.g:379:4: n= BEFORE
5785 + {
5786 + n = (pANTLR3_BASE_TREE) MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateop505);
5787 + if (HASEXCEPTION())
5788 + {
5789 + goto ruledateopEx;
5790 + }
5791 +
5792 + {
5793 + op= n->getToken(n);
5794 + }
5795 +
5796 + }
5797 + break;
5798 + case 2:
5799 + // RSP2SQL.g:381:4: n= AFTER
5800 + {
5801 + n = (pANTLR3_BASE_TREE) MATCHT(AFTER, &FOLLOW_AFTER_in_dateop518);
5802 + if (HASEXCEPTION())
5803 + {
5804 + goto ruledateopEx;
5805 + }
5806 +
5807 + {
5808 + op= n->getToken(n);
5809 + }
5810 +
5811 + }
5812 + break;
5813 +
5814 + }
5815 + }
5816 + }
5817 +
5818 +
5819 + // This is where rules clean up and exit
5820 + //
5821 + goto ruledateopEx; /* Prevent compiler warnings */
5822 + ruledateopEx: ;
5823 +
5824 + if (HASEXCEPTION())
5825 + {
5826 + PREPORTERROR();
5827 + PRECOVER();
5828 + }
5829 +
5830 +
5831 + return op;
5832 +}
5833 +/* $ANTLR end dateop */
5834 +
5835 +/**
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 ) );
5838 + */
5839 +static RSP2SQL_datespec_return
5840 +datespec(pRSP2SQL ctx)
5841 +{
5842 + RSP2SQL_datespec_return retval;
5843 +
5844 + pANTLR3_BASE_TREE m;
5845 + RSP2SQL_dateref_return r;
5846 + #undef RETURN_TYPE_r
5847 + #define RETURN_TYPE_r RSP2SQL_dateref_return
5848 +
5849 + pANTLR3_COMMON_TOKEN o;
5850 + #undef RETURN_TYPE_o
5851 + #define RETURN_TYPE_o pANTLR3_COMMON_TOKEN
5852 +
5853 + RSP2SQL_dateintval_return i;
5854 + #undef RETURN_TYPE_i
5855 + #define RETURN_TYPE_i RSP2SQL_dateintval_return
5856 +
5857 + /* Initialize rule variables
5858 + */
5859 +
5860 +
5861 + retval.date= 0; retval.valid= 1;
5862 + m = NULL;
5863 + o = NULL;
5864 + retval.start = LT(1); retval.stop = retval.start;
5865 +
5866 + {
5867 + {
5868 + // RSP2SQL.g:387:2: (r= dateref | ^(o= dateop r= dateref m= INT i= dateintval ) )
5869 +
5870 + ANTLR3_UINT32 alt5;
5871 +
5872 + alt5=2;
5873 +
5874 + switch ( LA(1) )
5875 + {
5876 + case DATE:
5877 + case TODAY:
5878 + {
5879 + alt5=1;
5880 + }
5881 + break;
5882 + case BEFORE:
5883 + case AFTER:
5884 + {
5885 + alt5=2;
5886 + }
5887 + break;
5888 +
5889 + default:
5890 + CONSTRUCTEX();
5891 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
5892 + EXCEPTION->message = (void *)"";
5893 + EXCEPTION->decisionNum = 5;
5894 + EXCEPTION->state = 0;
5895 +
5896 +
5897 + goto ruledatespecEx;
5898 + }
5899 +
5900 + switch (alt5)
5901 + {
5902 + case 1:
5903 + // RSP2SQL.g:387:4: r= dateref
5904 + {
5905 + FOLLOWPUSH(FOLLOW_dateref_in_datespec546);
5906 + r=dateref(ctx);
5907 +
5908 + FOLLOWPOP();
5909 + if (HASEXCEPTION())
5910 + {
5911 + goto ruledatespecEx;
5912 + }
5913 +
5914 + {
5915 +
5916 + if (!r.valid)
5917 + retval.valid= 0;
5918 + else
5919 + retval.date= r.date;
5920 +
5921 + }
5922 +
5923 + }
5924 + break;
5925 + case 2:
5926 + // RSP2SQL.g:394:4: ^(o= dateop r= dateref m= INT i= dateintval )
5927 + {
5928 + FOLLOWPUSH(FOLLOW_dateop_in_datespec560);
5929 + o=dateop(ctx);
5930 +
5931 + FOLLOWPOP();
5932 + if (HASEXCEPTION())
5933 + {
5934 + goto ruledatespecEx;
5935 + }
5936 +
5937 +
5938 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
5939 + if (HASEXCEPTION())
5940 + {
5941 + goto ruledatespecEx;
5942 + }
5943 +
5944 + FOLLOWPUSH(FOLLOW_dateref_in_datespec566);
5945 + r=dateref(ctx);
5946 +
5947 + FOLLOWPOP();
5948 + if (HASEXCEPTION())
5949 + {
5950 + goto ruledatespecEx;
5951 + }
5952 +
5953 + m = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_datespec572);
5954 + if (HASEXCEPTION())
5955 + {
5956 + goto ruledatespecEx;
5957 + }
5958 +
5959 + FOLLOWPUSH(FOLLOW_dateintval_in_datespec578);
5960 + i=dateintval(ctx);
5961 +
5962 + FOLLOWPOP();
5963 + if (HASEXCEPTION())
5964 + {
5965 + goto ruledatespecEx;
5966 + }
5967 +
5968 +
5969 + MATCHT(ANTLR3_TOKEN_UP, NULL);
5970 + if (HASEXCEPTION())
5971 + {
5972 + goto ruledatespecEx;
5973 + }
5974 +
5975 + {
5976 +
5977 + int32_t val;
5978 + int ret;
5979 +
5980 + if (!r.valid || !i.valid)
5981 + {
5982 + retval.valid= 0;
5983 + goto datespec_valid_0; /* ABORT */
5984 + }
5985 +
5986 + ret = safe_atoi32((char *)m->getText(m)->chars, &val);
5987 + if (ret < 0)
5988 + {
5989 + DPRINTF(E_LOG, L_RSP, "Could not convert '%s' to integer\n", (char *)m->getText(m));
5990 + retval.valid= 0;
5991 + goto datespec_valid_0; /* ABORT */
5992 + }
5993 +
5994 + switch (o->getType(o))
5995 + {
5996 + case BEFORE:
5997 + retval.date= r.date - (val * i.period);
5998 + break;
5999 +
6000 + case AFTER:
6001 + retval.date= r.date + (val * i.period);
6002 + break;
6003 + }
6004 +
6005 + datespec_valid_0:
6006 + ;
6007 +
6008 + }
6009 +
6010 + }
6011 + break;
6012 +
6013 + }
6014 + }
6015 + }
6016 +
6017 +
6018 + // This is where rules clean up and exit
6019 + //
6020 + goto ruledatespecEx; /* Prevent compiler warnings */
6021 + ruledatespecEx: ;
6022 +
6023 + if (HASEXCEPTION())
6024 + {
6025 + PREPORTERROR();
6026 + PRECOVER();
6027 + }
6028 +
6029 +
6030 + return retval;
6031 +}
6032 +/* $ANTLR end datespec */
6033 +
6034 +/**
6035 + * $ANTLR start dateref
6036 + * RSP2SQL.g:429:1: dateref returns [ time_t date, int valid ] : (n= DATE | TODAY );
6037 + */
6038 +static RSP2SQL_dateref_return
6039 +dateref(pRSP2SQL ctx)
6040 +{
6041 + RSP2SQL_dateref_return retval;
6042 +
6043 + pANTLR3_BASE_TREE n;
6044 +
6045 + /* Initialize rule variables
6046 + */
6047 +
6048 +
6049 + retval.date= 0; retval.valid= 1;
6050 + n = NULL;
6051 + retval.start = LT(1); retval.stop = retval.start;
6052 +
6053 + {
6054 + {
6055 + // RSP2SQL.g:431:2: (n= DATE | TODAY )
6056 +
6057 + ANTLR3_UINT32 alt6;
6058 +
6059 + alt6=2;
6060 +
6061 + switch ( LA(1) )
6062 + {
6063 + case DATE:
6064 + {
6065 + alt6=1;
6066 + }
6067 + break;
6068 + case TODAY:
6069 + {
6070 + alt6=2;
6071 + }
6072 + break;
6073 +
6074 + default:
6075 + CONSTRUCTEX();
6076 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
6077 + EXCEPTION->message = (void *)"";
6078 + EXCEPTION->decisionNum = 6;
6079 + EXCEPTION->state = 0;
6080 +
6081 +
6082 + goto ruledaterefEx;
6083 + }
6084 +
6085 + switch (alt6)
6086 + {
6087 + case 1:
6088 + // RSP2SQL.g:431:4: n= DATE
6089 + {
6090 + n = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateref607);
6091 + if (HASEXCEPTION())
6092 + {
6093 + goto ruledaterefEx;
6094 + }
6095 +
6096 + {
6097 +
6098 + struct tm tm;
6099 + char *ret;
6100 +
6101 + ret = strptime((char *)n->getText(n), "%Y-%m-%d", &tm);
6102 + if (!ret)
6103 + {
6104 + DPRINTF(E_LOG, L_RSP, "Date '%s' could not be interpreted\n", (char *)n->getText(n));
6105 + retval.valid= 0;
6106 + goto dateref_valid_0; /* ABORT */
6107 + }
6108 + else
6109 + {
6110 + if (*ret != '\0')
6111 + DPRINTF(E_LOG, L_RSP, "Garbage at end of date '%s' ?!\n", (char *)n->getText(n));
6112 +
6113 + retval.date= mktime(&tm);
6114 + if (retval.date == (time_t) -1)
6115 + {
6116 + DPRINTF(E_LOG, L_RSP, "Date '%s' could not be converted to an epoch\n", (char *)n->getText(n));
6117 + retval.valid= 0;
6118 + goto dateref_valid_0; /* ABORT */
6119 + }
6120 + }
6121 +
6122 + dateref_valid_0:
6123 + ;
6124 +
6125 + }
6126 +
6127 + }
6128 + break;
6129 + case 2:
6130 + // RSP2SQL.g:460:4: TODAY
6131 + {
6132 + MATCHT(TODAY, &FOLLOW_TODAY_in_dateref616);
6133 + if (HASEXCEPTION())
6134 + {
6135 + goto ruledaterefEx;
6136 + }
6137 +
6138 + {
6139 + retval.date= time(NULL);
6140 + }
6141 +
6142 + }
6143 + break;
6144 +
6145 + }
6146 + }
6147 + }
6148 +
6149 +
6150 + // This is where rules clean up and exit
6151 + //
6152 + goto ruledaterefEx; /* Prevent compiler warnings */
6153 + ruledaterefEx: ;
6154 +
6155 + if (HASEXCEPTION())
6156 + {
6157 + PREPORTERROR();
6158 + PRECOVER();
6159 + }
6160 +
6161 +
6162 + return retval;
6163 +}
6164 +/* $ANTLR end dateref */
6165 +
6166 +/**
6167 + * $ANTLR start dateintval
6168 + * RSP2SQL.g:464:1: dateintval returns [ time_t period, int valid ] : ( DAY | WEEK | MONTH | YEAR );
6169 + */
6170 +static RSP2SQL_dateintval_return
6171 +dateintval(pRSP2SQL ctx)
6172 +{
6173 + RSP2SQL_dateintval_return retval;
6174 +
6175 + /* Initialize rule variables
6176 + */
6177 +
6178 +
6179 + retval.period= 0; retval.valid= 1;
6180 + retval.start = LT(1); retval.stop = retval.start;
6181 +
6182 + {
6183 + {
6184 + // RSP2SQL.g:466:2: ( DAY | WEEK | MONTH | YEAR )
6185 +
6186 + ANTLR3_UINT32 alt7;
6187 +
6188 + alt7=4;
6189 +
6190 + switch ( LA(1) )
6191 + {
6192 + case DAY:
6193 + {
6194 + alt7=1;
6195 + }
6196 + break;
6197 + case WEEK:
6198 + {
6199 + alt7=2;
6200 + }
6201 + break;
6202 + case MONTH:
6203 + {
6204 + alt7=3;
6205 + }
6206 + break;
6207 + case YEAR:
6208 + {
6209 + alt7=4;
6210 + }
6211 + break;
6212 +
6213 + default:
6214 + CONSTRUCTEX();
6215 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
6216 + EXCEPTION->message = (void *)"";
6217 + EXCEPTION->decisionNum = 7;
6218 + EXCEPTION->state = 0;
6219 +
6220 +
6221 + goto ruledateintvalEx;
6222 + }
6223 +
6224 + switch (alt7)
6225 + {
6226 + case 1:
6227 + // RSP2SQL.g:466:4: DAY
6228 + {
6229 + MATCHT(DAY, &FOLLOW_DAY_in_dateintval640);
6230 + if (HASEXCEPTION())
6231 + {
6232 + goto ruledateintvalEx;
6233 + }
6234 +
6235 + {
6236 + retval.period= 24 * 60 * 60;
6237 + }
6238 +
6239 + }
6240 + break;
6241 + case 2:
6242 + // RSP2SQL.g:468:4: WEEK
6243 + {
6244 + MATCHT(WEEK, &FOLLOW_WEEK_in_dateintval649);
6245 + if (HASEXCEPTION())
6246 + {
6247 + goto ruledateintvalEx;
6248 + }
6249 +
6250 + {
6251 + retval.period= 7 * 24 * 60 * 60;
6252 + }
6253 +
6254 + }
6255 + break;
6256 + case 3:
6257 + // RSP2SQL.g:470:4: MONTH
6258 + {
6259 + MATCHT(MONTH, &FOLLOW_MONTH_in_dateintval658);
6260 + if (HASEXCEPTION())
6261 + {
6262 + goto ruledateintvalEx;
6263 + }
6264 +
6265 + {
6266 + retval.period= 30 * 24 * 60 * 60;
6267 + }
6268 +
6269 + }
6270 + break;
6271 + case 4:
6272 + // RSP2SQL.g:472:4: YEAR
6273 + {
6274 + MATCHT(YEAR, &FOLLOW_YEAR_in_dateintval667);
6275 + if (HASEXCEPTION())
6276 + {
6277 + goto ruledateintvalEx;
6278 + }
6279 +
6280 + {
6281 + retval.period= 365 * 24 * 60 * 60;
6282 + }
6283 +
6284 + }
6285 + break;
6286 +
6287 + }
6288 + }
6289 + }
6290 +
6291 +
6292 + // This is where rules clean up and exit
6293 + //
6294 + goto ruledateintvalEx; /* Prevent compiler warnings */
6295 + ruledateintvalEx: ;
6296 +
6297 + if (HASEXCEPTION())
6298 + {
6299 + PREPORTERROR();
6300 + PRECOVER();
6301 + }
6302 +
6303 +
6304 + return retval;
6305 +}
6306 +/* $ANTLR end dateintval */
6307 +/* End of parsing rules
6308 + * ==============================================
6309 + */
6310 +
6311 +/* ==============================================
6312 + * Syntactic predicates
6313 + */
6314 +/* End of syntactic predicates
6315 + * ==============================================
6316 + */
6317 +
6318 +
6319 +
6320 +
6321 +
6322 +
6323 +/* End of code
6324 + * =============================================================================
6325 + */
6326 diff --git a/src/pregen/RSP2SQL.h b/src/pregen/RSP2SQL.h
6327 new file mode 100644
6328 index 0000000..a94e317
6329 --- /dev/null
6330 +++ b/src/pregen/RSP2SQL.h
6331 @@ -0,0 +1,291 @@
6332 +/** \file
6333 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
6334 + *
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.
6339 + *
6340 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
6341 + *
6342 + *
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
6346 + * this rule.
6347 + *
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.
6352 + *
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().
6355 + *
6356 + * The methods in pRSP2SQL are as follows:
6357 + *
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)
6369 + *
6370 + * The return type for any particular rule is of course determined by the source
6371 + * grammar file.
6372 + */
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
6377 +//
6378 +// All rights reserved.
6379 +//
6380 +// Redistribution and use in source and binary forms, with or without
6381 +// modification, are permitted provided that the following conditions
6382 +// are met:
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.
6390 +//
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.
6401 +
6402 +#ifndef _RSP2SQL_H
6403 +#define _RSP2SQL_H
6404 +/* =============================================================================
6405 + * Standard antlr3 C runtime definitions
6406 + */
6407 +#include <antlr3.h>
6408 +
6409 +/* End of standard antlr 3 runtime definitions
6410 + * =============================================================================
6411 + */
6412 +
6413 +#ifdef __cplusplus
6414 +extern "C" {
6415 +#endif
6416 +
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.
6421 +//
6422 +typedef struct RSP2SQL_Ctx_struct RSP2SQL, * pRSP2SQL;
6423 +
6424 +
6425 +
6426 + /* Needs #define _GNU_SOURCE for strptime() */
6427 +
6428 + #include <stdio.h>
6429 + #include <string.h>
6430 + #include <time.h>
6431 + #include <stdint.h>
6432 +
6433 + #include "logger.h"
6434 + #include "db.h"
6435 + #include "misc.h"
6436 + #include "rsp_query.h"
6437 +
6438 +
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
6446 +//
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.
6451 +//
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 )
6458 +#endif
6459 +typedef struct RSP2SQL_expr_return_struct
6460 +{
6461 + pANTLR3_BASE_TREE start;
6462 + pANTLR3_BASE_TREE stop;
6463 + pANTLR3_STRING result;
6464 + int valid;
6465 +}
6466 + RSP2SQL_expr_return;
6467 +
6468 +typedef struct RSP2SQL_strcrit_return_struct
6469 +{
6470 + pANTLR3_BASE_TREE start;
6471 + pANTLR3_BASE_TREE stop;
6472 + pANTLR3_STRING result;
6473 + int valid;
6474 +}
6475 + RSP2SQL_strcrit_return;
6476 +
6477 +typedef struct RSP2SQL_intcrit_return_struct
6478 +{
6479 + pANTLR3_BASE_TREE start;
6480 + pANTLR3_BASE_TREE stop;
6481 + pANTLR3_STRING result;
6482 + int valid;
6483 +}
6484 + RSP2SQL_intcrit_return;
6485 +
6486 +typedef struct RSP2SQL_datecrit_return_struct
6487 +{
6488 + pANTLR3_BASE_TREE start;
6489 + pANTLR3_BASE_TREE stop;
6490 + pANTLR3_STRING result;
6491 + int valid;
6492 +}
6493 + RSP2SQL_datecrit_return;
6494 +
6495 +typedef struct RSP2SQL_datespec_return_struct
6496 +{
6497 + pANTLR3_BASE_TREE start;
6498 + pANTLR3_BASE_TREE stop;
6499 + time_t date;
6500 + int valid;
6501 +}
6502 + RSP2SQL_datespec_return;
6503 +
6504 +typedef struct RSP2SQL_dateref_return_struct
6505 +{
6506 + pANTLR3_BASE_TREE start;
6507 + pANTLR3_BASE_TREE stop;
6508 + time_t date;
6509 + int valid;
6510 +}
6511 + RSP2SQL_dateref_return;
6512 +
6513 +typedef struct RSP2SQL_dateintval_return_struct
6514 +{
6515 + pANTLR3_BASE_TREE start;
6516 + pANTLR3_BASE_TREE stop;
6517 + time_t period;
6518 + int valid;
6519 +}
6520 + RSP2SQL_dateintval_return;
6521 +
6522 +
6523 +
6524 +/** Context tracking structure for RSP2SQL
6525 + */
6526 +struct RSP2SQL_Ctx_struct
6527 +{
6528 + /** Built in ANTLR3 context tracker contains all the generic elements
6529 + * required for context tracking.
6530 + */
6531 + pANTLR3_TREE_PARSER pTreeParser;
6532 +
6533 +
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);
6548 +
6549 +};
6550 +
6551 +// Function protoypes for the constructor functions that external translation units
6552 +// such as delegators and delegates may wish to call.
6553 +//
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);
6556 +
6557 +/** Symbolic definitions of all the tokens that the tree parser will work with.
6558 + * \{
6559 + *
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.
6564 + */
6565 +#ifdef EOF
6566 +#undef EOF
6567 +#endif
6568 +#ifdef Tokens
6569 +#undef Tokens
6570 +#endif
6571 +#define STARTSW 14
6572 +#define WEEK 26
6573 +#define TODAY 24
6574 +#define YEAR 28
6575 +#define ENDSW 15
6576 +#define GTE 20
6577 +#define BEFORE 21
6578 +#define DAY 25
6579 +#define INT 16
6580 +#define NOT 11
6581 +#define AFTER 22
6582 +#define AND 6
6583 +#define EOF -1
6584 +#define LTE 19
6585 +#define MONTH 27
6586 +#define DIGIT19 31
6587 +#define INCLUDES 13
6588 +#define STR 10
6589 +#define QUOTE 29
6590 +#define GREATER 18
6591 +#define WS 30
6592 +#define LPAR 7
6593 +#define NEWLINE 4
6594 +#define EQUAL 12
6595 +#define OR 5
6596 +#define LESS 17
6597 +#define FIELD 9
6598 +#define RPAR 8
6599 +#define ESCAPED 33
6600 +#define DATE 23
6601 +#define DIGIT09 32
6602 +#ifdef EOF
6603 +#undef EOF
6604 +#define EOF ANTLR3_TOKEN_EOF
6605 +#endif
6606 +
6607 +#ifndef TOKENSOURCE
6608 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
6609 +#endif
6610 +
6611 +/* End of token definitions for RSP2SQL
6612 + * =============================================================================
6613 + */
6614 +/** \} */
6615 +
6616 +#ifdef __cplusplus
6617 +}
6618 +#endif
6619 +
6620 +#endif
6621 +
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
6626 --- /dev/null
6627 +++ b/src/pregen/RSP2SQL.u
6628 @@ -0,0 +1,5 @@
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
6638 --- /dev/null
6639 +++ b/src/pregen/RSPLexer.c
6640 @@ -0,0 +1,4867 @@
6641 +/** \file
6642 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
6643 + *
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.
6648 + *
6649 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
6650 + *
6651 + *
6652 +*/
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
6657 +//
6658 +// All rights reserved.
6659 +//
6660 +// Redistribution and use in source and binary forms, with or without
6661 +// modification, are permitted provided that the following conditions
6662 +// are met:
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.
6670 +//
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.
6681 +
6682 +/* -----------------------------------------
6683 + * Include the ANTLR3 generated header file.
6684 + */
6685 +#include "RSPLexer.h"
6686 +/* ----------------------------------------- */
6687 +
6688 +
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.
6694 + */
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};
6713 +
6714 +
6715 +
6716 +
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.
6728 + */
6729 +
6730 +#define CTX ctx
6731 +
6732 +/* Aids in accessing scopes for grammar programmers
6733 + */
6734 +#undef SCOPE_TYPE
6735 +#undef SCOPE_STACK
6736 +#undef SCOPE_TOP
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))
6742 +
6743 +
6744 +/* Macros for accessing things in a lexer
6745 + */
6746 +#undef LEXER
6747 +#undef RECOGNIZER
6748 +#undef RULEMEMO
6749 +#undef GETCHARINDEX
6750 +#undef GETLINE
6751 +#undef GETCHARPOSITIONINLINE
6752 +#undef EMIT
6753 +#undef EMITNEW
6754 +#undef MATCHC
6755 +#undef MATCHS
6756 +#undef MATCHRANGE
6757 +#undef LTOKEN
6758 +#undef HASFAILED
6759 +#undef FAILEDFLAG
6760 +#undef INPUT
6761 +#undef STRSTREAM
6762 +#undef LA
6763 +#undef HASEXCEPTION
6764 +#undef EXCEPTION
6765 +#undef CONSTRUCTEX
6766 +#undef CONSUME
6767 +#undef LRECOVER
6768 +#undef MARK
6769 +#undef REWIND
6770 +#undef REWINDLAST
6771 +#undef BACKTRACKING
6772 +#undef MATCHANY
6773 +#undef MEMOIZE
6774 +#undef HAVEPARSEDRULE
6775 +#undef GETTEXT
6776 +#undef INDEX
6777 +#undef SEEK
6778 +#undef PUSHSTREAM
6779 +#undef POPSTREAM
6780 +#undef SETTEXT
6781 +#undef SETTEXT8
6782 +
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
6826 +
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).
6833 + */
6834 +#if defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16)
6835 +
6836 +# ifdef ANTLR3_INLINE_INPUT_ASCII
6837 +
6838 +/* 8 bit "ASCII" (actually any 8 bit character set) */
6839 +
6840 +# define NEXTCHAR ((pANTLR3_UINT8)(INPUT->nextChar))
6841 +# define DATAP ((pANTLR3_UINT8)(INPUT->data))
6842 +
6843 +# else
6844 +
6845 +# define NEXTCHAR ((pANTLR3_UINT16)(INPUT->nextChar))
6846 +# define DATAP ((pANTLR3_UINT16)(INPUT->data))
6847 +
6848 +# endif
6849 +
6850 +# define LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1)))
6851 +# define CONSUME() \
6852 +{ \
6853 + if (NEXTCHAR < (DATAP + INPUT->sizeBuf)) \
6854 + { \
6855 + INPUT->charPositionInLine++; \
6856 + if ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar) \
6857 + { \
6858 + INPUT->line++; \
6859 + INPUT->charPositionInLine = 0; \
6860 + INPUT->currentLine = (void *)(NEXTCHAR + 1); \
6861 + } \
6862 + INPUT->nextChar = (void *)(NEXTCHAR + 1); \
6863 + } \
6864 +}
6865 +
6866 +#else
6867 +
6868 +// Pick up the input character by calling the input stream implementation.
6869 +//
6870 +#define CONSUME() INPUT->istream->consume(INPUT->istream)
6871 +#define LA(n) INPUT->istream->_LA(INPUT->istream, n)
6872 +
6873 +#endif
6874 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
6875 +
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.
6881 + */
6882 +#define UP ANTLR3_TOKEN_UP
6883 +#define DOWN ANTLR3_TOKEN_DOWN
6884 +#define EOR ANTLR3_TOKEN_EOR
6885 +#define INVALID ANTLR3_TOKEN_INVALID
6886 +
6887 +
6888 +/* =============================================================================
6889 + * Functions to create and destroy scopes. First come the rule scopes, followed
6890 + * by the global declared scopes.
6891 + */
6892 +
6893 +
6894 +
6895 +/* ============================================================================= */
6896 +
6897 +/* =============================================================================
6898 + * Start of recognizer
6899 + */
6900 +
6901 +
6902 +/* Forward declare the locally static matching functions we have generated and any predicate functions.
6903 + */
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);
6936 +
6937 +/* =========================================================================
6938 + * Lexer matching rules end.
6939 + * =========================================================================
6940 + */
6941 +
6942 +
6943 +
6944 +static void
6945 +RSPLexerFree (pRSPLexer ctx)
6946 +{
6947 + LEXER->free(LEXER);
6948 +
6949 + ANTLR3_FREE(ctx);
6950 +}
6951 +
6952 +/** \brief Name of the grammar file that generated this code
6953 + */
6954 +static const char fileName[] = "RSP.g";
6955 +
6956 +/** \brief Return the name of the grammar file that generated this code.
6957 + */
6958 +static const char * getGrammarFileName()
6959 +{
6960 + return fileName;
6961 +}
6962 +
6963 +/** \brief Create a new lexer called RSPLexer
6964 + *
6965 + * \param[in] instream Pointer to an initialized input stream
6966 + * \return
6967 + * - Success pRSPLexer initialized for the lex start
6968 + * - Fail NULL
6969 + */
6970 +ANTLR3_API pRSPLexer RSPLexerNew
6971 +(pANTLR3_INPUT_STREAM instream)
6972 +{
6973 + // See if we can create a new lexer with the standard constructor
6974 + //
6975 + return RSPLexerNewSSD(instream, NULL);
6976 +}
6977 +
6978 +/** \brief Create a new lexer called RSPLexer
6979 + *
6980 + * \param[in] instream Pointer to an initialized input stream
6981 + * \param[state] state Previously created shared recognizer stat
6982 + * \return
6983 + * - Success pRSPLexer initialized for the lex start
6984 + * - Fail NULL
6985 + */
6986 +ANTLR3_API pRSPLexer RSPLexerNewSSD
6987 +(pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
6988 +{
6989 + pRSPLexer ctx; // Context structure we will build and return
6990 +
6991 + ctx = (pRSPLexer) ANTLR3_CALLOC(1, sizeof(RSPLexer));
6992 +
6993 + if (ctx == NULL)
6994 + {
6995 + // Failed to allocate memory for lexer context
6996 + return NULL;
6997 + }
6998 +
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.
7005 + *
7006 + * We don't use the macros defined in RSPLexer.h here so you can get a sense
7007 + * of what goes where.
7008 + */
7009 +
7010 + /* Create a base lexer, using the supplied input stream
7011 + */
7012 + ctx->pLexer = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state);
7013 +
7014 + /* Check that we allocated the memory correctly
7015 + */
7016 + if (ctx->pLexer == NULL)
7017 + {
7018 + ANTLR3_FREE(ctx);
7019 + return NULL;
7020 + }
7021 + /* Install the implementation of our RSPLexer interface
7022 + */
7023 + ctx->mQUOTE = mQUOTE;
7024 + ctx->mLPAR = mLPAR;
7025 + ctx->mRPAR = mRPAR;
7026 + ctx->mAND = mAND;
7027 + ctx->mOR = mOR;
7028 + ctx->mNOT = mNOT;
7029 + ctx->mEQUAL = mEQUAL;
7030 + ctx->mINCLUDES = mINCLUDES;
7031 + ctx->mSTARTSW = mSTARTSW;
7032 + ctx->mENDSW = mENDSW;
7033 + ctx->mGREATER = mGREATER;
7034 + ctx->mLESS = mLESS;
7035 + ctx->mGTE = mGTE;
7036 + ctx->mLTE = mLTE;
7037 + ctx->mBEFORE = mBEFORE;
7038 + ctx->mAFTER = mAFTER;
7039 + ctx->mDAY = mDAY;
7040 + ctx->mWEEK = mWEEK;
7041 + ctx->mMONTH = mMONTH;
7042 + ctx->mYEAR = mYEAR;
7043 + ctx->mTODAY = mTODAY;
7044 + ctx->mNEWLINE = mNEWLINE;
7045 + ctx->mWS = mWS;
7046 + ctx->mFIELD = mFIELD;
7047 + ctx->mINT = mINT;
7048 + ctx->mDATE = mDATE;
7049 + ctx->mSTR = mSTR;
7050 + ctx->mESCAPED = mESCAPED;
7051 + ctx->mDIGIT09 = mDIGIT09;
7052 + ctx->mDIGIT19 = mDIGIT19;
7053 + ctx->mTokens = mTokens;
7054 +
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.
7058 + */
7059 + ctx->pLexer->ctx = ctx;
7060 +
7061 + /**Install the token matching function
7062 + */
7063 + ctx->pLexer->mTokens = (void (*) (void *))(mTokens);
7064 +
7065 + ctx->getGrammarFileName = getGrammarFileName;
7066 + ctx->free = RSPLexerFree;
7067 +
7068 +
7069 +
7070 +
7071 +
7072 + /* Return the newly built lexer to the caller
7073 + */
7074 + return ctx;
7075 +}
7076 +
7077 +
7078 +/* =========================================================================
7079 + * Functions to match the lexer grammar defined tokens from the input stream
7080 + */
7081 +
7082 +// Comes from: 85:7: ( '\"' )
7083 +/** \brief Lexer rule generated by ANTLR3
7084 + *
7085 + * $ANTLR start QUOTE
7086 + *
7087 + * Looks to match the characters the constitute the token QUOTE
7088 + * from the attached input stream.
7089 + *
7090 + *
7091 + * \remark
7092 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7093 + */
7094 +static ANTLR3_INLINE
7095 +void mQUOTE(pRSPLexer ctx)
7096 +{
7097 + ANTLR3_UINT32 _type;
7098 +
7099 + _type = QUOTE;
7100 +
7101 +
7102 + // RSP.g:85:7: ( '\"' )
7103 + // RSP.g:85:9: '\"'
7104 + {
7105 + MATCHC('"');
7106 + if (HASEXCEPTION())
7107 + {
7108 + goto ruleQUOTEEx;
7109 + }
7110 +
7111 +
7112 + }
7113 +
7114 + LEXSTATE->type = _type;
7115 +
7116 + // This is where rules clean up and exit
7117 + //
7118 + goto ruleQUOTEEx; /* Prevent compiler warnings */
7119 + ruleQUOTEEx: ;
7120 +
7121 +}
7122 +// $ANTLR end QUOTE
7123 +
7124 +// Comes from: 86:6: ( '(' )
7125 +/** \brief Lexer rule generated by ANTLR3
7126 + *
7127 + * $ANTLR start LPAR
7128 + *
7129 + * Looks to match the characters the constitute the token LPAR
7130 + * from the attached input stream.
7131 + *
7132 + *
7133 + * \remark
7134 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7135 + */
7136 +static ANTLR3_INLINE
7137 +void mLPAR(pRSPLexer ctx)
7138 +{
7139 + ANTLR3_UINT32 _type;
7140 +
7141 + _type = LPAR;
7142 +
7143 +
7144 + // RSP.g:86:6: ( '(' )
7145 + // RSP.g:86:8: '('
7146 + {
7147 + MATCHC('(');
7148 + if (HASEXCEPTION())
7149 + {
7150 + goto ruleLPAREx;
7151 + }
7152 +
7153 +
7154 + }
7155 +
7156 + LEXSTATE->type = _type;
7157 +
7158 + // This is where rules clean up and exit
7159 + //
7160 + goto ruleLPAREx; /* Prevent compiler warnings */
7161 + ruleLPAREx: ;
7162 +
7163 +}
7164 +// $ANTLR end LPAR
7165 +
7166 +// Comes from: 87:6: ( ')' )
7167 +/** \brief Lexer rule generated by ANTLR3
7168 + *
7169 + * $ANTLR start RPAR
7170 + *
7171 + * Looks to match the characters the constitute the token RPAR
7172 + * from the attached input stream.
7173 + *
7174 + *
7175 + * \remark
7176 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7177 + */
7178 +static ANTLR3_INLINE
7179 +void mRPAR(pRSPLexer ctx)
7180 +{
7181 + ANTLR3_UINT32 _type;
7182 +
7183 + _type = RPAR;
7184 +
7185 +
7186 + // RSP.g:87:6: ( ')' )
7187 + // RSP.g:87:8: ')'
7188 + {
7189 + MATCHC(')');
7190 + if (HASEXCEPTION())
7191 + {
7192 + goto ruleRPAREx;
7193 + }
7194 +
7195 +
7196 + }
7197 +
7198 + LEXSTATE->type = _type;
7199 +
7200 + // This is where rules clean up and exit
7201 + //
7202 + goto ruleRPAREx; /* Prevent compiler warnings */
7203 + ruleRPAREx: ;
7204 +
7205 +}
7206 +// $ANTLR end RPAR
7207 +
7208 +// Comes from: 89:5: ( 'and' )
7209 +/** \brief Lexer rule generated by ANTLR3
7210 + *
7211 + * $ANTLR start AND
7212 + *
7213 + * Looks to match the characters the constitute the token AND
7214 + * from the attached input stream.
7215 + *
7216 + *
7217 + * \remark
7218 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7219 + */
7220 +static ANTLR3_INLINE
7221 +void mAND(pRSPLexer ctx)
7222 +{
7223 + ANTLR3_UINT32 _type;
7224 +
7225 + _type = AND;
7226 +
7227 +
7228 + // RSP.g:89:5: ( 'and' )
7229 + // RSP.g:89:7: 'and'
7230 + {
7231 + MATCHS(lit_1);
7232 + if (HASEXCEPTION())
7233 + {
7234 + goto ruleANDEx;
7235 + }
7236 +
7237 +
7238 +
7239 + }
7240 +
7241 + LEXSTATE->type = _type;
7242 +
7243 + // This is where rules clean up and exit
7244 + //
7245 + goto ruleANDEx; /* Prevent compiler warnings */
7246 + ruleANDEx: ;
7247 +
7248 +}
7249 +// $ANTLR end AND
7250 +
7251 +// Comes from: 90:4: ( 'or' )
7252 +/** \brief Lexer rule generated by ANTLR3
7253 + *
7254 + * $ANTLR start OR
7255 + *
7256 + * Looks to match the characters the constitute the token OR
7257 + * from the attached input stream.
7258 + *
7259 + *
7260 + * \remark
7261 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7262 + */
7263 +static ANTLR3_INLINE
7264 +void mOR(pRSPLexer ctx)
7265 +{
7266 + ANTLR3_UINT32 _type;
7267 +
7268 + _type = OR;
7269 +
7270 +
7271 + // RSP.g:90:4: ( 'or' )
7272 + // RSP.g:90:6: 'or'
7273 + {
7274 + MATCHS(lit_2);
7275 + if (HASEXCEPTION())
7276 + {
7277 + goto ruleOREx;
7278 + }
7279 +
7280 +
7281 +
7282 + }
7283 +
7284 + LEXSTATE->type = _type;
7285 +
7286 + // This is where rules clean up and exit
7287 + //
7288 + goto ruleOREx; /* Prevent compiler warnings */
7289 + ruleOREx: ;
7290 +
7291 +}
7292 +// $ANTLR end OR
7293 +
7294 +// Comes from: 91:5: ( '!' )
7295 +/** \brief Lexer rule generated by ANTLR3
7296 + *
7297 + * $ANTLR start NOT
7298 + *
7299 + * Looks to match the characters the constitute the token NOT
7300 + * from the attached input stream.
7301 + *
7302 + *
7303 + * \remark
7304 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7305 + */
7306 +static ANTLR3_INLINE
7307 +void mNOT(pRSPLexer ctx)
7308 +{
7309 + ANTLR3_UINT32 _type;
7310 +
7311 + _type = NOT;
7312 +
7313 +
7314 + // RSP.g:91:5: ( '!' )
7315 + // RSP.g:91:7: '!'
7316 + {
7317 + MATCHC('!');
7318 + if (HASEXCEPTION())
7319 + {
7320 + goto ruleNOTEx;
7321 + }
7322 +
7323 +
7324 + }
7325 +
7326 + LEXSTATE->type = _type;
7327 +
7328 + // This is where rules clean up and exit
7329 + //
7330 + goto ruleNOTEx; /* Prevent compiler warnings */
7331 + ruleNOTEx: ;
7332 +
7333 +}
7334 +// $ANTLR end NOT
7335 +
7336 +// Comes from: 94:7: ( '=' )
7337 +/** \brief Lexer rule generated by ANTLR3
7338 + *
7339 + * $ANTLR start EQUAL
7340 + *
7341 + * Looks to match the characters the constitute the token EQUAL
7342 + * from the attached input stream.
7343 + *
7344 + *
7345 + * \remark
7346 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7347 + */
7348 +static ANTLR3_INLINE
7349 +void mEQUAL(pRSPLexer ctx)
7350 +{
7351 + ANTLR3_UINT32 _type;
7352 +
7353 + _type = EQUAL;
7354 +
7355 +
7356 + // RSP.g:94:7: ( '=' )
7357 + // RSP.g:94:9: '='
7358 + {
7359 + MATCHC('=');
7360 + if (HASEXCEPTION())
7361 + {
7362 + goto ruleEQUALEx;
7363 + }
7364 +
7365 +
7366 + }
7367 +
7368 + LEXSTATE->type = _type;
7369 +
7370 + // This is where rules clean up and exit
7371 + //
7372 + goto ruleEQUALEx; /* Prevent compiler warnings */
7373 + ruleEQUALEx: ;
7374 +
7375 +}
7376 +// $ANTLR end EQUAL
7377 +
7378 +// Comes from: 97:9: ( 'includes' )
7379 +/** \brief Lexer rule generated by ANTLR3
7380 + *
7381 + * $ANTLR start INCLUDES
7382 + *
7383 + * Looks to match the characters the constitute the token INCLUDES
7384 + * from the attached input stream.
7385 + *
7386 + *
7387 + * \remark
7388 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7389 + */
7390 +static ANTLR3_INLINE
7391 +void mINCLUDES(pRSPLexer ctx)
7392 +{
7393 + ANTLR3_UINT32 _type;
7394 +
7395 + _type = INCLUDES;
7396 +
7397 +
7398 + // RSP.g:97:9: ( 'includes' )
7399 + // RSP.g:97:11: 'includes'
7400 + {
7401 + MATCHS(lit_3);
7402 + if (HASEXCEPTION())
7403 + {
7404 + goto ruleINCLUDESEx;
7405 + }
7406 +
7407 +
7408 +
7409 + }
7410 +
7411 + LEXSTATE->type = _type;
7412 +
7413 + // This is where rules clean up and exit
7414 + //
7415 + goto ruleINCLUDESEx; /* Prevent compiler warnings */
7416 + ruleINCLUDESEx: ;
7417 +
7418 +}
7419 +// $ANTLR end INCLUDES
7420 +
7421 +// Comes from: 98:9: ( 'startswith' )
7422 +/** \brief Lexer rule generated by ANTLR3
7423 + *
7424 + * $ANTLR start STARTSW
7425 + *
7426 + * Looks to match the characters the constitute the token STARTSW
7427 + * from the attached input stream.
7428 + *
7429 + *
7430 + * \remark
7431 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7432 + */
7433 +static ANTLR3_INLINE
7434 +void mSTARTSW(pRSPLexer ctx)
7435 +{
7436 + ANTLR3_UINT32 _type;
7437 +
7438 + _type = STARTSW;
7439 +
7440 +
7441 + // RSP.g:98:9: ( 'startswith' )
7442 + // RSP.g:98:11: 'startswith'
7443 + {
7444 + MATCHS(lit_4);
7445 + if (HASEXCEPTION())
7446 + {
7447 + goto ruleSTARTSWEx;
7448 + }
7449 +
7450 +
7451 +
7452 + }
7453 +
7454 + LEXSTATE->type = _type;
7455 +
7456 + // This is where rules clean up and exit
7457 + //
7458 + goto ruleSTARTSWEx; /* Prevent compiler warnings */
7459 + ruleSTARTSWEx: ;
7460 +
7461 +}
7462 +// $ANTLR end STARTSW
7463 +
7464 +// Comes from: 99:7: ( 'endswith' )
7465 +/** \brief Lexer rule generated by ANTLR3
7466 + *
7467 + * $ANTLR start ENDSW
7468 + *
7469 + * Looks to match the characters the constitute the token ENDSW
7470 + * from the attached input stream.
7471 + *
7472 + *
7473 + * \remark
7474 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7475 + */
7476 +static ANTLR3_INLINE
7477 +void mENDSW(pRSPLexer ctx)
7478 +{
7479 + ANTLR3_UINT32 _type;
7480 +
7481 + _type = ENDSW;
7482 +
7483 +
7484 + // RSP.g:99:7: ( 'endswith' )
7485 + // RSP.g:99:9: 'endswith'
7486 + {
7487 + MATCHS(lit_5);
7488 + if (HASEXCEPTION())
7489 + {
7490 + goto ruleENDSWEx;
7491 + }
7492 +
7493 +
7494 +
7495 + }
7496 +
7497 + LEXSTATE->type = _type;
7498 +
7499 + // This is where rules clean up and exit
7500 + //
7501 + goto ruleENDSWEx; /* Prevent compiler warnings */
7502 + ruleENDSWEx: ;
7503 +
7504 +}
7505 +// $ANTLR end ENDSW
7506 +
7507 +// Comes from: 102:9: ( '>' )
7508 +/** \brief Lexer rule generated by ANTLR3
7509 + *
7510 + * $ANTLR start GREATER
7511 + *
7512 + * Looks to match the characters the constitute the token GREATER
7513 + * from the attached input stream.
7514 + *
7515 + *
7516 + * \remark
7517 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7518 + */
7519 +static ANTLR3_INLINE
7520 +void mGREATER(pRSPLexer ctx)
7521 +{
7522 + ANTLR3_UINT32 _type;
7523 +
7524 + _type = GREATER;
7525 +
7526 +
7527 + // RSP.g:102:9: ( '>' )
7528 + // RSP.g:102:11: '>'
7529 + {
7530 + MATCHC('>');
7531 + if (HASEXCEPTION())
7532 + {
7533 + goto ruleGREATEREx;
7534 + }
7535 +
7536 +
7537 + }
7538 +
7539 + LEXSTATE->type = _type;
7540 +
7541 + // This is where rules clean up and exit
7542 + //
7543 + goto ruleGREATEREx; /* Prevent compiler warnings */
7544 + ruleGREATEREx: ;
7545 +
7546 +}
7547 +// $ANTLR end GREATER
7548 +
7549 +// Comes from: 103:6: ( '<' )
7550 +/** \brief Lexer rule generated by ANTLR3
7551 + *
7552 + * $ANTLR start LESS
7553 + *
7554 + * Looks to match the characters the constitute the token LESS
7555 + * from the attached input stream.
7556 + *
7557 + *
7558 + * \remark
7559 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7560 + */
7561 +static ANTLR3_INLINE
7562 +void mLESS(pRSPLexer ctx)
7563 +{
7564 + ANTLR3_UINT32 _type;
7565 +
7566 + _type = LESS;
7567 +
7568 +
7569 + // RSP.g:103:6: ( '<' )
7570 + // RSP.g:103:8: '<'
7571 + {
7572 + MATCHC('<');
7573 + if (HASEXCEPTION())
7574 + {
7575 + goto ruleLESSEx;
7576 + }
7577 +
7578 +
7579 + }
7580 +
7581 + LEXSTATE->type = _type;
7582 +
7583 + // This is where rules clean up and exit
7584 + //
7585 + goto ruleLESSEx; /* Prevent compiler warnings */
7586 + ruleLESSEx: ;
7587 +
7588 +}
7589 +// $ANTLR end LESS
7590 +
7591 +// Comes from: 104:5: ( '>=' )
7592 +/** \brief Lexer rule generated by ANTLR3
7593 + *
7594 + * $ANTLR start GTE
7595 + *
7596 + * Looks to match the characters the constitute the token GTE
7597 + * from the attached input stream.
7598 + *
7599 + *
7600 + * \remark
7601 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7602 + */
7603 +static ANTLR3_INLINE
7604 +void mGTE(pRSPLexer ctx)
7605 +{
7606 + ANTLR3_UINT32 _type;
7607 +
7608 + _type = GTE;
7609 +
7610 +
7611 + // RSP.g:104:5: ( '>=' )
7612 + // RSP.g:104:7: '>='
7613 + {
7614 + MATCHS(lit_6);
7615 + if (HASEXCEPTION())
7616 + {
7617 + goto ruleGTEEx;
7618 + }
7619 +
7620 +
7621 +
7622 + }
7623 +
7624 + LEXSTATE->type = _type;
7625 +
7626 + // This is where rules clean up and exit
7627 + //
7628 + goto ruleGTEEx; /* Prevent compiler warnings */
7629 + ruleGTEEx: ;
7630 +
7631 +}
7632 +// $ANTLR end GTE
7633 +
7634 +// Comes from: 105:5: ( '<=' )
7635 +/** \brief Lexer rule generated by ANTLR3
7636 + *
7637 + * $ANTLR start LTE
7638 + *
7639 + * Looks to match the characters the constitute the token LTE
7640 + * from the attached input stream.
7641 + *
7642 + *
7643 + * \remark
7644 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7645 + */
7646 +static ANTLR3_INLINE
7647 +void mLTE(pRSPLexer ctx)
7648 +{
7649 + ANTLR3_UINT32 _type;
7650 +
7651 + _type = LTE;
7652 +
7653 +
7654 + // RSP.g:105:5: ( '<=' )
7655 + // RSP.g:105:7: '<='
7656 + {
7657 + MATCHS(lit_7);
7658 + if (HASEXCEPTION())
7659 + {
7660 + goto ruleLTEEx;
7661 + }
7662 +
7663 +
7664 +
7665 + }
7666 +
7667 + LEXSTATE->type = _type;
7668 +
7669 + // This is where rules clean up and exit
7670 + //
7671 + goto ruleLTEEx; /* Prevent compiler warnings */
7672 + ruleLTEEx: ;
7673 +
7674 +}
7675 +// $ANTLR end LTE
7676 +
7677 +// Comes from: 108:8: ( 'before' )
7678 +/** \brief Lexer rule generated by ANTLR3
7679 + *
7680 + * $ANTLR start BEFORE
7681 + *
7682 + * Looks to match the characters the constitute the token BEFORE
7683 + * from the attached input stream.
7684 + *
7685 + *
7686 + * \remark
7687 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7688 + */
7689 +static ANTLR3_INLINE
7690 +void mBEFORE(pRSPLexer ctx)
7691 +{
7692 + ANTLR3_UINT32 _type;
7693 +
7694 + _type = BEFORE;
7695 +
7696 +
7697 + // RSP.g:108:8: ( 'before' )
7698 + // RSP.g:108:10: 'before'
7699 + {
7700 + MATCHS(lit_8);
7701 + if (HASEXCEPTION())
7702 + {
7703 + goto ruleBEFOREEx;
7704 + }
7705 +
7706 +
7707 +
7708 + }
7709 +
7710 + LEXSTATE->type = _type;
7711 +
7712 + // This is where rules clean up and exit
7713 + //
7714 + goto ruleBEFOREEx; /* Prevent compiler warnings */
7715 + ruleBEFOREEx: ;
7716 +
7717 +}
7718 +// $ANTLR end BEFORE
7719 +
7720 +// Comes from: 109:7: ( 'after' )
7721 +/** \brief Lexer rule generated by ANTLR3
7722 + *
7723 + * $ANTLR start AFTER
7724 + *
7725 + * Looks to match the characters the constitute the token AFTER
7726 + * from the attached input stream.
7727 + *
7728 + *
7729 + * \remark
7730 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7731 + */
7732 +static ANTLR3_INLINE
7733 +void mAFTER(pRSPLexer ctx)
7734 +{
7735 + ANTLR3_UINT32 _type;
7736 +
7737 + _type = AFTER;
7738 +
7739 +
7740 + // RSP.g:109:7: ( 'after' )
7741 + // RSP.g:109:9: 'after'
7742 + {
7743 + MATCHS(lit_9);
7744 + if (HASEXCEPTION())
7745 + {
7746 + goto ruleAFTEREx;
7747 + }
7748 +
7749 +
7750 +
7751 + }
7752 +
7753 + LEXSTATE->type = _type;
7754 +
7755 + // This is where rules clean up and exit
7756 + //
7757 + goto ruleAFTEREx; /* Prevent compiler warnings */
7758 + ruleAFTEREx: ;
7759 +
7760 +}
7761 +// $ANTLR end AFTER
7762 +
7763 +// Comes from: 110:5: ( 'day' | 'days' )
7764 +/** \brief Lexer rule generated by ANTLR3
7765 + *
7766 + * $ANTLR start DAY
7767 + *
7768 + * Looks to match the characters the constitute the token DAY
7769 + * from the attached input stream.
7770 + *
7771 + *
7772 + * \remark
7773 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7774 + */
7775 +static ANTLR3_INLINE
7776 +void mDAY(pRSPLexer ctx)
7777 +{
7778 + ANTLR3_UINT32 _type;
7779 +
7780 + _type = DAY;
7781 +
7782 +
7783 + {
7784 + // RSP.g:110:5: ( 'day' | 'days' )
7785 +
7786 + ANTLR3_UINT32 alt1;
7787 +
7788 + alt1=2;
7789 +
7790 + switch ( LA(1) )
7791 + {
7792 + case 'd':
7793 + {
7794 + switch ( LA(2) )
7795 + {
7796 + case 'a':
7797 + {
7798 + switch ( LA(3) )
7799 + {
7800 + case 'y':
7801 + {
7802 + switch ( LA(4) )
7803 + {
7804 + case 's':
7805 + {
7806 + alt1=2;
7807 + }
7808 + break;
7809 +
7810 + default:
7811 + alt1=1;}
7812 +
7813 + }
7814 + break;
7815 +
7816 + default:
7817 + CONSTRUCTEX();
7818 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7819 + EXCEPTION->message = (void *)"";
7820 + EXCEPTION->decisionNum = 1;
7821 + EXCEPTION->state = 2;
7822 +
7823 +
7824 + goto ruleDAYEx;
7825 + }
7826 +
7827 + }
7828 + break;
7829 +
7830 + default:
7831 + CONSTRUCTEX();
7832 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7833 + EXCEPTION->message = (void *)"";
7834 + EXCEPTION->decisionNum = 1;
7835 + EXCEPTION->state = 1;
7836 +
7837 +
7838 + goto ruleDAYEx;
7839 + }
7840 +
7841 + }
7842 + break;
7843 +
7844 + default:
7845 + CONSTRUCTEX();
7846 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7847 + EXCEPTION->message = (void *)"";
7848 + EXCEPTION->decisionNum = 1;
7849 + EXCEPTION->state = 0;
7850 +
7851 +
7852 + goto ruleDAYEx;
7853 + }
7854 +
7855 + switch (alt1)
7856 + {
7857 + case 1:
7858 + // RSP.g:110:7: 'day'
7859 + {
7860 + MATCHS(lit_10);
7861 + if (HASEXCEPTION())
7862 + {
7863 + goto ruleDAYEx;
7864 + }
7865 +
7866 +
7867 +
7868 + }
7869 + break;
7870 + case 2:
7871 + // RSP.g:110:15: 'days'
7872 + {
7873 + MATCHS(lit_11);
7874 + if (HASEXCEPTION())
7875 + {
7876 + goto ruleDAYEx;
7877 + }
7878 +
7879 +
7880 +
7881 + }
7882 + break;
7883 +
7884 + }
7885 + }
7886 + LEXSTATE->type = _type;
7887 +
7888 + // This is where rules clean up and exit
7889 + //
7890 + goto ruleDAYEx; /* Prevent compiler warnings */
7891 + ruleDAYEx: ;
7892 +
7893 +}
7894 +// $ANTLR end DAY
7895 +
7896 +// Comes from: 111:6: ( 'week' | 'weeks' )
7897 +/** \brief Lexer rule generated by ANTLR3
7898 + *
7899 + * $ANTLR start WEEK
7900 + *
7901 + * Looks to match the characters the constitute the token WEEK
7902 + * from the attached input stream.
7903 + *
7904 + *
7905 + * \remark
7906 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
7907 + */
7908 +static ANTLR3_INLINE
7909 +void mWEEK(pRSPLexer ctx)
7910 +{
7911 + ANTLR3_UINT32 _type;
7912 +
7913 + _type = WEEK;
7914 +
7915 +
7916 + {
7917 + // RSP.g:111:6: ( 'week' | 'weeks' )
7918 +
7919 + ANTLR3_UINT32 alt2;
7920 +
7921 + alt2=2;
7922 +
7923 + switch ( LA(1) )
7924 + {
7925 + case 'w':
7926 + {
7927 + switch ( LA(2) )
7928 + {
7929 + case 'e':
7930 + {
7931 + switch ( LA(3) )
7932 + {
7933 + case 'e':
7934 + {
7935 + switch ( LA(4) )
7936 + {
7937 + case 'k':
7938 + {
7939 + switch ( LA(5) )
7940 + {
7941 + case 's':
7942 + {
7943 + alt2=2;
7944 + }
7945 + break;
7946 +
7947 + default:
7948 + alt2=1;}
7949 +
7950 + }
7951 + break;
7952 +
7953 + default:
7954 + CONSTRUCTEX();
7955 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7956 + EXCEPTION->message = (void *)"";
7957 + EXCEPTION->decisionNum = 2;
7958 + EXCEPTION->state = 3;
7959 +
7960 +
7961 + goto ruleWEEKEx;
7962 + }
7963 +
7964 + }
7965 + break;
7966 +
7967 + default:
7968 + CONSTRUCTEX();
7969 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7970 + EXCEPTION->message = (void *)"";
7971 + EXCEPTION->decisionNum = 2;
7972 + EXCEPTION->state = 2;
7973 +
7974 +
7975 + goto ruleWEEKEx;
7976 + }
7977 +
7978 + }
7979 + break;
7980 +
7981 + default:
7982 + CONSTRUCTEX();
7983 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7984 + EXCEPTION->message = (void *)"";
7985 + EXCEPTION->decisionNum = 2;
7986 + EXCEPTION->state = 1;
7987 +
7988 +
7989 + goto ruleWEEKEx;
7990 + }
7991 +
7992 + }
7993 + break;
7994 +
7995 + default:
7996 + CONSTRUCTEX();
7997 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
7998 + EXCEPTION->message = (void *)"";
7999 + EXCEPTION->decisionNum = 2;
8000 + EXCEPTION->state = 0;
8001 +
8002 +
8003 + goto ruleWEEKEx;
8004 + }
8005 +
8006 + switch (alt2)
8007 + {
8008 + case 1:
8009 + // RSP.g:111:8: 'week'
8010 + {
8011 + MATCHS(lit_12);
8012 + if (HASEXCEPTION())
8013 + {
8014 + goto ruleWEEKEx;
8015 + }
8016 +
8017 +
8018 +
8019 + }
8020 + break;
8021 + case 2:
8022 + // RSP.g:111:17: 'weeks'
8023 + {
8024 + MATCHS(lit_13);
8025 + if (HASEXCEPTION())
8026 + {
8027 + goto ruleWEEKEx;
8028 + }
8029 +
8030 +
8031 +
8032 + }
8033 + break;
8034 +
8035 + }
8036 + }
8037 + LEXSTATE->type = _type;
8038 +
8039 + // This is where rules clean up and exit
8040 + //
8041 + goto ruleWEEKEx; /* Prevent compiler warnings */
8042 + ruleWEEKEx: ;
8043 +
8044 +}
8045 +// $ANTLR end WEEK
8046 +
8047 +// Comes from: 112:7: ( 'month' | 'months' )
8048 +/** \brief Lexer rule generated by ANTLR3
8049 + *
8050 + * $ANTLR start MONTH
8051 + *
8052 + * Looks to match the characters the constitute the token MONTH
8053 + * from the attached input stream.
8054 + *
8055 + *
8056 + * \remark
8057 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8058 + */
8059 +static ANTLR3_INLINE
8060 +void mMONTH(pRSPLexer ctx)
8061 +{
8062 + ANTLR3_UINT32 _type;
8063 +
8064 + _type = MONTH;
8065 +
8066 +
8067 + {
8068 + // RSP.g:112:7: ( 'month' | 'months' )
8069 +
8070 + ANTLR3_UINT32 alt3;
8071 +
8072 + alt3=2;
8073 +
8074 + switch ( LA(1) )
8075 + {
8076 + case 'm':
8077 + {
8078 + switch ( LA(2) )
8079 + {
8080 + case 'o':
8081 + {
8082 + switch ( LA(3) )
8083 + {
8084 + case 'n':
8085 + {
8086 + switch ( LA(4) )
8087 + {
8088 + case 't':
8089 + {
8090 + switch ( LA(5) )
8091 + {
8092 + case 'h':
8093 + {
8094 + switch ( LA(6) )
8095 + {
8096 + case 's':
8097 + {
8098 + alt3=2;
8099 + }
8100 + break;
8101 +
8102 + default:
8103 + alt3=1;}
8104 +
8105 + }
8106 + break;
8107 +
8108 + default:
8109 + CONSTRUCTEX();
8110 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8111 + EXCEPTION->message = (void *)"";
8112 + EXCEPTION->decisionNum = 3;
8113 + EXCEPTION->state = 4;
8114 +
8115 +
8116 + goto ruleMONTHEx;
8117 + }
8118 +
8119 + }
8120 + break;
8121 +
8122 + default:
8123 + CONSTRUCTEX();
8124 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8125 + EXCEPTION->message = (void *)"";
8126 + EXCEPTION->decisionNum = 3;
8127 + EXCEPTION->state = 3;
8128 +
8129 +
8130 + goto ruleMONTHEx;
8131 + }
8132 +
8133 + }
8134 + break;
8135 +
8136 + default:
8137 + CONSTRUCTEX();
8138 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8139 + EXCEPTION->message = (void *)"";
8140 + EXCEPTION->decisionNum = 3;
8141 + EXCEPTION->state = 2;
8142 +
8143 +
8144 + goto ruleMONTHEx;
8145 + }
8146 +
8147 + }
8148 + break;
8149 +
8150 + default:
8151 + CONSTRUCTEX();
8152 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8153 + EXCEPTION->message = (void *)"";
8154 + EXCEPTION->decisionNum = 3;
8155 + EXCEPTION->state = 1;
8156 +
8157 +
8158 + goto ruleMONTHEx;
8159 + }
8160 +
8161 + }
8162 + break;
8163 +
8164 + default:
8165 + CONSTRUCTEX();
8166 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8167 + EXCEPTION->message = (void *)"";
8168 + EXCEPTION->decisionNum = 3;
8169 + EXCEPTION->state = 0;
8170 +
8171 +
8172 + goto ruleMONTHEx;
8173 + }
8174 +
8175 + switch (alt3)
8176 + {
8177 + case 1:
8178 + // RSP.g:112:9: 'month'
8179 + {
8180 + MATCHS(lit_14);
8181 + if (HASEXCEPTION())
8182 + {
8183 + goto ruleMONTHEx;
8184 + }
8185 +
8186 +
8187 +
8188 + }
8189 + break;
8190 + case 2:
8191 + // RSP.g:112:19: 'months'
8192 + {
8193 + MATCHS(lit_15);
8194 + if (HASEXCEPTION())
8195 + {
8196 + goto ruleMONTHEx;
8197 + }
8198 +
8199 +
8200 +
8201 + }
8202 + break;
8203 +
8204 + }
8205 + }
8206 + LEXSTATE->type = _type;
8207 +
8208 + // This is where rules clean up and exit
8209 + //
8210 + goto ruleMONTHEx; /* Prevent compiler warnings */
8211 + ruleMONTHEx: ;
8212 +
8213 +}
8214 +// $ANTLR end MONTH
8215 +
8216 +// Comes from: 113:6: ( 'year' | 'years' )
8217 +/** \brief Lexer rule generated by ANTLR3
8218 + *
8219 + * $ANTLR start YEAR
8220 + *
8221 + * Looks to match the characters the constitute the token YEAR
8222 + * from the attached input stream.
8223 + *
8224 + *
8225 + * \remark
8226 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8227 + */
8228 +static ANTLR3_INLINE
8229 +void mYEAR(pRSPLexer ctx)
8230 +{
8231 + ANTLR3_UINT32 _type;
8232 +
8233 + _type = YEAR;
8234 +
8235 +
8236 + {
8237 + // RSP.g:113:6: ( 'year' | 'years' )
8238 +
8239 + ANTLR3_UINT32 alt4;
8240 +
8241 + alt4=2;
8242 +
8243 + switch ( LA(1) )
8244 + {
8245 + case 'y':
8246 + {
8247 + switch ( LA(2) )
8248 + {
8249 + case 'e':
8250 + {
8251 + switch ( LA(3) )
8252 + {
8253 + case 'a':
8254 + {
8255 + switch ( LA(4) )
8256 + {
8257 + case 'r':
8258 + {
8259 + switch ( LA(5) )
8260 + {
8261 + case 's':
8262 + {
8263 + alt4=2;
8264 + }
8265 + break;
8266 +
8267 + default:
8268 + alt4=1;}
8269 +
8270 + }
8271 + break;
8272 +
8273 + default:
8274 + CONSTRUCTEX();
8275 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8276 + EXCEPTION->message = (void *)"";
8277 + EXCEPTION->decisionNum = 4;
8278 + EXCEPTION->state = 3;
8279 +
8280 +
8281 + goto ruleYEAREx;
8282 + }
8283 +
8284 + }
8285 + break;
8286 +
8287 + default:
8288 + CONSTRUCTEX();
8289 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8290 + EXCEPTION->message = (void *)"";
8291 + EXCEPTION->decisionNum = 4;
8292 + EXCEPTION->state = 2;
8293 +
8294 +
8295 + goto ruleYEAREx;
8296 + }
8297 +
8298 + }
8299 + break;
8300 +
8301 + default:
8302 + CONSTRUCTEX();
8303 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8304 + EXCEPTION->message = (void *)"";
8305 + EXCEPTION->decisionNum = 4;
8306 + EXCEPTION->state = 1;
8307 +
8308 +
8309 + goto ruleYEAREx;
8310 + }
8311 +
8312 + }
8313 + break;
8314 +
8315 + default:
8316 + CONSTRUCTEX();
8317 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8318 + EXCEPTION->message = (void *)"";
8319 + EXCEPTION->decisionNum = 4;
8320 + EXCEPTION->state = 0;
8321 +
8322 +
8323 + goto ruleYEAREx;
8324 + }
8325 +
8326 + switch (alt4)
8327 + {
8328 + case 1:
8329 + // RSP.g:113:8: 'year'
8330 + {
8331 + MATCHS(lit_16);
8332 + if (HASEXCEPTION())
8333 + {
8334 + goto ruleYEAREx;
8335 + }
8336 +
8337 +
8338 +
8339 + }
8340 + break;
8341 + case 2:
8342 + // RSP.g:113:17: 'years'
8343 + {
8344 + MATCHS(lit_17);
8345 + if (HASEXCEPTION())
8346 + {
8347 + goto ruleYEAREx;
8348 + }
8349 +
8350 +
8351 +
8352 + }
8353 + break;
8354 +
8355 + }
8356 + }
8357 + LEXSTATE->type = _type;
8358 +
8359 + // This is where rules clean up and exit
8360 + //
8361 + goto ruleYEAREx; /* Prevent compiler warnings */
8362 + ruleYEAREx: ;
8363 +
8364 +}
8365 +// $ANTLR end YEAR
8366 +
8367 +// Comes from: 114:7: ( 'today' )
8368 +/** \brief Lexer rule generated by ANTLR3
8369 + *
8370 + * $ANTLR start TODAY
8371 + *
8372 + * Looks to match the characters the constitute the token TODAY
8373 + * from the attached input stream.
8374 + *
8375 + *
8376 + * \remark
8377 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8378 + */
8379 +static ANTLR3_INLINE
8380 +void mTODAY(pRSPLexer ctx)
8381 +{
8382 + ANTLR3_UINT32 _type;
8383 +
8384 + _type = TODAY;
8385 +
8386 +
8387 + // RSP.g:114:7: ( 'today' )
8388 + // RSP.g:114:9: 'today'
8389 + {
8390 + MATCHS(lit_18);
8391 + if (HASEXCEPTION())
8392 + {
8393 + goto ruleTODAYEx;
8394 + }
8395 +
8396 +
8397 +
8398 + }
8399 +
8400 + LEXSTATE->type = _type;
8401 +
8402 + // This is where rules clean up and exit
8403 + //
8404 + goto ruleTODAYEx; /* Prevent compiler warnings */
8405 + ruleTODAYEx: ;
8406 +
8407 +}
8408 +// $ANTLR end TODAY
8409 +
8410 +// Comes from: 116:9: ( ( '\\r' )? '\\n' )
8411 +/** \brief Lexer rule generated by ANTLR3
8412 + *
8413 + * $ANTLR start NEWLINE
8414 + *
8415 + * Looks to match the characters the constitute the token NEWLINE
8416 + * from the attached input stream.
8417 + *
8418 + *
8419 + * \remark
8420 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8421 + */
8422 +static ANTLR3_INLINE
8423 +void mNEWLINE(pRSPLexer ctx)
8424 +{
8425 + ANTLR3_UINT32 _type;
8426 +
8427 + _type = NEWLINE;
8428 +
8429 +
8430 + // RSP.g:116:9: ( ( '\\r' )? '\\n' )
8431 + // RSP.g:116:11: ( '\\r' )? '\\n'
8432 + {
8433 +
8434 + // RSP.g:116:11: ( '\\r' )?
8435 + {
8436 + int alt5=2;
8437 + switch ( LA(1) )
8438 + {
8439 + case '\r':
8440 + {
8441 + alt5=1;
8442 + }
8443 + break;
8444 + }
8445 +
8446 + switch (alt5)
8447 + {
8448 + case 1:
8449 + // RSP.g:116:11: '\\r'
8450 + {
8451 + MATCHC('\r');
8452 + if (HASEXCEPTION())
8453 + {
8454 + goto ruleNEWLINEEx;
8455 + }
8456 +
8457 +
8458 + }
8459 + break;
8460 +
8461 + }
8462 + }
8463 + MATCHC('\n');
8464 + if (HASEXCEPTION())
8465 + {
8466 + goto ruleNEWLINEEx;
8467 + }
8468 +
8469 +
8470 + }
8471 +
8472 + LEXSTATE->type = _type;
8473 +
8474 + // This is where rules clean up and exit
8475 + //
8476 + goto ruleNEWLINEEx; /* Prevent compiler warnings */
8477 + ruleNEWLINEEx: ;
8478 +
8479 +}
8480 +// $ANTLR end NEWLINE
8481 +
8482 +// Comes from: 118:4: ( ( ' ' | '\\t' ) )
8483 +/** \brief Lexer rule generated by ANTLR3
8484 + *
8485 + * $ANTLR start WS
8486 + *
8487 + * Looks to match the characters the constitute the token WS
8488 + * from the attached input stream.
8489 + *
8490 + *
8491 + * \remark
8492 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8493 + */
8494 +static ANTLR3_INLINE
8495 +void mWS(pRSPLexer ctx)
8496 +{
8497 + ANTLR3_UINT32 _type;
8498 +
8499 + _type = WS;
8500 +
8501 +
8502 + // RSP.g:118:4: ( ( ' ' | '\\t' ) )
8503 + // RSP.g:118:6: ( ' ' | '\\t' )
8504 + {
8505 + if ( LA(1) == '\t' || LA(1) == ' ' )
8506 + {
8507 + CONSUME();
8508 +
8509 + }
8510 + else
8511 + {
8512 + CONSTRUCTEX();
8513 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
8514 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
8515 +
8516 + LRECOVER(); goto ruleWSEx;
8517 + }
8518 +
8519 + {
8520 + LEXSTATE->channel = HIDDEN;
8521 + }
8522 +
8523 + }
8524 +
8525 + LEXSTATE->type = _type;
8526 +
8527 + // This is where rules clean up and exit
8528 + //
8529 + goto ruleWSEx; /* Prevent compiler warnings */
8530 + ruleWSEx: ;
8531 +
8532 +}
8533 +// $ANTLR end WS
8534 +
8535 +// Comes from: 120:7: ( 'a' .. 'z' ( 'a' .. 'z' | '_' )* 'a' .. 'z' )
8536 +/** \brief Lexer rule generated by ANTLR3
8537 + *
8538 + * $ANTLR start FIELD
8539 + *
8540 + * Looks to match the characters the constitute the token FIELD
8541 + * from the attached input stream.
8542 + *
8543 + *
8544 + * \remark
8545 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8546 + */
8547 +static ANTLR3_INLINE
8548 +void mFIELD(pRSPLexer ctx)
8549 +{
8550 + ANTLR3_UINT32 _type;
8551 +
8552 + _type = FIELD;
8553 +
8554 +
8555 + // RSP.g:120:7: ( 'a' .. 'z' ( 'a' .. 'z' | '_' )* 'a' .. 'z' )
8556 + // RSP.g:120:9: 'a' .. 'z' ( 'a' .. 'z' | '_' )* 'a' .. 'z'
8557 + {
8558 + MATCHRANGE('a', 'z');
8559 + if (HASEXCEPTION())
8560 + {
8561 + goto ruleFIELDEx;
8562 + }
8563 +
8564 +
8565 + // RSP.g:120:18: ( 'a' .. 'z' | '_' )*
8566 +
8567 + for (;;)
8568 + {
8569 + int alt6=2;
8570 + switch ( LA(1) )
8571 + {
8572 + case 'a':
8573 + case 'b':
8574 + case 'c':
8575 + case 'd':
8576 + case 'e':
8577 + case 'f':
8578 + case 'g':
8579 + case 'h':
8580 + case 'i':
8581 + case 'j':
8582 + case 'k':
8583 + case 'l':
8584 + case 'm':
8585 + case 'n':
8586 + case 'o':
8587 + case 'p':
8588 + case 'q':
8589 + case 'r':
8590 + case 's':
8591 + case 't':
8592 + case 'u':
8593 + case 'v':
8594 + case 'w':
8595 + case 'x':
8596 + case 'y':
8597 + case 'z':
8598 + {
8599 + switch ( LA(2) )
8600 + {
8601 + case '_':
8602 + case 'a':
8603 + case 'b':
8604 + case 'c':
8605 + case 'd':
8606 + case 'e':
8607 + case 'f':
8608 + case 'g':
8609 + case 'h':
8610 + case 'i':
8611 + case 'j':
8612 + case 'k':
8613 + case 'l':
8614 + case 'm':
8615 + case 'n':
8616 + case 'o':
8617 + case 'p':
8618 + case 'q':
8619 + case 'r':
8620 + case 's':
8621 + case 't':
8622 + case 'u':
8623 + case 'v':
8624 + case 'w':
8625 + case 'x':
8626 + case 'y':
8627 + case 'z':
8628 + {
8629 + alt6=1;
8630 + }
8631 + break;
8632 +
8633 + }
8634 +
8635 + }
8636 + break;
8637 + case '_':
8638 + {
8639 + alt6=1;
8640 + }
8641 + break;
8642 +
8643 + }
8644 +
8645 + switch (alt6)
8646 + {
8647 + case 1:
8648 + // RSP.g:
8649 + {
8650 + if ( LA(1) == '_' || ((LA(1) >= 'a') && (LA(1) <= 'z')) )
8651 + {
8652 + CONSUME();
8653 +
8654 + }
8655 + else
8656 + {
8657 + CONSTRUCTEX();
8658 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
8659 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
8660 +
8661 + LRECOVER(); goto ruleFIELDEx;
8662 + }
8663 +
8664 +
8665 + }
8666 + break;
8667 +
8668 + default:
8669 + goto loop6; /* break out of the loop */
8670 + break;
8671 + }
8672 + }
8673 + loop6: ; /* Jump out to here if this rule does not match */
8674 +
8675 + MATCHRANGE('a', 'z');
8676 + if (HASEXCEPTION())
8677 + {
8678 + goto ruleFIELDEx;
8679 + }
8680 +
8681 +
8682 + }
8683 +
8684 + LEXSTATE->type = _type;
8685 +
8686 + // This is where rules clean up and exit
8687 + //
8688 + goto ruleFIELDEx; /* Prevent compiler warnings */
8689 + ruleFIELDEx: ;
8690 +
8691 +}
8692 +// $ANTLR end FIELD
8693 +
8694 +// Comes from: 122:5: ( DIGIT19 ( DIGIT09 )* )
8695 +/** \brief Lexer rule generated by ANTLR3
8696 + *
8697 + * $ANTLR start INT
8698 + *
8699 + * Looks to match the characters the constitute the token INT
8700 + * from the attached input stream.
8701 + *
8702 + *
8703 + * \remark
8704 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8705 + */
8706 +static ANTLR3_INLINE
8707 +void mINT(pRSPLexer ctx)
8708 +{
8709 + ANTLR3_UINT32 _type;
8710 +
8711 + _type = INT;
8712 +
8713 +
8714 + // RSP.g:122:5: ( DIGIT19 ( DIGIT09 )* )
8715 + // RSP.g:122:7: DIGIT19 ( DIGIT09 )*
8716 + {
8717 + /* 122:7: DIGIT19 ( DIGIT09 )* */
8718 + mDIGIT19(ctx );
8719 + if (HASEXCEPTION())
8720 + {
8721 + goto ruleINTEx;
8722 + }
8723 +
8724 +
8725 + // RSP.g:122:15: ( DIGIT09 )*
8726 +
8727 + for (;;)
8728 + {
8729 + int alt7=2;
8730 + switch ( LA(1) )
8731 + {
8732 + case '0':
8733 + case '1':
8734 + case '2':
8735 + case '3':
8736 + case '4':
8737 + case '5':
8738 + case '6':
8739 + case '7':
8740 + case '8':
8741 + case '9':
8742 + {
8743 + alt7=1;
8744 + }
8745 + break;
8746 +
8747 + }
8748 +
8749 + switch (alt7)
8750 + {
8751 + case 1:
8752 + // RSP.g:122:15: DIGIT09
8753 + {
8754 + /* 122:15: DIGIT09 */
8755 + mDIGIT09(ctx );
8756 + if (HASEXCEPTION())
8757 + {
8758 + goto ruleINTEx;
8759 + }
8760 +
8761 +
8762 + }
8763 + break;
8764 +
8765 + default:
8766 + goto loop7; /* break out of the loop */
8767 + break;
8768 + }
8769 + }
8770 + loop7: ; /* Jump out to here if this rule does not match */
8771 +
8772 +
8773 + }
8774 +
8775 + LEXSTATE->type = _type;
8776 +
8777 + // This is where rules clean up and exit
8778 + //
8779 + goto ruleINTEx; /* Prevent compiler warnings */
8780 + ruleINTEx: ;
8781 +
8782 +}
8783 +// $ANTLR end INT
8784 +
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
8787 + *
8788 + * $ANTLR start DATE
8789 + *
8790 + * Looks to match the characters the constitute the token DATE
8791 + * from the attached input stream.
8792 + *
8793 + *
8794 + * \remark
8795 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
8796 + */
8797 +static ANTLR3_INLINE
8798 +void mDATE(pRSPLexer ctx)
8799 +{
8800 + ANTLR3_UINT32 _type;
8801 +
8802 + _type = DATE;
8803 +
8804 +
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' )
8807 + {
8808 + /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */
8809 + mDIGIT19(ctx );
8810 + if (HASEXCEPTION())
8811 + {
8812 + goto ruleDATEEx;
8813 + }
8814 +
8815 + /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */
8816 + mDIGIT09(ctx );
8817 + if (HASEXCEPTION())
8818 + {
8819 + goto ruleDATEEx;
8820 + }
8821 +
8822 + /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */
8823 + mDIGIT09(ctx );
8824 + if (HASEXCEPTION())
8825 + {
8826 + goto ruleDATEEx;
8827 + }
8828 +
8829 + /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */
8830 + mDIGIT09(ctx );
8831 + if (HASEXCEPTION())
8832 + {
8833 + goto ruleDATEEx;
8834 + }
8835 +
8836 + MATCHC('-');
8837 + if (HASEXCEPTION())
8838 + {
8839 + goto ruleDATEEx;
8840 + }
8841 +
8842 +
8843 + // RSP.g:125:44: ( '0' DIGIT19 | '1' '0' .. '2' )
8844 + {
8845 + int alt8=2;
8846 + switch ( LA(1) )
8847 + {
8848 + case '0':
8849 + {
8850 + alt8=1;
8851 + }
8852 + break;
8853 + case '1':
8854 + {
8855 + alt8=2;
8856 + }
8857 + break;
8858 +
8859 + default:
8860 + CONSTRUCTEX();
8861 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8862 + EXCEPTION->message = (void *)"";
8863 + EXCEPTION->decisionNum = 8;
8864 + EXCEPTION->state = 0;
8865 +
8866 +
8867 + goto ruleDATEEx;
8868 + }
8869 +
8870 + switch (alt8)
8871 + {
8872 + case 1:
8873 + // RSP.g:125:45: '0' DIGIT19
8874 + {
8875 + MATCHC('0');
8876 + if (HASEXCEPTION())
8877 + {
8878 + goto ruleDATEEx;
8879 + }
8880 +
8881 + /* 125:45: '0' DIGIT19 */
8882 + mDIGIT19(ctx );
8883 + if (HASEXCEPTION())
8884 + {
8885 + goto ruleDATEEx;
8886 + }
8887 +
8888 +
8889 + }
8890 + break;
8891 + case 2:
8892 + // RSP.g:125:59: '1' '0' .. '2'
8893 + {
8894 + MATCHC('1');
8895 + if (HASEXCEPTION())
8896 + {
8897 + goto ruleDATEEx;
8898 + }
8899 +
8900 + MATCHRANGE('0', '2');
8901 + if (HASEXCEPTION())
8902 + {
8903 + goto ruleDATEEx;
8904 + }
8905 +
8906 +
8907 + }
8908 + break;
8909 +
8910 + }
8911 + }
8912 + MATCHC('-');
8913 + if (HASEXCEPTION())
8914 + {
8915 + goto ruleDATEEx;
8916 + }
8917 +
8918 +
8919 + // RSP.g:125:77: ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' )
8920 + {
8921 + int alt9=3;
8922 + switch ( LA(1) )
8923 + {
8924 + case '0':
8925 + {
8926 + alt9=1;
8927 + }
8928 + break;
8929 + case '1':
8930 + case '2':
8931 + {
8932 + alt9=2;
8933 + }
8934 + break;
8935 + case '3':
8936 + {
8937 + alt9=3;
8938 + }
8939 + break;
8940 +
8941 + default:
8942 + CONSTRUCTEX();
8943 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
8944 + EXCEPTION->message = (void *)"";
8945 + EXCEPTION->decisionNum = 9;
8946 + EXCEPTION->state = 0;
8947 +
8948 +
8949 + goto ruleDATEEx;
8950 + }
8951 +
8952 + switch (alt9)
8953 + {
8954 + case 1:
8955 + // RSP.g:125:78: '0' DIGIT19
8956 + {
8957 + MATCHC('0');
8958 + if (HASEXCEPTION())
8959 + {
8960 + goto ruleDATEEx;
8961 + }
8962 +
8963 + /* 125:78: '0' DIGIT19 */
8964 + mDIGIT19(ctx );
8965 + if (HASEXCEPTION())
8966 + {
8967 + goto ruleDATEEx;
8968 + }
8969 +
8970 +
8971 + }
8972 + break;
8973 + case 2:
8974 + // RSP.g:125:92: '1' .. '2' DIGIT09
8975 + {
8976 + MATCHRANGE('1', '2');
8977 + if (HASEXCEPTION())
8978 + {
8979 + goto ruleDATEEx;
8980 + }
8981 +
8982 + /* 125:92: '1' .. '2' DIGIT09 */
8983 + mDIGIT09(ctx );
8984 + if (HASEXCEPTION())
8985 + {
8986 + goto ruleDATEEx;
8987 + }
8988 +
8989 +
8990 + }
8991 + break;
8992 + case 3:
8993 + // RSP.g:125:111: '3' '0' .. '1'
8994 + {
8995 + MATCHC('3');
8996 + if (HASEXCEPTION())
8997 + {
8998 + goto ruleDATEEx;
8999 + }
9000 +
9001 + MATCHRANGE('0', '1');
9002 + if (HASEXCEPTION())
9003 + {
9004 + goto ruleDATEEx;
9005 + }
9006 +
9007 +
9008 + }
9009 + break;
9010 +
9011 + }
9012 + }
9013 +
9014 + }
9015 +
9016 + LEXSTATE->type = _type;
9017 +
9018 + // This is where rules clean up and exit
9019 + //
9020 + goto ruleDATEEx; /* Prevent compiler warnings */
9021 + ruleDATEEx: ;
9022 +
9023 +}
9024 +// $ANTLR end DATE
9025 +
9026 +// Comes from: 133:2: ( QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE )
9027 +/** \brief Lexer rule generated by ANTLR3
9028 + *
9029 + * $ANTLR start STR
9030 + *
9031 + * Looks to match the characters the constitute the token STR
9032 + * from the attached input stream.
9033 + *
9034 + *
9035 + * \remark
9036 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
9037 + */
9038 +static ANTLR3_INLINE
9039 +void mSTR(pRSPLexer ctx)
9040 +{
9041 + ANTLR3_UINT32 _type;
9042 + pANTLR3_COMMON_TOKEN esc;
9043 + ANTLR3_UINT32 reg;
9044 +
9045 +
9046 + esc = NULL;
9047 +
9048 + _type = STR;
9049 +
9050 + pANTLR3_STRING unesc = GETTEXT()->factory->newRaw(GETTEXT()->factory);
9051 +
9052 + // RSP.g:133:2: ( QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE )
9053 + // RSP.g:133:4: QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE
9054 + {
9055 + /* 133:4: QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE */
9056 + mQUOTE(ctx );
9057 + if (HASEXCEPTION())
9058 + {
9059 + goto ruleSTREx;
9060 + }
9061 +
9062 + // RSP.g:133:10: (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+
9063 + {
9064 + int cnt10=0;
9065 +
9066 + for (;;)
9067 + {
9068 + int alt10=3;
9069 + {
9070 + /* dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState)
9071 + */
9072 + int LA10_0 = LA(1);
9073 + if ( (((LA10_0 >= 0x0000) && (LA10_0 <= '!')) || ((LA10_0 >= '#') && (LA10_0 <= '[')) || ((LA10_0 >= ']') && (LA10_0 <= 0xFFFF))) )
9074 + {
9075 + alt10=1;
9076 + }
9077 + else if ( (LA10_0 == '\\') )
9078 + {
9079 + alt10=2;
9080 + }
9081 +
9082 + }
9083 + switch (alt10)
9084 + {
9085 + case 1:
9086 + // RSP.g:133:12: reg=~ ( '\\\\' | '\"' )
9087 + {
9088 + reg= LA(1);
9089 + if ( ((LA(1) >= 0x0000) && (LA(1) <= '!')) || ((LA(1) >= '#') && (LA(1) <= '[')) || ((LA(1) >= ']') && (LA(1) <= 0xFFFF)) )
9090 + {
9091 + CONSUME();
9092 +
9093 + }
9094 + else
9095 + {
9096 + CONSTRUCTEX();
9097 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
9098 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
9099 +
9100 + LRECOVER(); goto ruleSTREx;
9101 + }
9102 +
9103 + {
9104 + unesc->addc(unesc, reg);
9105 + }
9106 +
9107 + }
9108 + break;
9109 + case 2:
9110 + // RSP.g:134:6: esc= ESCAPED
9111 + {
9112 + /* 134:6: esc= ESCAPED */
9113 + {
9114 + ANTLR3_MARKER escStart381 = GETCHARINDEX();
9115 + mESCAPED(ctx );
9116 + if (HASEXCEPTION())
9117 + {
9118 + goto ruleSTREx;
9119 + }
9120 +
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;
9126 + }
9127 + {
9128 + unesc->appendS(unesc, GETTEXT());
9129 + }
9130 +
9131 + }
9132 + break;
9133 +
9134 + default:
9135 +
9136 + if ( cnt10 >= 1 )
9137 + {
9138 + goto loop10;
9139 + }
9140 + /* mismatchedSetEx()
9141 + */
9142 + CONSTRUCTEX();
9143 + EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
9144 + EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
9145 +
9146 +
9147 + goto ruleSTREx;
9148 + }
9149 + cnt10++;
9150 + }
9151 + loop10: ; /* Jump to here if this rule does not match */
9152 + }
9153 + /* 133:4: QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE */
9154 + mQUOTE(ctx );
9155 + if (HASEXCEPTION())
9156 + {
9157 + goto ruleSTREx;
9158 + }
9159 +
9160 + {
9161 + SETTEXT(unesc);
9162 + }
9163 +
9164 + }
9165 +
9166 + LEXSTATE->type = _type;
9167 +
9168 + // This is where rules clean up and exit
9169 + //
9170 + goto ruleSTREx; /* Prevent compiler warnings */
9171 + ruleSTREx: ;
9172 +
9173 + esc = NULL;
9174 +
9175 +}
9176 +// $ANTLR end STR
9177 +
9178 +// Comes from: 138:9: ( '\\\\' ( '\\\\' | '\"' ) )
9179 +/** \brief Lexer rule generated by ANTLR3
9180 + *
9181 + * $ANTLR start ESCAPED
9182 + *
9183 + * Looks to match the characters the constitute the token ESCAPED
9184 + * from the attached input stream.
9185 + *
9186 + *
9187 + * \remark
9188 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
9189 + */
9190 +static ANTLR3_INLINE
9191 +void mESCAPED(pRSPLexer ctx)
9192 +{
9193 + ANTLR3_UINT32 _type;
9194 +
9195 +
9196 + // RSP.g:138:9: ( '\\\\' ( '\\\\' | '\"' ) )
9197 + // RSP.g:138:11: '\\\\' ( '\\\\' | '\"' )
9198 + {
9199 + MATCHC('\\');
9200 + if (HASEXCEPTION())
9201 + {
9202 + goto ruleESCAPEDEx;
9203 + }
9204 +
9205 +
9206 + // RSP.g:139:3: ( '\\\\' | '\"' )
9207 + {
9208 + int alt11=2;
9209 + switch ( LA(1) )
9210 + {
9211 + case '\\':
9212 + {
9213 + alt11=1;
9214 + }
9215 + break;
9216 + case '"':
9217 + {
9218 + alt11=2;
9219 + }
9220 + break;
9221 +
9222 + default:
9223 + CONSTRUCTEX();
9224 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
9225 + EXCEPTION->message = (void *)"";
9226 + EXCEPTION->decisionNum = 11;
9227 + EXCEPTION->state = 0;
9228 +
9229 +
9230 + goto ruleESCAPEDEx;
9231 + }
9232 +
9233 + switch (alt11)
9234 + {
9235 + case 1:
9236 + // RSP.g:139:5: '\\\\'
9237 + {
9238 + MATCHC('\\');
9239 + if (HASEXCEPTION())
9240 + {
9241 + goto ruleESCAPEDEx;
9242 + }
9243 +
9244 + {
9245 + SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\\"));
9246 + }
9247 +
9248 + }
9249 + break;
9250 + case 2:
9251 + // RSP.g:140:5: '\"'
9252 + {
9253 + MATCHC('"');
9254 + if (HASEXCEPTION())
9255 + {
9256 + goto ruleESCAPEDEx;
9257 + }
9258 +
9259 + {
9260 + SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\""));
9261 + }
9262 +
9263 + }
9264 + break;
9265 +
9266 + }
9267 + }
9268 +
9269 + }
9270 +
9271 +
9272 +
9273 + // This is where rules clean up and exit
9274 + //
9275 + goto ruleESCAPEDEx; /* Prevent compiler warnings */
9276 + ruleESCAPEDEx: ;
9277 +
9278 +}
9279 +// $ANTLR end ESCAPED
9280 +
9281 +// Comes from: 145:9: ( '0' .. '9' )
9282 +/** \brief Lexer rule generated by ANTLR3
9283 + *
9284 + * $ANTLR start DIGIT09
9285 + *
9286 + * Looks to match the characters the constitute the token DIGIT09
9287 + * from the attached input stream.
9288 + *
9289 + *
9290 + * \remark
9291 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
9292 + */
9293 +static ANTLR3_INLINE
9294 +void mDIGIT09(pRSPLexer ctx)
9295 +{
9296 + ANTLR3_UINT32 _type;
9297 +
9298 +
9299 + // RSP.g:145:9: ( '0' .. '9' )
9300 + // RSP.g:145:11: '0' .. '9'
9301 + {
9302 + MATCHRANGE('0', '9');
9303 + if (HASEXCEPTION())
9304 + {
9305 + goto ruleDIGIT09Ex;
9306 + }
9307 +
9308 +
9309 + }
9310 +
9311 +
9312 +
9313 + // This is where rules clean up and exit
9314 + //
9315 + goto ruleDIGIT09Ex; /* Prevent compiler warnings */
9316 + ruleDIGIT09Ex: ;
9317 +
9318 +}
9319 +// $ANTLR end DIGIT09
9320 +
9321 +// Comes from: 148:9: ( '1' .. '9' )
9322 +/** \brief Lexer rule generated by ANTLR3
9323 + *
9324 + * $ANTLR start DIGIT19
9325 + *
9326 + * Looks to match the characters the constitute the token DIGIT19
9327 + * from the attached input stream.
9328 + *
9329 + *
9330 + * \remark
9331 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
9332 + */
9333 +static ANTLR3_INLINE
9334 +void mDIGIT19(pRSPLexer ctx)
9335 +{
9336 + ANTLR3_UINT32 _type;
9337 +
9338 +
9339 + // RSP.g:148:9: ( '1' .. '9' )
9340 + // RSP.g:148:11: '1' .. '9'
9341 + {
9342 + MATCHRANGE('1', '9');
9343 + if (HASEXCEPTION())
9344 + {
9345 + goto ruleDIGIT19Ex;
9346 + }
9347 +
9348 +
9349 + }
9350 +
9351 +
9352 +
9353 + // This is where rules clean up and exit
9354 + //
9355 + goto ruleDIGIT19Ex; /* Prevent compiler warnings */
9356 + ruleDIGIT19Ex: ;
9357 +
9358 +}
9359 +// $ANTLR end DIGIT19
9360 +
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
9363 + */
9364 +static void
9365 +mTokens(pRSPLexer ctx)
9366 +{
9367 + {
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 )
9369 +
9370 + ANTLR3_UINT32 alt12;
9371 +
9372 + alt12=27;
9373 +
9374 + switch ( LA(1) )
9375 + {
9376 + case '"':
9377 + {
9378 +
9379 + {
9380 + int LA12_1 = LA(2);
9381 + if ( (((LA12_1 >= 0x0000) && (LA12_1 <= '!')) || ((LA12_1 >= '#') && (LA12_1 <= 0xFFFF))) )
9382 + {
9383 + alt12=27;
9384 + }
9385 + else
9386 + {
9387 + alt12=1; }
9388 + }
9389 + }
9390 + break;
9391 + case '(':
9392 + {
9393 + alt12=2;
9394 + }
9395 + break;
9396 + case ')':
9397 + {
9398 + alt12=3;
9399 + }
9400 + break;
9401 + case 'a':
9402 + {
9403 + switch ( LA(2) )
9404 + {
9405 + case 'n':
9406 + {
9407 + switch ( LA(3) )
9408 + {
9409 + case 'd':
9410 + {
9411 + switch ( LA(4) )
9412 + {
9413 + case '_':
9414 + case 'a':
9415 + case 'b':
9416 + case 'c':
9417 + case 'd':
9418 + case 'e':
9419 + case 'f':
9420 + case 'g':
9421 + case 'h':
9422 + case 'i':
9423 + case 'j':
9424 + case 'k':
9425 + case 'l':
9426 + case 'm':
9427 + case 'n':
9428 + case 'o':
9429 + case 'p':
9430 + case 'q':
9431 + case 'r':
9432 + case 's':
9433 + case 't':
9434 + case 'u':
9435 + case 'v':
9436 + case 'w':
9437 + case 'x':
9438 + case 'y':
9439 + case 'z':
9440 + {
9441 + alt12=24;
9442 + }
9443 + break;
9444 +
9445 + default:
9446 + alt12=4;}
9447 +
9448 + }
9449 + break;
9450 +
9451 + default:
9452 + alt12=24;}
9453 +
9454 + }
9455 + break;
9456 + case 'f':
9457 + {
9458 + switch ( LA(3) )
9459 + {
9460 + case 't':
9461 + {
9462 + switch ( LA(4) )
9463 + {
9464 + case 'e':
9465 + {
9466 + switch ( LA(5) )
9467 + {
9468 + case 'r':
9469 + {
9470 + switch ( LA(6) )
9471 + {
9472 + case '_':
9473 + case 'a':
9474 + case 'b':
9475 + case 'c':
9476 + case 'd':
9477 + case 'e':
9478 + case 'f':
9479 + case 'g':
9480 + case 'h':
9481 + case 'i':
9482 + case 'j':
9483 + case 'k':
9484 + case 'l':
9485 + case 'm':
9486 + case 'n':
9487 + case 'o':
9488 + case 'p':
9489 + case 'q':
9490 + case 'r':
9491 + case 's':
9492 + case 't':
9493 + case 'u':
9494 + case 'v':
9495 + case 'w':
9496 + case 'x':
9497 + case 'y':
9498 + case 'z':
9499 + {
9500 + alt12=24;
9501 + }
9502 + break;
9503 +
9504 + default:
9505 + alt12=16;}
9506 +
9507 + }
9508 + break;
9509 +
9510 + default:
9511 + alt12=24;}
9512 +
9513 + }
9514 + break;
9515 +
9516 + default:
9517 + alt12=24;}
9518 +
9519 + }
9520 + break;
9521 +
9522 + default:
9523 + alt12=24;}
9524 +
9525 + }
9526 + break;
9527 + case '_':
9528 + case 'a':
9529 + case 'b':
9530 + case 'c':
9531 + case 'd':
9532 + case 'e':
9533 + case 'g':
9534 + case 'h':
9535 + case 'i':
9536 + case 'j':
9537 + case 'k':
9538 + case 'l':
9539 + case 'm':
9540 + case 'o':
9541 + case 'p':
9542 + case 'q':
9543 + case 'r':
9544 + case 's':
9545 + case 't':
9546 + case 'u':
9547 + case 'v':
9548 + case 'w':
9549 + case 'x':
9550 + case 'y':
9551 + case 'z':
9552 + {
9553 + alt12=24;
9554 + }
9555 + break;
9556 +
9557 + default:
9558 + CONSTRUCTEX();
9559 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
9560 + EXCEPTION->message = (void *)"";
9561 + EXCEPTION->decisionNum = 12;
9562 + EXCEPTION->state = 4;
9563 +
9564 +
9565 + goto ruleTokensEx;
9566 + }
9567 +
9568 + }
9569 + break;
9570 + case 'o':
9571 + {
9572 + switch ( LA(2) )
9573 + {
9574 + case 'r':
9575 + {
9576 + switch ( LA(3) )
9577 + {
9578 + case '_':
9579 + case 'a':
9580 + case 'b':
9581 + case 'c':
9582 + case 'd':
9583 + case 'e':
9584 + case 'f':
9585 + case 'g':
9586 + case 'h':
9587 + case 'i':
9588 + case 'j':
9589 + case 'k':
9590 + case 'l':
9591 + case 'm':
9592 + case 'n':
9593 + case 'o':
9594 + case 'p':
9595 + case 'q':
9596 + case 'r':
9597 + case 's':
9598 + case 't':
9599 + case 'u':
9600 + case 'v':
9601 + case 'w':
9602 + case 'x':
9603 + case 'y':
9604 + case 'z':
9605 + {
9606 + alt12=24;
9607 + }
9608 + break;
9609 +
9610 + default:
9611 + alt12=5;}
9612 +
9613 + }
9614 + break;
9615 + case '_':
9616 + case 'a':
9617 + case 'b':
9618 + case 'c':
9619 + case 'd':
9620 + case 'e':
9621 + case 'f':
9622 + case 'g':
9623 + case 'h':
9624 + case 'i':
9625 + case 'j':
9626 + case 'k':
9627 + case 'l':
9628 + case 'm':
9629 + case 'n':
9630 + case 'o':
9631 + case 'p':
9632 + case 'q':
9633 + case 's':
9634 + case 't':
9635 + case 'u':
9636 + case 'v':
9637 + case 'w':
9638 + case 'x':
9639 + case 'y':
9640 + case 'z':
9641 + {
9642 + alt12=24;
9643 + }
9644 + break;
9645 +
9646 + default:
9647 + CONSTRUCTEX();
9648 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
9649 + EXCEPTION->message = (void *)"";
9650 + EXCEPTION->decisionNum = 12;
9651 + EXCEPTION->state = 5;
9652 +
9653 +
9654 + goto ruleTokensEx;
9655 + }
9656 +
9657 + }
9658 + break;
9659 + case '!':
9660 + {
9661 + alt12=6;
9662 + }
9663 + break;
9664 + case '=':
9665 + {
9666 + alt12=7;
9667 + }
9668 + break;
9669 + case 'i':
9670 + {
9671 + switch ( LA(2) )
9672 + {
9673 + case 'n':
9674 + {
9675 + switch ( LA(3) )
9676 + {
9677 + case 'c':
9678 + {
9679 + switch ( LA(4) )
9680 + {
9681 + case 'l':
9682 + {
9683 + switch ( LA(5) )
9684 + {
9685 + case 'u':
9686 + {
9687 + switch ( LA(6) )
9688 + {
9689 + case 'd':
9690 + {
9691 + switch ( LA(7) )
9692 + {
9693 + case 'e':
9694 + {
9695 + switch ( LA(8) )
9696 + {
9697 + case 's':
9698 + {
9699 + switch ( LA(9) )
9700 + {
9701 + case '_':
9702 + case 'a':
9703 + case 'b':
9704 + case 'c':
9705 + case 'd':
9706 + case 'e':
9707 + case 'f':
9708 + case 'g':
9709 + case 'h':
9710 + case 'i':
9711 + case 'j':
9712 + case 'k':
9713 + case 'l':
9714 + case 'm':
9715 + case 'n':
9716 + case 'o':
9717 + case 'p':
9718 + case 'q':
9719 + case 'r':
9720 + case 's':
9721 + case 't':
9722 + case 'u':
9723 + case 'v':
9724 + case 'w':
9725 + case 'x':
9726 + case 'y':
9727 + case 'z':
9728 + {
9729 + alt12=24;
9730 + }
9731 + break;
9732 +
9733 + default:
9734 + alt12=8;}
9735 +
9736 + }
9737 + break;
9738 +
9739 + default:
9740 + alt12=24;}
9741 +
9742 + }
9743 + break;
9744 +
9745 + default:
9746 + alt12=24;}
9747 +
9748 + }
9749 + break;
9750 +
9751 + default:
9752 + alt12=24;}
9753 +
9754 + }
9755 + break;
9756 +
9757 + default:
9758 + alt12=24;}
9759 +
9760 + }
9761 + break;
9762 +
9763 + default:
9764 + alt12=24;}
9765 +
9766 + }
9767 + break;
9768 +
9769 + default:
9770 + alt12=24;}
9771 +
9772 + }
9773 + break;
9774 + case '_':
9775 + case 'a':
9776 + case 'b':
9777 + case 'c':
9778 + case 'd':
9779 + case 'e':
9780 + case 'f':
9781 + case 'g':
9782 + case 'h':
9783 + case 'i':
9784 + case 'j':
9785 + case 'k':
9786 + case 'l':
9787 + case 'm':
9788 + case 'o':
9789 + case 'p':
9790 + case 'q':
9791 + case 'r':
9792 + case 's':
9793 + case 't':
9794 + case 'u':
9795 + case 'v':
9796 + case 'w':
9797 + case 'x':
9798 + case 'y':
9799 + case 'z':
9800 + {
9801 + alt12=24;
9802 + }
9803 + break;
9804 +
9805 + default:
9806 + CONSTRUCTEX();
9807 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
9808 + EXCEPTION->message = (void *)"";
9809 + EXCEPTION->decisionNum = 12;
9810 + EXCEPTION->state = 8;
9811 +
9812 +
9813 + goto ruleTokensEx;
9814 + }
9815 +
9816 + }
9817 + break;
9818 + case 's':
9819 + {
9820 + switch ( LA(2) )
9821 + {
9822 + case 't':
9823 + {
9824 + switch ( LA(3) )
9825 + {
9826 + case 'a':
9827 + {
9828 + switch ( LA(4) )
9829 + {
9830 + case 'r':
9831 + {
9832 + switch ( LA(5) )
9833 + {
9834 + case 't':
9835 + {
9836 + switch ( LA(6) )
9837 + {
9838 + case 's':
9839 + {
9840 + switch ( LA(7) )
9841 + {
9842 + case 'w':
9843 + {
9844 + switch ( LA(8) )
9845 + {
9846 + case 'i':
9847 + {
9848 + switch ( LA(9) )
9849 + {
9850 + case 't':
9851 + {
9852 + switch ( LA(10) )
9853 + {
9854 + case 'h':
9855 + {
9856 + switch ( LA(11) )
9857 + {
9858 + case '_':
9859 + case 'a':
9860 + case 'b':
9861 + case 'c':
9862 + case 'd':
9863 + case 'e':
9864 + case 'f':
9865 + case 'g':
9866 + case 'h':
9867 + case 'i':
9868 + case 'j':
9869 + case 'k':
9870 + case 'l':
9871 + case 'm':
9872 + case 'n':
9873 + case 'o':
9874 + case 'p':
9875 + case 'q':
9876 + case 'r':
9877 + case 's':
9878 + case 't':
9879 + case 'u':
9880 + case 'v':
9881 + case 'w':
9882 + case 'x':
9883 + case 'y':
9884 + case 'z':
9885 + {
9886 + alt12=24;
9887 + }
9888 + break;
9889 +
9890 + default:
9891 + alt12=9;}
9892 +
9893 + }
9894 + break;
9895 +
9896 + default:
9897 + alt12=24;}
9898 +
9899 + }
9900 + break;
9901 +
9902 + default:
9903 + alt12=24;}
9904 +
9905 + }
9906 + break;
9907 +
9908 + default:
9909 + alt12=24;}
9910 +
9911 + }
9912 + break;
9913 +
9914 + default:
9915 + alt12=24;}
9916 +
9917 + }
9918 + break;
9919 +
9920 + default:
9921 + alt12=24;}
9922 +
9923 + }
9924 + break;
9925 +
9926 + default:
9927 + alt12=24;}
9928 +
9929 + }
9930 + break;
9931 +
9932 + default:
9933 + alt12=24;}
9934 +
9935 + }
9936 + break;
9937 +
9938 + default:
9939 + alt12=24;}
9940 +
9941 + }
9942 + break;
9943 + case '_':
9944 + case 'a':
9945 + case 'b':
9946 + case 'c':
9947 + case 'd':
9948 + case 'e':
9949 + case 'f':
9950 + case 'g':
9951 + case 'h':
9952 + case 'i':
9953 + case 'j':
9954 + case 'k':
9955 + case 'l':
9956 + case 'm':
9957 + case 'n':
9958 + case 'o':
9959 + case 'p':
9960 + case 'q':
9961 + case 'r':
9962 + case 's':
9963 + case 'u':
9964 + case 'v':
9965 + case 'w':
9966 + case 'x':
9967 + case 'y':
9968 + case 'z':
9969 + {
9970 + alt12=24;
9971 + }
9972 + break;
9973 +
9974 + default:
9975 + CONSTRUCTEX();
9976 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
9977 + EXCEPTION->message = (void *)"";
9978 + EXCEPTION->decisionNum = 12;
9979 + EXCEPTION->state = 9;
9980 +
9981 +
9982 + goto ruleTokensEx;
9983 + }
9984 +
9985 + }
9986 + break;
9987 + case 'e':
9988 + {
9989 + switch ( LA(2) )
9990 + {
9991 + case 'n':
9992 + {
9993 + switch ( LA(3) )
9994 + {
9995 + case 'd':
9996 + {
9997 + switch ( LA(4) )
9998 + {
9999 + case 's':
10000 + {
10001 + switch ( LA(5) )
10002 + {
10003 + case 'w':
10004 + {
10005 + switch ( LA(6) )
10006 + {
10007 + case 'i':
10008 + {
10009 + switch ( LA(7) )
10010 + {
10011 + case 't':
10012 + {
10013 + switch ( LA(8) )
10014 + {
10015 + case 'h':
10016 + {
10017 + switch ( LA(9) )
10018 + {
10019 + case '_':
10020 + case 'a':
10021 + case 'b':
10022 + case 'c':
10023 + case 'd':
10024 + case 'e':
10025 + case 'f':
10026 + case 'g':
10027 + case 'h':
10028 + case 'i':
10029 + case 'j':
10030 + case 'k':
10031 + case 'l':
10032 + case 'm':
10033 + case 'n':
10034 + case 'o':
10035 + case 'p':
10036 + case 'q':
10037 + case 'r':
10038 + case 's':
10039 + case 't':
10040 + case 'u':
10041 + case 'v':
10042 + case 'w':
10043 + case 'x':
10044 + case 'y':
10045 + case 'z':
10046 + {
10047 + alt12=24;
10048 + }
10049 + break;
10050 +
10051 + default:
10052 + alt12=10;}
10053 +
10054 + }
10055 + break;
10056 +
10057 + default:
10058 + alt12=24;}
10059 +
10060 + }
10061 + break;
10062 +
10063 + default:
10064 + alt12=24;}
10065 +
10066 + }
10067 + break;
10068 +
10069 + default:
10070 + alt12=24;}
10071 +
10072 + }
10073 + break;
10074 +
10075 + default:
10076 + alt12=24;}
10077 +
10078 + }
10079 + break;
10080 +
10081 + default:
10082 + alt12=24;}
10083 +
10084 + }
10085 + break;
10086 +
10087 + default:
10088 + alt12=24;}
10089 +
10090 + }
10091 + break;
10092 + case '_':
10093 + case 'a':
10094 + case 'b':
10095 + case 'c':
10096 + case 'd':
10097 + case 'e':
10098 + case 'f':
10099 + case 'g':
10100 + case 'h':
10101 + case 'i':
10102 + case 'j':
10103 + case 'k':
10104 + case 'l':
10105 + case 'm':
10106 + case 'o':
10107 + case 'p':
10108 + case 'q':
10109 + case 'r':
10110 + case 's':
10111 + case 't':
10112 + case 'u':
10113 + case 'v':
10114 + case 'w':
10115 + case 'x':
10116 + case 'y':
10117 + case 'z':
10118 + {
10119 + alt12=24;
10120 + }
10121 + break;
10122 +
10123 + default:
10124 + CONSTRUCTEX();
10125 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10126 + EXCEPTION->message = (void *)"";
10127 + EXCEPTION->decisionNum = 12;
10128 + EXCEPTION->state = 10;
10129 +
10130 +
10131 + goto ruleTokensEx;
10132 + }
10133 +
10134 + }
10135 + break;
10136 + case '>':
10137 + {
10138 + switch ( LA(2) )
10139 + {
10140 + case '=':
10141 + {
10142 + alt12=13;
10143 + }
10144 + break;
10145 +
10146 + default:
10147 + alt12=11;}
10148 +
10149 + }
10150 + break;
10151 + case '<':
10152 + {
10153 + switch ( LA(2) )
10154 + {
10155 + case '=':
10156 + {
10157 + alt12=14;
10158 + }
10159 + break;
10160 +
10161 + default:
10162 + alt12=12;}
10163 +
10164 + }
10165 + break;
10166 + case 'b':
10167 + {
10168 + switch ( LA(2) )
10169 + {
10170 + case 'e':
10171 + {
10172 + switch ( LA(3) )
10173 + {
10174 + case 'f':
10175 + {
10176 + switch ( LA(4) )
10177 + {
10178 + case 'o':
10179 + {
10180 + switch ( LA(5) )
10181 + {
10182 + case 'r':
10183 + {
10184 + switch ( LA(6) )
10185 + {
10186 + case 'e':
10187 + {
10188 + switch ( LA(7) )
10189 + {
10190 + case '_':
10191 + case 'a':
10192 + case 'b':
10193 + case 'c':
10194 + case 'd':
10195 + case 'e':
10196 + case 'f':
10197 + case 'g':
10198 + case 'h':
10199 + case 'i':
10200 + case 'j':
10201 + case 'k':
10202 + case 'l':
10203 + case 'm':
10204 + case 'n':
10205 + case 'o':
10206 + case 'p':
10207 + case 'q':
10208 + case 'r':
10209 + case 's':
10210 + case 't':
10211 + case 'u':
10212 + case 'v':
10213 + case 'w':
10214 + case 'x':
10215 + case 'y':
10216 + case 'z':
10217 + {
10218 + alt12=24;
10219 + }
10220 + break;
10221 +
10222 + default:
10223 + alt12=15;}
10224 +
10225 + }
10226 + break;
10227 +
10228 + default:
10229 + alt12=24;}
10230 +
10231 + }
10232 + break;
10233 +
10234 + default:
10235 + alt12=24;}
10236 +
10237 + }
10238 + break;
10239 +
10240 + default:
10241 + alt12=24;}
10242 +
10243 + }
10244 + break;
10245 +
10246 + default:
10247 + alt12=24;}
10248 +
10249 + }
10250 + break;
10251 + case '_':
10252 + case 'a':
10253 + case 'b':
10254 + case 'c':
10255 + case 'd':
10256 + case 'f':
10257 + case 'g':
10258 + case 'h':
10259 + case 'i':
10260 + case 'j':
10261 + case 'k':
10262 + case 'l':
10263 + case 'm':
10264 + case 'n':
10265 + case 'o':
10266 + case 'p':
10267 + case 'q':
10268 + case 'r':
10269 + case 's':
10270 + case 't':
10271 + case 'u':
10272 + case 'v':
10273 + case 'w':
10274 + case 'x':
10275 + case 'y':
10276 + case 'z':
10277 + {
10278 + alt12=24;
10279 + }
10280 + break;
10281 +
10282 + default:
10283 + CONSTRUCTEX();
10284 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10285 + EXCEPTION->message = (void *)"";
10286 + EXCEPTION->decisionNum = 12;
10287 + EXCEPTION->state = 13;
10288 +
10289 +
10290 + goto ruleTokensEx;
10291 + }
10292 +
10293 + }
10294 + break;
10295 + case 'd':
10296 + {
10297 + switch ( LA(2) )
10298 + {
10299 + case 'a':
10300 + {
10301 + switch ( LA(3) )
10302 + {
10303 + case 'y':
10304 + {
10305 + switch ( LA(4) )
10306 + {
10307 + case 's':
10308 + {
10309 + switch ( LA(5) )
10310 + {
10311 + case '_':
10312 + case 'a':
10313 + case 'b':
10314 + case 'c':
10315 + case 'd':
10316 + case 'e':
10317 + case 'f':
10318 + case 'g':
10319 + case 'h':
10320 + case 'i':
10321 + case 'j':
10322 + case 'k':
10323 + case 'l':
10324 + case 'm':
10325 + case 'n':
10326 + case 'o':
10327 + case 'p':
10328 + case 'q':
10329 + case 'r':
10330 + case 's':
10331 + case 't':
10332 + case 'u':
10333 + case 'v':
10334 + case 'w':
10335 + case 'x':
10336 + case 'y':
10337 + case 'z':
10338 + {
10339 + alt12=24;
10340 + }
10341 + break;
10342 +
10343 + default:
10344 + alt12=17;}
10345 +
10346 + }
10347 + break;
10348 + case '_':
10349 + case 'a':
10350 + case 'b':
10351 + case 'c':
10352 + case 'd':
10353 + case 'e':
10354 + case 'f':
10355 + case 'g':
10356 + case 'h':
10357 + case 'i':
10358 + case 'j':
10359 + case 'k':
10360 + case 'l':
10361 + case 'm':
10362 + case 'n':
10363 + case 'o':
10364 + case 'p':
10365 + case 'q':
10366 + case 'r':
10367 + case 't':
10368 + case 'u':
10369 + case 'v':
10370 + case 'w':
10371 + case 'x':
10372 + case 'y':
10373 + case 'z':
10374 + {
10375 + alt12=24;
10376 + }
10377 + break;
10378 +
10379 + default:
10380 + alt12=17;}
10381 +
10382 + }
10383 + break;
10384 +
10385 + default:
10386 + alt12=24;}
10387 +
10388 + }
10389 + break;
10390 + case '_':
10391 + case 'b':
10392 + case 'c':
10393 + case 'd':
10394 + case 'e':
10395 + case 'f':
10396 + case 'g':
10397 + case 'h':
10398 + case 'i':
10399 + case 'j':
10400 + case 'k':
10401 + case 'l':
10402 + case 'm':
10403 + case 'n':
10404 + case 'o':
10405 + case 'p':
10406 + case 'q':
10407 + case 'r':
10408 + case 's':
10409 + case 't':
10410 + case 'u':
10411 + case 'v':
10412 + case 'w':
10413 + case 'x':
10414 + case 'y':
10415 + case 'z':
10416 + {
10417 + alt12=24;
10418 + }
10419 + break;
10420 +
10421 + default:
10422 + CONSTRUCTEX();
10423 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10424 + EXCEPTION->message = (void *)"";
10425 + EXCEPTION->decisionNum = 12;
10426 + EXCEPTION->state = 14;
10427 +
10428 +
10429 + goto ruleTokensEx;
10430 + }
10431 +
10432 + }
10433 + break;
10434 + case 'w':
10435 + {
10436 + switch ( LA(2) )
10437 + {
10438 + case 'e':
10439 + {
10440 + switch ( LA(3) )
10441 + {
10442 + case 'e':
10443 + {
10444 + switch ( LA(4) )
10445 + {
10446 + case 'k':
10447 + {
10448 + switch ( LA(5) )
10449 + {
10450 + case 's':
10451 + {
10452 + switch ( LA(6) )
10453 + {
10454 + case '_':
10455 + case 'a':
10456 + case 'b':
10457 + case 'c':
10458 + case 'd':
10459 + case 'e':
10460 + case 'f':
10461 + case 'g':
10462 + case 'h':
10463 + case 'i':
10464 + case 'j':
10465 + case 'k':
10466 + case 'l':
10467 + case 'm':
10468 + case 'n':
10469 + case 'o':
10470 + case 'p':
10471 + case 'q':
10472 + case 'r':
10473 + case 's':
10474 + case 't':
10475 + case 'u':
10476 + case 'v':
10477 + case 'w':
10478 + case 'x':
10479 + case 'y':
10480 + case 'z':
10481 + {
10482 + alt12=24;
10483 + }
10484 + break;
10485 +
10486 + default:
10487 + alt12=18;}
10488 +
10489 + }
10490 + break;
10491 + case '_':
10492 + case 'a':
10493 + case 'b':
10494 + case 'c':
10495 + case 'd':
10496 + case 'e':
10497 + case 'f':
10498 + case 'g':
10499 + case 'h':
10500 + case 'i':
10501 + case 'j':
10502 + case 'k':
10503 + case 'l':
10504 + case 'm':
10505 + case 'n':
10506 + case 'o':
10507 + case 'p':
10508 + case 'q':
10509 + case 'r':
10510 + case 't':
10511 + case 'u':
10512 + case 'v':
10513 + case 'w':
10514 + case 'x':
10515 + case 'y':
10516 + case 'z':
10517 + {
10518 + alt12=24;
10519 + }
10520 + break;
10521 +
10522 + default:
10523 + alt12=18;}
10524 +
10525 + }
10526 + break;
10527 +
10528 + default:
10529 + alt12=24;}
10530 +
10531 + }
10532 + break;
10533 +
10534 + default:
10535 + alt12=24;}
10536 +
10537 + }
10538 + break;
10539 + case '_':
10540 + case 'a':
10541 + case 'b':
10542 + case 'c':
10543 + case 'd':
10544 + case 'f':
10545 + case 'g':
10546 + case 'h':
10547 + case 'i':
10548 + case 'j':
10549 + case 'k':
10550 + case 'l':
10551 + case 'm':
10552 + case 'n':
10553 + case 'o':
10554 + case 'p':
10555 + case 'q':
10556 + case 'r':
10557 + case 's':
10558 + case 't':
10559 + case 'u':
10560 + case 'v':
10561 + case 'w':
10562 + case 'x':
10563 + case 'y':
10564 + case 'z':
10565 + {
10566 + alt12=24;
10567 + }
10568 + break;
10569 +
10570 + default:
10571 + CONSTRUCTEX();
10572 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10573 + EXCEPTION->message = (void *)"";
10574 + EXCEPTION->decisionNum = 12;
10575 + EXCEPTION->state = 15;
10576 +
10577 +
10578 + goto ruleTokensEx;
10579 + }
10580 +
10581 + }
10582 + break;
10583 + case 'm':
10584 + {
10585 + switch ( LA(2) )
10586 + {
10587 + case 'o':
10588 + {
10589 + switch ( LA(3) )
10590 + {
10591 + case 'n':
10592 + {
10593 + switch ( LA(4) )
10594 + {
10595 + case 't':
10596 + {
10597 + switch ( LA(5) )
10598 + {
10599 + case 'h':
10600 + {
10601 + switch ( LA(6) )
10602 + {
10603 + case 's':
10604 + {
10605 + switch ( LA(7) )
10606 + {
10607 + case '_':
10608 + case 'a':
10609 + case 'b':
10610 + case 'c':
10611 + case 'd':
10612 + case 'e':
10613 + case 'f':
10614 + case 'g':
10615 + case 'h':
10616 + case 'i':
10617 + case 'j':
10618 + case 'k':
10619 + case 'l':
10620 + case 'm':
10621 + case 'n':
10622 + case 'o':
10623 + case 'p':
10624 + case 'q':
10625 + case 'r':
10626 + case 's':
10627 + case 't':
10628 + case 'u':
10629 + case 'v':
10630 + case 'w':
10631 + case 'x':
10632 + case 'y':
10633 + case 'z':
10634 + {
10635 + alt12=24;
10636 + }
10637 + break;
10638 +
10639 + default:
10640 + alt12=19;}
10641 +
10642 + }
10643 + break;
10644 + case '_':
10645 + case 'a':
10646 + case 'b':
10647 + case 'c':
10648 + case 'd':
10649 + case 'e':
10650 + case 'f':
10651 + case 'g':
10652 + case 'h':
10653 + case 'i':
10654 + case 'j':
10655 + case 'k':
10656 + case 'l':
10657 + case 'm':
10658 + case 'n':
10659 + case 'o':
10660 + case 'p':
10661 + case 'q':
10662 + case 'r':
10663 + case 't':
10664 + case 'u':
10665 + case 'v':
10666 + case 'w':
10667 + case 'x':
10668 + case 'y':
10669 + case 'z':
10670 + {
10671 + alt12=24;
10672 + }
10673 + break;
10674 +
10675 + default:
10676 + alt12=19;}
10677 +
10678 + }
10679 + break;
10680 +
10681 + default:
10682 + alt12=24;}
10683 +
10684 + }
10685 + break;
10686 +
10687 + default:
10688 + alt12=24;}
10689 +
10690 + }
10691 + break;
10692 +
10693 + default:
10694 + alt12=24;}
10695 +
10696 + }
10697 + break;
10698 + case '_':
10699 + case 'a':
10700 + case 'b':
10701 + case 'c':
10702 + case 'd':
10703 + case 'e':
10704 + case 'f':
10705 + case 'g':
10706 + case 'h':
10707 + case 'i':
10708 + case 'j':
10709 + case 'k':
10710 + case 'l':
10711 + case 'm':
10712 + case 'n':
10713 + case 'p':
10714 + case 'q':
10715 + case 'r':
10716 + case 's':
10717 + case 't':
10718 + case 'u':
10719 + case 'v':
10720 + case 'w':
10721 + case 'x':
10722 + case 'y':
10723 + case 'z':
10724 + {
10725 + alt12=24;
10726 + }
10727 + break;
10728 +
10729 + default:
10730 + CONSTRUCTEX();
10731 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10732 + EXCEPTION->message = (void *)"";
10733 + EXCEPTION->decisionNum = 12;
10734 + EXCEPTION->state = 16;
10735 +
10736 +
10737 + goto ruleTokensEx;
10738 + }
10739 +
10740 + }
10741 + break;
10742 + case 'y':
10743 + {
10744 + switch ( LA(2) )
10745 + {
10746 + case 'e':
10747 + {
10748 + switch ( LA(3) )
10749 + {
10750 + case 'a':
10751 + {
10752 + switch ( LA(4) )
10753 + {
10754 + case 'r':
10755 + {
10756 + switch ( LA(5) )
10757 + {
10758 + case 's':
10759 + {
10760 + switch ( LA(6) )
10761 + {
10762 + case '_':
10763 + case 'a':
10764 + case 'b':
10765 + case 'c':
10766 + case 'd':
10767 + case 'e':
10768 + case 'f':
10769 + case 'g':
10770 + case 'h':
10771 + case 'i':
10772 + case 'j':
10773 + case 'k':
10774 + case 'l':
10775 + case 'm':
10776 + case 'n':
10777 + case 'o':
10778 + case 'p':
10779 + case 'q':
10780 + case 'r':
10781 + case 's':
10782 + case 't':
10783 + case 'u':
10784 + case 'v':
10785 + case 'w':
10786 + case 'x':
10787 + case 'y':
10788 + case 'z':
10789 + {
10790 + alt12=24;
10791 + }
10792 + break;
10793 +
10794 + default:
10795 + alt12=20;}
10796 +
10797 + }
10798 + break;
10799 + case '_':
10800 + case 'a':
10801 + case 'b':
10802 + case 'c':
10803 + case 'd':
10804 + case 'e':
10805 + case 'f':
10806 + case 'g':
10807 + case 'h':
10808 + case 'i':
10809 + case 'j':
10810 + case 'k':
10811 + case 'l':
10812 + case 'm':
10813 + case 'n':
10814 + case 'o':
10815 + case 'p':
10816 + case 'q':
10817 + case 'r':
10818 + case 't':
10819 + case 'u':
10820 + case 'v':
10821 + case 'w':
10822 + case 'x':
10823 + case 'y':
10824 + case 'z':
10825 + {
10826 + alt12=24;
10827 + }
10828 + break;
10829 +
10830 + default:
10831 + alt12=20;}
10832 +
10833 + }
10834 + break;
10835 +
10836 + default:
10837 + alt12=24;}
10838 +
10839 + }
10840 + break;
10841 +
10842 + default:
10843 + alt12=24;}
10844 +
10845 + }
10846 + break;
10847 + case '_':
10848 + case 'a':
10849 + case 'b':
10850 + case 'c':
10851 + case 'd':
10852 + case 'f':
10853 + case 'g':
10854 + case 'h':
10855 + case 'i':
10856 + case 'j':
10857 + case 'k':
10858 + case 'l':
10859 + case 'm':
10860 + case 'n':
10861 + case 'o':
10862 + case 'p':
10863 + case 'q':
10864 + case 'r':
10865 + case 's':
10866 + case 't':
10867 + case 'u':
10868 + case 'v':
10869 + case 'w':
10870 + case 'x':
10871 + case 'y':
10872 + case 'z':
10873 + {
10874 + alt12=24;
10875 + }
10876 + break;
10877 +
10878 + default:
10879 + CONSTRUCTEX();
10880 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
10881 + EXCEPTION->message = (void *)"";
10882 + EXCEPTION->decisionNum = 12;
10883 + EXCEPTION->state = 17;
10884 +
10885 +
10886 + goto ruleTokensEx;
10887 + }
10888 +
10889 + }
10890 + break;
10891 + case 't':
10892 + {
10893 + switch ( LA(2) )
10894 + {
10895 + case 'o':
10896 + {
10897 + switch ( LA(3) )
10898 + {
10899 + case 'd':
10900 + {
10901 + switch ( LA(4) )
10902 + {
10903 + case 'a':
10904 + {
10905 + switch ( LA(5) )
10906 + {
10907 + case 'y':
10908 + {
10909 + switch ( LA(6) )
10910 + {
10911 + case '_':
10912 + case 'a':
10913 + case 'b':
10914 + case 'c':
10915 + case 'd':
10916 + case 'e':
10917 + case 'f':
10918 + case 'g':
10919 + case 'h':
10920 + case 'i':
10921 + case 'j':
10922 + case 'k':
10923 + case 'l':
10924 + case 'm':
10925 + case 'n':
10926 + case 'o':
10927 + case 'p':
10928 + case 'q':
10929 + case 'r':
10930 + case 's':
10931 + case 't':
10932 + case 'u':
10933 + case 'v':
10934 + case 'w':
10935 + case 'x':
10936 + case 'y':
10937 + case 'z':
10938 + {
10939 + alt12=24;
10940 + }
10941 + break;
10942 +
10943 + default:
10944 + alt12=21;}
10945 +
10946 + }
10947 + break;
10948 +
10949 + default:
10950 + alt12=24;}
10951 +
10952 + }
10953 + break;
10954 +
10955 + default:
10956 + alt12=24;}
10957 +
10958 + }
10959 + break;
10960 +
10961 + default:
10962 + alt12=24;}
10963 +
10964 + }
10965 + break;
10966 + case '_':
10967 + case 'a':
10968 + case 'b':
10969 + case 'c':
10970 + case 'd':
10971 + case 'e':
10972 + case 'f':
10973 + case 'g':
10974 + case 'h':
10975 + case 'i':
10976 + case 'j':
10977 + case 'k':
10978 + case 'l':
10979 + case 'm':
10980 + case 'n':
10981 + case 'p':
10982 + case 'q':
10983 + case 'r':
10984 + case 's':
10985 + case 't':
10986 + case 'u':
10987 + case 'v':
10988 + case 'w':
10989 + case 'x':
10990 + case 'y':
10991 + case 'z':
10992 + {
10993 + alt12=24;
10994 + }
10995 + break;
10996 +
10997 + default:
10998 + CONSTRUCTEX();
10999 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
11000 + EXCEPTION->message = (void *)"";
11001 + EXCEPTION->decisionNum = 12;
11002 + EXCEPTION->state = 18;
11003 +
11004 +
11005 + goto ruleTokensEx;
11006 + }
11007 +
11008 + }
11009 + break;
11010 + case '\n':
11011 + case '\r':
11012 + {
11013 + alt12=22;
11014 + }
11015 + break;
11016 + case '\t':
11017 + case ' ':
11018 + {
11019 + alt12=23;
11020 + }
11021 + break;
11022 + case 'c':
11023 + case 'f':
11024 + case 'g':
11025 + case 'h':
11026 + case 'j':
11027 + case 'k':
11028 + case 'l':
11029 + case 'n':
11030 + case 'p':
11031 + case 'q':
11032 + case 'r':
11033 + case 'u':
11034 + case 'v':
11035 + case 'x':
11036 + case 'z':
11037 + {
11038 + alt12=24;
11039 + }
11040 + break;
11041 + case '1':
11042 + case '2':
11043 + case '3':
11044 + case '4':
11045 + case '5':
11046 + case '6':
11047 + case '7':
11048 + case '8':
11049 + case '9':
11050 + {
11051 + switch ( LA(2) )
11052 + {
11053 + case '0':
11054 + case '1':
11055 + case '2':
11056 + case '3':
11057 + case '4':
11058 + case '5':
11059 + case '6':
11060 + case '7':
11061 + case '8':
11062 + case '9':
11063 + {
11064 + switch ( LA(3) )
11065 + {
11066 + case '0':
11067 + case '1':
11068 + case '2':
11069 + case '3':
11070 + case '4':
11071 + case '5':
11072 + case '6':
11073 + case '7':
11074 + case '8':
11075 + case '9':
11076 + {
11077 + switch ( LA(4) )
11078 + {
11079 + case '0':
11080 + case '1':
11081 + case '2':
11082 + case '3':
11083 + case '4':
11084 + case '5':
11085 + case '6':
11086 + case '7':
11087 + case '8':
11088 + case '9':
11089 + {
11090 + switch ( LA(5) )
11091 + {
11092 + case '-':
11093 + {
11094 + alt12=26;
11095 + }
11096 + break;
11097 +
11098 + default:
11099 + alt12=25;}
11100 +
11101 + }
11102 + break;
11103 +
11104 + default:
11105 + alt12=25;}
11106 +
11107 + }
11108 + break;
11109 +
11110 + default:
11111 + alt12=25;}
11112 +
11113 + }
11114 + break;
11115 +
11116 + default:
11117 + alt12=25;}
11118 +
11119 + }
11120 + break;
11121 +
11122 + default:
11123 + CONSTRUCTEX();
11124 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
11125 + EXCEPTION->message = (void *)"";
11126 + EXCEPTION->decisionNum = 12;
11127 + EXCEPTION->state = 0;
11128 +
11129 +
11130 + goto ruleTokensEx;
11131 + }
11132 +
11133 + switch (alt12)
11134 + {
11135 + case 1:
11136 + // RSP.g:1:10: QUOTE
11137 + {
11138 + /* 1:10: QUOTE */
11139 + mQUOTE(ctx );
11140 + if (HASEXCEPTION())
11141 + {
11142 + goto ruleTokensEx;
11143 + }
11144 +
11145 +
11146 + }
11147 + break;
11148 + case 2:
11149 + // RSP.g:1:16: LPAR
11150 + {
11151 + /* 1:16: LPAR */
11152 + mLPAR(ctx );
11153 + if (HASEXCEPTION())
11154 + {
11155 + goto ruleTokensEx;
11156 + }
11157 +
11158 +
11159 + }
11160 + break;
11161 + case 3:
11162 + // RSP.g:1:21: RPAR
11163 + {
11164 + /* 1:21: RPAR */
11165 + mRPAR(ctx );
11166 + if (HASEXCEPTION())
11167 + {
11168 + goto ruleTokensEx;
11169 + }
11170 +
11171 +
11172 + }
11173 + break;
11174 + case 4:
11175 + // RSP.g:1:26: AND
11176 + {
11177 + /* 1:26: AND */
11178 + mAND(ctx );
11179 + if (HASEXCEPTION())
11180 + {
11181 + goto ruleTokensEx;
11182 + }
11183 +
11184 +
11185 + }
11186 + break;
11187 + case 5:
11188 + // RSP.g:1:30: OR
11189 + {
11190 + /* 1:30: OR */
11191 + mOR(ctx );
11192 + if (HASEXCEPTION())
11193 + {
11194 + goto ruleTokensEx;
11195 + }
11196 +
11197 +
11198 + }
11199 + break;
11200 + case 6:
11201 + // RSP.g:1:33: NOT
11202 + {
11203 + /* 1:33: NOT */
11204 + mNOT(ctx );
11205 + if (HASEXCEPTION())
11206 + {
11207 + goto ruleTokensEx;
11208 + }
11209 +
11210 +
11211 + }
11212 + break;
11213 + case 7:
11214 + // RSP.g:1:37: EQUAL
11215 + {
11216 + /* 1:37: EQUAL */
11217 + mEQUAL(ctx );
11218 + if (HASEXCEPTION())
11219 + {
11220 + goto ruleTokensEx;
11221 + }
11222 +
11223 +
11224 + }
11225 + break;
11226 + case 8:
11227 + // RSP.g:1:43: INCLUDES
11228 + {
11229 + /* 1:43: INCLUDES */
11230 + mINCLUDES(ctx );
11231 + if (HASEXCEPTION())
11232 + {
11233 + goto ruleTokensEx;
11234 + }
11235 +
11236 +
11237 + }
11238 + break;
11239 + case 9:
11240 + // RSP.g:1:52: STARTSW
11241 + {
11242 + /* 1:52: STARTSW */
11243 + mSTARTSW(ctx );
11244 + if (HASEXCEPTION())
11245 + {
11246 + goto ruleTokensEx;
11247 + }
11248 +
11249 +
11250 + }
11251 + break;
11252 + case 10:
11253 + // RSP.g:1:60: ENDSW
11254 + {
11255 + /* 1:60: ENDSW */
11256 + mENDSW(ctx );
11257 + if (HASEXCEPTION())
11258 + {
11259 + goto ruleTokensEx;
11260 + }
11261 +
11262 +
11263 + }
11264 + break;
11265 + case 11:
11266 + // RSP.g:1:66: GREATER
11267 + {
11268 + /* 1:66: GREATER */
11269 + mGREATER(ctx );
11270 + if (HASEXCEPTION())
11271 + {
11272 + goto ruleTokensEx;
11273 + }
11274 +
11275 +
11276 + }
11277 + break;
11278 + case 12:
11279 + // RSP.g:1:74: LESS
11280 + {
11281 + /* 1:74: LESS */
11282 + mLESS(ctx );
11283 + if (HASEXCEPTION())
11284 + {
11285 + goto ruleTokensEx;
11286 + }
11287 +
11288 +
11289 + }
11290 + break;
11291 + case 13:
11292 + // RSP.g:1:79: GTE
11293 + {
11294 + /* 1:79: GTE */
11295 + mGTE(ctx );
11296 + if (HASEXCEPTION())
11297 + {
11298 + goto ruleTokensEx;
11299 + }
11300 +
11301 +
11302 + }
11303 + break;
11304 + case 14:
11305 + // RSP.g:1:83: LTE
11306 + {
11307 + /* 1:83: LTE */
11308 + mLTE(ctx );
11309 + if (HASEXCEPTION())
11310 + {
11311 + goto ruleTokensEx;
11312 + }
11313 +
11314 +
11315 + }
11316 + break;
11317 + case 15:
11318 + // RSP.g:1:87: BEFORE
11319 + {
11320 + /* 1:87: BEFORE */
11321 + mBEFORE(ctx );
11322 + if (HASEXCEPTION())
11323 + {
11324 + goto ruleTokensEx;
11325 + }
11326 +
11327 +
11328 + }
11329 + break;
11330 + case 16:
11331 + // RSP.g:1:94: AFTER
11332 + {
11333 + /* 1:94: AFTER */
11334 + mAFTER(ctx );
11335 + if (HASEXCEPTION())
11336 + {
11337 + goto ruleTokensEx;
11338 + }
11339 +
11340 +
11341 + }
11342 + break;
11343 + case 17:
11344 + // RSP.g:1:100: DAY
11345 + {
11346 + /* 1:100: DAY */
11347 + mDAY(ctx );
11348 + if (HASEXCEPTION())
11349 + {
11350 + goto ruleTokensEx;
11351 + }
11352 +
11353 +
11354 + }
11355 + break;
11356 + case 18:
11357 + // RSP.g:1:104: WEEK
11358 + {
11359 + /* 1:104: WEEK */
11360 + mWEEK(ctx );
11361 + if (HASEXCEPTION())
11362 + {
11363 + goto ruleTokensEx;
11364 + }
11365 +
11366 +
11367 + }
11368 + break;
11369 + case 19:
11370 + // RSP.g:1:109: MONTH
11371 + {
11372 + /* 1:109: MONTH */
11373 + mMONTH(ctx );
11374 + if (HASEXCEPTION())
11375 + {
11376 + goto ruleTokensEx;
11377 + }
11378 +
11379 +
11380 + }
11381 + break;
11382 + case 20:
11383 + // RSP.g:1:115: YEAR
11384 + {
11385 + /* 1:115: YEAR */
11386 + mYEAR(ctx );
11387 + if (HASEXCEPTION())
11388 + {
11389 + goto ruleTokensEx;
11390 + }
11391 +
11392 +
11393 + }
11394 + break;
11395 + case 21:
11396 + // RSP.g:1:120: TODAY
11397 + {
11398 + /* 1:120: TODAY */
11399 + mTODAY(ctx );
11400 + if (HASEXCEPTION())
11401 + {
11402 + goto ruleTokensEx;
11403 + }
11404 +
11405 +
11406 + }
11407 + break;
11408 + case 22:
11409 + // RSP.g:1:126: NEWLINE
11410 + {
11411 + /* 1:126: NEWLINE */
11412 + mNEWLINE(ctx );
11413 + if (HASEXCEPTION())
11414 + {
11415 + goto ruleTokensEx;
11416 + }
11417 +
11418 +
11419 + }
11420 + break;
11421 + case 23:
11422 + // RSP.g:1:134: WS
11423 + {
11424 + /* 1:134: WS */
11425 + mWS(ctx );
11426 + if (HASEXCEPTION())
11427 + {
11428 + goto ruleTokensEx;
11429 + }
11430 +
11431 +
11432 + }
11433 + break;
11434 + case 24:
11435 + // RSP.g:1:137: FIELD
11436 + {
11437 + /* 1:137: FIELD */
11438 + mFIELD(ctx );
11439 + if (HASEXCEPTION())
11440 + {
11441 + goto ruleTokensEx;
11442 + }
11443 +
11444 +
11445 + }
11446 + break;
11447 + case 25:
11448 + // RSP.g:1:143: INT
11449 + {
11450 + /* 1:143: INT */
11451 + mINT(ctx );
11452 + if (HASEXCEPTION())
11453 + {
11454 + goto ruleTokensEx;
11455 + }
11456 +
11457 +
11458 + }
11459 + break;
11460 + case 26:
11461 + // RSP.g:1:147: DATE
11462 + {
11463 + /* 1:147: DATE */
11464 + mDATE(ctx );
11465 + if (HASEXCEPTION())
11466 + {
11467 + goto ruleTokensEx;
11468 + }
11469 +
11470 +
11471 + }
11472 + break;
11473 + case 27:
11474 + // RSP.g:1:152: STR
11475 + {
11476 + /* 1:152: STR */
11477 + mSTR(ctx );
11478 + if (HASEXCEPTION())
11479 + {
11480 + goto ruleTokensEx;
11481 + }
11482 +
11483 +
11484 + }
11485 + break;
11486 +
11487 + }
11488 + }
11489 +
11490 +
11491 + goto ruleTokensEx; /* Prevent compiler warnings */
11492 +ruleTokensEx: ;
11493 +}
11494 +
11495 +/* =========================================================================
11496 + * Lexer matching rules end.
11497 + * =========================================================================
11498 + */
11499 +/* End of Lexer code
11500 + * ================================================
11501 + * ================================================
11502 + */
11503 +
11504 +
11505 +/* End of code
11506 + * =============================================================================
11507 + */
11508 diff --git a/src/pregen/RSPLexer.h b/src/pregen/RSPLexer.h
11509 new file mode 100644
11510 index 0000000..d93f93e
11511 --- /dev/null
11512 +++ b/src/pregen/RSPLexer.h
11513 @@ -0,0 +1,254 @@
11514 +/** \file
11515 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
11516 + *
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.
11521 + *
11522 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
11523 + *
11524 + *
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
11528 + * this rule.
11529 + *
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.
11534 + *
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().
11537 + *
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:
11541 + *
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)
11573 + *
11574 + * The return type for any particular rule is of course determined by the source
11575 + * grammar file.
11576 + */
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
11581 +//
11582 +// All rights reserved.
11583 +//
11584 +// Redistribution and use in source and binary forms, with or without
11585 +// modification, are permitted provided that the following conditions
11586 +// are met:
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.
11594 +//
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.
11605 +
11606 +#ifndef _RSPLexer_H
11607 +#define _RSPLexer_H
11608 +/* =============================================================================
11609 + * Standard antlr3 C runtime definitions
11610 + */
11611 +#include <antlr3.h>
11612 +
11613 +/* End of standard antlr 3 runtime definitions
11614 + * =============================================================================
11615 + */
11616 +
11617 +#ifdef __cplusplus
11618 +extern "C" {
11619 +#endif
11620 +
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.
11625 +//
11626 +typedef struct RSPLexer_Ctx_struct RSPLexer, * pRSPLexer;
11627 +
11628 +
11629 +
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
11637 +//
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.
11642 +//
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 )
11649 +#endif
11650 +
11651 +/** Context tracking structure for RSPLexer
11652 + */
11653 +struct RSPLexer_Ctx_struct
11654 +{
11655 + /** Built in ANTLR3 context tracker contains all the generic elements
11656 + * required for context tracking.
11657 + */
11658 + pANTLR3_LEXER pLexer;
11659 +
11660 +
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);
11693 +
11694 +};
11695 +
11696 +// Function protoypes for the constructor functions that external translation units
11697 +// such as delegators and delegates may wish to call.
11698 +//
11699 +ANTLR3_API pRSPLexer RSPLexerNew (pANTLR3_INPUT_STREAM instream);
11700 +ANTLR3_API pRSPLexer RSPLexerNewSSD (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
11701 +
11702 +/** Symbolic definitions of all the tokens that the lexer will work with.
11703 + * \{
11704 + *
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.
11709 + */
11710 +#ifdef EOF
11711 +#undef EOF
11712 +#endif
11713 +#ifdef Tokens
11714 +#undef Tokens
11715 +#endif
11716 +#define STARTSW 14
11717 +#define WEEK 26
11718 +#define TODAY 24
11719 +#define YEAR 28
11720 +#define ENDSW 15
11721 +#define GTE 20
11722 +#define BEFORE 21
11723 +#define DAY 25
11724 +#define INT 16
11725 +#define NOT 11
11726 +#define AFTER 22
11727 +#define AND 6
11728 +#define EOF -1
11729 +#define LTE 19
11730 +#define MONTH 27
11731 +#define DIGIT19 31
11732 +#define INCLUDES 13
11733 +#define STR 10
11734 +#define QUOTE 29
11735 +#define GREATER 18
11736 +#define WS 30
11737 +#define LPAR 7
11738 +#define NEWLINE 4
11739 +#define EQUAL 12
11740 +#define OR 5
11741 +#define LESS 17
11742 +#define FIELD 9
11743 +#define RPAR 8
11744 +#define ESCAPED 33
11745 +#define DATE 23
11746 +#define DIGIT09 32
11747 +#ifdef EOF
11748 +#undef EOF
11749 +#define EOF ANTLR3_TOKEN_EOF
11750 +#endif
11751 +
11752 +#ifndef TOKENSOURCE
11753 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
11754 +#endif
11755 +
11756 +/* End of token definitions for RSPLexer
11757 + * =============================================================================
11758 + */
11759 +/** \} */
11760 +
11761 +#ifdef __cplusplus
11762 +}
11763 +#endif
11764 +
11765 +#endif
11766 +
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
11771 --- /dev/null
11772 +++ b/src/pregen/RSPParser.c
11773 @@ -0,0 +1,2684 @@
11774 +/** \file
11775 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
11776 + *
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.
11781 + *
11782 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
11783 + *
11784 + *
11785 +*/
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
11790 +//
11791 +// All rights reserved.
11792 +//
11793 +// Redistribution and use in source and binary forms, with or without
11794 +// modification, are permitted provided that the following conditions
11795 +// are met:
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.
11803 +//
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.
11814 +
11815 +/* -----------------------------------------
11816 + * Include the ANTLR3 generated header file.
11817 + */
11818 +#include "RSPParser.h"
11819 +/* ----------------------------------------- */
11820 +
11821 +
11822 +
11823 +
11824 +
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.
11836 + */
11837 +
11838 +#define CTX ctx
11839 +
11840 +/* Aids in accessing scopes for grammar programmers
11841 + */
11842 +#undef SCOPE_TYPE
11843 +#undef SCOPE_STACK
11844 +#undef SCOPE_TOP
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))
11850 +
11851 +/* Macros for accessing things in the parser
11852 + */
11853 +
11854 +#undef PARSER
11855 +#undef RECOGNIZER
11856 +#undef HAVEPARSEDRULE
11857 +#undef MEMOIZE
11858 +#undef INPUT
11859 +#undef STRSTREAM
11860 +#undef HASEXCEPTION
11861 +#undef EXCEPTION
11862 +#undef MATCHT
11863 +#undef MATCHANYT
11864 +#undef FOLLOWSTACK
11865 +#undef FOLLOWPUSH
11866 +#undef FOLLOWPOP
11867 +#undef PRECOVER
11868 +#undef PREPORTERROR
11869 +#undef LA
11870 +#undef LT
11871 +#undef CONSTRUCTEX
11872 +#undef CONSUME
11873 +#undef MARK
11874 +#undef REWIND
11875 +#undef REWINDLAST
11876 +#undef PERRORRECOVERY
11877 +#undef HASFAILED
11878 +#undef FAILEDFLAG
11879 +#undef RECOVERFROMMISMATCHEDSET
11880 +#undef RECOVERFROMMISMATCHEDELEMENT
11881 +#undef INDEX
11882 +#undef ADAPTOR
11883 +#undef SEEK
11884 +#undef RULEMEMO
11885 +#undef DBG
11886 +
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
11922 +
11923 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
11924 +
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.
11930 + */
11931 +#define UP ANTLR3_TOKEN_UP
11932 +#define DOWN ANTLR3_TOKEN_DOWN
11933 +#define EOR ANTLR3_TOKEN_EOR
11934 +#define INVALID ANTLR3_TOKEN_INVALID
11935 +
11936 +
11937 +/* =============================================================================
11938 + * Functions to create and destroy scopes. First come the rule scopes, followed
11939 + * by the global declared scopes.
11940 + */
11941 +
11942 +
11943 +
11944 +/* ============================================================================= */
11945 +
11946 +/* =============================================================================
11947 + * Start of recognizer
11948 + */
11949 +
11950 +
11951 +
11952 +/** \brief Table of all token names in symbolic order, mainly used for
11953 + * error reporting.
11954 + */
11955 +pANTLR3_UINT8 RSPParserTokenNames[30+4]
11956 + = {
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"
11991 + };
11992 +
11993 +
11994 +
11995 +// Forward declare the locally static matching functions we have generated.
11996 +//
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.
12014 + */
12015 +static void ANTLR3_CDECL freeScope(void * scope)
12016 +{
12017 + ANTLR3_FREE(scope);
12018 +}
12019 +
12020 +/** \brief Name of the grammar file that generated this code
12021 + */
12022 +static const char fileName[] = "RSP.g";
12023 +
12024 +/** \brief Return the name of the grammar file that generated this code.
12025 + */
12026 +static const char * getGrammarFileName()
12027 +{
12028 + return fileName;
12029 +}
12030 +/** \brief Create a new RSPParser parser and return a context for it.
12031 + *
12032 + * \param[in] instream Pointer to an input stream interface.
12033 + *
12034 + * \return Pointer to new parser context upon success.
12035 + */
12036 +ANTLR3_API pRSPParser
12037 +RSPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream)
12038 +{
12039 + // See if we can create a new parser with the standard constructor
12040 + //
12041 + return RSPParserNewSSD(instream, NULL);
12042 +}
12043 +
12044 +/** \brief Create a new RSPParser parser and return a context for it.
12045 + *
12046 + * \param[in] instream Pointer to an input stream interface.
12047 + *
12048 + * \return Pointer to new parser context upon success.
12049 + */
12050 +ANTLR3_API pRSPParser
12051 +RSPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
12052 +{
12053 + pRSPParser ctx; /* Context structure we will build and return */
12054 +
12055 + ctx = (pRSPParser) ANTLR3_CALLOC(1, sizeof(RSPParser));
12056 +
12057 + if (ctx == NULL)
12058 + {
12059 + // Failed to allocate memory for parser context
12060 + //
12061 + return NULL;
12062 + }
12063 +
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.
12070 + *
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.
12073 + */
12074 +
12075 + /* Create a base parser/recognizer, using the supplied token stream
12076 + */
12077 + ctx->pParser = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state);
12078 + /* Install the implementation of our RSPParser interface
12079 + */
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;
12095 +
12096 + /* Install the scope pushing methods.
12097 + */
12098 + ADAPTOR = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory);
12099 + ctx->vectors = antlr3VectorFactoryNew(0);
12100 +
12101 +
12102 +
12103 + /* Install the token table
12104 + */
12105 + PSRSTATE->tokenNames = RSPParserTokenNames;
12106 +
12107 +
12108 + /* Return the newly built parser to the caller
12109 + */
12110 + return ctx;
12111 +}
12112 +
12113 +/** Free the parser resources
12114 + */
12115 + static void
12116 + RSPParserFree(pRSPParser ctx)
12117 + {
12118 + /* Free any scope memory
12119 + */
12120 +
12121 + ctx->vectors->close(ctx->vectors);
12122 + /* We created the adaptor so we must free it
12123 + */
12124 + ADAPTOR->free(ADAPTOR);
12125 + // Free this parser
12126 + //
12127 + ctx->pParser->free(ctx->pParser);
12128 + ANTLR3_FREE(ctx);
12129 +
12130 + /* Everything is released, so we can return
12131 + */
12132 + return;
12133 + }
12134 +
12135 +/** Return token names used by this parser
12136 + *
12137 + * The returned pointer is used as an index into the token names table (using the token
12138 + * number as the index).
12139 + *
12140 + * \return Pointer to first char * in the table.
12141 + */
12142 +static pANTLR3_UINT8 *getTokenNames()
12143 +{
12144 + return RSPParserTokenNames;
12145 +}
12146 +
12147 +
12148 +/* Declare the bitsets
12149 + */
12150 +
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 };
12277 +
12278 +
12279 +
12280 +
12281 +/* ==============================================
12282 + * Parsing rules
12283 + */
12284 +/**
12285 + * $ANTLR start query
12286 + * RSP.g:27:1: query : expr ( NEWLINE )? EOF -> expr ;
12287 + */
12288 +static RSPParser_query_return
12289 +query(pRSPParser ctx)
12290 +{
12291 + RSPParser_query_return retval;
12292 +
12293 + pANTLR3_BASE_TREE root_0;
12294 +
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
12300 +
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
12307 + */
12308 +
12309 +
12310 + root_0 = NULL;
12311 +
12312 + NEWLINE2 = NULL;
12313 + EOF3 = NULL;
12314 + expr1.tree = NULL;
12315 +
12316 + retval.start = LT(1); retval.stop = retval.start;
12317 +
12318 + NEWLINE2_tree = NULL;
12319 + EOF3_tree = NULL;
12320 +
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"); }
12327 +
12328 + retval.tree = NULL;
12329 + {
12330 + // RSP.g:27:7: ( expr ( NEWLINE )? EOF -> expr )
12331 + // RSP.g:27:9: expr ( NEWLINE )? EOF
12332 + {
12333 + FOLLOWPUSH(FOLLOW_expr_in_query42);
12334 + expr1=expr(ctx);
12335 +
12336 + FOLLOWPOP();
12337 + if (HASEXCEPTION())
12338 + {
12339 + goto rulequeryEx;
12340 + }
12341 +
12342 + CREATE_stream_expr; stream_expr->add(stream_expr, expr1.tree, NULL);
12343 +
12344 + // RSP.g:27:14: ( NEWLINE )?
12345 + {
12346 + int alt1=2;
12347 + switch ( LA(1) )
12348 + {
12349 + case NEWLINE:
12350 + {
12351 + alt1=1;
12352 + }
12353 + break;
12354 + }
12355 +
12356 + switch (alt1)
12357 + {
12358 + case 1:
12359 + // RSP.g:27:14: NEWLINE
12360 + {
12361 + NEWLINE2 = (pANTLR3_COMMON_TOKEN) MATCHT(NEWLINE, &FOLLOW_NEWLINE_in_query44);
12362 + if (HASEXCEPTION())
12363 + {
12364 + goto rulequeryEx;
12365 + }
12366 +
12367 + CREATE_stream_NEWLINE; stream_NEWLINE->add(stream_NEWLINE, NEWLINE2, NULL);
12368 +
12369 +
12370 + }
12371 + break;
12372 +
12373 + }
12374 + }
12375 + EOF3 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_query47);
12376 + if (HASEXCEPTION())
12377 + {
12378 + goto rulequeryEx;
12379 + }
12380 +
12381 + CREATE_stream_EOF; stream_EOF->add(stream_EOF, EOF3, NULL);
12382 +
12383 +
12384 +
12385 + /* AST REWRITE
12386 + * elements : expr
12387 + * token labels :
12388 + * rule labels : retval
12389 + * token list labels :
12390 + * rule list labels :
12391 + */
12392 + {
12393 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
12394 +
12395 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
12396 +
12397 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12398 + retval.tree = root_0;
12399 + // 27:28: -> expr
12400 + {
12401 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
12402 +
12403 + }
12404 +
12405 + retval.tree = root_0; // set result root
12406 + if (stream_retval != NULL) stream_retval->free(stream_retval);
12407 +
12408 +
12409 + }
12410 + }
12411 +
12412 + }
12413 +
12414 +
12415 + // This is where rules clean up and exit
12416 + //
12417 + goto rulequeryEx; /* Prevent compiler warnings */
12418 + rulequeryEx: ;
12419 + retval.stop = LT(-1);
12420 +
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);
12427 +
12428 + if (HASEXCEPTION())
12429 + {
12430 + PREPORTERROR();
12431 + PRECOVER();
12432 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
12433 + }
12434 +
12435 +
12436 + return retval;
12437 +}
12438 +/* $ANTLR end query */
12439 +
12440 +/**
12441 + * $ANTLR start expr
12442 + * RSP.g:30:1: expr : aexpr ( OR aexpr )* ;
12443 + */
12444 +static RSPParser_expr_return
12445 +expr(pRSPParser ctx)
12446 +{
12447 + RSPParser_expr_return retval;
12448 +
12449 + pANTLR3_BASE_TREE root_0;
12450 +
12451 + pANTLR3_COMMON_TOKEN OR5;
12452 + RSPParser_aexpr_return aexpr4;
12453 + #undef RETURN_TYPE_aexpr4
12454 + #define RETURN_TYPE_aexpr4 RSPParser_aexpr_return
12455 +
12456 + RSPParser_aexpr_return aexpr6;
12457 + #undef RETURN_TYPE_aexpr6
12458 + #define RETURN_TYPE_aexpr6 RSPParser_aexpr_return
12459 +
12460 + pANTLR3_BASE_TREE OR5_tree;
12461 +
12462 + /* Initialize rule variables
12463 + */
12464 +
12465 +
12466 + root_0 = NULL;
12467 +
12468 + OR5 = NULL;
12469 + aexpr4.tree = NULL;
12470 +
12471 + aexpr6.tree = NULL;
12472 +
12473 + retval.start = LT(1); retval.stop = retval.start;
12474 +
12475 + OR5_tree = NULL;
12476 +
12477 +
12478 + retval.tree = NULL;
12479 + {
12480 + // RSP.g:30:6: ( aexpr ( OR aexpr )* )
12481 + // RSP.g:30:8: aexpr ( OR aexpr )*
12482 + {
12483 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12484 +
12485 + FOLLOWPUSH(FOLLOW_aexpr_in_expr63);
12486 + aexpr4=aexpr(ctx);
12487 +
12488 + FOLLOWPOP();
12489 + if (HASEXCEPTION())
12490 + {
12491 + goto ruleexprEx;
12492 + }
12493 +
12494 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr4.tree);
12495 +
12496 + // RSP.g:30:14: ( OR aexpr )*
12497 +
12498 + for (;;)
12499 + {
12500 + int alt2=2;
12501 + switch ( LA(1) )
12502 + {
12503 + case OR:
12504 + {
12505 + alt2=1;
12506 + }
12507 + break;
12508 +
12509 + }
12510 +
12511 + switch (alt2)
12512 + {
12513 + case 1:
12514 + // RSP.g:30:15: OR aexpr
12515 + {
12516 + OR5 = (pANTLR3_COMMON_TOKEN) MATCHT(OR, &FOLLOW_OR_in_expr66);
12517 + if (HASEXCEPTION())
12518 + {
12519 + goto ruleexprEx;
12520 + }
12521 +
12522 + OR5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OR5));
12523 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OR5_tree, root_0));
12524 +
12525 + FOLLOWPUSH(FOLLOW_aexpr_in_expr69);
12526 + aexpr6=aexpr(ctx);
12527 +
12528 + FOLLOWPOP();
12529 + if (HASEXCEPTION())
12530 + {
12531 + goto ruleexprEx;
12532 + }
12533 +
12534 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree);
12535 +
12536 + }
12537 + break;
12538 +
12539 + default:
12540 + goto loop2; /* break out of the loop */
12541 + break;
12542 + }
12543 + }
12544 + loop2: ; /* Jump out to here if this rule does not match */
12545 +
12546 +
12547 + }
12548 +
12549 + }
12550 +
12551 +
12552 + // This is where rules clean up and exit
12553 + //
12554 + goto ruleexprEx; /* Prevent compiler warnings */
12555 + ruleexprEx: ;
12556 + retval.stop = LT(-1);
12557 +
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);
12561 +
12562 + if (HASEXCEPTION())
12563 + {
12564 + PREPORTERROR();
12565 + PRECOVER();
12566 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
12567 + }
12568 +
12569 +
12570 + return retval;
12571 +}
12572 +/* $ANTLR end expr */
12573 +
12574 +/**
12575 + * $ANTLR start aexpr
12576 + * RSP.g:33:1: aexpr : crit ( AND crit )* ;
12577 + */
12578 +static RSPParser_aexpr_return
12579 +aexpr(pRSPParser ctx)
12580 +{
12581 + RSPParser_aexpr_return retval;
12582 +
12583 + pANTLR3_BASE_TREE root_0;
12584 +
12585 + pANTLR3_COMMON_TOKEN AND8;
12586 + RSPParser_crit_return crit7;
12587 + #undef RETURN_TYPE_crit7
12588 + #define RETURN_TYPE_crit7 RSPParser_crit_return
12589 +
12590 + RSPParser_crit_return crit9;
12591 + #undef RETURN_TYPE_crit9
12592 + #define RETURN_TYPE_crit9 RSPParser_crit_return
12593 +
12594 + pANTLR3_BASE_TREE AND8_tree;
12595 +
12596 + /* Initialize rule variables
12597 + */
12598 +
12599 +
12600 + root_0 = NULL;
12601 +
12602 + AND8 = NULL;
12603 + crit7.tree = NULL;
12604 +
12605 + crit9.tree = NULL;
12606 +
12607 + retval.start = LT(1); retval.stop = retval.start;
12608 +
12609 + AND8_tree = NULL;
12610 +
12611 +
12612 + retval.tree = NULL;
12613 + {
12614 + // RSP.g:33:7: ( crit ( AND crit )* )
12615 + // RSP.g:33:9: crit ( AND crit )*
12616 + {
12617 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12618 +
12619 + FOLLOWPUSH(FOLLOW_crit_in_aexpr81);
12620 + crit7=crit(ctx);
12621 +
12622 + FOLLOWPOP();
12623 + if (HASEXCEPTION())
12624 + {
12625 + goto ruleaexprEx;
12626 + }
12627 +
12628 + ADAPTOR->addChild(ADAPTOR, root_0, crit7.tree);
12629 +
12630 + // RSP.g:33:14: ( AND crit )*
12631 +
12632 + for (;;)
12633 + {
12634 + int alt3=2;
12635 + switch ( LA(1) )
12636 + {
12637 + case AND:
12638 + {
12639 + alt3=1;
12640 + }
12641 + break;
12642 +
12643 + }
12644 +
12645 + switch (alt3)
12646 + {
12647 + case 1:
12648 + // RSP.g:33:15: AND crit
12649 + {
12650 + AND8 = (pANTLR3_COMMON_TOKEN) MATCHT(AND, &FOLLOW_AND_in_aexpr84);
12651 + if (HASEXCEPTION())
12652 + {
12653 + goto ruleaexprEx;
12654 + }
12655 +
12656 + AND8_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AND8));
12657 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, AND8_tree, root_0));
12658 +
12659 + FOLLOWPUSH(FOLLOW_crit_in_aexpr87);
12660 + crit9=crit(ctx);
12661 +
12662 + FOLLOWPOP();
12663 + if (HASEXCEPTION())
12664 + {
12665 + goto ruleaexprEx;
12666 + }
12667 +
12668 + ADAPTOR->addChild(ADAPTOR, root_0, crit9.tree);
12669 +
12670 + }
12671 + break;
12672 +
12673 + default:
12674 + goto loop3; /* break out of the loop */
12675 + break;
12676 + }
12677 + }
12678 + loop3: ; /* Jump out to here if this rule does not match */
12679 +
12680 +
12681 + }
12682 +
12683 + }
12684 +
12685 +
12686 + // This is where rules clean up and exit
12687 + //
12688 + goto ruleaexprEx; /* Prevent compiler warnings */
12689 + ruleaexprEx: ;
12690 + retval.stop = LT(-1);
12691 +
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);
12695 +
12696 + if (HASEXCEPTION())
12697 + {
12698 + PREPORTERROR();
12699 + PRECOVER();
12700 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
12701 + }
12702 +
12703 +
12704 + return retval;
12705 +}
12706 +/* $ANTLR end aexpr */
12707 +
12708 +/**
12709 + * $ANTLR start crit
12710 + * RSP.g:36:1: crit : ( LPAR expr RPAR -> expr | strcrit | intcrit | datecrit );
12711 + */
12712 +static RSPParser_crit_return
12713 +crit(pRSPParser ctx)
12714 +{
12715 + RSPParser_crit_return retval;
12716 +
12717 + pANTLR3_BASE_TREE root_0;
12718 +
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
12724 +
12725 + RSPParser_strcrit_return strcrit13;
12726 + #undef RETURN_TYPE_strcrit13
12727 + #define RETURN_TYPE_strcrit13 RSPParser_strcrit_return
12728 +
12729 + RSPParser_intcrit_return intcrit14;
12730 + #undef RETURN_TYPE_intcrit14
12731 + #define RETURN_TYPE_intcrit14 RSPParser_intcrit_return
12732 +
12733 + RSPParser_datecrit_return datecrit15;
12734 + #undef RETURN_TYPE_datecrit15
12735 + #define RETURN_TYPE_datecrit15 RSPParser_datecrit_return
12736 +
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
12743 + */
12744 +
12745 +
12746 + root_0 = NULL;
12747 +
12748 + LPAR10 = NULL;
12749 + RPAR12 = NULL;
12750 + expr11.tree = NULL;
12751 +
12752 + strcrit13.tree = NULL;
12753 +
12754 + intcrit14.tree = NULL;
12755 +
12756 + datecrit15.tree = NULL;
12757 +
12758 + retval.start = LT(1); retval.stop = retval.start;
12759 +
12760 + LPAR10_tree = NULL;
12761 + RPAR12_tree = NULL;
12762 +
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"); }
12769 +
12770 + retval.tree = NULL;
12771 + {
12772 + {
12773 + // RSP.g:36:6: ( LPAR expr RPAR -> expr | strcrit | intcrit | datecrit )
12774 +
12775 + ANTLR3_UINT32 alt4;
12776 +
12777 + alt4=4;
12778 +
12779 + switch ( LA(1) )
12780 + {
12781 + case LPAR:
12782 + {
12783 + alt4=1;
12784 + }
12785 + break;
12786 + case FIELD:
12787 + {
12788 + switch ( LA(2) )
12789 + {
12790 + case NOT:
12791 + {
12792 + switch ( LA(3) )
12793 + {
12794 + case EQUAL:
12795 + {
12796 + switch ( LA(4) )
12797 + {
12798 + case STR:
12799 + {
12800 + alt4=2;
12801 + }
12802 + break;
12803 + case INT:
12804 + {
12805 + alt4=3;
12806 + }
12807 + break;
12808 +
12809 + default:
12810 + CONSTRUCTEX();
12811 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12812 + EXCEPTION->message = (void *)"";
12813 + EXCEPTION->decisionNum = 4;
12814 + EXCEPTION->state = 8;
12815 +
12816 +
12817 + goto rulecritEx;
12818 + }
12819 +
12820 + }
12821 + break;
12822 + case INCLUDES:
12823 + case STARTSW:
12824 + case ENDSW:
12825 + {
12826 + alt4=2;
12827 + }
12828 + break;
12829 + case LESS:
12830 + case GREATER:
12831 + case LTE:
12832 + case GTE:
12833 + {
12834 + alt4=3;
12835 + }
12836 + break;
12837 +
12838 + default:
12839 + CONSTRUCTEX();
12840 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12841 + EXCEPTION->message = (void *)"";
12842 + EXCEPTION->decisionNum = 4;
12843 + EXCEPTION->state = 3;
12844 +
12845 +
12846 + goto rulecritEx;
12847 + }
12848 +
12849 + }
12850 + break;
12851 + case EQUAL:
12852 + {
12853 + switch ( LA(3) )
12854 + {
12855 + case INT:
12856 + {
12857 + alt4=3;
12858 + }
12859 + break;
12860 + case STR:
12861 + {
12862 + alt4=2;
12863 + }
12864 + break;
12865 +
12866 + default:
12867 + CONSTRUCTEX();
12868 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12869 + EXCEPTION->message = (void *)"";
12870 + EXCEPTION->decisionNum = 4;
12871 + EXCEPTION->state = 4;
12872 +
12873 +
12874 + goto rulecritEx;
12875 + }
12876 +
12877 + }
12878 + break;
12879 + case BEFORE:
12880 + case AFTER:
12881 + {
12882 + alt4=4;
12883 + }
12884 + break;
12885 + case LESS:
12886 + case GREATER:
12887 + case LTE:
12888 + case GTE:
12889 + {
12890 + alt4=3;
12891 + }
12892 + break;
12893 + case INCLUDES:
12894 + case STARTSW:
12895 + case ENDSW:
12896 + {
12897 + alt4=2;
12898 + }
12899 + break;
12900 +
12901 + default:
12902 + CONSTRUCTEX();
12903 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12904 + EXCEPTION->message = (void *)"";
12905 + EXCEPTION->decisionNum = 4;
12906 + EXCEPTION->state = 2;
12907 +
12908 +
12909 + goto rulecritEx;
12910 + }
12911 +
12912 + }
12913 + break;
12914 +
12915 + default:
12916 + CONSTRUCTEX();
12917 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
12918 + EXCEPTION->message = (void *)"";
12919 + EXCEPTION->decisionNum = 4;
12920 + EXCEPTION->state = 0;
12921 +
12922 +
12923 + goto rulecritEx;
12924 + }
12925 +
12926 + switch (alt4)
12927 + {
12928 + case 1:
12929 + // RSP.g:36:8: LPAR expr RPAR
12930 + {
12931 + LPAR10 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit99);
12932 + if (HASEXCEPTION())
12933 + {
12934 + goto rulecritEx;
12935 + }
12936 +
12937 + CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR10, NULL);
12938 +
12939 + FOLLOWPUSH(FOLLOW_expr_in_crit101);
12940 + expr11=expr(ctx);
12941 +
12942 + FOLLOWPOP();
12943 + if (HASEXCEPTION())
12944 + {
12945 + goto rulecritEx;
12946 + }
12947 +
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())
12951 + {
12952 + goto rulecritEx;
12953 + }
12954 +
12955 + CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR12, NULL);
12956 +
12957 +
12958 +
12959 + /* AST REWRITE
12960 + * elements : expr
12961 + * token labels :
12962 + * rule labels : retval
12963 + * token list labels :
12964 + * rule list labels :
12965 + */
12966 + {
12967 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
12968 +
12969 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
12970 +
12971 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12972 + retval.tree = root_0;
12973 + // 36:25: -> expr
12974 + {
12975 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
12976 +
12977 + }
12978 +
12979 + retval.tree = root_0; // set result root
12980 + if (stream_retval != NULL) stream_retval->free(stream_retval);
12981 +
12982 +
12983 + }
12984 + }
12985 + break;
12986 + case 2:
12987 + // RSP.g:37:4: strcrit
12988 + {
12989 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
12990 +
12991 + FOLLOWPUSH(FOLLOW_strcrit_in_crit114);
12992 + strcrit13=strcrit(ctx);
12993 +
12994 + FOLLOWPOP();
12995 + if (HASEXCEPTION())
12996 + {
12997 + goto rulecritEx;
12998 + }
12999 +
13000 + ADAPTOR->addChild(ADAPTOR, root_0, strcrit13.tree);
13001 +
13002 + }
13003 + break;
13004 + case 3:
13005 + // RSP.g:38:4: intcrit
13006 + {
13007 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13008 +
13009 + FOLLOWPUSH(FOLLOW_intcrit_in_crit119);
13010 + intcrit14=intcrit(ctx);
13011 +
13012 + FOLLOWPOP();
13013 + if (HASEXCEPTION())
13014 + {
13015 + goto rulecritEx;
13016 + }
13017 +
13018 + ADAPTOR->addChild(ADAPTOR, root_0, intcrit14.tree);
13019 +
13020 + }
13021 + break;
13022 + case 4:
13023 + // RSP.g:39:4: datecrit
13024 + {
13025 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13026 +
13027 + FOLLOWPUSH(FOLLOW_datecrit_in_crit124);
13028 + datecrit15=datecrit(ctx);
13029 +
13030 + FOLLOWPOP();
13031 + if (HASEXCEPTION())
13032 + {
13033 + goto rulecritEx;
13034 + }
13035 +
13036 + ADAPTOR->addChild(ADAPTOR, root_0, datecrit15.tree);
13037 +
13038 + }
13039 + break;
13040 +
13041 + }
13042 + }
13043 + }
13044 +
13045 +
13046 + // This is where rules clean up and exit
13047 + //
13048 + goto rulecritEx; /* Prevent compiler warnings */
13049 + rulecritEx: ;
13050 + retval.stop = LT(-1);
13051 +
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);
13058 +
13059 + if (HASEXCEPTION())
13060 + {
13061 + PREPORTERROR();
13062 + PRECOVER();
13063 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13064 + }
13065 +
13066 +
13067 + return retval;
13068 +}
13069 +/* $ANTLR end crit */
13070 +
13071 +/**
13072 + * $ANTLR start strcrit
13073 + * RSP.g:42:1: strcrit : ( FIELD strop STR -> ^( strop FIELD STR ) | FIELD NOT strop STR -> ^( NOT ^( strop FIELD STR ) ) );
13074 + */
13075 +static RSPParser_strcrit_return
13076 +strcrit(pRSPParser ctx)
13077 +{
13078 + RSPParser_strcrit_return retval;
13079 +
13080 + pANTLR3_BASE_TREE root_0;
13081 +
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
13090 +
13091 + RSPParser_strop_return strop21;
13092 + #undef RETURN_TYPE_strop21
13093 + #define RETURN_TYPE_strop21 RSPParser_strop_return
13094 +
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
13105 + */
13106 +
13107 +
13108 + root_0 = NULL;
13109 +
13110 + FIELD16 = NULL;
13111 + STR18 = NULL;
13112 + FIELD19 = NULL;
13113 + NOT20 = NULL;
13114 + STR22 = NULL;
13115 + strop17.tree = NULL;
13116 +
13117 + strop21.tree = NULL;
13118 +
13119 + retval.start = LT(1); retval.stop = retval.start;
13120 +
13121 + FIELD16_tree = NULL;
13122 + STR18_tree = NULL;
13123 + FIELD19_tree = NULL;
13124 + NOT20_tree = NULL;
13125 + STR22_tree = NULL;
13126 +
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"); }
13135 +
13136 + retval.tree = NULL;
13137 + {
13138 + {
13139 + // RSP.g:42:9: ( FIELD strop STR -> ^( strop FIELD STR ) | FIELD NOT strop STR -> ^( NOT ^( strop FIELD STR ) ) )
13140 +
13141 + ANTLR3_UINT32 alt5;
13142 +
13143 + alt5=2;
13144 +
13145 + switch ( LA(1) )
13146 + {
13147 + case FIELD:
13148 + {
13149 + switch ( LA(2) )
13150 + {
13151 + case NOT:
13152 + {
13153 + alt5=2;
13154 + }
13155 + break;
13156 + case EQUAL:
13157 + case INCLUDES:
13158 + case STARTSW:
13159 + case ENDSW:
13160 + {
13161 + alt5=1;
13162 + }
13163 + break;
13164 +
13165 + default:
13166 + CONSTRUCTEX();
13167 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13168 + EXCEPTION->message = (void *)"";
13169 + EXCEPTION->decisionNum = 5;
13170 + EXCEPTION->state = 1;
13171 +
13172 +
13173 + goto rulestrcritEx;
13174 + }
13175 +
13176 + }
13177 + break;
13178 +
13179 + default:
13180 + CONSTRUCTEX();
13181 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13182 + EXCEPTION->message = (void *)"";
13183 + EXCEPTION->decisionNum = 5;
13184 + EXCEPTION->state = 0;
13185 +
13186 +
13187 + goto rulestrcritEx;
13188 + }
13189 +
13190 + switch (alt5)
13191 + {
13192 + case 1:
13193 + // RSP.g:42:11: FIELD strop STR
13194 + {
13195 + FIELD16 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit134);
13196 + if (HASEXCEPTION())
13197 + {
13198 + goto rulestrcritEx;
13199 + }
13200 +
13201 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD16, NULL);
13202 +
13203 + FOLLOWPUSH(FOLLOW_strop_in_strcrit136);
13204 + strop17=strop(ctx);
13205 +
13206 + FOLLOWPOP();
13207 + if (HASEXCEPTION())
13208 + {
13209 + goto rulestrcritEx;
13210 + }
13211 +
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())
13215 + {
13216 + goto rulestrcritEx;
13217 + }
13218 +
13219 + CREATE_stream_STR; stream_STR->add(stream_STR, STR18, NULL);
13220 +
13221 +
13222 +
13223 + /* AST REWRITE
13224 + * elements : strop, STR, FIELD
13225 + * token labels :
13226 + * rule labels : retval
13227 + * token list labels :
13228 + * rule list labels :
13229 + */
13230 + {
13231 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13232 +
13233 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13234 +
13235 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13236 + retval.tree = root_0;
13237 + // 42:29: -> ^( strop FIELD STR )
13238 + {
13239 + // RSP.g:42:32: ^( strop FIELD STR )
13240 + {
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));
13243 +
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));
13246 +
13247 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13248 + }
13249 +
13250 + }
13251 +
13252 + retval.tree = root_0; // set result root
13253 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13254 +
13255 +
13256 + }
13257 + }
13258 + break;
13259 + case 2:
13260 + // RSP.g:43:4: FIELD NOT strop STR
13261 + {
13262 + FIELD19 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit155);
13263 + if (HASEXCEPTION())
13264 + {
13265 + goto rulestrcritEx;
13266 + }
13267 +
13268 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD19, NULL);
13269 +
13270 + NOT20 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_strcrit157);
13271 + if (HASEXCEPTION())
13272 + {
13273 + goto rulestrcritEx;
13274 + }
13275 +
13276 + CREATE_stream_NOT; stream_NOT->add(stream_NOT, NOT20, NULL);
13277 +
13278 + FOLLOWPUSH(FOLLOW_strop_in_strcrit159);
13279 + strop21=strop(ctx);
13280 +
13281 + FOLLOWPOP();
13282 + if (HASEXCEPTION())
13283 + {
13284 + goto rulestrcritEx;
13285 + }
13286 +
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())
13290 + {
13291 + goto rulestrcritEx;
13292 + }
13293 +
13294 + CREATE_stream_STR; stream_STR->add(stream_STR, STR22, NULL);
13295 +
13296 +
13297 +
13298 + /* AST REWRITE
13299 + * elements : NOT, strop, STR, FIELD
13300 + * token labels :
13301 + * rule labels : retval
13302 + * token list labels :
13303 + * rule list labels :
13304 + */
13305 + {
13306 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13307 +
13308 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13309 +
13310 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13311 + retval.tree = root_0;
13312 + // 43:25: -> ^( NOT ^( strop FIELD STR ) )
13313 + {
13314 + // RSP.g:43:28: ^( NOT ^( strop FIELD STR ) )
13315 + {
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));
13318 +
13319 + // RSP.g:43:34: ^( strop FIELD STR )
13320 + {
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));
13323 +
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));
13326 +
13327 + ADAPTOR->addChild(ADAPTOR, root_1, root_2);
13328 + }
13329 +
13330 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13331 + }
13332 +
13333 + }
13334 +
13335 + retval.tree = root_0; // set result root
13336 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13337 +
13338 +
13339 + }
13340 + }
13341 + break;
13342 +
13343 + }
13344 + }
13345 + }
13346 +
13347 +
13348 + // This is where rules clean up and exit
13349 + //
13350 + goto rulestrcritEx; /* Prevent compiler warnings */
13351 + rulestrcritEx: ;
13352 + retval.stop = LT(-1);
13353 +
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);
13361 +
13362 + if (HASEXCEPTION())
13363 + {
13364 + PREPORTERROR();
13365 + PRECOVER();
13366 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13367 + }
13368 +
13369 +
13370 + return retval;
13371 +}
13372 +/* $ANTLR end strcrit */
13373 +
13374 +/**
13375 + * $ANTLR start strop
13376 + * RSP.g:46:1: strop : ( EQUAL | INCLUDES | STARTSW | ENDSW );
13377 + */
13378 +static RSPParser_strop_return
13379 +strop(pRSPParser ctx)
13380 +{
13381 + RSPParser_strop_return retval;
13382 +
13383 + pANTLR3_BASE_TREE root_0;
13384 +
13385 + pANTLR3_COMMON_TOKEN set23;
13386 +
13387 + pANTLR3_BASE_TREE set23_tree;
13388 +
13389 + /* Initialize rule variables
13390 + */
13391 +
13392 +
13393 + root_0 = NULL;
13394 +
13395 + set23 = NULL;
13396 + retval.start = LT(1); retval.stop = retval.start;
13397 +
13398 + set23_tree = NULL;
13399 +
13400 +
13401 + retval.tree = NULL;
13402 + {
13403 + // RSP.g:46:7: ( EQUAL | INCLUDES | STARTSW | ENDSW )
13404 + // RSP.g:
13405 + {
13406 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13407 +
13408 + set23=(pANTLR3_COMMON_TOKEN)LT(1);
13409 + if ( ((LA(1) >= EQUAL) && (LA(1) <= ENDSW)) )
13410 + {
13411 + CONSUME();
13412 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set23)));
13413 + PERRORRECOVERY=ANTLR3_FALSE;
13414 + }
13415 + else
13416 + {
13417 + CONSTRUCTEX();
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;
13422 + }
13423 +
13424 +
13425 + }
13426 +
13427 + }
13428 +
13429 +
13430 + // This is where rules clean up and exit
13431 + //
13432 + goto rulestropEx; /* Prevent compiler warnings */
13433 + rulestropEx: ;
13434 + retval.stop = LT(-1);
13435 +
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);
13439 +
13440 + if (HASEXCEPTION())
13441 + {
13442 + PREPORTERROR();
13443 + PRECOVER();
13444 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13445 + }
13446 +
13447 +
13448 + return retval;
13449 +}
13450 +/* $ANTLR end strop */
13451 +
13452 +/**
13453 + * $ANTLR start intcrit
13454 + * RSP.g:52:1: intcrit : ( FIELD intop INT -> ^( intop FIELD INT ) | FIELD NOT intop INT -> ^( NOT ^( intop FIELD INT ) ) );
13455 + */
13456 +static RSPParser_intcrit_return
13457 +intcrit(pRSPParser ctx)
13458 +{
13459 + RSPParser_intcrit_return retval;
13460 +
13461 + pANTLR3_BASE_TREE root_0;
13462 +
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
13471 +
13472 + RSPParser_intop_return intop29;
13473 + #undef RETURN_TYPE_intop29
13474 + #define RETURN_TYPE_intop29 RSPParser_intop_return
13475 +
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
13486 + */
13487 +
13488 +
13489 + root_0 = NULL;
13490 +
13491 + FIELD24 = NULL;
13492 + INT26 = NULL;
13493 + FIELD27 = NULL;
13494 + NOT28 = NULL;
13495 + INT30 = NULL;
13496 + intop25.tree = NULL;
13497 +
13498 + intop29.tree = NULL;
13499 +
13500 + retval.start = LT(1); retval.stop = retval.start;
13501 +
13502 + FIELD24_tree = NULL;
13503 + INT26_tree = NULL;
13504 + FIELD27_tree = NULL;
13505 + NOT28_tree = NULL;
13506 + INT30_tree = NULL;
13507 +
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"); }
13516 +
13517 + retval.tree = NULL;
13518 + {
13519 + {
13520 + // RSP.g:52:9: ( FIELD intop INT -> ^( intop FIELD INT ) | FIELD NOT intop INT -> ^( NOT ^( intop FIELD INT ) ) )
13521 +
13522 + ANTLR3_UINT32 alt6;
13523 +
13524 + alt6=2;
13525 +
13526 + switch ( LA(1) )
13527 + {
13528 + case FIELD:
13529 + {
13530 + switch ( LA(2) )
13531 + {
13532 + case NOT:
13533 + {
13534 + alt6=2;
13535 + }
13536 + break;
13537 + case EQUAL:
13538 + case LESS:
13539 + case GREATER:
13540 + case LTE:
13541 + case GTE:
13542 + {
13543 + alt6=1;
13544 + }
13545 + break;
13546 +
13547 + default:
13548 + CONSTRUCTEX();
13549 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13550 + EXCEPTION->message = (void *)"";
13551 + EXCEPTION->decisionNum = 6;
13552 + EXCEPTION->state = 1;
13553 +
13554 +
13555 + goto ruleintcritEx;
13556 + }
13557 +
13558 + }
13559 + break;
13560 +
13561 + default:
13562 + CONSTRUCTEX();
13563 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
13564 + EXCEPTION->message = (void *)"";
13565 + EXCEPTION->decisionNum = 6;
13566 + EXCEPTION->state = 0;
13567 +
13568 +
13569 + goto ruleintcritEx;
13570 + }
13571 +
13572 + switch (alt6)
13573 + {
13574 + case 1:
13575 + // RSP.g:52:11: FIELD intop INT
13576 + {
13577 + FIELD24 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit211);
13578 + if (HASEXCEPTION())
13579 + {
13580 + goto ruleintcritEx;
13581 + }
13582 +
13583 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD24, NULL);
13584 +
13585 + FOLLOWPUSH(FOLLOW_intop_in_intcrit213);
13586 + intop25=intop(ctx);
13587 +
13588 + FOLLOWPOP();
13589 + if (HASEXCEPTION())
13590 + {
13591 + goto ruleintcritEx;
13592 + }
13593 +
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())
13597 + {
13598 + goto ruleintcritEx;
13599 + }
13600 +
13601 + CREATE_stream_INT; stream_INT->add(stream_INT, INT26, NULL);
13602 +
13603 +
13604 +
13605 + /* AST REWRITE
13606 + * elements : intop, INT, FIELD
13607 + * token labels :
13608 + * rule labels : retval
13609 + * token list labels :
13610 + * rule list labels :
13611 + */
13612 + {
13613 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13614 +
13615 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13616 +
13617 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13618 + retval.tree = root_0;
13619 + // 52:29: -> ^( intop FIELD INT )
13620 + {
13621 + // RSP.g:52:32: ^( intop FIELD INT )
13622 + {
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));
13625 +
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));
13628 +
13629 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13630 + }
13631 +
13632 + }
13633 +
13634 + retval.tree = root_0; // set result root
13635 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13636 +
13637 +
13638 + }
13639 + }
13640 + break;
13641 + case 2:
13642 + // RSP.g:53:4: FIELD NOT intop INT
13643 + {
13644 + FIELD27 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit232);
13645 + if (HASEXCEPTION())
13646 + {
13647 + goto ruleintcritEx;
13648 + }
13649 +
13650 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD27, NULL);
13651 +
13652 + NOT28 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_intcrit234);
13653 + if (HASEXCEPTION())
13654 + {
13655 + goto ruleintcritEx;
13656 + }
13657 +
13658 + CREATE_stream_NOT; stream_NOT->add(stream_NOT, NOT28, NULL);
13659 +
13660 + FOLLOWPUSH(FOLLOW_intop_in_intcrit236);
13661 + intop29=intop(ctx);
13662 +
13663 + FOLLOWPOP();
13664 + if (HASEXCEPTION())
13665 + {
13666 + goto ruleintcritEx;
13667 + }
13668 +
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())
13672 + {
13673 + goto ruleintcritEx;
13674 + }
13675 +
13676 + CREATE_stream_INT; stream_INT->add(stream_INT, INT30, NULL);
13677 +
13678 +
13679 +
13680 + /* AST REWRITE
13681 + * elements : INT, FIELD, intop, NOT
13682 + * token labels :
13683 + * rule labels : retval
13684 + * token list labels :
13685 + * rule list labels :
13686 + */
13687 + {
13688 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13689 +
13690 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13691 +
13692 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13693 + retval.tree = root_0;
13694 + // 53:25: -> ^( NOT ^( intop FIELD INT ) )
13695 + {
13696 + // RSP.g:53:28: ^( NOT ^( intop FIELD INT ) )
13697 + {
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));
13700 +
13701 + // RSP.g:53:34: ^( intop FIELD INT )
13702 + {
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));
13705 +
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));
13708 +
13709 + ADAPTOR->addChild(ADAPTOR, root_1, root_2);
13710 + }
13711 +
13712 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13713 + }
13714 +
13715 + }
13716 +
13717 + retval.tree = root_0; // set result root
13718 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13719 +
13720 +
13721 + }
13722 + }
13723 + break;
13724 +
13725 + }
13726 + }
13727 + }
13728 +
13729 +
13730 + // This is where rules clean up and exit
13731 + //
13732 + goto ruleintcritEx; /* Prevent compiler warnings */
13733 + ruleintcritEx: ;
13734 + retval.stop = LT(-1);
13735 +
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);
13743 +
13744 + if (HASEXCEPTION())
13745 + {
13746 + PREPORTERROR();
13747 + PRECOVER();
13748 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13749 + }
13750 +
13751 +
13752 + return retval;
13753 +}
13754 +/* $ANTLR end intcrit */
13755 +
13756 +/**
13757 + * $ANTLR start intop
13758 + * RSP.g:56:1: intop : ( EQUAL | LESS | GREATER | LTE | GTE );
13759 + */
13760 +static RSPParser_intop_return
13761 +intop(pRSPParser ctx)
13762 +{
13763 + RSPParser_intop_return retval;
13764 +
13765 + pANTLR3_BASE_TREE root_0;
13766 +
13767 + pANTLR3_COMMON_TOKEN set31;
13768 +
13769 + pANTLR3_BASE_TREE set31_tree;
13770 +
13771 + /* Initialize rule variables
13772 + */
13773 +
13774 +
13775 + root_0 = NULL;
13776 +
13777 + set31 = NULL;
13778 + retval.start = LT(1); retval.stop = retval.start;
13779 +
13780 + set31_tree = NULL;
13781 +
13782 +
13783 + retval.tree = NULL;
13784 + {
13785 + // RSP.g:56:7: ( EQUAL | LESS | GREATER | LTE | GTE )
13786 + // RSP.g:
13787 + {
13788 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13789 +
13790 + set31=(pANTLR3_COMMON_TOKEN)LT(1);
13791 + if ( LA(1) == EQUAL || ((LA(1) >= LESS) && (LA(1) <= GTE)) )
13792 + {
13793 + CONSUME();
13794 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set31)));
13795 + PERRORRECOVERY=ANTLR3_FALSE;
13796 + }
13797 + else
13798 + {
13799 + CONSTRUCTEX();
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;
13804 + }
13805 +
13806 +
13807 + }
13808 +
13809 + }
13810 +
13811 +
13812 + // This is where rules clean up and exit
13813 + //
13814 + goto ruleintopEx; /* Prevent compiler warnings */
13815 + ruleintopEx: ;
13816 + retval.stop = LT(-1);
13817 +
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);
13821 +
13822 + if (HASEXCEPTION())
13823 + {
13824 + PREPORTERROR();
13825 + PRECOVER();
13826 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13827 + }
13828 +
13829 +
13830 + return retval;
13831 +}
13832 +/* $ANTLR end intop */
13833 +
13834 +/**
13835 + * $ANTLR start datecrit
13836 + * RSP.g:63:1: datecrit : FIELD dateop datespec -> ^( dateop FIELD datespec ) ;
13837 + */
13838 +static RSPParser_datecrit_return
13839 +datecrit(pRSPParser ctx)
13840 +{
13841 + RSPParser_datecrit_return retval;
13842 +
13843 + pANTLR3_BASE_TREE root_0;
13844 +
13845 + pANTLR3_COMMON_TOKEN FIELD32;
13846 + RSPParser_dateop_return dateop33;
13847 + #undef RETURN_TYPE_dateop33
13848 + #define RETURN_TYPE_dateop33 RSPParser_dateop_return
13849 +
13850 + RSPParser_datespec_return datespec34;
13851 + #undef RETURN_TYPE_datespec34
13852 + #define RETURN_TYPE_datespec34 RSPParser_datespec_return
13853 +
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
13859 + */
13860 +
13861 +
13862 + root_0 = NULL;
13863 +
13864 + FIELD32 = NULL;
13865 + dateop33.tree = NULL;
13866 +
13867 + datespec34.tree = NULL;
13868 +
13869 + retval.start = LT(1); retval.stop = retval.start;
13870 +
13871 + FIELD32_tree = NULL;
13872 +
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"); }
13879 +
13880 + retval.tree = NULL;
13881 + {
13882 + // RSP.g:63:9: ( FIELD dateop datespec -> ^( dateop FIELD datespec ) )
13883 + // RSP.g:63:11: FIELD dateop datespec
13884 + {
13885 + FIELD32 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_datecrit292);
13886 + if (HASEXCEPTION())
13887 + {
13888 + goto ruledatecritEx;
13889 + }
13890 +
13891 + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD32, NULL);
13892 +
13893 + FOLLOWPUSH(FOLLOW_dateop_in_datecrit294);
13894 + dateop33=dateop(ctx);
13895 +
13896 + FOLLOWPOP();
13897 + if (HASEXCEPTION())
13898 + {
13899 + goto ruledatecritEx;
13900 + }
13901 +
13902 + CREATE_stream_dateop; stream_dateop->add(stream_dateop, dateop33.tree, NULL);
13903 + FOLLOWPUSH(FOLLOW_datespec_in_datecrit296);
13904 + datespec34=datespec(ctx);
13905 +
13906 + FOLLOWPOP();
13907 + if (HASEXCEPTION())
13908 + {
13909 + goto ruledatecritEx;
13910 + }
13911 +
13912 + CREATE_stream_datespec; stream_datespec->add(stream_datespec, datespec34.tree, NULL);
13913 +
13914 +
13915 + /* AST REWRITE
13916 + * elements : datespec, FIELD, dateop
13917 + * token labels :
13918 + * rule labels : retval
13919 + * token list labels :
13920 + * rule list labels :
13921 + */
13922 + {
13923 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
13924 +
13925 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
13926 +
13927 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
13928 + retval.tree = root_0;
13929 + // 63:34: -> ^( dateop FIELD datespec )
13930 + {
13931 + // RSP.g:63:37: ^( dateop FIELD datespec )
13932 + {
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));
13935 +
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));
13938 +
13939 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
13940 + }
13941 +
13942 + }
13943 +
13944 + retval.tree = root_0; // set result root
13945 + if (stream_retval != NULL) stream_retval->free(stream_retval);
13946 +
13947 +
13948 + }
13949 + }
13950 +
13951 + }
13952 +
13953 +
13954 + // This is where rules clean up and exit
13955 + //
13956 + goto ruledatecritEx; /* Prevent compiler warnings */
13957 + ruledatecritEx: ;
13958 + retval.stop = LT(-1);
13959 +
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);
13966 +
13967 + if (HASEXCEPTION())
13968 + {
13969 + PREPORTERROR();
13970 + PRECOVER();
13971 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
13972 + }
13973 +
13974 +
13975 + return retval;
13976 +}
13977 +/* $ANTLR end datecrit */
13978 +
13979 +/**
13980 + * $ANTLR start dateop
13981 + * RSP.g:66:1: dateop : ( BEFORE | AFTER );
13982 + */
13983 +static RSPParser_dateop_return
13984 +dateop(pRSPParser ctx)
13985 +{
13986 + RSPParser_dateop_return retval;
13987 +
13988 + pANTLR3_BASE_TREE root_0;
13989 +
13990 + pANTLR3_COMMON_TOKEN set35;
13991 +
13992 + pANTLR3_BASE_TREE set35_tree;
13993 +
13994 + /* Initialize rule variables
13995 + */
13996 +
13997 +
13998 + root_0 = NULL;
13999 +
14000 + set35 = NULL;
14001 + retval.start = LT(1); retval.stop = retval.start;
14002 +
14003 + set35_tree = NULL;
14004 +
14005 +
14006 + retval.tree = NULL;
14007 + {
14008 + // RSP.g:66:8: ( BEFORE | AFTER )
14009 + // RSP.g:
14010 + {
14011 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14012 +
14013 + set35=(pANTLR3_COMMON_TOKEN)LT(1);
14014 + if ( ((LA(1) >= BEFORE) && (LA(1) <= AFTER)) )
14015 + {
14016 + CONSUME();
14017 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set35)));
14018 + PERRORRECOVERY=ANTLR3_FALSE;
14019 + }
14020 + else
14021 + {
14022 + CONSTRUCTEX();
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;
14027 + }
14028 +
14029 +
14030 + }
14031 +
14032 + }
14033 +
14034 +
14035 + // This is where rules clean up and exit
14036 + //
14037 + goto ruledateopEx; /* Prevent compiler warnings */
14038 + ruledateopEx: ;
14039 + retval.stop = LT(-1);
14040 +
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);
14044 +
14045 + if (HASEXCEPTION())
14046 + {
14047 + PREPORTERROR();
14048 + PRECOVER();
14049 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14050 + }
14051 +
14052 +
14053 + return retval;
14054 +}
14055 +/* $ANTLR end dateop */
14056 +
14057 +/**
14058 + * $ANTLR start datespec
14059 + * RSP.g:70:1: datespec : ( dateref | INT dateintval dateop dateref -> ^( dateop dateref INT dateintval ) );
14060 + */
14061 +static RSPParser_datespec_return
14062 +datespec(pRSPParser ctx)
14063 +{
14064 + RSPParser_datespec_return retval;
14065 +
14066 + pANTLR3_BASE_TREE root_0;
14067 +
14068 + pANTLR3_COMMON_TOKEN INT37;
14069 + RSPParser_dateref_return dateref36;
14070 + #undef RETURN_TYPE_dateref36
14071 + #define RETURN_TYPE_dateref36 RSPParser_dateref_return
14072 +
14073 + RSPParser_dateintval_return dateintval38;
14074 + #undef RETURN_TYPE_dateintval38
14075 + #define RETURN_TYPE_dateintval38 RSPParser_dateintval_return
14076 +
14077 + RSPParser_dateop_return dateop39;
14078 + #undef RETURN_TYPE_dateop39
14079 + #define RETURN_TYPE_dateop39 RSPParser_dateop_return
14080 +
14081 + RSPParser_dateref_return dateref40;
14082 + #undef RETURN_TYPE_dateref40
14083 + #define RETURN_TYPE_dateref40 RSPParser_dateref_return
14084 +
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
14091 + */
14092 +
14093 +
14094 + root_0 = NULL;
14095 +
14096 + INT37 = NULL;
14097 + dateref36.tree = NULL;
14098 +
14099 + dateintval38.tree = NULL;
14100 +
14101 + dateop39.tree = NULL;
14102 +
14103 + dateref40.tree = NULL;
14104 +
14105 + retval.start = LT(1); retval.stop = retval.start;
14106 +
14107 + INT37_tree = NULL;
14108 +
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"); }
14117 +
14118 + retval.tree = NULL;
14119 + {
14120 + {
14121 + // RSP.g:70:9: ( dateref | INT dateintval dateop dateref -> ^( dateop dateref INT dateintval ) )
14122 +
14123 + ANTLR3_UINT32 alt7;
14124 +
14125 + alt7=2;
14126 +
14127 + switch ( LA(1) )
14128 + {
14129 + case DATE:
14130 + case TODAY:
14131 + {
14132 + alt7=1;
14133 + }
14134 + break;
14135 + case INT:
14136 + {
14137 + alt7=2;
14138 + }
14139 + break;
14140 +
14141 + default:
14142 + CONSTRUCTEX();
14143 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
14144 + EXCEPTION->message = (void *)"";
14145 + EXCEPTION->decisionNum = 7;
14146 + EXCEPTION->state = 0;
14147 +
14148 +
14149 + goto ruledatespecEx;
14150 + }
14151 +
14152 + switch (alt7)
14153 + {
14154 + case 1:
14155 + // RSP.g:70:11: dateref
14156 + {
14157 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14158 +
14159 + FOLLOWPUSH(FOLLOW_dateref_in_datespec331);
14160 + dateref36=dateref(ctx);
14161 +
14162 + FOLLOWPOP();
14163 + if (HASEXCEPTION())
14164 + {
14165 + goto ruledatespecEx;
14166 + }
14167 +
14168 + ADAPTOR->addChild(ADAPTOR, root_0, dateref36.tree);
14169 +
14170 + }
14171 + break;
14172 + case 2:
14173 + // RSP.g:71:4: INT dateintval dateop dateref
14174 + {
14175 + INT37 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_datespec336);
14176 + if (HASEXCEPTION())
14177 + {
14178 + goto ruledatespecEx;
14179 + }
14180 +
14181 + CREATE_stream_INT; stream_INT->add(stream_INT, INT37, NULL);
14182 +
14183 + FOLLOWPUSH(FOLLOW_dateintval_in_datespec338);
14184 + dateintval38=dateintval(ctx);
14185 +
14186 + FOLLOWPOP();
14187 + if (HASEXCEPTION())
14188 + {
14189 + goto ruledatespecEx;
14190 + }
14191 +
14192 + CREATE_stream_dateintval; stream_dateintval->add(stream_dateintval, dateintval38.tree, NULL);
14193 + FOLLOWPUSH(FOLLOW_dateop_in_datespec340);
14194 + dateop39=dateop(ctx);
14195 +
14196 + FOLLOWPOP();
14197 + if (HASEXCEPTION())
14198 + {
14199 + goto ruledatespecEx;
14200 + }
14201 +
14202 + CREATE_stream_dateop; stream_dateop->add(stream_dateop, dateop39.tree, NULL);
14203 + FOLLOWPUSH(FOLLOW_dateref_in_datespec342);
14204 + dateref40=dateref(ctx);
14205 +
14206 + FOLLOWPOP();
14207 + if (HASEXCEPTION())
14208 + {
14209 + goto ruledatespecEx;
14210 + }
14211 +
14212 + CREATE_stream_dateref; stream_dateref->add(stream_dateref, dateref40.tree, NULL);
14213 +
14214 +
14215 + /* AST REWRITE
14216 + * elements : INT, dateintval, dateop, dateref
14217 + * token labels :
14218 + * rule labels : retval
14219 + * token list labels :
14220 + * rule list labels :
14221 + */
14222 + {
14223 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
14224 +
14225 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
14226 +
14227 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14228 + retval.tree = root_0;
14229 + // 71:34: -> ^( dateop dateref INT dateintval )
14230 + {
14231 + // RSP.g:71:37: ^( dateop dateref INT dateintval )
14232 + {
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));
14235 +
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));
14239 +
14240 + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
14241 + }
14242 +
14243 + }
14244 +
14245 + retval.tree = root_0; // set result root
14246 + if (stream_retval != NULL) stream_retval->free(stream_retval);
14247 +
14248 +
14249 + }
14250 + }
14251 + break;
14252 +
14253 + }
14254 + }
14255 + }
14256 +
14257 +
14258 + // This is where rules clean up and exit
14259 + //
14260 + goto ruledatespecEx; /* Prevent compiler warnings */
14261 + ruledatespecEx: ;
14262 + retval.stop = LT(-1);
14263 +
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);
14271 +
14272 + if (HASEXCEPTION())
14273 + {
14274 + PREPORTERROR();
14275 + PRECOVER();
14276 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14277 + }
14278 +
14279 +
14280 + return retval;
14281 +}
14282 +/* $ANTLR end datespec */
14283 +
14284 +/**
14285 + * $ANTLR start dateref
14286 + * RSP.g:74:1: dateref : ( DATE | TODAY );
14287 + */
14288 +static RSPParser_dateref_return
14289 +dateref(pRSPParser ctx)
14290 +{
14291 + RSPParser_dateref_return retval;
14292 +
14293 + pANTLR3_BASE_TREE root_0;
14294 +
14295 + pANTLR3_COMMON_TOKEN set41;
14296 +
14297 + pANTLR3_BASE_TREE set41_tree;
14298 +
14299 + /* Initialize rule variables
14300 + */
14301 +
14302 +
14303 + root_0 = NULL;
14304 +
14305 + set41 = NULL;
14306 + retval.start = LT(1); retval.stop = retval.start;
14307 +
14308 + set41_tree = NULL;
14309 +
14310 +
14311 + retval.tree = NULL;
14312 + {
14313 + // RSP.g:74:9: ( DATE | TODAY )
14314 + // RSP.g:
14315 + {
14316 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14317 +
14318 + set41=(pANTLR3_COMMON_TOKEN)LT(1);
14319 + if ( ((LA(1) >= DATE) && (LA(1) <= TODAY)) )
14320 + {
14321 + CONSUME();
14322 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set41)));
14323 + PERRORRECOVERY=ANTLR3_FALSE;
14324 + }
14325 + else
14326 + {
14327 + CONSTRUCTEX();
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;
14332 + }
14333 +
14334 +
14335 + }
14336 +
14337 + }
14338 +
14339 +
14340 + // This is where rules clean up and exit
14341 + //
14342 + goto ruledaterefEx; /* Prevent compiler warnings */
14343 + ruledaterefEx: ;
14344 + retval.stop = LT(-1);
14345 +
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);
14349 +
14350 + if (HASEXCEPTION())
14351 + {
14352 + PREPORTERROR();
14353 + PRECOVER();
14354 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14355 + }
14356 +
14357 +
14358 + return retval;
14359 +}
14360 +/* $ANTLR end dateref */
14361 +
14362 +/**
14363 + * $ANTLR start dateintval
14364 + * RSP.g:78:1: dateintval : ( DAY | WEEK | MONTH | YEAR );
14365 + */
14366 +static RSPParser_dateintval_return
14367 +dateintval(pRSPParser ctx)
14368 +{
14369 + RSPParser_dateintval_return retval;
14370 +
14371 + pANTLR3_BASE_TREE root_0;
14372 +
14373 + pANTLR3_COMMON_TOKEN set42;
14374 +
14375 + pANTLR3_BASE_TREE set42_tree;
14376 +
14377 + /* Initialize rule variables
14378 + */
14379 +
14380 +
14381 + root_0 = NULL;
14382 +
14383 + set42 = NULL;
14384 + retval.start = LT(1); retval.stop = retval.start;
14385 +
14386 + set42_tree = NULL;
14387 +
14388 +
14389 + retval.tree = NULL;
14390 + {
14391 + // RSP.g:79:2: ( DAY | WEEK | MONTH | YEAR )
14392 + // RSP.g:
14393 + {
14394 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
14395 +
14396 + set42=(pANTLR3_COMMON_TOKEN)LT(1);
14397 + if ( ((LA(1) >= DAY) && (LA(1) <= YEAR)) )
14398 + {
14399 + CONSUME();
14400 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set42)));
14401 + PERRORRECOVERY=ANTLR3_FALSE;
14402 + }
14403 + else
14404 + {
14405 + CONSTRUCTEX();
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;
14410 + }
14411 +
14412 +
14413 + }
14414 +
14415 + }
14416 +
14417 +
14418 + // This is where rules clean up and exit
14419 + //
14420 + goto ruledateintvalEx; /* Prevent compiler warnings */
14421 + ruledateintvalEx: ;
14422 + retval.stop = LT(-1);
14423 +
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);
14427 +
14428 + if (HASEXCEPTION())
14429 + {
14430 + PREPORTERROR();
14431 + PRECOVER();
14432 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
14433 + }
14434 +
14435 +
14436 + return retval;
14437 +}
14438 +/* $ANTLR end dateintval */
14439 +/* End of parsing rules
14440 + * ==============================================
14441 + */
14442 +
14443 +/* ==============================================
14444 + * Syntactic predicates
14445 + */
14446 +/* End of syntactic predicates
14447 + * ==============================================
14448 + */
14449 +
14450 +
14451 +
14452 +
14453 +
14454 +
14455 +/* End of code
14456 + * =============================================================================
14457 + */
14458 diff --git a/src/pregen/RSPParser.h b/src/pregen/RSPParser.h
14459 new file mode 100644
14460 index 0000000..4b3bbfe
14461 --- /dev/null
14462 +++ b/src/pregen/RSPParser.h
14463 @@ -0,0 +1,365 @@
14464 +/** \file
14465 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
14466 + *
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.
14471 + *
14472 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
14473 + *
14474 + *
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
14478 + * this rule.
14479 + *
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.
14484 + *
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().
14487 + *
14488 + * The methods in pRSPParser are as follows:
14489 + *
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)
14503 + *
14504 + * The return type for any particular rule is of course determined by the source
14505 + * grammar file.
14506 + */
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
14511 +//
14512 +// All rights reserved.
14513 +//
14514 +// Redistribution and use in source and binary forms, with or without
14515 +// modification, are permitted provided that the following conditions
14516 +// are met:
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.
14524 +//
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.
14535 +
14536 +#ifndef _RSPParser_H
14537 +#define _RSPParser_H
14538 +/* =============================================================================
14539 + * Standard antlr3 C runtime definitions
14540 + */
14541 +#include <antlr3.h>
14542 +
14543 +/* End of standard antlr 3 runtime definitions
14544 + * =============================================================================
14545 + */
14546 +
14547 +#ifdef __cplusplus
14548 +extern "C" {
14549 +#endif
14550 +
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.
14555 +//
14556 +typedef struct RSPParser_Ctx_struct RSPParser, * pRSPParser;
14557 +
14558 +
14559 +
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
14567 +//
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.
14572 +//
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 )
14579 +#endif
14580 +typedef struct RSPParser_query_return_struct
14581 +{
14582 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14583 + */
14584 + pANTLR3_COMMON_TOKEN start;
14585 + pANTLR3_COMMON_TOKEN stop;
14586 + pANTLR3_BASE_TREE tree;
14587 +
14588 +}
14589 + RSPParser_query_return;
14590 +
14591 +typedef struct RSPParser_expr_return_struct
14592 +{
14593 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14594 + */
14595 + pANTLR3_COMMON_TOKEN start;
14596 + pANTLR3_COMMON_TOKEN stop;
14597 + pANTLR3_BASE_TREE tree;
14598 +
14599 +}
14600 + RSPParser_expr_return;
14601 +
14602 +typedef struct RSPParser_aexpr_return_struct
14603 +{
14604 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14605 + */
14606 + pANTLR3_COMMON_TOKEN start;
14607 + pANTLR3_COMMON_TOKEN stop;
14608 + pANTLR3_BASE_TREE tree;
14609 +
14610 +}
14611 + RSPParser_aexpr_return;
14612 +
14613 +typedef struct RSPParser_crit_return_struct
14614 +{
14615 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14616 + */
14617 + pANTLR3_COMMON_TOKEN start;
14618 + pANTLR3_COMMON_TOKEN stop;
14619 + pANTLR3_BASE_TREE tree;
14620 +
14621 +}
14622 + RSPParser_crit_return;
14623 +
14624 +typedef struct RSPParser_strcrit_return_struct
14625 +{
14626 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14627 + */
14628 + pANTLR3_COMMON_TOKEN start;
14629 + pANTLR3_COMMON_TOKEN stop;
14630 + pANTLR3_BASE_TREE tree;
14631 +
14632 +}
14633 + RSPParser_strcrit_return;
14634 +
14635 +typedef struct RSPParser_strop_return_struct
14636 +{
14637 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14638 + */
14639 + pANTLR3_COMMON_TOKEN start;
14640 + pANTLR3_COMMON_TOKEN stop;
14641 + pANTLR3_BASE_TREE tree;
14642 +
14643 +}
14644 + RSPParser_strop_return;
14645 +
14646 +typedef struct RSPParser_intcrit_return_struct
14647 +{
14648 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14649 + */
14650 + pANTLR3_COMMON_TOKEN start;
14651 + pANTLR3_COMMON_TOKEN stop;
14652 + pANTLR3_BASE_TREE tree;
14653 +
14654 +}
14655 + RSPParser_intcrit_return;
14656 +
14657 +typedef struct RSPParser_intop_return_struct
14658 +{
14659 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14660 + */
14661 + pANTLR3_COMMON_TOKEN start;
14662 + pANTLR3_COMMON_TOKEN stop;
14663 + pANTLR3_BASE_TREE tree;
14664 +
14665 +}
14666 + RSPParser_intop_return;
14667 +
14668 +typedef struct RSPParser_datecrit_return_struct
14669 +{
14670 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14671 + */
14672 + pANTLR3_COMMON_TOKEN start;
14673 + pANTLR3_COMMON_TOKEN stop;
14674 + pANTLR3_BASE_TREE tree;
14675 +
14676 +}
14677 + RSPParser_datecrit_return;
14678 +
14679 +typedef struct RSPParser_dateop_return_struct
14680 +{
14681 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14682 + */
14683 + pANTLR3_COMMON_TOKEN start;
14684 + pANTLR3_COMMON_TOKEN stop;
14685 + pANTLR3_BASE_TREE tree;
14686 +
14687 +}
14688 + RSPParser_dateop_return;
14689 +
14690 +typedef struct RSPParser_datespec_return_struct
14691 +{
14692 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14693 + */
14694 + pANTLR3_COMMON_TOKEN start;
14695 + pANTLR3_COMMON_TOKEN stop;
14696 + pANTLR3_BASE_TREE tree;
14697 +
14698 +}
14699 + RSPParser_datespec_return;
14700 +
14701 +typedef struct RSPParser_dateref_return_struct
14702 +{
14703 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14704 + */
14705 + pANTLR3_COMMON_TOKEN start;
14706 + pANTLR3_COMMON_TOKEN stop;
14707 + pANTLR3_BASE_TREE tree;
14708 +
14709 +}
14710 + RSPParser_dateref_return;
14711 +
14712 +typedef struct RSPParser_dateintval_return_struct
14713 +{
14714 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
14715 + */
14716 + pANTLR3_COMMON_TOKEN start;
14717 + pANTLR3_COMMON_TOKEN stop;
14718 + pANTLR3_BASE_TREE tree;
14719 +
14720 +}
14721 + RSPParser_dateintval_return;
14722 +
14723 +
14724 +
14725 +/** Context tracking structure for RSPParser
14726 + */
14727 +struct RSPParser_Ctx_struct
14728 +{
14729 + /** Built in ANTLR3 context tracker contains all the generic elements
14730 + * required for context tracking.
14731 + */
14732 + pANTLR3_PARSER pParser;
14733 +
14734 +
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() */
14755 +};
14756 +
14757 +// Function protoypes for the constructor functions that external translation units
14758 +// such as delegators and delegates may wish to call.
14759 +//
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);
14762 +
14763 +/** Symbolic definitions of all the tokens that the parser will work with.
14764 + * \{
14765 + *
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.
14770 + */
14771 +#ifdef EOF
14772 +#undef EOF
14773 +#endif
14774 +#ifdef Tokens
14775 +#undef Tokens
14776 +#endif
14777 +#define STARTSW 14
14778 +#define WEEK 26
14779 +#define TODAY 24
14780 +#define YEAR 28
14781 +#define ENDSW 15
14782 +#define GTE 20
14783 +#define BEFORE 21
14784 +#define DAY 25
14785 +#define INT 16
14786 +#define NOT 11
14787 +#define AFTER 22
14788 +#define AND 6
14789 +#define EOF -1
14790 +#define LTE 19
14791 +#define MONTH 27
14792 +#define DIGIT19 31
14793 +#define INCLUDES 13
14794 +#define STR 10
14795 +#define QUOTE 29
14796 +#define WS 30
14797 +#define GREATER 18
14798 +#define NEWLINE 4
14799 +#define LPAR 7
14800 +#define EQUAL 12
14801 +#define OR 5
14802 +#define LESS 17
14803 +#define RPAR 8
14804 +#define FIELD 9
14805 +#define ESCAPED 33
14806 +#define DATE 23
14807 +#define DIGIT09 32
14808 +#ifdef EOF
14809 +#undef EOF
14810 +#define EOF ANTLR3_TOKEN_EOF
14811 +#endif
14812 +
14813 +#ifndef TOKENSOURCE
14814 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
14815 +#endif
14816 +
14817 +/* End of token definitions for RSPParser
14818 + * =============================================================================
14819 + */
14820 +/** \} */
14821 +
14822 +#ifdef __cplusplus
14823 +}
14824 +#endif
14825 +
14826 +#endif
14827 +
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
14832 --- /dev/null
14833 +++ b/src/pregen/SMARTPL.u
14834 @@ -0,0 +1,6 @@
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
14845 --- /dev/null
14846 +++ b/src/pregen/SMARTPL2SQL.c
14847 @@ -0,0 +1,1649 @@
14848 +/** \file
14849 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
14850 + *
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.
14855 + *
14856 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
14857 + *
14858 + *
14859 +*/
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
14864 +//
14865 +// All rights reserved.
14866 +//
14867 +// Redistribution and use in source and binary forms, with or without
14868 +// modification, are permitted provided that the following conditions
14869 +// are met:
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.
14877 +//
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.
14888 +
14889 +
14890 +/* =============================================================================
14891 + * This is what the grammar programmer asked us to put at the top of every file.
14892 + */
14893 +
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>
14901 +
14902 + #include "logger.h"
14903 + #include "db.h"
14904 +
14905 +/* End of Header action.
14906 + * =============================================================================
14907 + */
14908 +/* -----------------------------------------
14909 + * Include the ANTLR3 generated header file.
14910 + */
14911 +#include "SMARTPL2SQL.h"
14912 +/* ----------------------------------------- */
14913 +
14914 +
14915 +
14916 +
14917 +
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.
14929 + */
14930 +
14931 +#define CTX ctx
14932 +
14933 +/* Aids in accessing scopes for grammar programmers
14934 + */
14935 +#undef SCOPE_TYPE
14936 +#undef SCOPE_STACK
14937 +#undef SCOPE_TOP
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))
14943 +
14944 +/* Macros for accessing things in the parser
14945 + */
14946 +
14947 +#undef PARSER
14948 +#undef RECOGNIZER
14949 +#undef HAVEPARSEDRULE
14950 +#undef INPUT
14951 +#undef STRSTREAM
14952 +#undef HASEXCEPTION
14953 +#undef EXCEPTION
14954 +#undef MATCHT
14955 +#undef MATCHANYT
14956 +#undef FOLLOWSTACK
14957 +#undef FOLLOWPUSH
14958 +#undef FOLLOWPOP
14959 +#undef PRECOVER
14960 +#undef PREPORTERROR
14961 +#undef LA
14962 +#undef LT
14963 +#undef CONSTRUCTEX
14964 +#undef CONSUME
14965 +#undef MARK
14966 +#undef REWIND
14967 +#undef REWINDLAST
14968 +#undef PERRORRECOVERY
14969 +#undef HASFAILED
14970 +#undef FAILEDFLAG
14971 +#undef RECOVERFROMMISMATCHEDSET
14972 +#undef RECOVERFROMMISMATCHEDELEMENT
14973 +#undef BACKTRACKING
14974 +#undef ADAPTOR
14975 +#undef RULEMEMO
14976 +#undef SEEK
14977 +#undef INDEX
14978 +#undef DBG
14979 +
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
15014 +
15015 +
15016 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
15017 +
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.
15023 + */
15024 +#define UP ANTLR3_TOKEN_UP
15025 +#define DOWN ANTLR3_TOKEN_DOWN
15026 +#define EOR ANTLR3_TOKEN_EOR
15027 +#define INVALID ANTLR3_TOKEN_INVALID
15028 +
15029 +
15030 +/* =============================================================================
15031 + * Functions to create and destroy scopes. First come the rule scopes, followed
15032 + * by the global declared scopes.
15033 + */
15034 +
15035 +
15036 +
15037 +/* ============================================================================= */
15038 +
15039 +/* =============================================================================
15040 + * Start of recognizer
15041 + */
15042 +
15043 +
15044 +
15045 +/** \brief Table of all token names in symbolic order, mainly used for
15046 + * error reporting.
15047 + */
15048 +pANTLR3_UINT8 SMARTPL2SQLTokenNames[28+4]
15049 + = {
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) "'}'"
15082 + };
15083 +
15084 +
15085 +
15086 +// Forward declare the locally static matching functions we have generated.
15087 +//
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.
15096 + */
15097 +static void ANTLR3_CDECL freeScope(void * scope)
15098 +{
15099 + ANTLR3_FREE(scope);
15100 +}
15101 +
15102 +/** \brief Name of the grammar file that generated this code
15103 + */
15104 +static const char fileName[] = "SMARTPL2SQL.g";
15105 +
15106 +/** \brief Return the name of the grammar file that generated this code.
15107 + */
15108 +static const char * getGrammarFileName()
15109 +{
15110 + return fileName;
15111 +}
15112 +/** \brief Create a new SMARTPL2SQL parser and return a context for it.
15113 + *
15114 + * \param[in] instream Pointer to an input stream interface.
15115 + *
15116 + * \return Pointer to new parser context upon success.
15117 + */
15118 +ANTLR3_API pSMARTPL2SQL
15119 +SMARTPL2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream)
15120 +{
15121 + // See if we can create a new parser with the standard constructor
15122 + //
15123 + return SMARTPL2SQLNewSSD(instream, NULL);
15124 +}
15125 +
15126 +/** \brief Create a new SMARTPL2SQL parser and return a context for it.
15127 + *
15128 + * \param[in] instream Pointer to an input stream interface.
15129 + *
15130 + * \return Pointer to new parser context upon success.
15131 + */
15132 +ANTLR3_API pSMARTPL2SQL
15133 +SMARTPL2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
15134 +{
15135 + pSMARTPL2SQL ctx; /* Context structure we will build and return */
15136 +
15137 + ctx = (pSMARTPL2SQL) ANTLR3_CALLOC(1, sizeof(SMARTPL2SQL));
15138 +
15139 + if (ctx == NULL)
15140 + {
15141 + // Failed to allocate memory for parser context
15142 + //
15143 + return NULL;
15144 + }
15145 +
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.
15152 + *
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.
15155 + */
15156 +
15157 + /* Create a base Tree parser/recognizer, using the supplied tree node stream
15158 + */
15159 + ctx->pTreeParser = antlr3TreeParserNewStream(ANTLR3_SIZE_HINT, instream, state);
15160 + /* Install the implementation of our SMARTPL2SQL interface
15161 + */
15162 + ctx->playlist = playlist;
15163 + ctx->expression = expression;
15164 + ctx->dateval = dateval;
15165 + ctx->interval = interval;
15166 + ctx->free = SMARTPL2SQLFree;
15167 + ctx->getGrammarFileName = getGrammarFileName;
15168 +
15169 + /* Install the scope pushing methods.
15170 + */
15171 +
15172 +
15173 +
15174 +
15175 +
15176 + /* Install the token table
15177 + */
15178 + PSRSTATE->tokenNames = SMARTPL2SQLTokenNames;
15179 +
15180 +
15181 + /* Return the newly built parser to the caller
15182 + */
15183 + return ctx;
15184 +}
15185 +
15186 +/** Free the parser resources
15187 + */
15188 + static void
15189 + SMARTPL2SQLFree(pSMARTPL2SQL ctx)
15190 + {
15191 + /* Free any scope memory
15192 + */
15193 +
15194 +
15195 + // Free this parser
15196 + //
15197 + ctx->pTreeParser->free(ctx->pTreeParser);
15198 + ANTLR3_FREE(ctx);
15199 +
15200 + /* Everything is released, so we can return
15201 + */
15202 + return;
15203 + }
15204 +
15205 +/** Return token names used by this tree parser
15206 + *
15207 + * The returned pointer is used as an index into the token names table (using the token
15208 + * number as the index).
15209 + *
15210 + * \return Pointer to first char * in the table.
15211 + */
15212 +static pANTLR3_UINT8 *getTokenNames()
15213 +{
15214 + return SMARTPL2SQLTokenNames;
15215 +}
15216 +
15217 +
15218 +
15219 +
15220 +/* Declare the bitsets
15221 + */
15222 +
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 };
15346 +
15347 +
15348 +
15349 +
15350 +/* ==============================================
15351 + * Parsing rules
15352 + */
15353 +/**
15354 + * $ANTLR start playlist
15355 + * SMARTPL2SQL.g:43:1: playlist returns [ pANTLR3_STRING title, pANTLR3_STRING query ] : STR '{' e= expression '}' ;
15356 + */
15357 +static SMARTPL2SQL_playlist_return
15358 +playlist(pSMARTPL2SQL ctx)
15359 +{
15360 + SMARTPL2SQL_playlist_return retval;
15361 +
15362 + pANTLR3_BASE_TREE STR1;
15363 + pANTLR3_STRING e;
15364 + #undef RETURN_TYPE_e
15365 + #define RETURN_TYPE_e pANTLR3_STRING
15366 +
15367 + /* Initialize rule variables
15368 + */
15369 +
15370 +
15371 + retval.title= NULL; retval.query= NULL;
15372 + STR1 = NULL;
15373 + e = NULL;
15374 + retval.start = LT(1); retval.stop = retval.start;
15375 +
15376 + {
15377 + // SMARTPL2SQL.g:45:2: ( STR '{' e= expression '}' )
15378 + // SMARTPL2SQL.g:45:4: STR '{' e= expression '}'
15379 + {
15380 + STR1 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_playlist66);
15381 + if (HASEXCEPTION())
15382 + {
15383 + goto ruleplaylistEx;
15384 + }
15385 +
15386 + MATCHT(30, &FOLLOW_30_in_playlist68);
15387 + if (HASEXCEPTION())
15388 + {
15389 + goto ruleplaylistEx;
15390 + }
15391 +
15392 + FOLLOWPUSH(FOLLOW_expression_in_playlist74);
15393 + e=expression(ctx);
15394 +
15395 + FOLLOWPOP();
15396 + if (HASEXCEPTION())
15397 + {
15398 + goto ruleplaylistEx;
15399 + }
15400 +
15401 + MATCHT(31, &FOLLOW_31_in_playlist76);
15402 + if (HASEXCEPTION())
15403 + {
15404 + goto ruleplaylistEx;
15405 + }
15406 +
15407 + {
15408 +
15409 + pANTLR3_UINT8 val;
15410 + val = (STR1->getText(STR1))->toUTF8((STR1->getText(STR1)))->chars;
15411 + val++;
15412 + val[strlen((const char *)val) - 1] = '\0';
15413 +
15414 + retval.title= (STR1->getText(STR1))->factory->newRaw((STR1->getText(STR1))->factory);
15415 + retval.title->append8(retval.title, (const char *)val);
15416 +
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, ")");
15421 +
15422 + }
15423 +
15424 + }
15425 +
15426 + }
15427 +
15428 +
15429 + // This is where rules clean up and exit
15430 + //
15431 + goto ruleplaylistEx; /* Prevent compiler warnings */
15432 + ruleplaylistEx: ;
15433 +
15434 + if (HASEXCEPTION())
15435 + {
15436 + PREPORTERROR();
15437 + PRECOVER();
15438 + }
15439 +
15440 +
15441 + return retval;
15442 +}
15443 +/* $ANTLR end playlist */
15444 +
15445 +/**
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 );
15448 + */
15449 +static pANTLR3_STRING
15450 +expression(pSMARTPL2SQL ctx)
15451 +{
15452 + pANTLR3_STRING result = NULL;
15453 +
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
15468 +
15469 + pANTLR3_STRING b;
15470 + #undef RETURN_TYPE_b
15471 + #define RETURN_TYPE_b pANTLR3_STRING
15472 +
15473 + int dateval9;
15474 + #undef RETURN_TYPE_dateval9
15475 + #define RETURN_TYPE_dateval9 int
15476 +
15477 + int dateval11;
15478 + #undef RETURN_TYPE_dateval11
15479 + #define RETURN_TYPE_dateval11 int
15480 +
15481 + /* Initialize rule variables
15482 + */
15483 +
15484 +
15485 + result= NULL;
15486 + STR2 = NULL;
15487 + STRTAG3 = NULL;
15488 + STR4 = NULL;
15489 + STRTAG5 = NULL;
15490 + INTTAG6 = NULL;
15491 + INTBOOL7 = NULL;
15492 + INT8 = NULL;
15493 + DATETAG10 = NULL;
15494 + DATETAG12 = NULL;
15495 + ENUMTAG13 = NULL;
15496 + ENUMVAL14 = NULL;
15497 + a = NULL;
15498 + b = NULL;
15499 + dateval9 = 0;
15500 + dateval11 = 0;
15501 +
15502 + {
15503 + {
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 )
15505 +
15506 + ANTLR3_UINT32 alt1;
15507 +
15508 + alt1=9;
15509 +
15510 + switch ( LA(1) )
15511 + {
15512 + case NOT:
15513 + {
15514 + alt1=1;
15515 + }
15516 + break;
15517 + case AND:
15518 + {
15519 + alt1=2;
15520 + }
15521 + break;
15522 + case OR:
15523 + {
15524 + alt1=3;
15525 + }
15526 + break;
15527 + case STRTAG:
15528 + {
15529 + switch ( LA(2) )
15530 + {
15531 + case INCLUDES:
15532 + {
15533 + alt1=4;
15534 + }
15535 + break;
15536 + case IS:
15537 + {
15538 + alt1=5;
15539 + }
15540 + break;
15541 +
15542 + default:
15543 + CONSTRUCTEX();
15544 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
15545 + EXCEPTION->message = (void *)"";
15546 + EXCEPTION->decisionNum = 1;
15547 + EXCEPTION->state = 4;
15548 +
15549 +
15550 + goto ruleexpressionEx;
15551 + }
15552 +
15553 + }
15554 + break;
15555 + case INTTAG:
15556 + {
15557 + alt1=6;
15558 + }
15559 + break;
15560 + case DATETAG:
15561 + {
15562 + switch ( LA(2) )
15563 + {
15564 + case AFTER:
15565 + {
15566 + alt1=7;
15567 + }
15568 + break;
15569 + case BEFORE:
15570 + {
15571 + alt1=8;
15572 + }
15573 + break;
15574 +
15575 + default:
15576 + CONSTRUCTEX();
15577 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
15578 + EXCEPTION->message = (void *)"";
15579 + EXCEPTION->decisionNum = 1;
15580 + EXCEPTION->state = 6;
15581 +
15582 +
15583 + goto ruleexpressionEx;
15584 + }
15585 +
15586 + }
15587 + break;
15588 + case ENUMTAG:
15589 + {
15590 + alt1=9;
15591 + }
15592 + break;
15593 +
15594 + default:
15595 + CONSTRUCTEX();
15596 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
15597 + EXCEPTION->message = (void *)"";
15598 + EXCEPTION->decisionNum = 1;
15599 + EXCEPTION->state = 0;
15600 +
15601 +
15602 + goto ruleexpressionEx;
15603 + }
15604 +
15605 + switch (alt1)
15606 + {
15607 + case 1:
15608 + // SMARTPL2SQL.g:64:4: ^( NOT a= expression )
15609 + {
15610 + MATCHT(NOT, &FOLLOW_NOT_in_expression101);
15611 + if (HASEXCEPTION())
15612 + {
15613 + goto ruleexpressionEx;
15614 + }
15615 +
15616 +
15617 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
15618 + if (HASEXCEPTION())
15619 + {
15620 + goto ruleexpressionEx;
15621 + }
15622 +
15623 + FOLLOWPUSH(FOLLOW_expression_in_expression107);
15624 + a=expression(ctx);
15625 +
15626 + FOLLOWPOP();
15627 + if (HASEXCEPTION())
15628 + {
15629 + goto ruleexpressionEx;
15630 + }
15631 +
15632 +
15633 + MATCHT(ANTLR3_TOKEN_UP, NULL);
15634 + if (HASEXCEPTION())
15635 + {
15636 + goto ruleexpressionEx;
15637 + }
15638 +
15639 + {
15640 +
15641 + result= a->factory->newRaw(a->factory);
15642 + result->append8(result, "NOT(");
15643 + result->appendS(result, a);
15644 + result->append8(result, ")");
15645 +
15646 + }
15647 +
15648 + }
15649 + break;
15650 + case 2:
15651 + // SMARTPL2SQL.g:71:4: ^( AND a= expression b= expression )
15652 + {
15653 + MATCHT(AND, &FOLLOW_AND_in_expression118);
15654 + if (HASEXCEPTION())
15655 + {
15656 + goto ruleexpressionEx;
15657 + }
15658 +
15659 +
15660 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
15661 + if (HASEXCEPTION())
15662 + {
15663 + goto ruleexpressionEx;
15664 + }
15665 +
15666 + FOLLOWPUSH(FOLLOW_expression_in_expression124);
15667 + a=expression(ctx);
15668 +
15669 + FOLLOWPOP();
15670 + if (HASEXCEPTION())
15671 + {
15672 + goto ruleexpressionEx;
15673 + }
15674 +
15675 + FOLLOWPUSH(FOLLOW_expression_in_expression130);
15676 + b=expression(ctx);
15677 +
15678 + FOLLOWPOP();
15679 + if (HASEXCEPTION())
15680 + {
15681 + goto ruleexpressionEx;
15682 + }
15683 +
15684 +
15685 + MATCHT(ANTLR3_TOKEN_UP, NULL);
15686 + if (HASEXCEPTION())
15687 + {
15688 + goto ruleexpressionEx;
15689 + }
15690 +
15691 + {
15692 +
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, ")");
15699 +
15700 + }
15701 +
15702 + }
15703 + break;
15704 + case 3:
15705 + // SMARTPL2SQL.g:80:4: ^( OR a= expression b= expression )
15706 + {
15707 + MATCHT(OR, &FOLLOW_OR_in_expression141);
15708 + if (HASEXCEPTION())
15709 + {
15710 + goto ruleexpressionEx;
15711 + }
15712 +
15713 +
15714 + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
15715 + if (HASEXCEPTION())
15716 + {
15717 + goto ruleexpressionEx;
15718 + }
15719 +
15720 + FOLLOWPUSH(FOLLOW_expression_in_expression147);
15721 + a=expression(ctx);
15722 +
15723 + FOLLOWPOP();
15724 + if (HASEXCEPTION())
15725 + {
15726 + goto ruleexpressionEx;
15727 + }
15728 +
15729 + FOLLOWPUSH(FOLLOW_expression_in_expression153);
15730 + b=expression(ctx);
15731 +
15732 + FOLLOWPOP();
15733 + if (HASEXCEPTION())
15734 + {
15735 + goto ruleexpressionEx;
15736 + }
15737 +
15738 +
15739 + MATCHT(ANTLR3_TOKEN_UP, NULL);
15740 + if (HASEXCEPTION())
15741 + {
15742 + goto ruleexpressionEx;
15743 + }
15744 +
15745 + {
15746 +
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, ")");
15753 +
15754 + }
15755 +
15756 + }
15757 + break;
15758 + case 4:
15759 + // SMARTPL2SQL.g:89:4: STRTAG INCLUDES STR
15760 + {
15761 + STRTAG3 = (pANTLR3_BASE_TREE) MATCHT(STRTAG, &FOLLOW_STRTAG_in_expression163);
15762 + if (HASEXCEPTION())
15763 + {
15764 + goto ruleexpressionEx;
15765 + }
15766 +
15767 + MATCHT(INCLUDES, &FOLLOW_INCLUDES_in_expression165);
15768 + if (HASEXCEPTION())
15769 + {
15770 + goto ruleexpressionEx;
15771 + }
15772 +
15773 + STR2 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expression167);
15774 + if (HASEXCEPTION())
15775 + {
15776 + goto ruleexpressionEx;
15777 + }
15778 +
15779 + {
15780 +
15781 + pANTLR3_UINT8 val;
15782 + val = (STR2->getText(STR2))->toUTF8((STR2->getText(STR2)))->chars;
15783 + val++;
15784 + val[strlen((const char *)val) - 1] = '\0';
15785 +
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, "%'");
15792 +
15793 + }
15794 +
15795 + }
15796 + break;
15797 + case 5:
15798 + // SMARTPL2SQL.g:103:4: STRTAG IS STR
15799 + {
15800 + STRTAG5 = (pANTLR3_BASE_TREE) MATCHT(STRTAG, &FOLLOW_STRTAG_in_expression176);
15801 + if (HASEXCEPTION())
15802 + {
15803 + goto ruleexpressionEx;
15804 + }
15805 +
15806 + MATCHT(IS, &FOLLOW_IS_in_expression178);
15807 + if (HASEXCEPTION())
15808 + {
15809 + goto ruleexpressionEx;
15810 + }
15811 +
15812 + STR4 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expression180);
15813 + if (HASEXCEPTION())
15814 + {
15815 + goto ruleexpressionEx;
15816 + }
15817 +
15818 + {
15819 +
15820 + pANTLR3_UINT8 val;
15821 + val = (STR4->getText(STR4))->toUTF8((STR4->getText(STR4)))->chars;
15822 + val++;
15823 + val[strlen((const char *)val) - 1] = '\0';
15824 +
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, "'");
15831 +
15832 + }
15833 +
15834 + }
15835 + break;
15836 + case 6:
15837 + // SMARTPL2SQL.g:117:4: INTTAG INTBOOL INT
15838 + {
15839 + INTTAG6 = (pANTLR3_BASE_TREE) MATCHT(INTTAG, &FOLLOW_INTTAG_in_expression189);
15840 + if (HASEXCEPTION())
15841 + {
15842 + goto ruleexpressionEx;
15843 + }
15844 +
15845 + INTBOOL7 = (pANTLR3_BASE_TREE) MATCHT(INTBOOL, &FOLLOW_INTBOOL_in_expression191);
15846 + if (HASEXCEPTION())
15847 + {
15848 + goto ruleexpressionEx;
15849 + }
15850 +
15851 + INT8 = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_expression193);
15852 + if (HASEXCEPTION())
15853 + {
15854 + goto ruleexpressionEx;
15855 + }
15856 +
15857 + {
15858 +
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))));
15866 +
15867 + }
15868 +
15869 + }
15870 + break;
15871 + case 7:
15872 + // SMARTPL2SQL.g:127:4: DATETAG AFTER dateval
15873 + {
15874 + DATETAG10 = (pANTLR3_BASE_TREE) MATCHT(DATETAG, &FOLLOW_DATETAG_in_expression202);
15875 + if (HASEXCEPTION())
15876 + {
15877 + goto ruleexpressionEx;
15878 + }
15879 +
15880 + MATCHT(AFTER, &FOLLOW_AFTER_in_expression204);
15881 + if (HASEXCEPTION())
15882 + {
15883 + goto ruleexpressionEx;
15884 + }
15885 +
15886 + FOLLOWPUSH(FOLLOW_dateval_in_expression206);
15887 + dateval9=dateval(ctx);
15888 +
15889 + FOLLOWPOP();
15890 + if (HASEXCEPTION())
15891 + {
15892 + goto ruleexpressionEx;
15893 + }
15894 +
15895 + {
15896 +
15897 + char str[15];
15898 + sprintf(str, "%d", dateval9);
15899 +
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);
15905 +
15906 + }
15907 +
15908 + }
15909 + break;
15910 + case 8:
15911 + // SMARTPL2SQL.g:138:4: DATETAG BEFORE dateval
15912 + {
15913 + DATETAG12 = (pANTLR3_BASE_TREE) MATCHT(DATETAG, &FOLLOW_DATETAG_in_expression215);
15914 + if (HASEXCEPTION())
15915 + {
15916 + goto ruleexpressionEx;
15917 + }
15918 +
15919 + MATCHT(BEFORE, &FOLLOW_BEFORE_in_expression217);
15920 + if (HASEXCEPTION())
15921 + {
15922 + goto ruleexpressionEx;
15923 + }
15924 +
15925 + FOLLOWPUSH(FOLLOW_dateval_in_expression219);
15926 + dateval11=dateval(ctx);
15927 +
15928 + FOLLOWPOP();
15929 + if (HASEXCEPTION())
15930 + {
15931 + goto ruleexpressionEx;
15932 + }
15933 +
15934 + {
15935 +
15936 + char str[15];
15937 + sprintf(str, "%d", dateval11);
15938 +
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);
15944 +
15945 + }
15946 +
15947 + }
15948 + break;
15949 + case 9:
15950 + // SMARTPL2SQL.g:149:4: ENUMTAG IS ENUMVAL
15951 + {
15952 + ENUMTAG13 = (pANTLR3_BASE_TREE) MATCHT(ENUMTAG, &FOLLOW_ENUMTAG_in_expression228);
15953 + if (HASEXCEPTION())
15954 + {
15955 + goto ruleexpressionEx;
15956 + }
15957 +
15958 + MATCHT(IS, &FOLLOW_IS_in_expression230);
15959 + if (HASEXCEPTION())
15960 + {
15961 + goto ruleexpressionEx;
15962 + }
15963 +
15964 + ENUMVAL14 = (pANTLR3_BASE_TREE) MATCHT(ENUMVAL, &FOLLOW_ENUMVAL_in_expression232);
15965 + if (HASEXCEPTION())
15966 + {
15967 + goto ruleexpressionEx;
15968 + }
15969 +
15970 + {
15971 +
15972 + pANTLR3_UINT8 tag;
15973 + pANTLR3_UINT8 val;
15974 + char str[20];
15975 +
15976 + sprintf(str, "1=1");
15977 +
15978 + tag = (ENUMTAG13->getText(ENUMTAG13))->chars;
15979 + val = (ENUMVAL14->getText(ENUMVAL14))->chars;
15980 + if (strcmp((char *)tag, "media_kind") == 0)
15981 + {
15982 + if (strcmp((char *)val, "music") == 0)
15983 + {
15984 + sprintf(str, "f.media_kind = %d", MEDIA_KIND_MUSIC);
15985 + }
15986 + else if (strcmp((char *)val, "movie") == 0)
15987 + {
15988 + sprintf(str, "f.media_kind = %d", MEDIA_KIND_MOVIE);
15989 + }
15990 + else if (strcmp((char *)val, "podcast") == 0)
15991 + {
15992 + sprintf(str, "f.media_kind = %d", MEDIA_KIND_PODCAST);
15993 + }
15994 + else if (strcmp((char *)val, "audiobook") == 0)
15995 + {
15996 + sprintf(str, "f.media_kind = %d", MEDIA_KIND_AUDIOBOOK);
15997 + }
15998 + else if (strcmp((char *)val, "tvshow") == 0)
15999 + {
16000 + sprintf(str, "f.media_kind = %d", MEDIA_KIND_TVSHOW);
16001 + }
16002 + }
16003 + else if (strcmp((char *)tag, "data_kind") == 0)
16004 + {
16005 + if (strcmp((char *)val, "file") == 0)
16006 + {
16007 + sprintf(str, "f.data_kind = %d", DATA_KIND_FILE);
16008 + }
16009 + else if (strcmp((char *)val, "url") == 0)
16010 + {
16011 + sprintf(str, "f.data_kind = %d", DATA_KIND_URL);
16012 + }
16013 + else if (strcmp((char *)val, "spotify") == 0)
16014 + {
16015 + sprintf(str, "f.data_kind = %d", DATA_KIND_SPOTIFY);
16016 + }
16017 + else if (strcmp((char *)val, "pipe") == 0)
16018 + {
16019 + sprintf(str, "f.data_kind = %d", DATA_KIND_PIPE);
16020 + }
16021 + }
16022 +
16023 + result= (ENUMTAG13->getText(ENUMTAG13))->factory->newRaw((ENUMTAG13->getText(ENUMTAG13))->factory);
16024 + result->append8(result, str);
16025 +
16026 + }
16027 +
16028 + }
16029 + break;
16030 +
16031 + }
16032 + }
16033 + }
16034 +
16035 +
16036 + // This is where rules clean up and exit
16037 + //
16038 + goto ruleexpressionEx; /* Prevent compiler warnings */
16039 + ruleexpressionEx: ;
16040 +
16041 + if (HASEXCEPTION())
16042 + {
16043 + PREPORTERROR();
16044 + PRECOVER();
16045 + }
16046 +
16047 +
16048 + return result;
16049 +}
16050 +/* $ANTLR end expression */
16051 +
16052 +/**
16053 + * $ANTLR start dateval
16054 + * SMARTPL2SQL.g:207:1: dateval returns [ int result ] : ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO );
16055 + */
16056 +static int
16057 +dateval(pSMARTPL2SQL ctx)
16058 +{
16059 + int result = 0;
16060 +
16061 + pANTLR3_BASE_TREE DATE15;
16062 + pANTLR3_BASE_TREE DATE16;
16063 + pANTLR3_BASE_TREE DATE18;
16064 + int interval17;
16065 + #undef RETURN_TYPE_interval17
16066 + #define RETURN_TYPE_interval17 int
16067 +
16068 + int interval19;
16069 + #undef RETURN_TYPE_interval19
16070 + #define RETURN_TYPE_interval19 int
16071 +
16072 + int interval20;
16073 + #undef RETURN_TYPE_interval20
16074 + #define RETURN_TYPE_interval20 int
16075 +
16076 + /* Initialize rule variables
16077 + */
16078 +
16079 +
16080 + result= 0;
16081 + DATE15 = NULL;
16082 + DATE16 = NULL;
16083 + DATE18 = NULL;
16084 + interval17 = 0;
16085 + interval19 = 0;
16086 + interval20 = 0;
16087 +
16088 + {
16089 + {
16090 + // SMARTPL2SQL.g:209:2: ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO )
16091 +
16092 + ANTLR3_UINT32 alt2;
16093 +
16094 + alt2=4;
16095 +
16096 + switch ( LA(1) )
16097 + {
16098 + case DATE:
16099 + {
16100 + alt2=1;
16101 + }
16102 + break;
16103 + case INT:
16104 + {
16105 + switch ( LA(2) )
16106 + {
16107 + case DATINTERVAL:
16108 + {
16109 + switch ( LA(3) )
16110 + {
16111 + case AGO:
16112 + {
16113 + alt2=4;
16114 + }
16115 + break;
16116 + case BEFORE:
16117 + {
16118 + alt2=2;
16119 + }
16120 + break;
16121 + case AFTER:
16122 + {
16123 + alt2=3;
16124 + }
16125 + break;
16126 +
16127 + default:
16128 + CONSTRUCTEX();
16129 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
16130 + EXCEPTION->message = (void *)"";
16131 + EXCEPTION->decisionNum = 2;
16132 + EXCEPTION->state = 3;
16133 +
16134 +
16135 + goto ruledatevalEx;
16136 + }
16137 +
16138 + }
16139 + break;
16140 +
16141 + default:
16142 + CONSTRUCTEX();
16143 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
16144 + EXCEPTION->message = (void *)"";
16145 + EXCEPTION->decisionNum = 2;
16146 + EXCEPTION->state = 2;
16147 +
16148 +
16149 + goto ruledatevalEx;
16150 + }
16151 +
16152 + }
16153 + break;
16154 +
16155 + default:
16156 + CONSTRUCTEX();
16157 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
16158 + EXCEPTION->message = (void *)"";
16159 + EXCEPTION->decisionNum = 2;
16160 + EXCEPTION->state = 0;
16161 +
16162 +
16163 + goto ruledatevalEx;
16164 + }
16165 +
16166 + switch (alt2)
16167 + {
16168 + case 1:
16169 + // SMARTPL2SQL.g:209:4: DATE
16170 + {
16171 + DATE15 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval257);
16172 + if (HASEXCEPTION())
16173 + {
16174 + goto ruledatevalEx;
16175 + }
16176 +
16177 + {
16178 +
16179 + pANTLR3_UINT8 datval;
16180 +
16181 + datval = (DATE15->getText(DATE15))->chars;
16182 +
16183 + if (strcmp((char *)datval, "today") == 0)
16184 + {
16185 + result= time(NULL);
16186 + }
16187 + else if (strcmp((char *)datval, "yesterday") == 0)
16188 + {
16189 + result= time(NULL) - 24 * 3600;
16190 + }
16191 + else if (strcmp((char *)datval, "last week") == 0)
16192 + {
16193 + result= time(NULL) - 24 * 3600 * 7;
16194 + }
16195 + else if (strcmp((char *)datval, "last month") == 0)
16196 + {
16197 + result= time(NULL) - 24 * 3600 * 30;
16198 + }
16199 + else if (strcmp((char *)datval, "last year") == 0)
16200 + {
16201 + result= time(NULL) - 24 * 3600 * 365;
16202 + }
16203 + else
16204 + {
16205 + struct tm tm;
16206 + char year[5];
16207 + char month[3];
16208 + char day[3];
16209 +
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));
16214 +
16215 + strncpy(year, (const char *)datval, 4);
16216 + strncpy(month, (const char *)datval + 5, 2);
16217 + strncpy(day, (const char *)datval + 8, 2);
16218 +
16219 + tm.tm_year = atoi(year) - 1900;
16220 + tm.tm_mon = atoi(month) - 1;
16221 + tm.tm_mday = atoi(day);
16222 +
16223 + result= mktime(&tm);
16224 + }
16225 +
16226 + }
16227 +
16228 + }
16229 + break;
16230 + case 2:
16231 + // SMARTPL2SQL.g:258:4: interval BEFORE DATE
16232 + {
16233 + FOLLOWPUSH(FOLLOW_interval_in_dateval266);
16234 + interval17=interval(ctx);
16235 +
16236 + FOLLOWPOP();
16237 + if (HASEXCEPTION())
16238 + {
16239 + goto ruledatevalEx;
16240 + }
16241 +
16242 + MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateval268);
16243 + if (HASEXCEPTION())
16244 + {
16245 + goto ruledatevalEx;
16246 + }
16247 +
16248 + DATE16 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval270);
16249 + if (HASEXCEPTION())
16250 + {
16251 + goto ruledatevalEx;
16252 + }
16253 +
16254 + {
16255 +
16256 + pANTLR3_UINT8 datval;
16257 +
16258 + datval = (DATE16->getText(DATE16))->chars;
16259 +
16260 + if (strcmp((char *)datval, "yesterday") == 0)
16261 + {
16262 + result= time(NULL) - 24 * 3600;
16263 + }
16264 + else if (strcmp((char *)datval, "last week") == 0)
16265 + {
16266 + result= time(NULL) - 24 * 3600 * 7;
16267 + }
16268 + else if (strcmp((char *)datval, "last month") == 0)
16269 + {
16270 + result= time(NULL) - 24 * 3600 * 30;
16271 + }
16272 + else if (strcmp((char *)datval, "last year") == 0)
16273 + {
16274 + result= time(NULL) - 24 * 3600 * 365;
16275 + }
16276 + else
16277 + {
16278 + result= time(NULL);
16279 + }
16280 +
16281 + result= result - interval17;
16282 +
16283 + }
16284 +
16285 + }
16286 + break;
16287 + case 3:
16288 + // SMARTPL2SQL.g:287:4: interval AFTER DATE
16289 + {
16290 + FOLLOWPUSH(FOLLOW_interval_in_dateval279);
16291 + interval19=interval(ctx);
16292 +
16293 + FOLLOWPOP();
16294 + if (HASEXCEPTION())
16295 + {
16296 + goto ruledatevalEx;
16297 + }
16298 +
16299 + MATCHT(AFTER, &FOLLOW_AFTER_in_dateval281);
16300 + if (HASEXCEPTION())
16301 + {
16302 + goto ruledatevalEx;
16303 + }
16304 +
16305 + DATE18 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval283);
16306 + if (HASEXCEPTION())
16307 + {
16308 + goto ruledatevalEx;
16309 + }
16310 +
16311 + {
16312 +
16313 + pANTLR3_UINT8 datval;
16314 +
16315 + datval = (DATE18->getText(DATE18))->chars;
16316 +
16317 + if (strcmp((char *)datval, "yesterday") == 0)
16318 + {
16319 + result= time(NULL) - 24 * 3600;
16320 + }
16321 + else if (strcmp((char *)datval, "last week") == 0)
16322 + {
16323 + result= time(NULL) - 24 * 3600 * 7;
16324 + }
16325 + else if (strcmp((char *)datval, "last month") == 0)
16326 + {
16327 + result= time(NULL) - 24 * 3600 * 30;
16328 + }
16329 + else if (strcmp((char *)datval, "last year") == 0)
16330 + {
16331 + result= time(NULL) - 24 * 3600 * 365;
16332 + }
16333 + else
16334 + {
16335 + result= time(NULL);
16336 + }
16337 +
16338 + result= result + interval19;
16339 +
16340 + }
16341 +
16342 + }
16343 + break;
16344 + case 4:
16345 + // SMARTPL2SQL.g:316:4: interval AGO
16346 + {
16347 + FOLLOWPUSH(FOLLOW_interval_in_dateval292);
16348 + interval20=interval(ctx);
16349 +
16350 + FOLLOWPOP();
16351 + if (HASEXCEPTION())
16352 + {
16353 + goto ruledatevalEx;
16354 + }
16355 +
16356 + MATCHT(AGO, &FOLLOW_AGO_in_dateval294);
16357 + if (HASEXCEPTION())
16358 + {
16359 + goto ruledatevalEx;
16360 + }
16361 +
16362 + {
16363 +
16364 + result= time(NULL) - interval20;
16365 +
16366 + }
16367 +
16368 + }
16369 + break;
16370 +
16371 + }
16372 + }
16373 + }
16374 +
16375 +
16376 + // This is where rules clean up and exit
16377 + //
16378 + goto ruledatevalEx; /* Prevent compiler warnings */
16379 + ruledatevalEx: ;
16380 +
16381 + if (HASEXCEPTION())
16382 + {
16383 + PREPORTERROR();
16384 + PRECOVER();
16385 + }
16386 +
16387 +
16388 + return result;
16389 +}
16390 +/* $ANTLR end dateval */
16391 +
16392 +/**
16393 + * $ANTLR start interval
16394 + * SMARTPL2SQL.g:322:1: interval returns [ int result ] : INT DATINTERVAL ;
16395 + */
16396 +static int
16397 +interval(pSMARTPL2SQL ctx)
16398 +{
16399 + int result = 0;
16400 +
16401 + pANTLR3_BASE_TREE INT21;
16402 + pANTLR3_BASE_TREE DATINTERVAL22;
16403 +
16404 + /* Initialize rule variables
16405 + */
16406 +
16407 +
16408 + result= 0;
16409 + INT21 = NULL;
16410 + DATINTERVAL22 = NULL;
16411 +
16412 + {
16413 + // SMARTPL2SQL.g:324:2: ( INT DATINTERVAL )
16414 + // SMARTPL2SQL.g:324:4: INT DATINTERVAL
16415 + {
16416 + INT21 = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_interval318);
16417 + if (HASEXCEPTION())
16418 + {
16419 + goto ruleintervalEx;
16420 + }
16421 +
16422 + DATINTERVAL22 = (pANTLR3_BASE_TREE) MATCHT(DATINTERVAL, &FOLLOW_DATINTERVAL_in_interval320);
16423 + if (HASEXCEPTION())
16424 + {
16425 + goto ruleintervalEx;
16426 + }
16427 +
16428 + {
16429 +
16430 + pANTLR3_UINT8 interval;
16431 +
16432 + result= atoi((const char *)(INT21->getText(INT21))->chars);
16433 + interval = (DATINTERVAL22->getText(DATINTERVAL22))->chars;
16434 +
16435 + if (strcmp((char *)interval, "days") == 0)
16436 + {
16437 + result= result * 24 * 3600;
16438 + }
16439 + else if (strcmp((char *)interval, "weeks") == 0)
16440 + {
16441 + result= result * 24 * 3600 * 7;
16442 + }
16443 + else if (strcmp((char *)interval, "months") == 0)
16444 + {
16445 + result= result * 24 * 3600 * 30;
16446 + }
16447 + else if (strcmp((char *)interval, "weeks") == 0)
16448 + {
16449 + result= result * 24 * 3600 * 365;
16450 + }
16451 + else
16452 + {
16453 + result= 0;
16454 + }
16455 +
16456 + }
16457 +
16458 + }
16459 +
16460 + }
16461 +
16462 +
16463 + // This is where rules clean up and exit
16464 + //
16465 + goto ruleintervalEx; /* Prevent compiler warnings */
16466 + ruleintervalEx: ;
16467 +
16468 + if (HASEXCEPTION())
16469 + {
16470 + PREPORTERROR();
16471 + PRECOVER();
16472 + }
16473 +
16474 +
16475 + return result;
16476 +}
16477 +/* $ANTLR end interval */
16478 +/* End of parsing rules
16479 + * ==============================================
16480 + */
16481 +
16482 +/* ==============================================
16483 + * Syntactic predicates
16484 + */
16485 +/* End of syntactic predicates
16486 + * ==============================================
16487 + */
16488 +
16489 +
16490 +
16491 +
16492 +
16493 +
16494 +/* End of code
16495 + * =============================================================================
16496 + */
16497 diff --git a/src/pregen/SMARTPL2SQL.h b/src/pregen/SMARTPL2SQL.h
16498 new file mode 100644
16499 index 0000000..322e8fd
16500 --- /dev/null
16501 +++ b/src/pregen/SMARTPL2SQL.h
16502 @@ -0,0 +1,220 @@
16503 +/** \file
16504 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
16505 + *
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.
16510 + *
16511 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
16512 + *
16513 + *
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
16517 + * this rule.
16518 + *
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.
16523 + *
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().
16526 + *
16527 + * The methods in pSMARTPL2SQL are as follows:
16528 + *
16529 + * - SMARTPL2SQL_playlist_return pSMARTPL2SQL->playlist(pSMARTPL2SQL)
16530 + * - pANTLR3_STRING pSMARTPL2SQL->expression(pSMARTPL2SQL)
16531 + * - int pSMARTPL2SQL->dateval(pSMARTPL2SQL)
16532 + * - int pSMARTPL2SQL->interval(pSMARTPL2SQL)
16533 + *
16534 + * The return type for any particular rule is of course determined by the source
16535 + * grammar file.
16536 + */
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
16541 +//
16542 +// All rights reserved.
16543 +//
16544 +// Redistribution and use in source and binary forms, with or without
16545 +// modification, are permitted provided that the following conditions
16546 +// are met:
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.
16554 +//
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.
16565 +
16566 +#ifndef _SMARTPL2SQL_H
16567 +#define _SMARTPL2SQL_H
16568 +/* =============================================================================
16569 + * Standard antlr3 C runtime definitions
16570 + */
16571 +#include <antlr3.h>
16572 +
16573 +/* End of standard antlr 3 runtime definitions
16574 + * =============================================================================
16575 + */
16576 +
16577 +#ifdef __cplusplus
16578 +extern "C" {
16579 +#endif
16580 +
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.
16585 +//
16586 +typedef struct SMARTPL2SQL_Ctx_struct SMARTPL2SQL, * pSMARTPL2SQL;
16587 +
16588 +
16589 +
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>
16597 +
16598 + #include "logger.h"
16599 + #include "db.h"
16600 +
16601 +
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
16609 +//
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.
16614 +//
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 )
16621 +#endif
16622 +typedef struct SMARTPL2SQL_playlist_return_struct
16623 +{
16624 + pANTLR3_BASE_TREE start;
16625 + pANTLR3_BASE_TREE stop;
16626 + pANTLR3_STRING title;
16627 + pANTLR3_STRING query;
16628 +}
16629 + SMARTPL2SQL_playlist_return;
16630 +
16631 +
16632 +
16633 +/** Context tracking structure for SMARTPL2SQL
16634 + */
16635 +struct SMARTPL2SQL_Ctx_struct
16636 +{
16637 + /** Built in ANTLR3 context tracker contains all the generic elements
16638 + * required for context tracking.
16639 + */
16640 + pANTLR3_TREE_PARSER pTreeParser;
16641 +
16642 +
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);
16650 +
16651 +};
16652 +
16653 +// Function protoypes for the constructor functions that external translation units
16654 +// such as delegators and delegates may wish to call.
16655 +//
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);
16658 +
16659 +/** Symbolic definitions of all the tokens that the tree parser will work with.
16660 + * \{
16661 + *
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.
16666 + */
16667 +#ifdef EOF
16668 +#undef EOF
16669 +#endif
16670 +#ifdef Tokens
16671 +#undef Tokens
16672 +#endif
16673 +#define INTBOOL 14
16674 +#define STRTAG 10
16675 +#define AGO 22
16676 +#define WHITESPACE 29
16677 +#define GREATEREQUAL 25
16678 +#define BEFORE 18
16679 +#define DATETAG 16
16680 +#define INT 15
16681 +#define NOT 7
16682 +#define AFTER 17
16683 +#define AND 6
16684 +#define EOF -1
16685 +#define INCLUDES 11
16686 +#define STR 4
16687 +#define T__30 30
16688 +#define T__31 31
16689 +#define GREATER 24
16690 +#define LPAR 8
16691 +#define ENUMTAG 19
16692 +#define IS 12
16693 +#define ENUMVAL 20
16694 +#define EQUAL 28
16695 +#define OR 5
16696 +#define LESS 26
16697 +#define RPAR 9
16698 +#define DATE 21
16699 +#define LESSEQUAL 27
16700 +#define INTTAG 13
16701 +#define DATINTERVAL 23
16702 +#ifdef EOF
16703 +#undef EOF
16704 +#define EOF ANTLR3_TOKEN_EOF
16705 +#endif
16706 +
16707 +#ifndef TOKENSOURCE
16708 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
16709 +#endif
16710 +
16711 +/* End of token definitions for SMARTPL2SQL
16712 + * =============================================================================
16713 + */
16714 +/** \} */
16715 +
16716 +#ifdef __cplusplus
16717 +}
16718 +#endif
16719 +
16720 +#endif
16721 +
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
16726 --- /dev/null
16727 +++ b/src/pregen/SMARTPL2SQL.u
16728 @@ -0,0 +1,5 @@
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
16738 --- /dev/null
16739 +++ b/src/pregen/SMARTPLLexer.c
16740 @@ -0,0 +1,4168 @@
16741 +/** \file
16742 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
16743 + *
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.
16748 + *
16749 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
16750 + *
16751 + *
16752 +*/
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
16757 +//
16758 +// All rights reserved.
16759 +//
16760 +// Redistribution and use in source and binary forms, with or without
16761 +// modification, are permitted provided that the following conditions
16762 +// are met:
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.
16770 +//
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.
16781 +
16782 +/* -----------------------------------------
16783 + * Include the ANTLR3 generated header file.
16784 + */
16785 +#include "SMARTPLLexer.h"
16786 +/* ----------------------------------------- */
16787 +
16788 +
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.
16794 + */
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};
16843 +
16844 +
16845 +
16846 +
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.
16858 + */
16859 +
16860 +#define CTX ctx
16861 +
16862 +/* Aids in accessing scopes for grammar programmers
16863 + */
16864 +#undef SCOPE_TYPE
16865 +#undef SCOPE_STACK
16866 +#undef SCOPE_TOP
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))
16872 +
16873 +
16874 +/* Macros for accessing things in a lexer
16875 + */
16876 +#undef LEXER
16877 +#undef RECOGNIZER
16878 +#undef RULEMEMO
16879 +#undef GETCHARINDEX
16880 +#undef GETLINE
16881 +#undef GETCHARPOSITIONINLINE
16882 +#undef EMIT
16883 +#undef EMITNEW
16884 +#undef MATCHC
16885 +#undef MATCHS
16886 +#undef MATCHRANGE
16887 +#undef LTOKEN
16888 +#undef HASFAILED
16889 +#undef FAILEDFLAG
16890 +#undef INPUT
16891 +#undef STRSTREAM
16892 +#undef LA
16893 +#undef HASEXCEPTION
16894 +#undef EXCEPTION
16895 +#undef CONSTRUCTEX
16896 +#undef CONSUME
16897 +#undef LRECOVER
16898 +#undef MARK
16899 +#undef REWIND
16900 +#undef REWINDLAST
16901 +#undef BACKTRACKING
16902 +#undef MATCHANY
16903 +#undef MEMOIZE
16904 +#undef HAVEPARSEDRULE
16905 +#undef GETTEXT
16906 +#undef INDEX
16907 +#undef SEEK
16908 +#undef PUSHSTREAM
16909 +#undef POPSTREAM
16910 +#undef SETTEXT
16911 +#undef SETTEXT8
16912 +
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
16956 +
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).
16963 + */
16964 +#if defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16)
16965 +
16966 +# ifdef ANTLR3_INLINE_INPUT_ASCII
16967 +
16968 +/* 8 bit "ASCII" (actually any 8 bit character set) */
16969 +
16970 +# define NEXTCHAR ((pANTLR3_UINT8)(INPUT->nextChar))
16971 +# define DATAP ((pANTLR3_UINT8)(INPUT->data))
16972 +
16973 +# else
16974 +
16975 +# define NEXTCHAR ((pANTLR3_UINT16)(INPUT->nextChar))
16976 +# define DATAP ((pANTLR3_UINT16)(INPUT->data))
16977 +
16978 +# endif
16979 +
16980 +# define LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1)))
16981 +# define CONSUME() \
16982 +{ \
16983 + if (NEXTCHAR < (DATAP + INPUT->sizeBuf)) \
16984 + { \
16985 + INPUT->charPositionInLine++; \
16986 + if ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar) \
16987 + { \
16988 + INPUT->line++; \
16989 + INPUT->charPositionInLine = 0; \
16990 + INPUT->currentLine = (void *)(NEXTCHAR + 1); \
16991 + } \
16992 + INPUT->nextChar = (void *)(NEXTCHAR + 1); \
16993 + } \
16994 +}
16995 +
16996 +#else
16997 +
16998 +// Pick up the input character by calling the input stream implementation.
16999 +//
17000 +#define CONSUME() INPUT->istream->consume(INPUT->istream)
17001 +#define LA(n) INPUT->istream->_LA(INPUT->istream, n)
17002 +
17003 +#endif
17004 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
17005 +
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.
17011 + */
17012 +#define UP ANTLR3_TOKEN_UP
17013 +#define DOWN ANTLR3_TOKEN_DOWN
17014 +#define EOR ANTLR3_TOKEN_EOR
17015 +#define INVALID ANTLR3_TOKEN_INVALID
17016 +
17017 +
17018 +/* =============================================================================
17019 + * Functions to create and destroy scopes. First come the rule scopes, followed
17020 + * by the global declared scopes.
17021 + */
17022 +
17023 +
17024 +
17025 +/* ============================================================================= */
17026 +
17027 +/* =============================================================================
17028 + * Start of recognizer
17029 + */
17030 +
17031 +
17032 +/* Forward declare the locally static matching functions we have generated and any predicate functions.
17033 + */
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);
17064 +
17065 +/* =========================================================================
17066 + * Lexer matching rules end.
17067 + * =========================================================================
17068 + */
17069 +
17070 +
17071 +
17072 +static void
17073 +SMARTPLLexerFree (pSMARTPLLexer ctx)
17074 +{
17075 + LEXER->free(LEXER);
17076 +
17077 + ANTLR3_FREE(ctx);
17078 +}
17079 +
17080 +/** \brief Name of the grammar file that generated this code
17081 + */
17082 +static const char fileName[] = "SMARTPL.g";
17083 +
17084 +/** \brief Return the name of the grammar file that generated this code.
17085 + */
17086 +static const char * getGrammarFileName()
17087 +{
17088 + return fileName;
17089 +}
17090 +
17091 +/** \brief Create a new lexer called SMARTPLLexer
17092 + *
17093 + * \param[in] instream Pointer to an initialized input stream
17094 + * \return
17095 + * - Success pSMARTPLLexer initialized for the lex start
17096 + * - Fail NULL
17097 + */
17098 +ANTLR3_API pSMARTPLLexer SMARTPLLexerNew
17099 +(pANTLR3_INPUT_STREAM instream)
17100 +{
17101 + // See if we can create a new lexer with the standard constructor
17102 + //
17103 + return SMARTPLLexerNewSSD(instream, NULL);
17104 +}
17105 +
17106 +/** \brief Create a new lexer called SMARTPLLexer
17107 + *
17108 + * \param[in] instream Pointer to an initialized input stream
17109 + * \param[state] state Previously created shared recognizer stat
17110 + * \return
17111 + * - Success pSMARTPLLexer initialized for the lex start
17112 + * - Fail NULL
17113 + */
17114 +ANTLR3_API pSMARTPLLexer SMARTPLLexerNewSSD
17115 +(pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
17116 +{
17117 + pSMARTPLLexer ctx; // Context structure we will build and return
17118 +
17119 + ctx = (pSMARTPLLexer) ANTLR3_CALLOC(1, sizeof(SMARTPLLexer));
17120 +
17121 + if (ctx == NULL)
17122 + {
17123 + // Failed to allocate memory for lexer context
17124 + return NULL;
17125 + }
17126 +
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.
17133 + *
17134 + * We don't use the macros defined in SMARTPLLexer.h here so you can get a sense
17135 + * of what goes where.
17136 + */
17137 +
17138 + /* Create a base lexer, using the supplied input stream
17139 + */
17140 + ctx->pLexer = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state);
17141 +
17142 + /* Check that we allocated the memory correctly
17143 + */
17144 + if (ctx->pLexer == NULL)
17145 + {
17146 + ANTLR3_FREE(ctx);
17147 + return NULL;
17148 + }
17149 + /* Install the implementation of our SMARTPLLexer interface
17150 + */
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;
17158 + ctx->mIS = mIS;
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;
17169 + ctx->mOR = mOR;
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;
17180 +
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.
17184 + */
17185 + ctx->pLexer->ctx = ctx;
17186 +
17187 + /**Install the token matching function
17188 + */
17189 + ctx->pLexer->mTokens = (void (*) (void *))(mTokens);
17190 +
17191 + ctx->getGrammarFileName = getGrammarFileName;
17192 + ctx->free = SMARTPLLexerFree;
17193 +
17194 +
17195 +
17196 +
17197 +
17198 + /* Return the newly built lexer to the caller
17199 + */
17200 + return ctx;
17201 +}
17202 +
17203 +
17204 +/* =========================================================================
17205 + * Functions to match the lexer grammar defined tokens from the input stream
17206 + */
17207 +
17208 +// Comes from: 7:7: ( '{' )
17209 +/** \brief Lexer rule generated by ANTLR3
17210 + *
17211 + * $ANTLR start T__30
17212 + *
17213 + * Looks to match the characters the constitute the token T__30
17214 + * from the attached input stream.
17215 + *
17216 + *
17217 + * \remark
17218 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
17219 + */
17220 +static ANTLR3_INLINE
17221 +void mT__30(pSMARTPLLexer ctx)
17222 +{
17223 + ANTLR3_UINT32 _type;
17224 +
17225 + _type = T__30;
17226 +
17227 +
17228 + // SMARTPL.g:7:7: ( '{' )
17229 + // SMARTPL.g:7:9: '{'
17230 + {
17231 + MATCHC('{');
17232 + if (HASEXCEPTION())
17233 + {
17234 + goto ruleT__30Ex;
17235 + }
17236 +
17237 +
17238 + }
17239 +
17240 + LEXSTATE->type = _type;
17241 +
17242 + // This is where rules clean up and exit
17243 + //
17244 + goto ruleT__30Ex; /* Prevent compiler warnings */
17245 + ruleT__30Ex: ;
17246 +
17247 +}
17248 +// $ANTLR end T__30
17249 +
17250 +// Comes from: 8:7: ( '}' )
17251 +/** \brief Lexer rule generated by ANTLR3
17252 + *
17253 + * $ANTLR start T__31
17254 + *
17255 + * Looks to match the characters the constitute the token T__31
17256 + * from the attached input stream.
17257 + *
17258 + *
17259 + * \remark
17260 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
17261 + */
17262 +static ANTLR3_INLINE
17263 +void mT__31(pSMARTPLLexer ctx)
17264 +{
17265 + ANTLR3_UINT32 _type;
17266 +
17267 + _type = T__31;
17268 +
17269 +
17270 + // SMARTPL.g:8:7: ( '}' )
17271 + // SMARTPL.g:8:9: '}'
17272 + {
17273 + MATCHC('}');
17274 + if (HASEXCEPTION())
17275 + {
17276 + goto ruleT__31Ex;
17277 + }
17278 +
17279 +
17280 + }
17281 +
17282 + LEXSTATE->type = _type;
17283 +
17284 + // This is where rules clean up and exit
17285 + //
17286 + goto ruleT__31Ex; /* Prevent compiler warnings */
17287 + ruleT__31Ex: ;
17288 +
17289 +}
17290 +// $ANTLR end T__31
17291 +
17292 +// Comes from: 56:9: ( 'artist' | 'album_artist' | 'album' | 'title' | 'genre' | 'composer' | 'path' | 'type' | 'grouping' )
17293 +/** \brief Lexer rule generated by ANTLR3
17294 + *
17295 + * $ANTLR start STRTAG
17296 + *
17297 + * Looks to match the characters the constitute the token STRTAG
17298 + * from the attached input stream.
17299 + *
17300 + *
17301 + * \remark
17302 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
17303 + */
17304 +static ANTLR3_INLINE
17305 +void mSTRTAG(pSMARTPLLexer ctx)
17306 +{
17307 + ANTLR3_UINT32 _type;
17308 +
17309 + _type = STRTAG;
17310 +
17311 +
17312 + {
17313 + // SMARTPL.g:56:9: ( 'artist' | 'album_artist' | 'album' | 'title' | 'genre' | 'composer' | 'path' | 'type' | 'grouping' )
17314 +
17315 + ANTLR3_UINT32 alt1;
17316 +
17317 + alt1=9;
17318 +
17319 + switch ( LA(1) )
17320 + {
17321 + case 'a':
17322 + {
17323 + switch ( LA(2) )
17324 + {
17325 + case 'r':
17326 + {
17327 + alt1=1;
17328 + }
17329 + break;
17330 + case 'l':
17331 + {
17332 + switch ( LA(3) )
17333 + {
17334 + case 'b':
17335 + {
17336 + switch ( LA(4) )
17337 + {
17338 + case 'u':
17339 + {
17340 + switch ( LA(5) )
17341 + {
17342 + case 'm':
17343 + {
17344 + switch ( LA(6) )
17345 + {
17346 + case '_':
17347 + {
17348 + alt1=2;
17349 + }
17350 + break;
17351 +
17352 + default:
17353 + alt1=3;}
17354 +
17355 + }
17356 + break;
17357 +
17358 + default:
17359 + CONSTRUCTEX();
17360 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17361 + EXCEPTION->message = (void *)"";
17362 + EXCEPTION->decisionNum = 1;
17363 + EXCEPTION->state = 13;
17364 +
17365 +
17366 + goto ruleSTRTAGEx;
17367 + }
17368 +
17369 + }
17370 + break;
17371 +
17372 + default:
17373 + CONSTRUCTEX();
17374 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17375 + EXCEPTION->message = (void *)"";
17376 + EXCEPTION->decisionNum = 1;
17377 + EXCEPTION->state = 12;
17378 +
17379 +
17380 + goto ruleSTRTAGEx;
17381 + }
17382 +
17383 + }
17384 + break;
17385 +
17386 + default:
17387 + CONSTRUCTEX();
17388 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17389 + EXCEPTION->message = (void *)"";
17390 + EXCEPTION->decisionNum = 1;
17391 + EXCEPTION->state = 7;
17392 +
17393 +
17394 + goto ruleSTRTAGEx;
17395 + }
17396 +
17397 + }
17398 + break;
17399 +
17400 + default:
17401 + CONSTRUCTEX();
17402 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17403 + EXCEPTION->message = (void *)"";
17404 + EXCEPTION->decisionNum = 1;
17405 + EXCEPTION->state = 1;
17406 +
17407 +
17408 + goto ruleSTRTAGEx;
17409 + }
17410 +
17411 + }
17412 + break;
17413 + case 't':
17414 + {
17415 + switch ( LA(2) )
17416 + {
17417 + case 'i':
17418 + {
17419 + alt1=4;
17420 + }
17421 + break;
17422 + case 'y':
17423 + {
17424 + alt1=8;
17425 + }
17426 + break;
17427 +
17428 + default:
17429 + CONSTRUCTEX();
17430 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17431 + EXCEPTION->message = (void *)"";
17432 + EXCEPTION->decisionNum = 1;
17433 + EXCEPTION->state = 2;
17434 +
17435 +
17436 + goto ruleSTRTAGEx;
17437 + }
17438 +
17439 + }
17440 + break;
17441 + case 'g':
17442 + {
17443 + switch ( LA(2) )
17444 + {
17445 + case 'e':
17446 + {
17447 + alt1=5;
17448 + }
17449 + break;
17450 + case 'r':
17451 + {
17452 + alt1=9;
17453 + }
17454 + break;
17455 +
17456 + default:
17457 + CONSTRUCTEX();
17458 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17459 + EXCEPTION->message = (void *)"";
17460 + EXCEPTION->decisionNum = 1;
17461 + EXCEPTION->state = 3;
17462 +
17463 +
17464 + goto ruleSTRTAGEx;
17465 + }
17466 +
17467 + }
17468 + break;
17469 + case 'c':
17470 + {
17471 + alt1=6;
17472 + }
17473 + break;
17474 + case 'p':
17475 + {
17476 + alt1=7;
17477 + }
17478 + break;
17479 +
17480 + default:
17481 + CONSTRUCTEX();
17482 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17483 + EXCEPTION->message = (void *)"";
17484 + EXCEPTION->decisionNum = 1;
17485 + EXCEPTION->state = 0;
17486 +
17487 +
17488 + goto ruleSTRTAGEx;
17489 + }
17490 +
17491 + switch (alt1)
17492 + {
17493 + case 1:
17494 + // SMARTPL.g:56:11: 'artist'
17495 + {
17496 + MATCHS(lit_1);
17497 + if (HASEXCEPTION())
17498 + {
17499 + goto ruleSTRTAGEx;
17500 + }
17501 +
17502 +
17503 +
17504 + }
17505 + break;
17506 + case 2:
17507 + // SMARTPL.g:57:6: 'album_artist'
17508 + {
17509 + MATCHS(lit_2);
17510 + if (HASEXCEPTION())
17511 + {
17512 + goto ruleSTRTAGEx;
17513 + }
17514 +
17515 +
17516 +
17517 + }
17518 + break;
17519 + case 3:
17520 + // SMARTPL.g:58:6: 'album'
17521 + {
17522 + MATCHS(lit_3);
17523 + if (HASEXCEPTION())
17524 + {
17525 + goto ruleSTRTAGEx;
17526 + }
17527 +
17528 +
17529 +
17530 + }
17531 + break;
17532 + case 4:
17533 + // SMARTPL.g:59:6: 'title'
17534 + {
17535 + MATCHS(lit_4);
17536 + if (HASEXCEPTION())
17537 + {
17538 + goto ruleSTRTAGEx;
17539 + }
17540 +
17541 +
17542 +
17543 + }
17544 + break;
17545 + case 5:
17546 + // SMARTPL.g:60:6: 'genre'
17547 + {
17548 + MATCHS(lit_5);
17549 + if (HASEXCEPTION())
17550 + {
17551 + goto ruleSTRTAGEx;
17552 + }
17553 +
17554 +
17555 +
17556 + }
17557 + break;
17558 + case 6:
17559 + // SMARTPL.g:61:6: 'composer'
17560 + {
17561 + MATCHS(lit_6);
17562 + if (HASEXCEPTION())
17563 + {
17564 + goto ruleSTRTAGEx;
17565 + }
17566 +
17567 +
17568 +
17569 + }
17570 + break;
17571 + case 7:
17572 + // SMARTPL.g:62:6: 'path'
17573 + {
17574 + MATCHS(lit_7);
17575 + if (HASEXCEPTION())
17576 + {
17577 + goto ruleSTRTAGEx;
17578 + }
17579 +
17580 +
17581 +
17582 + }
17583 + break;
17584 + case 8:
17585 + // SMARTPL.g:63:6: 'type'
17586 + {
17587 + MATCHS(lit_8);
17588 + if (HASEXCEPTION())
17589 + {
17590 + goto ruleSTRTAGEx;
17591 + }
17592 +
17593 +
17594 +
17595 + }
17596 + break;
17597 + case 9:
17598 + // SMARTPL.g:64:6: 'grouping'
17599 + {
17600 + MATCHS(lit_9);
17601 + if (HASEXCEPTION())
17602 + {
17603 + goto ruleSTRTAGEx;
17604 + }
17605 +
17606 +
17607 +
17608 + }
17609 + break;
17610 +
17611 + }
17612 + }
17613 + LEXSTATE->type = _type;
17614 +
17615 + // This is where rules clean up and exit
17616 + //
17617 + goto ruleSTRTAGEx; /* Prevent compiler warnings */
17618 + ruleSTRTAGEx: ;
17619 +
17620 +}
17621 +// $ANTLR end STRTAG
17622 +
17623 +// Comes from: 67:9: ( 'play_count' | 'rating' | 'year' | 'compilation' )
17624 +/** \brief Lexer rule generated by ANTLR3
17625 + *
17626 + * $ANTLR start INTTAG
17627 + *
17628 + * Looks to match the characters the constitute the token INTTAG
17629 + * from the attached input stream.
17630 + *
17631 + *
17632 + * \remark
17633 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
17634 + */
17635 +static ANTLR3_INLINE
17636 +void mINTTAG(pSMARTPLLexer ctx)
17637 +{
17638 + ANTLR3_UINT32 _type;
17639 +
17640 + _type = INTTAG;
17641 +
17642 +
17643 + {
17644 + // SMARTPL.g:67:9: ( 'play_count' | 'rating' | 'year' | 'compilation' )
17645 +
17646 + ANTLR3_UINT32 alt2;
17647 +
17648 + alt2=4;
17649 +
17650 + switch ( LA(1) )
17651 + {
17652 + case 'p':
17653 + {
17654 + alt2=1;
17655 + }
17656 + break;
17657 + case 'r':
17658 + {
17659 + alt2=2;
17660 + }
17661 + break;
17662 + case 'y':
17663 + {
17664 + alt2=3;
17665 + }
17666 + break;
17667 + case 'c':
17668 + {
17669 + alt2=4;
17670 + }
17671 + break;
17672 +
17673 + default:
17674 + CONSTRUCTEX();
17675 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17676 + EXCEPTION->message = (void *)"";
17677 + EXCEPTION->decisionNum = 2;
17678 + EXCEPTION->state = 0;
17679 +
17680 +
17681 + goto ruleINTTAGEx;
17682 + }
17683 +
17684 + switch (alt2)
17685 + {
17686 + case 1:
17687 + // SMARTPL.g:67:11: 'play_count'
17688 + {
17689 + MATCHS(lit_10);
17690 + if (HASEXCEPTION())
17691 + {
17692 + goto ruleINTTAGEx;
17693 + }
17694 +
17695 +
17696 +
17697 + }
17698 + break;
17699 + case 2:
17700 + // SMARTPL.g:68:6: 'rating'
17701 + {
17702 + MATCHS(lit_11);
17703 + if (HASEXCEPTION())
17704 + {
17705 + goto ruleINTTAGEx;
17706 + }
17707 +
17708 +
17709 +
17710 + }
17711 + break;
17712 + case 3:
17713 + // SMARTPL.g:69:6: 'year'
17714 + {
17715 + MATCHS(lit_12);
17716 + if (HASEXCEPTION())
17717 + {
17718 + goto ruleINTTAGEx;
17719 + }
17720 +
17721 +
17722 +
17723 + }
17724 + break;
17725 + case 4:
17726 + // SMARTPL.g:70:6: 'compilation'
17727 + {
17728 + MATCHS(lit_13);
17729 + if (HASEXCEPTION())
17730 + {
17731 + goto ruleINTTAGEx;
17732 + }
17733 +
17734 +
17735 +
17736 + }
17737 + break;
17738 +
17739 + }
17740 + }
17741 + LEXSTATE->type = _type;
17742 +
17743 + // This is where rules clean up and exit
17744 + //
17745 + goto ruleINTTAGEx; /* Prevent compiler warnings */
17746 + ruleINTTAGEx: ;
17747 +
17748 +}
17749 +// $ANTLR end INTTAG
17750 +
17751 +// Comes from: 73:10: ( 'time_added' | 'time_played' )
17752 +/** \brief Lexer rule generated by ANTLR3
17753 + *
17754 + * $ANTLR start DATETAG
17755 + *
17756 + * Looks to match the characters the constitute the token DATETAG
17757 + * from the attached input stream.
17758 + *
17759 + *
17760 + * \remark
17761 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
17762 + */
17763 +static ANTLR3_INLINE
17764 +void mDATETAG(pSMARTPLLexer ctx)
17765 +{
17766 + ANTLR3_UINT32 _type;
17767 +
17768 + _type = DATETAG;
17769 +
17770 +
17771 + {
17772 + // SMARTPL.g:73:10: ( 'time_added' | 'time_played' )
17773 +
17774 + ANTLR3_UINT32 alt3;
17775 +
17776 + alt3=2;
17777 +
17778 + switch ( LA(1) )
17779 + {
17780 + case 't':
17781 + {
17782 + switch ( LA(2) )
17783 + {
17784 + case 'i':
17785 + {
17786 + switch ( LA(3) )
17787 + {
17788 + case 'm':
17789 + {
17790 + switch ( LA(4) )
17791 + {
17792 + case 'e':
17793 + {
17794 + switch ( LA(5) )
17795 + {
17796 + case '_':
17797 + {
17798 + switch ( LA(6) )
17799 + {
17800 + case 'a':
17801 + {
17802 + alt3=1;
17803 + }
17804 + break;
17805 + case 'p':
17806 + {
17807 + alt3=2;
17808 + }
17809 + break;
17810 +
17811 + default:
17812 + CONSTRUCTEX();
17813 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17814 + EXCEPTION->message = (void *)"";
17815 + EXCEPTION->decisionNum = 3;
17816 + EXCEPTION->state = 5;
17817 +
17818 +
17819 + goto ruleDATETAGEx;
17820 + }
17821 +
17822 + }
17823 + break;
17824 +
17825 + default:
17826 + CONSTRUCTEX();
17827 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17828 + EXCEPTION->message = (void *)"";
17829 + EXCEPTION->decisionNum = 3;
17830 + EXCEPTION->state = 4;
17831 +
17832 +
17833 + goto ruleDATETAGEx;
17834 + }
17835 +
17836 + }
17837 + break;
17838 +
17839 + default:
17840 + CONSTRUCTEX();
17841 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17842 + EXCEPTION->message = (void *)"";
17843 + EXCEPTION->decisionNum = 3;
17844 + EXCEPTION->state = 3;
17845 +
17846 +
17847 + goto ruleDATETAGEx;
17848 + }
17849 +
17850 + }
17851 + break;
17852 +
17853 + default:
17854 + CONSTRUCTEX();
17855 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17856 + EXCEPTION->message = (void *)"";
17857 + EXCEPTION->decisionNum = 3;
17858 + EXCEPTION->state = 2;
17859 +
17860 +
17861 + goto ruleDATETAGEx;
17862 + }
17863 +
17864 + }
17865 + break;
17866 +
17867 + default:
17868 + CONSTRUCTEX();
17869 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17870 + EXCEPTION->message = (void *)"";
17871 + EXCEPTION->decisionNum = 3;
17872 + EXCEPTION->state = 1;
17873 +
17874 +
17875 + goto ruleDATETAGEx;
17876 + }
17877 +
17878 + }
17879 + break;
17880 +
17881 + default:
17882 + CONSTRUCTEX();
17883 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17884 + EXCEPTION->message = (void *)"";
17885 + EXCEPTION->decisionNum = 3;
17886 + EXCEPTION->state = 0;
17887 +
17888 +
17889 + goto ruleDATETAGEx;
17890 + }
17891 +
17892 + switch (alt3)
17893 + {
17894 + case 1:
17895 + // SMARTPL.g:73:12: 'time_added'
17896 + {
17897 + MATCHS(lit_14);
17898 + if (HASEXCEPTION())
17899 + {
17900 + goto ruleDATETAGEx;
17901 + }
17902 +
17903 +
17904 +
17905 + }
17906 + break;
17907 + case 2:
17908 + // SMARTPL.g:74:6: 'time_played'
17909 + {
17910 + MATCHS(lit_15);
17911 + if (HASEXCEPTION())
17912 + {
17913 + goto ruleDATETAGEx;
17914 + }
17915 +
17916 +
17917 +
17918 + }
17919 + break;
17920 +
17921 + }
17922 + }
17923 + LEXSTATE->type = _type;
17924 +
17925 + // This is where rules clean up and exit
17926 + //
17927 + goto ruleDATETAGEx; /* Prevent compiler warnings */
17928 + ruleDATETAGEx: ;
17929 +
17930 +}
17931 +// $ANTLR end DATETAG
17932 +
17933 +// Comes from: 77:10: ( 'data_kind' | 'media_kind' )
17934 +/** \brief Lexer rule generated by ANTLR3
17935 + *
17936 + * $ANTLR start ENUMTAG
17937 + *
17938 + * Looks to match the characters the constitute the token ENUMTAG
17939 + * from the attached input stream.
17940 + *
17941 + *
17942 + * \remark
17943 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
17944 + */
17945 +static ANTLR3_INLINE
17946 +void mENUMTAG(pSMARTPLLexer ctx)
17947 +{
17948 + ANTLR3_UINT32 _type;
17949 +
17950 + _type = ENUMTAG;
17951 +
17952 +
17953 + {
17954 + // SMARTPL.g:77:10: ( 'data_kind' | 'media_kind' )
17955 +
17956 + ANTLR3_UINT32 alt4;
17957 +
17958 + alt4=2;
17959 +
17960 + switch ( LA(1) )
17961 + {
17962 + case 'd':
17963 + {
17964 + alt4=1;
17965 + }
17966 + break;
17967 + case 'm':
17968 + {
17969 + alt4=2;
17970 + }
17971 + break;
17972 +
17973 + default:
17974 + CONSTRUCTEX();
17975 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
17976 + EXCEPTION->message = (void *)"";
17977 + EXCEPTION->decisionNum = 4;
17978 + EXCEPTION->state = 0;
17979 +
17980 +
17981 + goto ruleENUMTAGEx;
17982 + }
17983 +
17984 + switch (alt4)
17985 + {
17986 + case 1:
17987 + // SMARTPL.g:77:12: 'data_kind'
17988 + {
17989 + MATCHS(lit_16);
17990 + if (HASEXCEPTION())
17991 + {
17992 + goto ruleENUMTAGEx;
17993 + }
17994 +
17995 +
17996 +
17997 + }
17998 + break;
17999 + case 2:
18000 + // SMARTPL.g:78:6: 'media_kind'
18001 + {
18002 + MATCHS(lit_17);
18003 + if (HASEXCEPTION())
18004 + {
18005 + goto ruleENUMTAGEx;
18006 + }
18007 +
18008 +
18009 +
18010 + }
18011 + break;
18012 +
18013 + }
18014 + }
18015 + LEXSTATE->type = _type;
18016 +
18017 + // This is where rules clean up and exit
18018 + //
18019 + goto ruleENUMTAGEx; /* Prevent compiler warnings */
18020 + ruleENUMTAGEx: ;
18021 +
18022 +}
18023 +// $ANTLR end ENUMTAG
18024 +
18025 +// Comes from: 81:10: ( 'includes' )
18026 +/** \brief Lexer rule generated by ANTLR3
18027 + *
18028 + * $ANTLR start INCLUDES
18029 + *
18030 + * Looks to match the characters the constitute the token INCLUDES
18031 + * from the attached input stream.
18032 + *
18033 + *
18034 + * \remark
18035 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18036 + */
18037 +static ANTLR3_INLINE
18038 +void mINCLUDES(pSMARTPLLexer ctx)
18039 +{
18040 + ANTLR3_UINT32 _type;
18041 +
18042 + _type = INCLUDES;
18043 +
18044 +
18045 + // SMARTPL.g:81:10: ( 'includes' )
18046 + // SMARTPL.g:81:12: 'includes'
18047 + {
18048 + MATCHS(lit_18);
18049 + if (HASEXCEPTION())
18050 + {
18051 + goto ruleINCLUDESEx;
18052 + }
18053 +
18054 +
18055 +
18056 + }
18057 +
18058 + LEXSTATE->type = _type;
18059 +
18060 + // This is where rules clean up and exit
18061 + //
18062 + goto ruleINCLUDESEx; /* Prevent compiler warnings */
18063 + ruleINCLUDESEx: ;
18064 +
18065 +}
18066 +// $ANTLR end INCLUDES
18067 +
18068 +// Comes from: 84:6: ( 'is' )
18069 +/** \brief Lexer rule generated by ANTLR3
18070 + *
18071 + * $ANTLR start IS
18072 + *
18073 + * Looks to match the characters the constitute the token IS
18074 + * from the attached input stream.
18075 + *
18076 + *
18077 + * \remark
18078 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18079 + */
18080 +static ANTLR3_INLINE
18081 +void mIS(pSMARTPLLexer ctx)
18082 +{
18083 + ANTLR3_UINT32 _type;
18084 +
18085 + _type = IS;
18086 +
18087 +
18088 + // SMARTPL.g:84:6: ( 'is' )
18089 + // SMARTPL.g:84:8: 'is'
18090 + {
18091 + MATCHS(lit_19);
18092 + if (HASEXCEPTION())
18093 + {
18094 + goto ruleISEx;
18095 + }
18096 +
18097 +
18098 +
18099 + }
18100 +
18101 + LEXSTATE->type = _type;
18102 +
18103 + // This is where rules clean up and exit
18104 + //
18105 + goto ruleISEx; /* Prevent compiler warnings */
18106 + ruleISEx: ;
18107 +
18108 +}
18109 +// $ANTLR end IS
18110 +
18111 +// Comes from: 87:10: ( ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL ) )
18112 +/** \brief Lexer rule generated by ANTLR3
18113 + *
18114 + * $ANTLR start INTBOOL
18115 + *
18116 + * Looks to match the characters the constitute the token INTBOOL
18117 + * from the attached input stream.
18118 + *
18119 + *
18120 + * \remark
18121 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18122 + */
18123 +static ANTLR3_INLINE
18124 +void mINTBOOL(pSMARTPLLexer ctx)
18125 +{
18126 + ANTLR3_UINT32 _type;
18127 +
18128 + _type = INTBOOL;
18129 +
18130 +
18131 + // SMARTPL.g:87:10: ( ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL ) )
18132 + // SMARTPL.g:87:12: ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL )
18133 + {
18134 +
18135 + // SMARTPL.g:87:12: ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL )
18136 + {
18137 + int alt5=5;
18138 + switch ( LA(1) )
18139 + {
18140 + case '>':
18141 + {
18142 + switch ( LA(2) )
18143 + {
18144 + case '=':
18145 + {
18146 + alt5=2;
18147 + }
18148 + break;
18149 +
18150 + default:
18151 + alt5=1;}
18152 +
18153 + }
18154 + break;
18155 + case '<':
18156 + {
18157 + switch ( LA(2) )
18158 + {
18159 + case '=':
18160 + {
18161 + alt5=4;
18162 + }
18163 + break;
18164 +
18165 + default:
18166 + alt5=3;}
18167 +
18168 + }
18169 + break;
18170 + case '=':
18171 + {
18172 + alt5=5;
18173 + }
18174 + break;
18175 +
18176 + default:
18177 + CONSTRUCTEX();
18178 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18179 + EXCEPTION->message = (void *)"";
18180 + EXCEPTION->decisionNum = 5;
18181 + EXCEPTION->state = 0;
18182 +
18183 +
18184 + goto ruleINTBOOLEx;
18185 + }
18186 +
18187 + switch (alt5)
18188 + {
18189 + case 1:
18190 + // SMARTPL.g:87:13: GREATER
18191 + {
18192 + /* 87:13: GREATER */
18193 + mGREATER(ctx );
18194 + if (HASEXCEPTION())
18195 + {
18196 + goto ruleINTBOOLEx;
18197 + }
18198 +
18199 +
18200 + }
18201 + break;
18202 + case 2:
18203 + // SMARTPL.g:87:21: GREATEREQUAL
18204 + {
18205 + /* 87:21: GREATEREQUAL */
18206 + mGREATEREQUAL(ctx );
18207 + if (HASEXCEPTION())
18208 + {
18209 + goto ruleINTBOOLEx;
18210 + }
18211 +
18212 +
18213 + }
18214 + break;
18215 + case 3:
18216 + // SMARTPL.g:87:34: LESS
18217 + {
18218 + /* 87:34: LESS */
18219 + mLESS(ctx );
18220 + if (HASEXCEPTION())
18221 + {
18222 + goto ruleINTBOOLEx;
18223 + }
18224 +
18225 +
18226 + }
18227 + break;
18228 + case 4:
18229 + // SMARTPL.g:87:39: LESSEQUAL
18230 + {
18231 + /* 87:39: LESSEQUAL */
18232 + mLESSEQUAL(ctx );
18233 + if (HASEXCEPTION())
18234 + {
18235 + goto ruleINTBOOLEx;
18236 + }
18237 +
18238 +
18239 + }
18240 + break;
18241 + case 5:
18242 + // SMARTPL.g:87:49: EQUAL
18243 + {
18244 + /* 87:49: EQUAL */
18245 + mEQUAL(ctx );
18246 + if (HASEXCEPTION())
18247 + {
18248 + goto ruleINTBOOLEx;
18249 + }
18250 +
18251 +
18252 + }
18253 + break;
18254 +
18255 + }
18256 + }
18257 +
18258 + }
18259 +
18260 + LEXSTATE->type = _type;
18261 +
18262 + // This is where rules clean up and exit
18263 + //
18264 + goto ruleINTBOOLEx; /* Prevent compiler warnings */
18265 + ruleINTBOOLEx: ;
18266 +
18267 +}
18268 +// $ANTLR end INTBOOL
18269 +
18270 +// Comes from: 91:10: ( '>' )
18271 +/** \brief Lexer rule generated by ANTLR3
18272 + *
18273 + * $ANTLR start GREATER
18274 + *
18275 + * Looks to match the characters the constitute the token GREATER
18276 + * from the attached input stream.
18277 + *
18278 + *
18279 + * \remark
18280 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18281 + */
18282 +static ANTLR3_INLINE
18283 +void mGREATER(pSMARTPLLexer ctx)
18284 +{
18285 + ANTLR3_UINT32 _type;
18286 +
18287 +
18288 + // SMARTPL.g:91:10: ( '>' )
18289 + // SMARTPL.g:91:12: '>'
18290 + {
18291 + MATCHC('>');
18292 + if (HASEXCEPTION())
18293 + {
18294 + goto ruleGREATEREx;
18295 + }
18296 +
18297 +
18298 + }
18299 +
18300 +
18301 +
18302 + // This is where rules clean up and exit
18303 + //
18304 + goto ruleGREATEREx; /* Prevent compiler warnings */
18305 + ruleGREATEREx: ;
18306 +
18307 +}
18308 +// $ANTLR end GREATER
18309 +
18310 +// Comes from: 95:13: ( '>=' )
18311 +/** \brief Lexer rule generated by ANTLR3
18312 + *
18313 + * $ANTLR start GREATEREQUAL
18314 + *
18315 + * Looks to match the characters the constitute the token GREATEREQUAL
18316 + * from the attached input stream.
18317 + *
18318 + *
18319 + * \remark
18320 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18321 + */
18322 +static ANTLR3_INLINE
18323 +void mGREATEREQUAL(pSMARTPLLexer ctx)
18324 +{
18325 + ANTLR3_UINT32 _type;
18326 +
18327 +
18328 + // SMARTPL.g:95:13: ( '>=' )
18329 + // SMARTPL.g:95:15: '>='
18330 + {
18331 + MATCHS(lit_20);
18332 + if (HASEXCEPTION())
18333 + {
18334 + goto ruleGREATEREQUALEx;
18335 + }
18336 +
18337 +
18338 +
18339 + }
18340 +
18341 +
18342 +
18343 + // This is where rules clean up and exit
18344 + //
18345 + goto ruleGREATEREQUALEx; /* Prevent compiler warnings */
18346 + ruleGREATEREQUALEx: ;
18347 +
18348 +}
18349 +// $ANTLR end GREATEREQUAL
18350 +
18351 +// Comes from: 99:7: ( '<' )
18352 +/** \brief Lexer rule generated by ANTLR3
18353 + *
18354 + * $ANTLR start LESS
18355 + *
18356 + * Looks to match the characters the constitute the token LESS
18357 + * from the attached input stream.
18358 + *
18359 + *
18360 + * \remark
18361 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18362 + */
18363 +static ANTLR3_INLINE
18364 +void mLESS(pSMARTPLLexer ctx)
18365 +{
18366 + ANTLR3_UINT32 _type;
18367 +
18368 +
18369 + // SMARTPL.g:99:7: ( '<' )
18370 + // SMARTPL.g:99:9: '<'
18371 + {
18372 + MATCHC('<');
18373 + if (HASEXCEPTION())
18374 + {
18375 + goto ruleLESSEx;
18376 + }
18377 +
18378 +
18379 + }
18380 +
18381 +
18382 +
18383 + // This is where rules clean up and exit
18384 + //
18385 + goto ruleLESSEx; /* Prevent compiler warnings */
18386 + ruleLESSEx: ;
18387 +
18388 +}
18389 +// $ANTLR end LESS
18390 +
18391 +// Comes from: 103:11: ( '<=' )
18392 +/** \brief Lexer rule generated by ANTLR3
18393 + *
18394 + * $ANTLR start LESSEQUAL
18395 + *
18396 + * Looks to match the characters the constitute the token LESSEQUAL
18397 + * from the attached input stream.
18398 + *
18399 + *
18400 + * \remark
18401 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18402 + */
18403 +static ANTLR3_INLINE
18404 +void mLESSEQUAL(pSMARTPLLexer ctx)
18405 +{
18406 + ANTLR3_UINT32 _type;
18407 +
18408 +
18409 + // SMARTPL.g:103:11: ( '<=' )
18410 + // SMARTPL.g:103:13: '<='
18411 + {
18412 + MATCHS(lit_21);
18413 + if (HASEXCEPTION())
18414 + {
18415 + goto ruleLESSEQUALEx;
18416 + }
18417 +
18418 +
18419 +
18420 + }
18421 +
18422 +
18423 +
18424 + // This is where rules clean up and exit
18425 + //
18426 + goto ruleLESSEQUALEx; /* Prevent compiler warnings */
18427 + ruleLESSEQUALEx: ;
18428 +
18429 +}
18430 +// $ANTLR end LESSEQUAL
18431 +
18432 +// Comes from: 107:8: ( '=' )
18433 +/** \brief Lexer rule generated by ANTLR3
18434 + *
18435 + * $ANTLR start EQUAL
18436 + *
18437 + * Looks to match the characters the constitute the token EQUAL
18438 + * from the attached input stream.
18439 + *
18440 + *
18441 + * \remark
18442 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18443 + */
18444 +static ANTLR3_INLINE
18445 +void mEQUAL(pSMARTPLLexer ctx)
18446 +{
18447 + ANTLR3_UINT32 _type;
18448 +
18449 +
18450 + // SMARTPL.g:107:8: ( '=' )
18451 + // SMARTPL.g:107:10: '='
18452 + {
18453 + MATCHC('=');
18454 + if (HASEXCEPTION())
18455 + {
18456 + goto ruleEQUALEx;
18457 + }
18458 +
18459 +
18460 + }
18461 +
18462 +
18463 +
18464 + // This is where rules clean up and exit
18465 + //
18466 + goto ruleEQUALEx; /* Prevent compiler warnings */
18467 + ruleEQUALEx: ;
18468 +
18469 +}
18470 +// $ANTLR end EQUAL
18471 +
18472 +// Comes from: 110:8: ( 'after' )
18473 +/** \brief Lexer rule generated by ANTLR3
18474 + *
18475 + * $ANTLR start AFTER
18476 + *
18477 + * Looks to match the characters the constitute the token AFTER
18478 + * from the attached input stream.
18479 + *
18480 + *
18481 + * \remark
18482 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18483 + */
18484 +static ANTLR3_INLINE
18485 +void mAFTER(pSMARTPLLexer ctx)
18486 +{
18487 + ANTLR3_UINT32 _type;
18488 +
18489 + _type = AFTER;
18490 +
18491 +
18492 + // SMARTPL.g:110:8: ( 'after' )
18493 + // SMARTPL.g:110:10: 'after'
18494 + {
18495 + MATCHS(lit_22);
18496 + if (HASEXCEPTION())
18497 + {
18498 + goto ruleAFTEREx;
18499 + }
18500 +
18501 +
18502 +
18503 + }
18504 +
18505 + LEXSTATE->type = _type;
18506 +
18507 + // This is where rules clean up and exit
18508 + //
18509 + goto ruleAFTEREx; /* Prevent compiler warnings */
18510 + ruleAFTEREx: ;
18511 +
18512 +}
18513 +// $ANTLR end AFTER
18514 +
18515 +// Comes from: 113:9: ( 'before' )
18516 +/** \brief Lexer rule generated by ANTLR3
18517 + *
18518 + * $ANTLR start BEFORE
18519 + *
18520 + * Looks to match the characters the constitute the token BEFORE
18521 + * from the attached input stream.
18522 + *
18523 + *
18524 + * \remark
18525 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18526 + */
18527 +static ANTLR3_INLINE
18528 +void mBEFORE(pSMARTPLLexer ctx)
18529 +{
18530 + ANTLR3_UINT32 _type;
18531 +
18532 + _type = BEFORE;
18533 +
18534 +
18535 + // SMARTPL.g:113:9: ( 'before' )
18536 + // SMARTPL.g:113:11: 'before'
18537 + {
18538 + MATCHS(lit_23);
18539 + if (HASEXCEPTION())
18540 + {
18541 + goto ruleBEFOREEx;
18542 + }
18543 +
18544 +
18545 +
18546 + }
18547 +
18548 + LEXSTATE->type = _type;
18549 +
18550 + // This is where rules clean up and exit
18551 + //
18552 + goto ruleBEFOREEx; /* Prevent compiler warnings */
18553 + ruleBEFOREEx: ;
18554 +
18555 +}
18556 +// $ANTLR end BEFORE
18557 +
18558 +// Comes from: 116:7: ( 'ago' )
18559 +/** \brief Lexer rule generated by ANTLR3
18560 + *
18561 + * $ANTLR start AGO
18562 + *
18563 + * Looks to match the characters the constitute the token AGO
18564 + * from the attached input stream.
18565 + *
18566 + *
18567 + * \remark
18568 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18569 + */
18570 +static ANTLR3_INLINE
18571 +void mAGO(pSMARTPLLexer ctx)
18572 +{
18573 + ANTLR3_UINT32 _type;
18574 +
18575 + _type = AGO;
18576 +
18577 +
18578 + // SMARTPL.g:116:7: ( 'ago' )
18579 + // SMARTPL.g:116:9: 'ago'
18580 + {
18581 + MATCHS(lit_24);
18582 + if (HASEXCEPTION())
18583 + {
18584 + goto ruleAGOEx;
18585 + }
18586 +
18587 +
18588 +
18589 + }
18590 +
18591 + LEXSTATE->type = _type;
18592 +
18593 + // This is where rules clean up and exit
18594 + //
18595 + goto ruleAGOEx; /* Prevent compiler warnings */
18596 + ruleAGOEx: ;
18597 +
18598 +}
18599 +// $ANTLR end AGO
18600 +
18601 +// Comes from: 119:7: ( 'AND' | 'and' )
18602 +/** \brief Lexer rule generated by ANTLR3
18603 + *
18604 + * $ANTLR start AND
18605 + *
18606 + * Looks to match the characters the constitute the token AND
18607 + * from the attached input stream.
18608 + *
18609 + *
18610 + * \remark
18611 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18612 + */
18613 +static ANTLR3_INLINE
18614 +void mAND(pSMARTPLLexer ctx)
18615 +{
18616 + ANTLR3_UINT32 _type;
18617 +
18618 + _type = AND;
18619 +
18620 +
18621 + {
18622 + // SMARTPL.g:119:7: ( 'AND' | 'and' )
18623 +
18624 + ANTLR3_UINT32 alt6;
18625 +
18626 + alt6=2;
18627 +
18628 + switch ( LA(1) )
18629 + {
18630 + case 'A':
18631 + {
18632 + alt6=1;
18633 + }
18634 + break;
18635 + case 'a':
18636 + {
18637 + alt6=2;
18638 + }
18639 + break;
18640 +
18641 + default:
18642 + CONSTRUCTEX();
18643 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18644 + EXCEPTION->message = (void *)"";
18645 + EXCEPTION->decisionNum = 6;
18646 + EXCEPTION->state = 0;
18647 +
18648 +
18649 + goto ruleANDEx;
18650 + }
18651 +
18652 + switch (alt6)
18653 + {
18654 + case 1:
18655 + // SMARTPL.g:119:9: 'AND'
18656 + {
18657 + MATCHS(lit_25);
18658 + if (HASEXCEPTION())
18659 + {
18660 + goto ruleANDEx;
18661 + }
18662 +
18663 +
18664 +
18665 + }
18666 + break;
18667 + case 2:
18668 + // SMARTPL.g:120:6: 'and'
18669 + {
18670 + MATCHS(lit_26);
18671 + if (HASEXCEPTION())
18672 + {
18673 + goto ruleANDEx;
18674 + }
18675 +
18676 +
18677 +
18678 + }
18679 + break;
18680 +
18681 + }
18682 + }
18683 + LEXSTATE->type = _type;
18684 +
18685 + // This is where rules clean up and exit
18686 + //
18687 + goto ruleANDEx; /* Prevent compiler warnings */
18688 + ruleANDEx: ;
18689 +
18690 +}
18691 +// $ANTLR end AND
18692 +
18693 +// Comes from: 123:6: ( 'OR' | 'or' )
18694 +/** \brief Lexer rule generated by ANTLR3
18695 + *
18696 + * $ANTLR start OR
18697 + *
18698 + * Looks to match the characters the constitute the token OR
18699 + * from the attached input stream.
18700 + *
18701 + *
18702 + * \remark
18703 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18704 + */
18705 +static ANTLR3_INLINE
18706 +void mOR(pSMARTPLLexer ctx)
18707 +{
18708 + ANTLR3_UINT32 _type;
18709 +
18710 + _type = OR;
18711 +
18712 +
18713 + {
18714 + // SMARTPL.g:123:6: ( 'OR' | 'or' )
18715 +
18716 + ANTLR3_UINT32 alt7;
18717 +
18718 + alt7=2;
18719 +
18720 + switch ( LA(1) )
18721 + {
18722 + case 'O':
18723 + {
18724 + alt7=1;
18725 + }
18726 + break;
18727 + case 'o':
18728 + {
18729 + alt7=2;
18730 + }
18731 + break;
18732 +
18733 + default:
18734 + CONSTRUCTEX();
18735 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18736 + EXCEPTION->message = (void *)"";
18737 + EXCEPTION->decisionNum = 7;
18738 + EXCEPTION->state = 0;
18739 +
18740 +
18741 + goto ruleOREx;
18742 + }
18743 +
18744 + switch (alt7)
18745 + {
18746 + case 1:
18747 + // SMARTPL.g:123:8: 'OR'
18748 + {
18749 + MATCHS(lit_27);
18750 + if (HASEXCEPTION())
18751 + {
18752 + goto ruleOREx;
18753 + }
18754 +
18755 +
18756 +
18757 + }
18758 + break;
18759 + case 2:
18760 + // SMARTPL.g:124:6: 'or'
18761 + {
18762 + MATCHS(lit_28);
18763 + if (HASEXCEPTION())
18764 + {
18765 + goto ruleOREx;
18766 + }
18767 +
18768 +
18769 +
18770 + }
18771 + break;
18772 +
18773 + }
18774 + }
18775 + LEXSTATE->type = _type;
18776 +
18777 + // This is where rules clean up and exit
18778 + //
18779 + goto ruleOREx; /* Prevent compiler warnings */
18780 + ruleOREx: ;
18781 +
18782 +}
18783 +// $ANTLR end OR
18784 +
18785 +// Comes from: 127:7: ( 'NOT' | 'not' )
18786 +/** \brief Lexer rule generated by ANTLR3
18787 + *
18788 + * $ANTLR start NOT
18789 + *
18790 + * Looks to match the characters the constitute the token NOT
18791 + * from the attached input stream.
18792 + *
18793 + *
18794 + * \remark
18795 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18796 + */
18797 +static ANTLR3_INLINE
18798 +void mNOT(pSMARTPLLexer ctx)
18799 +{
18800 + ANTLR3_UINT32 _type;
18801 +
18802 + _type = NOT;
18803 +
18804 +
18805 + {
18806 + // SMARTPL.g:127:7: ( 'NOT' | 'not' )
18807 +
18808 + ANTLR3_UINT32 alt8;
18809 +
18810 + alt8=2;
18811 +
18812 + switch ( LA(1) )
18813 + {
18814 + case 'N':
18815 + {
18816 + alt8=1;
18817 + }
18818 + break;
18819 + case 'n':
18820 + {
18821 + alt8=2;
18822 + }
18823 + break;
18824 +
18825 + default:
18826 + CONSTRUCTEX();
18827 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
18828 + EXCEPTION->message = (void *)"";
18829 + EXCEPTION->decisionNum = 8;
18830 + EXCEPTION->state = 0;
18831 +
18832 +
18833 + goto ruleNOTEx;
18834 + }
18835 +
18836 + switch (alt8)
18837 + {
18838 + case 1:
18839 + // SMARTPL.g:127:9: 'NOT'
18840 + {
18841 + MATCHS(lit_29);
18842 + if (HASEXCEPTION())
18843 + {
18844 + goto ruleNOTEx;
18845 + }
18846 +
18847 +
18848 +
18849 + }
18850 + break;
18851 + case 2:
18852 + // SMARTPL.g:128:6: 'not'
18853 + {
18854 + MATCHS(lit_30);
18855 + if (HASEXCEPTION())
18856 + {
18857 + goto ruleNOTEx;
18858 + }
18859 +
18860 +
18861 +
18862 + }
18863 + break;
18864 +
18865 + }
18866 + }
18867 + LEXSTATE->type = _type;
18868 +
18869 + // This is where rules clean up and exit
18870 + //
18871 + goto ruleNOTEx; /* Prevent compiler warnings */
18872 + ruleNOTEx: ;
18873 +
18874 +}
18875 +// $ANTLR end NOT
18876 +
18877 +// Comes from: 131:7: ( '(' )
18878 +/** \brief Lexer rule generated by ANTLR3
18879 + *
18880 + * $ANTLR start LPAR
18881 + *
18882 + * Looks to match the characters the constitute the token LPAR
18883 + * from the attached input stream.
18884 + *
18885 + *
18886 + * \remark
18887 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18888 + */
18889 +static ANTLR3_INLINE
18890 +void mLPAR(pSMARTPLLexer ctx)
18891 +{
18892 + ANTLR3_UINT32 _type;
18893 +
18894 + _type = LPAR;
18895 +
18896 +
18897 + // SMARTPL.g:131:7: ( '(' )
18898 + // SMARTPL.g:131:9: '('
18899 + {
18900 + MATCHC('(');
18901 + if (HASEXCEPTION())
18902 + {
18903 + goto ruleLPAREx;
18904 + }
18905 +
18906 +
18907 + }
18908 +
18909 + LEXSTATE->type = _type;
18910 +
18911 + // This is where rules clean up and exit
18912 + //
18913 + goto ruleLPAREx; /* Prevent compiler warnings */
18914 + ruleLPAREx: ;
18915 +
18916 +}
18917 +// $ANTLR end LPAR
18918 +
18919 +// Comes from: 134:7: ( ')' )
18920 +/** \brief Lexer rule generated by ANTLR3
18921 + *
18922 + * $ANTLR start RPAR
18923 + *
18924 + * Looks to match the characters the constitute the token RPAR
18925 + * from the attached input stream.
18926 + *
18927 + *
18928 + * \remark
18929 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18930 + */
18931 +static ANTLR3_INLINE
18932 +void mRPAR(pSMARTPLLexer ctx)
18933 +{
18934 + ANTLR3_UINT32 _type;
18935 +
18936 + _type = RPAR;
18937 +
18938 +
18939 + // SMARTPL.g:134:7: ( ')' )
18940 + // SMARTPL.g:134:9: ')'
18941 + {
18942 + MATCHC(')');
18943 + if (HASEXCEPTION())
18944 + {
18945 + goto ruleRPAREx;
18946 + }
18947 +
18948 +
18949 + }
18950 +
18951 + LEXSTATE->type = _type;
18952 +
18953 + // This is where rules clean up and exit
18954 + //
18955 + goto ruleRPAREx; /* Prevent compiler warnings */
18956 + ruleRPAREx: ;
18957 +
18958 +}
18959 +// $ANTLR end RPAR
18960 +
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
18963 + *
18964 + * $ANTLR start DATE
18965 + *
18966 + * Looks to match the characters the constitute the token DATE
18967 + * from the attached input stream.
18968 + *
18969 + *
18970 + * \remark
18971 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
18972 + */
18973 +static ANTLR3_INLINE
18974 +void mDATE(pSMARTPLLexer ctx)
18975 +{
18976 + ANTLR3_UINT32 _type;
18977 +
18978 + _type = DATE;
18979 +
18980 +
18981 + {
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' )
18983 +
18984 + ANTLR3_UINT32 alt9;
18985 +
18986 + alt9=6;
18987 +
18988 + switch ( LA(1) )
18989 + {
18990 + case '0':
18991 + case '1':
18992 + case '2':
18993 + case '3':
18994 + case '4':
18995 + case '5':
18996 + case '6':
18997 + case '7':
18998 + case '8':
18999 + case '9':
19000 + {
19001 + alt9=1;
19002 + }
19003 + break;
19004 + case 't':
19005 + {
19006 + alt9=2;
19007 + }
19008 + break;
19009 + case 'y':
19010 + {
19011 + alt9=3;
19012 + }
19013 + break;
19014 + case 'l':
19015 + {
19016 + switch ( LA(2) )
19017 + {
19018 + case 'a':
19019 + {
19020 + switch ( LA(3) )
19021 + {
19022 + case 's':
19023 + {
19024 + switch ( LA(4) )
19025 + {
19026 + case 't':
19027 + {
19028 + switch ( LA(5) )
19029 + {
19030 + case ' ':
19031 + {
19032 + switch ( LA(6) )
19033 + {
19034 + case 'w':
19035 + {
19036 + alt9=4;
19037 + }
19038 + break;
19039 + case 'm':
19040 + {
19041 + alt9=5;
19042 + }
19043 + break;
19044 + case 'y':
19045 + {
19046 + alt9=6;
19047 + }
19048 + break;
19049 +
19050 + default:
19051 + CONSTRUCTEX();
19052 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19053 + EXCEPTION->message = (void *)"";
19054 + EXCEPTION->decisionNum = 9;
19055 + EXCEPTION->state = 8;
19056 +
19057 +
19058 + goto ruleDATEEx;
19059 + }
19060 +
19061 + }
19062 + break;
19063 +
19064 + default:
19065 + CONSTRUCTEX();
19066 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19067 + EXCEPTION->message = (void *)"";
19068 + EXCEPTION->decisionNum = 9;
19069 + EXCEPTION->state = 7;
19070 +
19071 +
19072 + goto ruleDATEEx;
19073 + }
19074 +
19075 + }
19076 + break;
19077 +
19078 + default:
19079 + CONSTRUCTEX();
19080 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19081 + EXCEPTION->message = (void *)"";
19082 + EXCEPTION->decisionNum = 9;
19083 + EXCEPTION->state = 6;
19084 +
19085 +
19086 + goto ruleDATEEx;
19087 + }
19088 +
19089 + }
19090 + break;
19091 +
19092 + default:
19093 + CONSTRUCTEX();
19094 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19095 + EXCEPTION->message = (void *)"";
19096 + EXCEPTION->decisionNum = 9;
19097 + EXCEPTION->state = 5;
19098 +
19099 +
19100 + goto ruleDATEEx;
19101 + }
19102 +
19103 + }
19104 + break;
19105 +
19106 + default:
19107 + CONSTRUCTEX();
19108 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19109 + EXCEPTION->message = (void *)"";
19110 + EXCEPTION->decisionNum = 9;
19111 + EXCEPTION->state = 4;
19112 +
19113 +
19114 + goto ruleDATEEx;
19115 + }
19116 +
19117 + }
19118 + break;
19119 +
19120 + default:
19121 + CONSTRUCTEX();
19122 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19123 + EXCEPTION->message = (void *)"";
19124 + EXCEPTION->decisionNum = 9;
19125 + EXCEPTION->state = 0;
19126 +
19127 +
19128 + goto ruleDATEEx;
19129 + }
19130 +
19131 + switch (alt9)
19132 + {
19133 + case 1:
19134 + // SMARTPL.g:137:9: ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) '-' ( '0' .. '1' ) ( '0' .. '9' ) '-' ( '0' .. '3' ) ( '0' .. '9' )
19135 + {
19136 + // SMARTPL.g:137:9: ( '0' .. '9' )
19137 + // SMARTPL.g:137:10: '0' .. '9'
19138 + {
19139 + MATCHRANGE('0', '9');
19140 + if (HASEXCEPTION())
19141 + {
19142 + goto ruleDATEEx;
19143 + }
19144 +
19145 +
19146 + }
19147 +
19148 + // SMARTPL.g:137:19: ( '0' .. '9' )
19149 + // SMARTPL.g:137:20: '0' .. '9'
19150 + {
19151 + MATCHRANGE('0', '9');
19152 + if (HASEXCEPTION())
19153 + {
19154 + goto ruleDATEEx;
19155 + }
19156 +
19157 +
19158 + }
19159 +
19160 + // SMARTPL.g:137:29: ( '0' .. '9' )
19161 + // SMARTPL.g:137:30: '0' .. '9'
19162 + {
19163 + MATCHRANGE('0', '9');
19164 + if (HASEXCEPTION())
19165 + {
19166 + goto ruleDATEEx;
19167 + }
19168 +
19169 +
19170 + }
19171 +
19172 + // SMARTPL.g:137:39: ( '0' .. '9' )
19173 + // SMARTPL.g:137:40: '0' .. '9'
19174 + {
19175 + MATCHRANGE('0', '9');
19176 + if (HASEXCEPTION())
19177 + {
19178 + goto ruleDATEEx;
19179 + }
19180 +
19181 +
19182 + }
19183 +
19184 + MATCHC('-');
19185 + if (HASEXCEPTION())
19186 + {
19187 + goto ruleDATEEx;
19188 + }
19189 +
19190 + // SMARTPL.g:137:52: ( '0' .. '1' )
19191 + // SMARTPL.g:137:53: '0' .. '1'
19192 + {
19193 + MATCHRANGE('0', '1');
19194 + if (HASEXCEPTION())
19195 + {
19196 + goto ruleDATEEx;
19197 + }
19198 +
19199 +
19200 + }
19201 +
19202 + // SMARTPL.g:137:62: ( '0' .. '9' )
19203 + // SMARTPL.g:137:63: '0' .. '9'
19204 + {
19205 + MATCHRANGE('0', '9');
19206 + if (HASEXCEPTION())
19207 + {
19208 + goto ruleDATEEx;
19209 + }
19210 +
19211 +
19212 + }
19213 +
19214 + MATCHC('-');
19215 + if (HASEXCEPTION())
19216 + {
19217 + goto ruleDATEEx;
19218 + }
19219 +
19220 + // SMARTPL.g:137:75: ( '0' .. '3' )
19221 + // SMARTPL.g:137:76: '0' .. '3'
19222 + {
19223 + MATCHRANGE('0', '3');
19224 + if (HASEXCEPTION())
19225 + {
19226 + goto ruleDATEEx;
19227 + }
19228 +
19229 +
19230 + }
19231 +
19232 + // SMARTPL.g:137:85: ( '0' .. '9' )
19233 + // SMARTPL.g:137:86: '0' .. '9'
19234 + {
19235 + MATCHRANGE('0', '9');
19236 + if (HASEXCEPTION())
19237 + {
19238 + goto ruleDATEEx;
19239 + }
19240 +
19241 +
19242 + }
19243 +
19244 +
19245 + }
19246 + break;
19247 + case 2:
19248 + // SMARTPL.g:138:6: 'today'
19249 + {
19250 + MATCHS(lit_31);
19251 + if (HASEXCEPTION())
19252 + {
19253 + goto ruleDATEEx;
19254 + }
19255 +
19256 +
19257 +
19258 + }
19259 + break;
19260 + case 3:
19261 + // SMARTPL.g:139:6: 'yesterday'
19262 + {
19263 + MATCHS(lit_32);
19264 + if (HASEXCEPTION())
19265 + {
19266 + goto ruleDATEEx;
19267 + }
19268 +
19269 +
19270 +
19271 + }
19272 + break;
19273 + case 4:
19274 + // SMARTPL.g:140:6: 'last week'
19275 + {
19276 + MATCHS(lit_33);
19277 + if (HASEXCEPTION())
19278 + {
19279 + goto ruleDATEEx;
19280 + }
19281 +
19282 +
19283 +
19284 + }
19285 + break;
19286 + case 5:
19287 + // SMARTPL.g:141:6: 'last month'
19288 + {
19289 + MATCHS(lit_34);
19290 + if (HASEXCEPTION())
19291 + {
19292 + goto ruleDATEEx;
19293 + }
19294 +
19295 +
19296 +
19297 + }
19298 + break;
19299 + case 6:
19300 + // SMARTPL.g:142:6: 'last year'
19301 + {
19302 + MATCHS(lit_35);
19303 + if (HASEXCEPTION())
19304 + {
19305 + goto ruleDATEEx;
19306 + }
19307 +
19308 +
19309 +
19310 + }
19311 + break;
19312 +
19313 + }
19314 + }
19315 + LEXSTATE->type = _type;
19316 +
19317 + // This is where rules clean up and exit
19318 + //
19319 + goto ruleDATEEx; /* Prevent compiler warnings */
19320 + ruleDATEEx: ;
19321 +
19322 +}
19323 +// $ANTLR end DATE
19324 +
19325 +// Comes from: 145:13: ( 'days' | 'weeks' | 'months' | 'years' )
19326 +/** \brief Lexer rule generated by ANTLR3
19327 + *
19328 + * $ANTLR start DATINTERVAL
19329 + *
19330 + * Looks to match the characters the constitute the token DATINTERVAL
19331 + * from the attached input stream.
19332 + *
19333 + *
19334 + * \remark
19335 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19336 + */
19337 +static ANTLR3_INLINE
19338 +void mDATINTERVAL(pSMARTPLLexer ctx)
19339 +{
19340 + ANTLR3_UINT32 _type;
19341 +
19342 + _type = DATINTERVAL;
19343 +
19344 +
19345 + {
19346 + // SMARTPL.g:145:13: ( 'days' | 'weeks' | 'months' | 'years' )
19347 +
19348 + ANTLR3_UINT32 alt10;
19349 +
19350 + alt10=4;
19351 +
19352 + switch ( LA(1) )
19353 + {
19354 + case 'd':
19355 + {
19356 + alt10=1;
19357 + }
19358 + break;
19359 + case 'w':
19360 + {
19361 + alt10=2;
19362 + }
19363 + break;
19364 + case 'm':
19365 + {
19366 + alt10=3;
19367 + }
19368 + break;
19369 + case 'y':
19370 + {
19371 + alt10=4;
19372 + }
19373 + break;
19374 +
19375 + default:
19376 + CONSTRUCTEX();
19377 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19378 + EXCEPTION->message = (void *)"";
19379 + EXCEPTION->decisionNum = 10;
19380 + EXCEPTION->state = 0;
19381 +
19382 +
19383 + goto ruleDATINTERVALEx;
19384 + }
19385 +
19386 + switch (alt10)
19387 + {
19388 + case 1:
19389 + // SMARTPL.g:145:15: 'days'
19390 + {
19391 + MATCHS(lit_36);
19392 + if (HASEXCEPTION())
19393 + {
19394 + goto ruleDATINTERVALEx;
19395 + }
19396 +
19397 +
19398 +
19399 + }
19400 + break;
19401 + case 2:
19402 + // SMARTPL.g:146:6: 'weeks'
19403 + {
19404 + MATCHS(lit_37);
19405 + if (HASEXCEPTION())
19406 + {
19407 + goto ruleDATINTERVALEx;
19408 + }
19409 +
19410 +
19411 +
19412 + }
19413 + break;
19414 + case 3:
19415 + // SMARTPL.g:147:6: 'months'
19416 + {
19417 + MATCHS(lit_38);
19418 + if (HASEXCEPTION())
19419 + {
19420 + goto ruleDATINTERVALEx;
19421 + }
19422 +
19423 +
19424 +
19425 + }
19426 + break;
19427 + case 4:
19428 + // SMARTPL.g:148:6: 'years'
19429 + {
19430 + MATCHS(lit_39);
19431 + if (HASEXCEPTION())
19432 + {
19433 + goto ruleDATINTERVALEx;
19434 + }
19435 +
19436 +
19437 +
19438 + }
19439 + break;
19440 +
19441 + }
19442 + }
19443 + LEXSTATE->type = _type;
19444 +
19445 + // This is where rules clean up and exit
19446 + //
19447 + goto ruleDATINTERVALEx; /* Prevent compiler warnings */
19448 + ruleDATINTERVALEx: ;
19449 +
19450 +}
19451 +// $ANTLR end DATINTERVAL
19452 +
19453 +// Comes from: 151:10: ( 'music' | 'movie' | 'podcast' | 'audiobook' | 'tvshow' | 'file' | 'url' | 'spotify' | 'pipe' )
19454 +/** \brief Lexer rule generated by ANTLR3
19455 + *
19456 + * $ANTLR start ENUMVAL
19457 + *
19458 + * Looks to match the characters the constitute the token ENUMVAL
19459 + * from the attached input stream.
19460 + *
19461 + *
19462 + * \remark
19463 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19464 + */
19465 +static ANTLR3_INLINE
19466 +void mENUMVAL(pSMARTPLLexer ctx)
19467 +{
19468 + ANTLR3_UINT32 _type;
19469 +
19470 + _type = ENUMVAL;
19471 +
19472 +
19473 + {
19474 + // SMARTPL.g:151:10: ( 'music' | 'movie' | 'podcast' | 'audiobook' | 'tvshow' | 'file' | 'url' | 'spotify' | 'pipe' )
19475 +
19476 + ANTLR3_UINT32 alt11;
19477 +
19478 + alt11=9;
19479 +
19480 + switch ( LA(1) )
19481 + {
19482 + case 'm':
19483 + {
19484 + switch ( LA(2) )
19485 + {
19486 + case 'u':
19487 + {
19488 + alt11=1;
19489 + }
19490 + break;
19491 + case 'o':
19492 + {
19493 + alt11=2;
19494 + }
19495 + break;
19496 +
19497 + default:
19498 + CONSTRUCTEX();
19499 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19500 + EXCEPTION->message = (void *)"";
19501 + EXCEPTION->decisionNum = 11;
19502 + EXCEPTION->state = 1;
19503 +
19504 +
19505 + goto ruleENUMVALEx;
19506 + }
19507 +
19508 + }
19509 + break;
19510 + case 'p':
19511 + {
19512 + switch ( LA(2) )
19513 + {
19514 + case 'o':
19515 + {
19516 + alt11=3;
19517 + }
19518 + break;
19519 + case 'i':
19520 + {
19521 + alt11=9;
19522 + }
19523 + break;
19524 +
19525 + default:
19526 + CONSTRUCTEX();
19527 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19528 + EXCEPTION->message = (void *)"";
19529 + EXCEPTION->decisionNum = 11;
19530 + EXCEPTION->state = 2;
19531 +
19532 +
19533 + goto ruleENUMVALEx;
19534 + }
19535 +
19536 + }
19537 + break;
19538 + case 'a':
19539 + {
19540 + alt11=4;
19541 + }
19542 + break;
19543 + case 't':
19544 + {
19545 + alt11=5;
19546 + }
19547 + break;
19548 + case 'f':
19549 + {
19550 + alt11=6;
19551 + }
19552 + break;
19553 + case 'u':
19554 + {
19555 + alt11=7;
19556 + }
19557 + break;
19558 + case 's':
19559 + {
19560 + alt11=8;
19561 + }
19562 + break;
19563 +
19564 + default:
19565 + CONSTRUCTEX();
19566 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
19567 + EXCEPTION->message = (void *)"";
19568 + EXCEPTION->decisionNum = 11;
19569 + EXCEPTION->state = 0;
19570 +
19571 +
19572 + goto ruleENUMVALEx;
19573 + }
19574 +
19575 + switch (alt11)
19576 + {
19577 + case 1:
19578 + // SMARTPL.g:151:12: 'music'
19579 + {
19580 + MATCHS(lit_40);
19581 + if (HASEXCEPTION())
19582 + {
19583 + goto ruleENUMVALEx;
19584 + }
19585 +
19586 +
19587 +
19588 + }
19589 + break;
19590 + case 2:
19591 + // SMARTPL.g:152:6: 'movie'
19592 + {
19593 + MATCHS(lit_41);
19594 + if (HASEXCEPTION())
19595 + {
19596 + goto ruleENUMVALEx;
19597 + }
19598 +
19599 +
19600 +
19601 + }
19602 + break;
19603 + case 3:
19604 + // SMARTPL.g:153:6: 'podcast'
19605 + {
19606 + MATCHS(lit_42);
19607 + if (HASEXCEPTION())
19608 + {
19609 + goto ruleENUMVALEx;
19610 + }
19611 +
19612 +
19613 +
19614 + }
19615 + break;
19616 + case 4:
19617 + // SMARTPL.g:154:6: 'audiobook'
19618 + {
19619 + MATCHS(lit_43);
19620 + if (HASEXCEPTION())
19621 + {
19622 + goto ruleENUMVALEx;
19623 + }
19624 +
19625 +
19626 +
19627 + }
19628 + break;
19629 + case 5:
19630 + // SMARTPL.g:155:6: 'tvshow'
19631 + {
19632 + MATCHS(lit_44);
19633 + if (HASEXCEPTION())
19634 + {
19635 + goto ruleENUMVALEx;
19636 + }
19637 +
19638 +
19639 +
19640 + }
19641 + break;
19642 + case 6:
19643 + // SMARTPL.g:156:6: 'file'
19644 + {
19645 + MATCHS(lit_45);
19646 + if (HASEXCEPTION())
19647 + {
19648 + goto ruleENUMVALEx;
19649 + }
19650 +
19651 +
19652 +
19653 + }
19654 + break;
19655 + case 7:
19656 + // SMARTPL.g:157:6: 'url'
19657 + {
19658 + MATCHS(lit_46);
19659 + if (HASEXCEPTION())
19660 + {
19661 + goto ruleENUMVALEx;
19662 + }
19663 +
19664 +
19665 +
19666 + }
19667 + break;
19668 + case 8:
19669 + // SMARTPL.g:158:6: 'spotify'
19670 + {
19671 + MATCHS(lit_47);
19672 + if (HASEXCEPTION())
19673 + {
19674 + goto ruleENUMVALEx;
19675 + }
19676 +
19677 +
19678 +
19679 + }
19680 + break;
19681 + case 9:
19682 + // SMARTPL.g:159:6: 'pipe'
19683 + {
19684 + MATCHS(lit_48);
19685 + if (HASEXCEPTION())
19686 + {
19687 + goto ruleENUMVALEx;
19688 + }
19689 +
19690 +
19691 +
19692 + }
19693 + break;
19694 +
19695 + }
19696 + }
19697 + LEXSTATE->type = _type;
19698 +
19699 + // This is where rules clean up and exit
19700 + //
19701 + goto ruleENUMVALEx; /* Prevent compiler warnings */
19702 + ruleENUMVALEx: ;
19703 +
19704 +}
19705 +// $ANTLR end ENUMVAL
19706 +
19707 +// Comes from: 162:7: ( '\"' (~ ( '\"' ) )+ '\"' )
19708 +/** \brief Lexer rule generated by ANTLR3
19709 + *
19710 + * $ANTLR start STR
19711 + *
19712 + * Looks to match the characters the constitute the token STR
19713 + * from the attached input stream.
19714 + *
19715 + *
19716 + * \remark
19717 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19718 + */
19719 +static ANTLR3_INLINE
19720 +void mSTR(pSMARTPLLexer ctx)
19721 +{
19722 + ANTLR3_UINT32 _type;
19723 +
19724 + _type = STR;
19725 +
19726 +
19727 + // SMARTPL.g:162:7: ( '\"' (~ ( '\"' ) )+ '\"' )
19728 + // SMARTPL.g:162:9: '\"' (~ ( '\"' ) )+ '\"'
19729 + {
19730 + MATCHC('"');
19731 + if (HASEXCEPTION())
19732 + {
19733 + goto ruleSTREx;
19734 + }
19735 +
19736 + // SMARTPL.g:162:13: (~ ( '\"' ) )+
19737 + {
19738 + int cnt12=0;
19739 +
19740 + for (;;)
19741 + {
19742 + int alt12=2;
19743 + {
19744 + /* dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState)
19745 + */
19746 + int LA12_0 = LA(1);
19747 + if ( (((LA12_0 >= 0x0000) && (LA12_0 <= '!')) || ((LA12_0 >= '#') && (LA12_0 <= 0xFFFF))) )
19748 + {
19749 + alt12=1;
19750 + }
19751 +
19752 + }
19753 + switch (alt12)
19754 + {
19755 + case 1:
19756 + // SMARTPL.g:162:13: ~ ( '\"' )
19757 + {
19758 + if ( ((LA(1) >= 0x0000) && (LA(1) <= '!')) || ((LA(1) >= '#') && (LA(1) <= 0xFFFF)) )
19759 + {
19760 + CONSUME();
19761 +
19762 + }
19763 + else
19764 + {
19765 + CONSTRUCTEX();
19766 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
19767 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
19768 +
19769 + LRECOVER(); goto ruleSTREx;
19770 + }
19771 +
19772 +
19773 + }
19774 + break;
19775 +
19776 + default:
19777 +
19778 + if ( cnt12 >= 1 )
19779 + {
19780 + goto loop12;
19781 + }
19782 + /* mismatchedSetEx()
19783 + */
19784 + CONSTRUCTEX();
19785 + EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
19786 + EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
19787 +
19788 +
19789 + goto ruleSTREx;
19790 + }
19791 + cnt12++;
19792 + }
19793 + loop12: ; /* Jump to here if this rule does not match */
19794 + }
19795 + MATCHC('"');
19796 + if (HASEXCEPTION())
19797 + {
19798 + goto ruleSTREx;
19799 + }
19800 +
19801 +
19802 + }
19803 +
19804 + LEXSTATE->type = _type;
19805 +
19806 + // This is where rules clean up and exit
19807 + //
19808 + goto ruleSTREx; /* Prevent compiler warnings */
19809 + ruleSTREx: ;
19810 +
19811 +}
19812 +// $ANTLR end STR
19813 +
19814 +// Comes from: 165:7: ( ( '0' .. '9' )+ )
19815 +/** \brief Lexer rule generated by ANTLR3
19816 + *
19817 + * $ANTLR start INT
19818 + *
19819 + * Looks to match the characters the constitute the token INT
19820 + * from the attached input stream.
19821 + *
19822 + *
19823 + * \remark
19824 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19825 + */
19826 +static ANTLR3_INLINE
19827 +void mINT(pSMARTPLLexer ctx)
19828 +{
19829 + ANTLR3_UINT32 _type;
19830 +
19831 + _type = INT;
19832 +
19833 +
19834 + // SMARTPL.g:165:7: ( ( '0' .. '9' )+ )
19835 + // SMARTPL.g:165:9: ( '0' .. '9' )+
19836 + {
19837 + // SMARTPL.g:165:9: ( '0' .. '9' )+
19838 + {
19839 + int cnt13=0;
19840 +
19841 + for (;;)
19842 + {
19843 + int alt13=2;
19844 + switch ( LA(1) )
19845 + {
19846 + case '0':
19847 + case '1':
19848 + case '2':
19849 + case '3':
19850 + case '4':
19851 + case '5':
19852 + case '6':
19853 + case '7':
19854 + case '8':
19855 + case '9':
19856 + {
19857 + alt13=1;
19858 + }
19859 + break;
19860 +
19861 + }
19862 +
19863 + switch (alt13)
19864 + {
19865 + case 1:
19866 + // SMARTPL.g:165:10: '0' .. '9'
19867 + {
19868 + MATCHRANGE('0', '9');
19869 + if (HASEXCEPTION())
19870 + {
19871 + goto ruleINTEx;
19872 + }
19873 +
19874 +
19875 + }
19876 + break;
19877 +
19878 + default:
19879 +
19880 + if ( cnt13 >= 1 )
19881 + {
19882 + goto loop13;
19883 + }
19884 + /* mismatchedSetEx()
19885 + */
19886 + CONSTRUCTEX();
19887 + EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
19888 + EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
19889 +
19890 +
19891 + goto ruleINTEx;
19892 + }
19893 + cnt13++;
19894 + }
19895 + loop13: ; /* Jump to here if this rule does not match */
19896 + }
19897 +
19898 + }
19899 +
19900 + LEXSTATE->type = _type;
19901 +
19902 + // This is where rules clean up and exit
19903 + //
19904 + goto ruleINTEx; /* Prevent compiler warnings */
19905 + ruleINTEx: ;
19906 +
19907 +}
19908 +// $ANTLR end INT
19909 +
19910 +// Comes from: 168:12: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' ) )
19911 +/** \brief Lexer rule generated by ANTLR3
19912 + *
19913 + * $ANTLR start WHITESPACE
19914 + *
19915 + * Looks to match the characters the constitute the token WHITESPACE
19916 + * from the attached input stream.
19917 + *
19918 + *
19919 + * \remark
19920 + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
19921 + */
19922 +static ANTLR3_INLINE
19923 +void mWHITESPACE(pSMARTPLLexer ctx)
19924 +{
19925 + ANTLR3_UINT32 _type;
19926 +
19927 + _type = WHITESPACE;
19928 +
19929 +
19930 + // SMARTPL.g:168:12: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' ) )
19931 + // SMARTPL.g:168:14: ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' )
19932 + {
19933 + if ( ((LA(1) >= '\t') && (LA(1) <= '\n')) || ((LA(1) >= '\f') && (LA(1) <= '\r')) || LA(1) == ' ' )
19934 + {
19935 + CONSUME();
19936 +
19937 + }
19938 + else
19939 + {
19940 + CONSTRUCTEX();
19941 + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
19942 + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
19943 +
19944 + LRECOVER(); goto ruleWHITESPACEEx;
19945 + }
19946 +
19947 + {
19948 + LEXSTATE->channel = HIDDEN;
19949 + }
19950 +
19951 + }
19952 +
19953 + LEXSTATE->type = _type;
19954 +
19955 + // This is where rules clean up and exit
19956 + //
19957 + goto ruleWHITESPACEEx; /* Prevent compiler warnings */
19958 + ruleWHITESPACEEx: ;
19959 +
19960 +}
19961 +// $ANTLR end WHITESPACE
19962 +
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
19965 + */
19966 +static void
19967 +mTokens(pSMARTPLLexer ctx)
19968 +{
19969 + {
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 )
19971 +
19972 + ANTLR3_UINT32 alt14;
19973 +
19974 + alt14=23;
19975 +
19976 + switch ( LA(1) )
19977 + {
19978 + case '{':
19979 + {
19980 + alt14=1;
19981 + }
19982 + break;
19983 + case '}':
19984 + {
19985 + alt14=2;
19986 + }
19987 + break;
19988 + case 'a':
19989 + {
19990 + switch ( LA(2) )
19991 + {
19992 + case 'l':
19993 + case 'r':
19994 + {
19995 + alt14=3;
19996 + }
19997 + break;
19998 + case 'f':
19999 + {
20000 + alt14=10;
20001 + }
20002 + break;
20003 + case 'g':
20004 + {
20005 + alt14=12;
20006 + }
20007 + break;
20008 + case 'n':
20009 + {
20010 + alt14=13;
20011 + }
20012 + break;
20013 + case 'u':
20014 + {
20015 + alt14=20;
20016 + }
20017 + break;
20018 +
20019 + default:
20020 + CONSTRUCTEX();
20021 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20022 + EXCEPTION->message = (void *)"";
20023 + EXCEPTION->decisionNum = 14;
20024 + EXCEPTION->state = 3;
20025 +
20026 +
20027 + goto ruleTokensEx;
20028 + }
20029 +
20030 + }
20031 + break;
20032 + case 't':
20033 + {
20034 + switch ( LA(2) )
20035 + {
20036 + case 'i':
20037 + {
20038 + switch ( LA(3) )
20039 + {
20040 + case 't':
20041 + {
20042 + alt14=3;
20043 + }
20044 + break;
20045 + case 'm':
20046 + {
20047 + alt14=5;
20048 + }
20049 + break;
20050 +
20051 + default:
20052 + CONSTRUCTEX();
20053 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20054 + EXCEPTION->message = (void *)"";
20055 + EXCEPTION->decisionNum = 14;
20056 + EXCEPTION->state = 28;
20057 +
20058 +
20059 + goto ruleTokensEx;
20060 + }
20061 +
20062 + }
20063 + break;
20064 + case 'y':
20065 + {
20066 + alt14=3;
20067 + }
20068 + break;
20069 + case 'o':
20070 + {
20071 + alt14=18;
20072 + }
20073 + break;
20074 + case 'v':
20075 + {
20076 + alt14=20;
20077 + }
20078 + break;
20079 +
20080 + default:
20081 + CONSTRUCTEX();
20082 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20083 + EXCEPTION->message = (void *)"";
20084 + EXCEPTION->decisionNum = 14;
20085 + EXCEPTION->state = 4;
20086 +
20087 +
20088 + goto ruleTokensEx;
20089 + }
20090 +
20091 + }
20092 + break;
20093 + case 'g':
20094 + {
20095 + alt14=3;
20096 + }
20097 + break;
20098 + case 'c':
20099 + {
20100 + switch ( LA(2) )
20101 + {
20102 + case 'o':
20103 + {
20104 + switch ( LA(3) )
20105 + {
20106 + case 'm':
20107 + {
20108 + switch ( LA(4) )
20109 + {
20110 + case 'p':
20111 + {
20112 + switch ( LA(5) )
20113 + {
20114 + case 'o':
20115 + {
20116 + alt14=3;
20117 + }
20118 + break;
20119 + case 'i':
20120 + {
20121 + alt14=4;
20122 + }
20123 + break;
20124 +
20125 + default:
20126 + CONSTRUCTEX();
20127 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20128 + EXCEPTION->message = (void *)"";
20129 + EXCEPTION->decisionNum = 14;
20130 + EXCEPTION->state = 42;
20131 +
20132 +
20133 + goto ruleTokensEx;
20134 + }
20135 +
20136 + }
20137 + break;
20138 +
20139 + default:
20140 + CONSTRUCTEX();
20141 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20142 + EXCEPTION->message = (void *)"";
20143 + EXCEPTION->decisionNum = 14;
20144 + EXCEPTION->state = 39;
20145 +
20146 +
20147 + goto ruleTokensEx;
20148 + }
20149 +
20150 + }
20151 + break;
20152 +
20153 + default:
20154 + CONSTRUCTEX();
20155 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20156 + EXCEPTION->message = (void *)"";
20157 + EXCEPTION->decisionNum = 14;
20158 + EXCEPTION->state = 29;
20159 +
20160 +
20161 + goto ruleTokensEx;
20162 + }
20163 +
20164 + }
20165 + break;
20166 +
20167 + default:
20168 + CONSTRUCTEX();
20169 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20170 + EXCEPTION->message = (void *)"";
20171 + EXCEPTION->decisionNum = 14;
20172 + EXCEPTION->state = 6;
20173 +
20174 +
20175 + goto ruleTokensEx;
20176 + }
20177 +
20178 + }
20179 + break;
20180 + case 'p':
20181 + {
20182 + switch ( LA(2) )
20183 + {
20184 + case 'a':
20185 + {
20186 + alt14=3;
20187 + }
20188 + break;
20189 + case 'l':
20190 + {
20191 + alt14=4;
20192 + }
20193 + break;
20194 + case 'i':
20195 + case 'o':
20196 + {
20197 + alt14=20;
20198 + }
20199 + break;
20200 +
20201 + default:
20202 + CONSTRUCTEX();
20203 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20204 + EXCEPTION->message = (void *)"";
20205 + EXCEPTION->decisionNum = 14;
20206 + EXCEPTION->state = 7;
20207 +
20208 +
20209 + goto ruleTokensEx;
20210 + }
20211 +
20212 + }
20213 + break;
20214 + case 'r':
20215 + {
20216 + alt14=4;
20217 + }
20218 + break;
20219 + case 'y':
20220 + {
20221 + switch ( LA(2) )
20222 + {
20223 + case 'e':
20224 + {
20225 + switch ( LA(3) )
20226 + {
20227 + case 'a':
20228 + {
20229 + switch ( LA(4) )
20230 + {
20231 + case 'r':
20232 + {
20233 + switch ( LA(5) )
20234 + {
20235 + case 's':
20236 + {
20237 + alt14=19;
20238 + }
20239 + break;
20240 +
20241 + default:
20242 + alt14=4;}
20243 +
20244 + }
20245 + break;
20246 +
20247 + default:
20248 + CONSTRUCTEX();
20249 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20250 + EXCEPTION->message = (void *)"";
20251 + EXCEPTION->decisionNum = 14;
20252 + EXCEPTION->state = 40;
20253 +
20254 +
20255 + goto ruleTokensEx;
20256 + }
20257 +
20258 + }
20259 + break;
20260 + case 's':
20261 + {
20262 + alt14=18;
20263 + }
20264 + break;
20265 +
20266 + default:
20267 + CONSTRUCTEX();
20268 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20269 + EXCEPTION->message = (void *)"";
20270 + EXCEPTION->decisionNum = 14;
20271 + EXCEPTION->state = 30;
20272 +
20273 +
20274 + goto ruleTokensEx;
20275 + }
20276 +
20277 + }
20278 + break;
20279 +
20280 + default:
20281 + CONSTRUCTEX();
20282 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20283 + EXCEPTION->message = (void *)"";
20284 + EXCEPTION->decisionNum = 14;
20285 + EXCEPTION->state = 9;
20286 +
20287 +
20288 + goto ruleTokensEx;
20289 + }
20290 +
20291 + }
20292 + break;
20293 + case 'd':
20294 + {
20295 + switch ( LA(2) )
20296 + {
20297 + case 'a':
20298 + {
20299 + switch ( LA(3) )
20300 + {
20301 + case 't':
20302 + {
20303 + alt14=6;
20304 + }
20305 + break;
20306 + case 'y':
20307 + {
20308 + alt14=19;
20309 + }
20310 + break;
20311 +
20312 + default:
20313 + CONSTRUCTEX();
20314 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20315 + EXCEPTION->message = (void *)"";
20316 + EXCEPTION->decisionNum = 14;
20317 + EXCEPTION->state = 31;
20318 +
20319 +
20320 + goto ruleTokensEx;
20321 + }
20322 +
20323 + }
20324 + break;
20325 +
20326 + default:
20327 + CONSTRUCTEX();
20328 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20329 + EXCEPTION->message = (void *)"";
20330 + EXCEPTION->decisionNum = 14;
20331 + EXCEPTION->state = 10;
20332 +
20333 +
20334 + goto ruleTokensEx;
20335 + }
20336 +
20337 + }
20338 + break;
20339 + case 'm':
20340 + {
20341 + switch ( LA(2) )
20342 + {
20343 + case 'e':
20344 + {
20345 + alt14=6;
20346 + }
20347 + break;
20348 + case 'o':
20349 + {
20350 + switch ( LA(3) )
20351 + {
20352 + case 'n':
20353 + {
20354 + alt14=19;
20355 + }
20356 + break;
20357 + case 'v':
20358 + {
20359 + alt14=20;
20360 + }
20361 + break;
20362 +
20363 + default:
20364 + CONSTRUCTEX();
20365 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20366 + EXCEPTION->message = (void *)"";
20367 + EXCEPTION->decisionNum = 14;
20368 + EXCEPTION->state = 33;
20369 +
20370 +
20371 + goto ruleTokensEx;
20372 + }
20373 +
20374 + }
20375 + break;
20376 + case 'u':
20377 + {
20378 + alt14=20;
20379 + }
20380 + break;
20381 +
20382 + default:
20383 + CONSTRUCTEX();
20384 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20385 + EXCEPTION->message = (void *)"";
20386 + EXCEPTION->decisionNum = 14;
20387 + EXCEPTION->state = 11;
20388 +
20389 +
20390 + goto ruleTokensEx;
20391 + }
20392 +
20393 + }
20394 + break;
20395 + case 'i':
20396 + {
20397 + switch ( LA(2) )
20398 + {
20399 + case 'n':
20400 + {
20401 + alt14=7;
20402 + }
20403 + break;
20404 + case 's':
20405 + {
20406 + alt14=8;
20407 + }
20408 + break;
20409 +
20410 + default:
20411 + CONSTRUCTEX();
20412 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20413 + EXCEPTION->message = (void *)"";
20414 + EXCEPTION->decisionNum = 14;
20415 + EXCEPTION->state = 12;
20416 +
20417 +
20418 + goto ruleTokensEx;
20419 + }
20420 +
20421 + }
20422 + break;
20423 + case '<':
20424 + case '=':
20425 + case '>':
20426 + {
20427 + alt14=9;
20428 + }
20429 + break;
20430 + case 'b':
20431 + {
20432 + alt14=11;
20433 + }
20434 + break;
20435 + case 'A':
20436 + {
20437 + alt14=13;
20438 + }
20439 + break;
20440 + case 'O':
20441 + case 'o':
20442 + {
20443 + alt14=14;
20444 + }
20445 + break;
20446 + case 'N':
20447 + case 'n':
20448 + {
20449 + alt14=15;
20450 + }
20451 + break;
20452 + case '(':
20453 + {
20454 + alt14=16;
20455 + }
20456 + break;
20457 + case ')':
20458 + {
20459 + alt14=17;
20460 + }
20461 + break;
20462 + case '0':
20463 + case '1':
20464 + case '2':
20465 + case '3':
20466 + case '4':
20467 + case '5':
20468 + case '6':
20469 + case '7':
20470 + case '8':
20471 + case '9':
20472 + {
20473 + switch ( LA(2) )
20474 + {
20475 + case '0':
20476 + case '1':
20477 + case '2':
20478 + case '3':
20479 + case '4':
20480 + case '5':
20481 + case '6':
20482 + case '7':
20483 + case '8':
20484 + case '9':
20485 + {
20486 + switch ( LA(3) )
20487 + {
20488 + case '0':
20489 + case '1':
20490 + case '2':
20491 + case '3':
20492 + case '4':
20493 + case '5':
20494 + case '6':
20495 + case '7':
20496 + case '8':
20497 + case '9':
20498 + {
20499 + switch ( LA(4) )
20500 + {
20501 + case '0':
20502 + case '1':
20503 + case '2':
20504 + case '3':
20505 + case '4':
20506 + case '5':
20507 + case '6':
20508 + case '7':
20509 + case '8':
20510 + case '9':
20511 + {
20512 + switch ( LA(5) )
20513 + {
20514 + case '-':
20515 + {
20516 + alt14=18;
20517 + }
20518 + break;
20519 +
20520 + default:
20521 + alt14=22;}
20522 +
20523 + }
20524 + break;
20525 +
20526 + default:
20527 + alt14=22;}
20528 +
20529 + }
20530 + break;
20531 +
20532 + default:
20533 + alt14=22;}
20534 +
20535 + }
20536 + break;
20537 +
20538 + default:
20539 + alt14=22;}
20540 +
20541 + }
20542 + break;
20543 + case 'l':
20544 + {
20545 + alt14=18;
20546 + }
20547 + break;
20548 + case 'w':
20549 + {
20550 + alt14=19;
20551 + }
20552 + break;
20553 + case 'f':
20554 + case 's':
20555 + case 'u':
20556 + {
20557 + alt14=20;
20558 + }
20559 + break;
20560 + case '"':
20561 + {
20562 + alt14=21;
20563 + }
20564 + break;
20565 + case '\t':
20566 + case '\n':
20567 + case '\f':
20568 + case '\r':
20569 + case ' ':
20570 + {
20571 + alt14=23;
20572 + }
20573 + break;
20574 +
20575 + default:
20576 + CONSTRUCTEX();
20577 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
20578 + EXCEPTION->message = (void *)"";
20579 + EXCEPTION->decisionNum = 14;
20580 + EXCEPTION->state = 0;
20581 +
20582 +
20583 + goto ruleTokensEx;
20584 + }
20585 +
20586 + switch (alt14)
20587 + {
20588 + case 1:
20589 + // SMARTPL.g:1:10: T__30
20590 + {
20591 + /* 1:10: T__30 */
20592 + mT__30(ctx );
20593 + if (HASEXCEPTION())
20594 + {
20595 + goto ruleTokensEx;
20596 + }
20597 +
20598 +
20599 + }
20600 + break;
20601 + case 2:
20602 + // SMARTPL.g:1:16: T__31
20603 + {
20604 + /* 1:16: T__31 */
20605 + mT__31(ctx );
20606 + if (HASEXCEPTION())
20607 + {
20608 + goto ruleTokensEx;
20609 + }
20610 +
20611 +
20612 + }
20613 + break;
20614 + case 3:
20615 + // SMARTPL.g:1:22: STRTAG
20616 + {
20617 + /* 1:22: STRTAG */
20618 + mSTRTAG(ctx );
20619 + if (HASEXCEPTION())
20620 + {
20621 + goto ruleTokensEx;
20622 + }
20623 +
20624 +
20625 + }
20626 + break;
20627 + case 4:
20628 + // SMARTPL.g:1:29: INTTAG
20629 + {
20630 + /* 1:29: INTTAG */
20631 + mINTTAG(ctx );
20632 + if (HASEXCEPTION())
20633 + {
20634 + goto ruleTokensEx;
20635 + }
20636 +
20637 +
20638 + }
20639 + break;
20640 + case 5:
20641 + // SMARTPL.g:1:36: DATETAG
20642 + {
20643 + /* 1:36: DATETAG */
20644 + mDATETAG(ctx );
20645 + if (HASEXCEPTION())
20646 + {
20647 + goto ruleTokensEx;
20648 + }
20649 +
20650 +
20651 + }
20652 + break;
20653 + case 6:
20654 + // SMARTPL.g:1:44: ENUMTAG
20655 + {
20656 + /* 1:44: ENUMTAG */
20657 + mENUMTAG(ctx );
20658 + if (HASEXCEPTION())
20659 + {
20660 + goto ruleTokensEx;
20661 + }
20662 +
20663 +
20664 + }
20665 + break;
20666 + case 7:
20667 + // SMARTPL.g:1:52: INCLUDES
20668 + {
20669 + /* 1:52: INCLUDES */
20670 + mINCLUDES(ctx );
20671 + if (HASEXCEPTION())
20672 + {
20673 + goto ruleTokensEx;
20674 + }
20675 +
20676 +
20677 + }
20678 + break;
20679 + case 8:
20680 + // SMARTPL.g:1:61: IS
20681 + {
20682 + /* 1:61: IS */
20683 + mIS(ctx );
20684 + if (HASEXCEPTION())
20685 + {
20686 + goto ruleTokensEx;
20687 + }
20688 +
20689 +
20690 + }
20691 + break;
20692 + case 9:
20693 + // SMARTPL.g:1:64: INTBOOL
20694 + {
20695 + /* 1:64: INTBOOL */
20696 + mINTBOOL(ctx );
20697 + if (HASEXCEPTION())
20698 + {
20699 + goto ruleTokensEx;
20700 + }
20701 +
20702 +
20703 + }
20704 + break;
20705 + case 10:
20706 + // SMARTPL.g:1:72: AFTER
20707 + {
20708 + /* 1:72: AFTER */
20709 + mAFTER(ctx );
20710 + if (HASEXCEPTION())
20711 + {
20712 + goto ruleTokensEx;
20713 + }
20714 +
20715 +
20716 + }
20717 + break;
20718 + case 11:
20719 + // SMARTPL.g:1:78: BEFORE
20720 + {
20721 + /* 1:78: BEFORE */
20722 + mBEFORE(ctx );
20723 + if (HASEXCEPTION())
20724 + {
20725 + goto ruleTokensEx;
20726 + }
20727 +
20728 +
20729 + }
20730 + break;
20731 + case 12:
20732 + // SMARTPL.g:1:85: AGO
20733 + {
20734 + /* 1:85: AGO */
20735 + mAGO(ctx );
20736 + if (HASEXCEPTION())
20737 + {
20738 + goto ruleTokensEx;
20739 + }
20740 +
20741 +
20742 + }
20743 + break;
20744 + case 13:
20745 + // SMARTPL.g:1:89: AND
20746 + {
20747 + /* 1:89: AND */
20748 + mAND(ctx );
20749 + if (HASEXCEPTION())
20750 + {
20751 + goto ruleTokensEx;
20752 + }
20753 +
20754 +
20755 + }
20756 + break;
20757 + case 14:
20758 + // SMARTPL.g:1:93: OR
20759 + {
20760 + /* 1:93: OR */
20761 + mOR(ctx );
20762 + if (HASEXCEPTION())
20763 + {
20764 + goto ruleTokensEx;
20765 + }
20766 +
20767 +
20768 + }
20769 + break;
20770 + case 15:
20771 + // SMARTPL.g:1:96: NOT
20772 + {
20773 + /* 1:96: NOT */
20774 + mNOT(ctx );
20775 + if (HASEXCEPTION())
20776 + {
20777 + goto ruleTokensEx;
20778 + }
20779 +
20780 +
20781 + }
20782 + break;
20783 + case 16:
20784 + // SMARTPL.g:1:100: LPAR
20785 + {
20786 + /* 1:100: LPAR */
20787 + mLPAR(ctx );
20788 + if (HASEXCEPTION())
20789 + {
20790 + goto ruleTokensEx;
20791 + }
20792 +
20793 +
20794 + }
20795 + break;
20796 + case 17:
20797 + // SMARTPL.g:1:105: RPAR
20798 + {
20799 + /* 1:105: RPAR */
20800 + mRPAR(ctx );
20801 + if (HASEXCEPTION())
20802 + {
20803 + goto ruleTokensEx;
20804 + }
20805 +
20806 +
20807 + }
20808 + break;
20809 + case 18:
20810 + // SMARTPL.g:1:110: DATE
20811 + {
20812 + /* 1:110: DATE */
20813 + mDATE(ctx );
20814 + if (HASEXCEPTION())
20815 + {
20816 + goto ruleTokensEx;
20817 + }
20818 +
20819 +
20820 + }
20821 + break;
20822 + case 19:
20823 + // SMARTPL.g:1:115: DATINTERVAL
20824 + {
20825 + /* 1:115: DATINTERVAL */
20826 + mDATINTERVAL(ctx );
20827 + if (HASEXCEPTION())
20828 + {
20829 + goto ruleTokensEx;
20830 + }
20831 +
20832 +
20833 + }
20834 + break;
20835 + case 20:
20836 + // SMARTPL.g:1:127: ENUMVAL
20837 + {
20838 + /* 1:127: ENUMVAL */
20839 + mENUMVAL(ctx );
20840 + if (HASEXCEPTION())
20841 + {
20842 + goto ruleTokensEx;
20843 + }
20844 +
20845 +
20846 + }
20847 + break;
20848 + case 21:
20849 + // SMARTPL.g:1:135: STR
20850 + {
20851 + /* 1:135: STR */
20852 + mSTR(ctx );
20853 + if (HASEXCEPTION())
20854 + {
20855 + goto ruleTokensEx;
20856 + }
20857 +
20858 +
20859 + }
20860 + break;
20861 + case 22:
20862 + // SMARTPL.g:1:139: INT
20863 + {
20864 + /* 1:139: INT */
20865 + mINT(ctx );
20866 + if (HASEXCEPTION())
20867 + {
20868 + goto ruleTokensEx;
20869 + }
20870 +
20871 +
20872 + }
20873 + break;
20874 + case 23:
20875 + // SMARTPL.g:1:143: WHITESPACE
20876 + {
20877 + /* 1:143: WHITESPACE */
20878 + mWHITESPACE(ctx );
20879 + if (HASEXCEPTION())
20880 + {
20881 + goto ruleTokensEx;
20882 + }
20883 +
20884 +
20885 + }
20886 + break;
20887 +
20888 + }
20889 + }
20890 +
20891 +
20892 + goto ruleTokensEx; /* Prevent compiler warnings */
20893 +ruleTokensEx: ;
20894 +}
20895 +
20896 +/* =========================================================================
20897 + * Lexer matching rules end.
20898 + * =========================================================================
20899 + */
20900 +/* End of Lexer code
20901 + * ================================================
20902 + * ================================================
20903 + */
20904 +
20905 +
20906 +/* End of code
20907 + * =============================================================================
20908 + */
20909 diff --git a/src/pregen/SMARTPLLexer.h b/src/pregen/SMARTPLLexer.h
20910 new file mode 100644
20911 index 0000000..9d73721
20912 --- /dev/null
20913 +++ b/src/pregen/SMARTPLLexer.h
20914 @@ -0,0 +1,248 @@
20915 +/** \file
20916 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
20917 + *
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.
20922 + *
20923 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
20924 + *
20925 + *
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
20929 + * this rule.
20930 + *
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.
20935 + *
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().
20938 + *
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:
20942 + *
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)
20972 + *
20973 + * The return type for any particular rule is of course determined by the source
20974 + * grammar file.
20975 + */
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
20980 +//
20981 +// All rights reserved.
20982 +//
20983 +// Redistribution and use in source and binary forms, with or without
20984 +// modification, are permitted provided that the following conditions
20985 +// are met:
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.
20993 +//
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.
21004 +
21005 +#ifndef _SMARTPLLexer_H
21006 +#define _SMARTPLLexer_H
21007 +/* =============================================================================
21008 + * Standard antlr3 C runtime definitions
21009 + */
21010 +#include <antlr3.h>
21011 +
21012 +/* End of standard antlr 3 runtime definitions
21013 + * =============================================================================
21014 + */
21015 +
21016 +#ifdef __cplusplus
21017 +extern "C" {
21018 +#endif
21019 +
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.
21024 +//
21025 +typedef struct SMARTPLLexer_Ctx_struct SMARTPLLexer, * pSMARTPLLexer;
21026 +
21027 +
21028 +
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
21036 +//
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.
21041 +//
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 )
21048 +#endif
21049 +
21050 +/** Context tracking structure for SMARTPLLexer
21051 + */
21052 +struct SMARTPLLexer_Ctx_struct
21053 +{
21054 + /** Built in ANTLR3 context tracker contains all the generic elements
21055 + * required for context tracking.
21056 + */
21057 + pANTLR3_LEXER pLexer;
21058 +
21059 +
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);
21090 +
21091 +};
21092 +
21093 +// Function protoypes for the constructor functions that external translation units
21094 +// such as delegators and delegates may wish to call.
21095 +//
21096 +ANTLR3_API pSMARTPLLexer SMARTPLLexerNew (pANTLR3_INPUT_STREAM instream);
21097 +ANTLR3_API pSMARTPLLexer SMARTPLLexerNewSSD (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
21098 +
21099 +/** Symbolic definitions of all the tokens that the lexer will work with.
21100 + * \{
21101 + *
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.
21106 + */
21107 +#ifdef EOF
21108 +#undef EOF
21109 +#endif
21110 +#ifdef Tokens
21111 +#undef Tokens
21112 +#endif
21113 +#define INTBOOL 14
21114 +#define STRTAG 10
21115 +#define AGO 22
21116 +#define WHITESPACE 29
21117 +#define GREATEREQUAL 25
21118 +#define BEFORE 18
21119 +#define DATETAG 16
21120 +#define INT 15
21121 +#define NOT 7
21122 +#define AFTER 17
21123 +#define AND 6
21124 +#define EOF -1
21125 +#define INCLUDES 11
21126 +#define STR 4
21127 +#define T__30 30
21128 +#define T__31 31
21129 +#define GREATER 24
21130 +#define LPAR 8
21131 +#define ENUMTAG 19
21132 +#define IS 12
21133 +#define ENUMVAL 20
21134 +#define EQUAL 28
21135 +#define OR 5
21136 +#define LESS 26
21137 +#define RPAR 9
21138 +#define DATE 21
21139 +#define LESSEQUAL 27
21140 +#define INTTAG 13
21141 +#define DATINTERVAL 23
21142 +#ifdef EOF
21143 +#undef EOF
21144 +#define EOF ANTLR3_TOKEN_EOF
21145 +#endif
21146 +
21147 +#ifndef TOKENSOURCE
21148 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
21149 +#endif
21150 +
21151 +/* End of token definitions for SMARTPLLexer
21152 + * =============================================================================
21153 + */
21154 +/** \} */
21155 +
21156 +#ifdef __cplusplus
21157 +}
21158 +#endif
21159 +
21160 +#endif
21161 +
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
21166 --- /dev/null
21167 +++ b/src/pregen/SMARTPLParser.c
21168 @@ -0,0 +1,1812 @@
21169 +/** \file
21170 + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
21171 + *
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.
21176 + *
21177 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
21178 + *
21179 + *
21180 +*/
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
21185 +//
21186 +// All rights reserved.
21187 +//
21188 +// Redistribution and use in source and binary forms, with or without
21189 +// modification, are permitted provided that the following conditions
21190 +// are met:
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.
21198 +//
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.
21209 +
21210 +/* -----------------------------------------
21211 + * Include the ANTLR3 generated header file.
21212 + */
21213 +#include "SMARTPLParser.h"
21214 +/* ----------------------------------------- */
21215 +
21216 +
21217 +
21218 +
21219 +
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.
21231 + */
21232 +
21233 +#define CTX ctx
21234 +
21235 +/* Aids in accessing scopes for grammar programmers
21236 + */
21237 +#undef SCOPE_TYPE
21238 +#undef SCOPE_STACK
21239 +#undef SCOPE_TOP
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))
21245 +
21246 +/* Macros for accessing things in the parser
21247 + */
21248 +
21249 +#undef PARSER
21250 +#undef RECOGNIZER
21251 +#undef HAVEPARSEDRULE
21252 +#undef MEMOIZE
21253 +#undef INPUT
21254 +#undef STRSTREAM
21255 +#undef HASEXCEPTION
21256 +#undef EXCEPTION
21257 +#undef MATCHT
21258 +#undef MATCHANYT
21259 +#undef FOLLOWSTACK
21260 +#undef FOLLOWPUSH
21261 +#undef FOLLOWPOP
21262 +#undef PRECOVER
21263 +#undef PREPORTERROR
21264 +#undef LA
21265 +#undef LT
21266 +#undef CONSTRUCTEX
21267 +#undef CONSUME
21268 +#undef MARK
21269 +#undef REWIND
21270 +#undef REWINDLAST
21271 +#undef PERRORRECOVERY
21272 +#undef HASFAILED
21273 +#undef FAILEDFLAG
21274 +#undef RECOVERFROMMISMATCHEDSET
21275 +#undef RECOVERFROMMISMATCHEDELEMENT
21276 +#undef INDEX
21277 +#undef ADAPTOR
21278 +#undef SEEK
21279 +#undef RULEMEMO
21280 +#undef DBG
21281 +
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
21317 +
21318 +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
21319 +
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.
21325 + */
21326 +#define UP ANTLR3_TOKEN_UP
21327 +#define DOWN ANTLR3_TOKEN_DOWN
21328 +#define EOR ANTLR3_TOKEN_EOR
21329 +#define INVALID ANTLR3_TOKEN_INVALID
21330 +
21331 +
21332 +/* =============================================================================
21333 + * Functions to create and destroy scopes. First come the rule scopes, followed
21334 + * by the global declared scopes.
21335 + */
21336 +
21337 +
21338 +
21339 +/* ============================================================================= */
21340 +
21341 +/* =============================================================================
21342 + * Start of recognizer
21343 + */
21344 +
21345 +
21346 +
21347 +/** \brief Table of all token names in symbolic order, mainly used for
21348 + * error reporting.
21349 + */
21350 +pANTLR3_UINT8 SMARTPLParserTokenNames[28+4]
21351 + = {
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) "'}'"
21384 + };
21385 +
21386 +
21387 +
21388 +// Forward declare the locally static matching functions we have generated.
21389 +//
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.
21401 + */
21402 +static void ANTLR3_CDECL freeScope(void * scope)
21403 +{
21404 + ANTLR3_FREE(scope);
21405 +}
21406 +
21407 +/** \brief Name of the grammar file that generated this code
21408 + */
21409 +static const char fileName[] = "SMARTPL.g";
21410 +
21411 +/** \brief Return the name of the grammar file that generated this code.
21412 + */
21413 +static const char * getGrammarFileName()
21414 +{
21415 + return fileName;
21416 +}
21417 +/** \brief Create a new SMARTPLParser parser and return a context for it.
21418 + *
21419 + * \param[in] instream Pointer to an input stream interface.
21420 + *
21421 + * \return Pointer to new parser context upon success.
21422 + */
21423 +ANTLR3_API pSMARTPLParser
21424 +SMARTPLParserNew (pANTLR3_COMMON_TOKEN_STREAM instream)
21425 +{
21426 + // See if we can create a new parser with the standard constructor
21427 + //
21428 + return SMARTPLParserNewSSD(instream, NULL);
21429 +}
21430 +
21431 +/** \brief Create a new SMARTPLParser parser and return a context for it.
21432 + *
21433 + * \param[in] instream Pointer to an input stream interface.
21434 + *
21435 + * \return Pointer to new parser context upon success.
21436 + */
21437 +ANTLR3_API pSMARTPLParser
21438 +SMARTPLParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
21439 +{
21440 + pSMARTPLParser ctx; /* Context structure we will build and return */
21441 +
21442 + ctx = (pSMARTPLParser) ANTLR3_CALLOC(1, sizeof(SMARTPLParser));
21443 +
21444 + if (ctx == NULL)
21445 + {
21446 + // Failed to allocate memory for parser context
21447 + //
21448 + return NULL;
21449 + }
21450 +
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.
21457 + *
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.
21460 + */
21461 +
21462 + /* Create a base parser/recognizer, using the supplied token stream
21463 + */
21464 + ctx->pParser = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state);
21465 + /* Install the implementation of our SMARTPLParser interface
21466 + */
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;
21476 +
21477 + /* Install the scope pushing methods.
21478 + */
21479 + ADAPTOR = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory);
21480 + ctx->vectors = antlr3VectorFactoryNew(0);
21481 +
21482 +
21483 +
21484 + /* Install the token table
21485 + */
21486 + PSRSTATE->tokenNames = SMARTPLParserTokenNames;
21487 +
21488 +
21489 + /* Return the newly built parser to the caller
21490 + */
21491 + return ctx;
21492 +}
21493 +
21494 +/** Free the parser resources
21495 + */
21496 + static void
21497 + SMARTPLParserFree(pSMARTPLParser ctx)
21498 + {
21499 + /* Free any scope memory
21500 + */
21501 +
21502 + ctx->vectors->close(ctx->vectors);
21503 + /* We created the adaptor so we must free it
21504 + */
21505 + ADAPTOR->free(ADAPTOR);
21506 + // Free this parser
21507 + //
21508 + ctx->pParser->free(ctx->pParser);
21509 + ANTLR3_FREE(ctx);
21510 +
21511 + /* Everything is released, so we can return
21512 + */
21513 + return;
21514 + }
21515 +
21516 +/** Return token names used by this parser
21517 + *
21518 + * The returned pointer is used as an index into the token names table (using the token
21519 + * number as the index).
21520 + *
21521 + * \return Pointer to first char * in the table.
21522 + */
21523 +static pANTLR3_UINT8 *getTokenNames()
21524 +{
21525 + return SMARTPLParserTokenNames;
21526 +}
21527 +
21528 +
21529 +/* Declare the bitsets
21530 + */
21531 +
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 };
21652 +
21653 +
21654 +
21655 +
21656 +/* ==============================================
21657 + * Parsing rules
21658 + */
21659 +/**
21660 + * $ANTLR start playlist
21661 + * SMARTPL.g:27:1: playlist : STR '{' expression '}' EOF ;
21662 + */
21663 +static SMARTPLParser_playlist_return
21664 +playlist(pSMARTPLParser ctx)
21665 +{
21666 + SMARTPLParser_playlist_return retval;
21667 +
21668 + pANTLR3_BASE_TREE root_0;
21669 +
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
21677 +
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;
21682 +
21683 + /* Initialize rule variables
21684 + */
21685 +
21686 +
21687 + root_0 = NULL;
21688 +
21689 + STR1 = NULL;
21690 + char_literal2 = NULL;
21691 + char_literal4 = NULL;
21692 + EOF5 = NULL;
21693 + expression3.tree = NULL;
21694 +
21695 + retval.start = LT(1); retval.stop = retval.start;
21696 +
21697 + STR1_tree = NULL;
21698 + char_literal2_tree = NULL;
21699 + char_literal4_tree = NULL;
21700 + EOF5_tree = NULL;
21701 +
21702 +
21703 + retval.tree = NULL;
21704 + {
21705 + // SMARTPL.g:27:10: ( STR '{' expression '}' EOF )
21706 + // SMARTPL.g:27:12: STR '{' expression '}' EOF
21707 + {
21708 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
21709 +
21710 + STR1 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_playlist42);
21711 + if (HASEXCEPTION())
21712 + {
21713 + goto ruleplaylistEx;
21714 + }
21715 +
21716 + STR1_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR1));
21717 + ADAPTOR->addChild(ADAPTOR, root_0, STR1_tree);
21718 +
21719 + char_literal2 = (pANTLR3_COMMON_TOKEN) MATCHT(30, &FOLLOW_30_in_playlist44);
21720 + if (HASEXCEPTION())
21721 + {
21722 + goto ruleplaylistEx;
21723 + }
21724 +
21725 + char_literal2_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, char_literal2));
21726 + ADAPTOR->addChild(ADAPTOR, root_0, char_literal2_tree);
21727 +
21728 + FOLLOWPUSH(FOLLOW_expression_in_playlist46);
21729 + expression3=expression(ctx);
21730 +
21731 + FOLLOWPOP();
21732 + if (HASEXCEPTION())
21733 + {
21734 + goto ruleplaylistEx;
21735 + }
21736 +
21737 + ADAPTOR->addChild(ADAPTOR, root_0, expression3.tree);
21738 + char_literal4 = (pANTLR3_COMMON_TOKEN) MATCHT(31, &FOLLOW_31_in_playlist48);
21739 + if (HASEXCEPTION())
21740 + {
21741 + goto ruleplaylistEx;
21742 + }
21743 +
21744 + char_literal4_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, char_literal4));
21745 + ADAPTOR->addChild(ADAPTOR, root_0, char_literal4_tree);
21746 +
21747 + EOF5 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_playlist50);
21748 + if (HASEXCEPTION())
21749 + {
21750 + goto ruleplaylistEx;
21751 + }
21752 +
21753 + EOF5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, EOF5));
21754 + ADAPTOR->addChild(ADAPTOR, root_0, EOF5_tree);
21755 +
21756 +
21757 + }
21758 +
21759 + }
21760 +
21761 +
21762 + // This is where rules clean up and exit
21763 + //
21764 + goto ruleplaylistEx; /* Prevent compiler warnings */
21765 + ruleplaylistEx: ;
21766 + retval.stop = LT(-1);
21767 +
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);
21771 +
21772 + if (HASEXCEPTION())
21773 + {
21774 + PREPORTERROR();
21775 + PRECOVER();
21776 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
21777 + }
21778 +
21779 +
21780 + return retval;
21781 +}
21782 +/* $ANTLR end playlist */
21783 +
21784 +/**
21785 + * $ANTLR start expression
21786 + * SMARTPL.g:30:1: expression : aexpr ( OR aexpr )* ;
21787 + */
21788 +static SMARTPLParser_expression_return
21789 +expression(pSMARTPLParser ctx)
21790 +{
21791 + SMARTPLParser_expression_return retval;
21792 +
21793 + pANTLR3_BASE_TREE root_0;
21794 +
21795 + pANTLR3_COMMON_TOKEN OR7;
21796 + SMARTPLParser_aexpr_return aexpr6;
21797 + #undef RETURN_TYPE_aexpr6
21798 + #define RETURN_TYPE_aexpr6 SMARTPLParser_aexpr_return
21799 +
21800 + SMARTPLParser_aexpr_return aexpr8;
21801 + #undef RETURN_TYPE_aexpr8
21802 + #define RETURN_TYPE_aexpr8 SMARTPLParser_aexpr_return
21803 +
21804 + pANTLR3_BASE_TREE OR7_tree;
21805 +
21806 + /* Initialize rule variables
21807 + */
21808 +
21809 +
21810 + root_0 = NULL;
21811 +
21812 + OR7 = NULL;
21813 + aexpr6.tree = NULL;
21814 +
21815 + aexpr8.tree = NULL;
21816 +
21817 + retval.start = LT(1); retval.stop = retval.start;
21818 +
21819 + OR7_tree = NULL;
21820 +
21821 +
21822 + retval.tree = NULL;
21823 + {
21824 + // SMARTPL.g:30:12: ( aexpr ( OR aexpr )* )
21825 + // SMARTPL.g:30:14: aexpr ( OR aexpr )*
21826 + {
21827 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
21828 +
21829 + FOLLOWPUSH(FOLLOW_aexpr_in_expression62);
21830 + aexpr6=aexpr(ctx);
21831 +
21832 + FOLLOWPOP();
21833 + if (HASEXCEPTION())
21834 + {
21835 + goto ruleexpressionEx;
21836 + }
21837 +
21838 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree);
21839 +
21840 + // SMARTPL.g:30:20: ( OR aexpr )*
21841 +
21842 + for (;;)
21843 + {
21844 + int alt1=2;
21845 + switch ( LA(1) )
21846 + {
21847 + case OR:
21848 + {
21849 + alt1=1;
21850 + }
21851 + break;
21852 +
21853 + }
21854 +
21855 + switch (alt1)
21856 + {
21857 + case 1:
21858 + // SMARTPL.g:30:21: OR aexpr
21859 + {
21860 + OR7 = (pANTLR3_COMMON_TOKEN) MATCHT(OR, &FOLLOW_OR_in_expression65);
21861 + if (HASEXCEPTION())
21862 + {
21863 + goto ruleexpressionEx;
21864 + }
21865 +
21866 + OR7_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OR7));
21867 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OR7_tree, root_0));
21868 +
21869 + FOLLOWPUSH(FOLLOW_aexpr_in_expression68);
21870 + aexpr8=aexpr(ctx);
21871 +
21872 + FOLLOWPOP();
21873 + if (HASEXCEPTION())
21874 + {
21875 + goto ruleexpressionEx;
21876 + }
21877 +
21878 + ADAPTOR->addChild(ADAPTOR, root_0, aexpr8.tree);
21879 +
21880 + }
21881 + break;
21882 +
21883 + default:
21884 + goto loop1; /* break out of the loop */
21885 + break;
21886 + }
21887 + }
21888 + loop1: ; /* Jump out to here if this rule does not match */
21889 +
21890 +
21891 + }
21892 +
21893 + }
21894 +
21895 +
21896 + // This is where rules clean up and exit
21897 + //
21898 + goto ruleexpressionEx; /* Prevent compiler warnings */
21899 + ruleexpressionEx: ;
21900 + retval.stop = LT(-1);
21901 +
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);
21905 +
21906 + if (HASEXCEPTION())
21907 + {
21908 + PREPORTERROR();
21909 + PRECOVER();
21910 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
21911 + }
21912 +
21913 +
21914 + return retval;
21915 +}
21916 +/* $ANTLR end expression */
21917 +
21918 +/**
21919 + * $ANTLR start aexpr
21920 + * SMARTPL.g:33:1: aexpr : nexpr ( AND nexpr )* ;
21921 + */
21922 +static SMARTPLParser_aexpr_return
21923 +aexpr(pSMARTPLParser ctx)
21924 +{
21925 + SMARTPLParser_aexpr_return retval;
21926 +
21927 + pANTLR3_BASE_TREE root_0;
21928 +
21929 + pANTLR3_COMMON_TOKEN AND10;
21930 + SMARTPLParser_nexpr_return nexpr9;
21931 + #undef RETURN_TYPE_nexpr9
21932 + #define RETURN_TYPE_nexpr9 SMARTPLParser_nexpr_return
21933 +
21934 + SMARTPLParser_nexpr_return nexpr11;
21935 + #undef RETURN_TYPE_nexpr11
21936 + #define RETURN_TYPE_nexpr11 SMARTPLParser_nexpr_return
21937 +
21938 + pANTLR3_BASE_TREE AND10_tree;
21939 +
21940 + /* Initialize rule variables
21941 + */
21942 +
21943 +
21944 + root_0 = NULL;
21945 +
21946 + AND10 = NULL;
21947 + nexpr9.tree = NULL;
21948 +
21949 + nexpr11.tree = NULL;
21950 +
21951 + retval.start = LT(1); retval.stop = retval.start;
21952 +
21953 + AND10_tree = NULL;
21954 +
21955 +
21956 + retval.tree = NULL;
21957 + {
21958 + // SMARTPL.g:33:8: ( nexpr ( AND nexpr )* )
21959 + // SMARTPL.g:33:10: nexpr ( AND nexpr )*
21960 + {
21961 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
21962 +
21963 + FOLLOWPUSH(FOLLOW_nexpr_in_aexpr83);
21964 + nexpr9=nexpr(ctx);
21965 +
21966 + FOLLOWPOP();
21967 + if (HASEXCEPTION())
21968 + {
21969 + goto ruleaexprEx;
21970 + }
21971 +
21972 + ADAPTOR->addChild(ADAPTOR, root_0, nexpr9.tree);
21973 +
21974 + // SMARTPL.g:33:16: ( AND nexpr )*
21975 +
21976 + for (;;)
21977 + {
21978 + int alt2=2;
21979 + switch ( LA(1) )
21980 + {
21981 + case AND:
21982 + {
21983 + alt2=1;
21984 + }
21985 + break;
21986 +
21987 + }
21988 +
21989 + switch (alt2)
21990 + {
21991 + case 1:
21992 + // SMARTPL.g:33:17: AND nexpr
21993 + {
21994 + AND10 = (pANTLR3_COMMON_TOKEN) MATCHT(AND, &FOLLOW_AND_in_aexpr86);
21995 + if (HASEXCEPTION())
21996 + {
21997 + goto ruleaexprEx;
21998 + }
21999 +
22000 + AND10_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AND10));
22001 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, AND10_tree, root_0));
22002 +
22003 + FOLLOWPUSH(FOLLOW_nexpr_in_aexpr89);
22004 + nexpr11=nexpr(ctx);
22005 +
22006 + FOLLOWPOP();
22007 + if (HASEXCEPTION())
22008 + {
22009 + goto ruleaexprEx;
22010 + }
22011 +
22012 + ADAPTOR->addChild(ADAPTOR, root_0, nexpr11.tree);
22013 +
22014 + }
22015 + break;
22016 +
22017 + default:
22018 + goto loop2; /* break out of the loop */
22019 + break;
22020 + }
22021 + }
22022 + loop2: ; /* Jump out to here if this rule does not match */
22023 +
22024 +
22025 + }
22026 +
22027 + }
22028 +
22029 +
22030 + // This is where rules clean up and exit
22031 + //
22032 + goto ruleaexprEx; /* Prevent compiler warnings */
22033 + ruleaexprEx: ;
22034 + retval.stop = LT(-1);
22035 +
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);
22039 +
22040 + if (HASEXCEPTION())
22041 + {
22042 + PREPORTERROR();
22043 + PRECOVER();
22044 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
22045 + }
22046 +
22047 +
22048 + return retval;
22049 +}
22050 +/* $ANTLR end aexpr */
22051 +
22052 +/**
22053 + * $ANTLR start nexpr
22054 + * SMARTPL.g:36:1: nexpr : ( NOT crit | crit );
22055 + */
22056 +static SMARTPLParser_nexpr_return
22057 +nexpr(pSMARTPLParser ctx)
22058 +{
22059 + SMARTPLParser_nexpr_return retval;
22060 +
22061 + pANTLR3_BASE_TREE root_0;
22062 +
22063 + pANTLR3_COMMON_TOKEN NOT12;
22064 + SMARTPLParser_crit_return crit13;
22065 + #undef RETURN_TYPE_crit13
22066 + #define RETURN_TYPE_crit13 SMARTPLParser_crit_return
22067 +
22068 + SMARTPLParser_crit_return crit14;
22069 + #undef RETURN_TYPE_crit14
22070 + #define RETURN_TYPE_crit14 SMARTPLParser_crit_return
22071 +
22072 + pANTLR3_BASE_TREE NOT12_tree;
22073 +
22074 + /* Initialize rule variables
22075 + */
22076 +
22077 +
22078 + root_0 = NULL;
22079 +
22080 + NOT12 = NULL;
22081 + crit13.tree = NULL;
22082 +
22083 + crit14.tree = NULL;
22084 +
22085 + retval.start = LT(1); retval.stop = retval.start;
22086 +
22087 + NOT12_tree = NULL;
22088 +
22089 +
22090 + retval.tree = NULL;
22091 + {
22092 + {
22093 + // SMARTPL.g:36:8: ( NOT crit | crit )
22094 +
22095 + ANTLR3_UINT32 alt3;
22096 +
22097 + alt3=2;
22098 +
22099 + switch ( LA(1) )
22100 + {
22101 + case NOT:
22102 + {
22103 + alt3=1;
22104 + }
22105 + break;
22106 + case LPAR:
22107 + case STRTAG:
22108 + case INTTAG:
22109 + case DATETAG:
22110 + case ENUMTAG:
22111 + {
22112 + alt3=2;
22113 + }
22114 + break;
22115 +
22116 + default:
22117 + CONSTRUCTEX();
22118 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
22119 + EXCEPTION->message = (void *)"";
22120 + EXCEPTION->decisionNum = 3;
22121 + EXCEPTION->state = 0;
22122 +
22123 +
22124 + goto rulenexprEx;
22125 + }
22126 +
22127 + switch (alt3)
22128 + {
22129 + case 1:
22130 + // SMARTPL.g:36:10: NOT crit
22131 + {
22132 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22133 +
22134 + NOT12 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_nexpr104);
22135 + if (HASEXCEPTION())
22136 + {
22137 + goto rulenexprEx;
22138 + }
22139 +
22140 + NOT12_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, NOT12));
22141 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, NOT12_tree, root_0));
22142 +
22143 + FOLLOWPUSH(FOLLOW_crit_in_nexpr107);
22144 + crit13=crit(ctx);
22145 +
22146 + FOLLOWPOP();
22147 + if (HASEXCEPTION())
22148 + {
22149 + goto rulenexprEx;
22150 + }
22151 +
22152 + ADAPTOR->addChild(ADAPTOR, root_0, crit13.tree);
22153 +
22154 + }
22155 + break;
22156 + case 2:
22157 + // SMARTPL.g:37:6: crit
22158 + {
22159 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22160 +
22161 + FOLLOWPUSH(FOLLOW_crit_in_nexpr114);
22162 + crit14=crit(ctx);
22163 +
22164 + FOLLOWPOP();
22165 + if (HASEXCEPTION())
22166 + {
22167 + goto rulenexprEx;
22168 + }
22169 +
22170 + ADAPTOR->addChild(ADAPTOR, root_0, crit14.tree);
22171 +
22172 + }
22173 + break;
22174 +
22175 + }
22176 + }
22177 + }
22178 +
22179 +
22180 + // This is where rules clean up and exit
22181 + //
22182 + goto rulenexprEx; /* Prevent compiler warnings */
22183 + rulenexprEx: ;
22184 + retval.stop = LT(-1);
22185 +
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);
22189 +
22190 + if (HASEXCEPTION())
22191 + {
22192 + PREPORTERROR();
22193 + PRECOVER();
22194 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
22195 + }
22196 +
22197 +
22198 + return retval;
22199 +}
22200 +/* $ANTLR end nexpr */
22201 +
22202 +/**
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 );
22205 + */
22206 +static SMARTPLParser_crit_return
22207 +crit(pSMARTPLParser ctx)
22208 +{
22209 + SMARTPLParser_crit_return retval;
22210 +
22211 + pANTLR3_BASE_TREE root_0;
22212 +
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
22229 +
22230 + SMARTPLParser_dateval_return dateval26;
22231 + #undef RETURN_TYPE_dateval26
22232 + #define RETURN_TYPE_dateval26 SMARTPLParser_dateval_return
22233 +
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
22251 + */
22252 +
22253 +
22254 + root_0 = NULL;
22255 +
22256 + LPAR15 = NULL;
22257 + RPAR17 = NULL;
22258 + STRTAG18 = NULL;
22259 + set19 = NULL;
22260 + STR20 = NULL;
22261 + INTTAG21 = NULL;
22262 + INTBOOL22 = NULL;
22263 + INT23 = NULL;
22264 + DATETAG24 = NULL;
22265 + set25 = NULL;
22266 + ENUMTAG27 = NULL;
22267 + IS28 = NULL;
22268 + ENUMVAL29 = NULL;
22269 + expression16.tree = NULL;
22270 +
22271 + dateval26.tree = NULL;
22272 +
22273 + retval.start = LT(1); retval.stop = retval.start;
22274 +
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;
22288 +
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"); }
22295 +
22296 + retval.tree = NULL;
22297 + {
22298 + {
22299 + // SMARTPL.g:40:7: ( LPAR expression RPAR -> expression | STRTAG ( INCLUDES | IS ) STR | INTTAG INTBOOL INT | DATETAG ( AFTER | BEFORE ) dateval | ENUMTAG IS ENUMVAL )
22300 +
22301 + ANTLR3_UINT32 alt4;
22302 +
22303 + alt4=5;
22304 +
22305 + switch ( LA(1) )
22306 + {
22307 + case LPAR:
22308 + {
22309 + alt4=1;
22310 + }
22311 + break;
22312 + case STRTAG:
22313 + {
22314 + alt4=2;
22315 + }
22316 + break;
22317 + case INTTAG:
22318 + {
22319 + alt4=3;
22320 + }
22321 + break;
22322 + case DATETAG:
22323 + {
22324 + alt4=4;
22325 + }
22326 + break;
22327 + case ENUMTAG:
22328 + {
22329 + alt4=5;
22330 + }
22331 + break;
22332 +
22333 + default:
22334 + CONSTRUCTEX();
22335 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
22336 + EXCEPTION->message = (void *)"";
22337 + EXCEPTION->decisionNum = 4;
22338 + EXCEPTION->state = 0;
22339 +
22340 +
22341 + goto rulecritEx;
22342 + }
22343 +
22344 + switch (alt4)
22345 + {
22346 + case 1:
22347 + // SMARTPL.g:40:9: LPAR expression RPAR
22348 + {
22349 + LPAR15 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit127);
22350 + if (HASEXCEPTION())
22351 + {
22352 + goto rulecritEx;
22353 + }
22354 +
22355 + CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR15, NULL);
22356 +
22357 + FOLLOWPUSH(FOLLOW_expression_in_crit129);
22358 + expression16=expression(ctx);
22359 +
22360 + FOLLOWPOP();
22361 + if (HASEXCEPTION())
22362 + {
22363 + goto rulecritEx;
22364 + }
22365 +
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())
22369 + {
22370 + goto rulecritEx;
22371 + }
22372 +
22373 + CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR17, NULL);
22374 +
22375 +
22376 +
22377 + /* AST REWRITE
22378 + * elements : expression
22379 + * token labels :
22380 + * rule labels : retval
22381 + * token list labels :
22382 + * rule list labels :
22383 + */
22384 + {
22385 + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
22386 +
22387 + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
22388 +
22389 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22390 + retval.tree = root_0;
22391 + // 40:30: -> expression
22392 + {
22393 + ADAPTOR->addChild(ADAPTOR, root_0, stream_expression == NULL ? NULL : stream_expression->nextTree(stream_expression));
22394 +
22395 + }
22396 +
22397 + retval.tree = root_0; // set result root
22398 + if (stream_retval != NULL) stream_retval->free(stream_retval);
22399 +
22400 +
22401 + }
22402 + }
22403 + break;
22404 + case 2:
22405 + // SMARTPL.g:41:6: STRTAG ( INCLUDES | IS ) STR
22406 + {
22407 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22408 +
22409 + STRTAG18 = (pANTLR3_COMMON_TOKEN) MATCHT(STRTAG, &FOLLOW_STRTAG_in_crit142);
22410 + if (HASEXCEPTION())
22411 + {
22412 + goto rulecritEx;
22413 + }
22414 +
22415 + STRTAG18_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STRTAG18));
22416 + ADAPTOR->addChild(ADAPTOR, root_0, STRTAG18_tree);
22417 +
22418 + set19=(pANTLR3_COMMON_TOKEN)LT(1);
22419 + if ( ((LA(1) >= INCLUDES) && (LA(1) <= IS)) )
22420 + {
22421 + CONSUME();
22422 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set19)));
22423 + PERRORRECOVERY=ANTLR3_FALSE;
22424 + }
22425 + else
22426 + {
22427 + CONSTRUCTEX();
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;
22432 + }
22433 +
22434 + STR20 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_crit150);
22435 + if (HASEXCEPTION())
22436 + {
22437 + goto rulecritEx;
22438 + }
22439 +
22440 + STR20_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR20));
22441 + ADAPTOR->addChild(ADAPTOR, root_0, STR20_tree);
22442 +
22443 +
22444 + }
22445 + break;
22446 + case 3:
22447 + // SMARTPL.g:42:6: INTTAG INTBOOL INT
22448 + {
22449 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22450 +
22451 + INTTAG21 = (pANTLR3_COMMON_TOKEN) MATCHT(INTTAG, &FOLLOW_INTTAG_in_crit157);
22452 + if (HASEXCEPTION())
22453 + {
22454 + goto rulecritEx;
22455 + }
22456 +
22457 + INTTAG21_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INTTAG21));
22458 + ADAPTOR->addChild(ADAPTOR, root_0, INTTAG21_tree);
22459 +
22460 + INTBOOL22 = (pANTLR3_COMMON_TOKEN) MATCHT(INTBOOL, &FOLLOW_INTBOOL_in_crit159);
22461 + if (HASEXCEPTION())
22462 + {
22463 + goto rulecritEx;
22464 + }
22465 +
22466 + INTBOOL22_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INTBOOL22));
22467 + ADAPTOR->addChild(ADAPTOR, root_0, INTBOOL22_tree);
22468 +
22469 + INT23 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_crit161);
22470 + if (HASEXCEPTION())
22471 + {
22472 + goto rulecritEx;
22473 + }
22474 +
22475 + INT23_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INT23));
22476 + ADAPTOR->addChild(ADAPTOR, root_0, INT23_tree);
22477 +
22478 +
22479 + }
22480 + break;
22481 + case 4:
22482 + // SMARTPL.g:43:6: DATETAG ( AFTER | BEFORE ) dateval
22483 + {
22484 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22485 +
22486 + DATETAG24 = (pANTLR3_COMMON_TOKEN) MATCHT(DATETAG, &FOLLOW_DATETAG_in_crit168);
22487 + if (HASEXCEPTION())
22488 + {
22489 + goto rulecritEx;
22490 + }
22491 +
22492 + DATETAG24_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATETAG24));
22493 + ADAPTOR->addChild(ADAPTOR, root_0, DATETAG24_tree);
22494 +
22495 + set25=(pANTLR3_COMMON_TOKEN)LT(1);
22496 + if ( ((LA(1) >= AFTER) && (LA(1) <= BEFORE)) )
22497 + {
22498 + CONSUME();
22499 + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set25)));
22500 + PERRORRECOVERY=ANTLR3_FALSE;
22501 + }
22502 + else
22503 + {
22504 + CONSTRUCTEX();
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;
22509 + }
22510 +
22511 + FOLLOWPUSH(FOLLOW_dateval_in_crit176);
22512 + dateval26=dateval(ctx);
22513 +
22514 + FOLLOWPOP();
22515 + if (HASEXCEPTION())
22516 + {
22517 + goto rulecritEx;
22518 + }
22519 +
22520 + ADAPTOR->addChild(ADAPTOR, root_0, dateval26.tree);
22521 +
22522 + }
22523 + break;
22524 + case 5:
22525 + // SMARTPL.g:44:6: ENUMTAG IS ENUMVAL
22526 + {
22527 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22528 +
22529 + ENUMTAG27 = (pANTLR3_COMMON_TOKEN) MATCHT(ENUMTAG, &FOLLOW_ENUMTAG_in_crit183);
22530 + if (HASEXCEPTION())
22531 + {
22532 + goto rulecritEx;
22533 + }
22534 +
22535 + ENUMTAG27_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, ENUMTAG27));
22536 + ADAPTOR->addChild(ADAPTOR, root_0, ENUMTAG27_tree);
22537 +
22538 + IS28 = (pANTLR3_COMMON_TOKEN) MATCHT(IS, &FOLLOW_IS_in_crit185);
22539 + if (HASEXCEPTION())
22540 + {
22541 + goto rulecritEx;
22542 + }
22543 +
22544 + IS28_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, IS28));
22545 + ADAPTOR->addChild(ADAPTOR, root_0, IS28_tree);
22546 +
22547 + ENUMVAL29 = (pANTLR3_COMMON_TOKEN) MATCHT(ENUMVAL, &FOLLOW_ENUMVAL_in_crit187);
22548 + if (HASEXCEPTION())
22549 + {
22550 + goto rulecritEx;
22551 + }
22552 +
22553 + ENUMVAL29_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, ENUMVAL29));
22554 + ADAPTOR->addChild(ADAPTOR, root_0, ENUMVAL29_tree);
22555 +
22556 +
22557 + }
22558 + break;
22559 +
22560 + }
22561 + }
22562 + }
22563 +
22564 +
22565 + // This is where rules clean up and exit
22566 + //
22567 + goto rulecritEx; /* Prevent compiler warnings */
22568 + rulecritEx: ;
22569 + retval.stop = LT(-1);
22570 +
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);
22577 +
22578 + if (HASEXCEPTION())
22579 + {
22580 + PREPORTERROR();
22581 + PRECOVER();
22582 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
22583 + }
22584 +
22585 +
22586 + return retval;
22587 +}
22588 +/* $ANTLR end crit */
22589 +
22590 +/**
22591 + * $ANTLR start dateval
22592 + * SMARTPL.g:47:1: dateval : ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO );
22593 + */
22594 +static SMARTPLParser_dateval_return
22595 +dateval(pSMARTPLParser ctx)
22596 +{
22597 + SMARTPLParser_dateval_return retval;
22598 +
22599 + pANTLR3_BASE_TREE root_0;
22600 +
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
22610 +
22611 + SMARTPLParser_interval_return interval34;
22612 + #undef RETURN_TYPE_interval34
22613 + #define RETURN_TYPE_interval34 SMARTPLParser_interval_return
22614 +
22615 + SMARTPLParser_interval_return interval37;
22616 + #undef RETURN_TYPE_interval37
22617 + #define RETURN_TYPE_interval37 SMARTPLParser_interval_return
22618 +
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;
22625 +
22626 + /* Initialize rule variables
22627 + */
22628 +
22629 +
22630 + root_0 = NULL;
22631 +
22632 + DATE30 = NULL;
22633 + BEFORE32 = NULL;
22634 + DATE33 = NULL;
22635 + AFTER35 = NULL;
22636 + DATE36 = NULL;
22637 + AGO38 = NULL;
22638 + interval31.tree = NULL;
22639 +
22640 + interval34.tree = NULL;
22641 +
22642 + interval37.tree = NULL;
22643 +
22644 + retval.start = LT(1); retval.stop = retval.start;
22645 +
22646 + DATE30_tree = NULL;
22647 + BEFORE32_tree = NULL;
22648 + DATE33_tree = NULL;
22649 + AFTER35_tree = NULL;
22650 + DATE36_tree = NULL;
22651 + AGO38_tree = NULL;
22652 +
22653 +
22654 + retval.tree = NULL;
22655 + {
22656 + {
22657 + // SMARTPL.g:47:10: ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO )
22658 +
22659 + ANTLR3_UINT32 alt5;
22660 +
22661 + alt5=4;
22662 +
22663 + switch ( LA(1) )
22664 + {
22665 + case DATE:
22666 + {
22667 + alt5=1;
22668 + }
22669 + break;
22670 + case INT:
22671 + {
22672 + switch ( LA(2) )
22673 + {
22674 + case DATINTERVAL:
22675 + {
22676 + switch ( LA(3) )
22677 + {
22678 + case AGO:
22679 + {
22680 + alt5=4;
22681 + }
22682 + break;
22683 + case AFTER:
22684 + {
22685 + alt5=3;
22686 + }
22687 + break;
22688 + case BEFORE:
22689 + {
22690 + alt5=2;
22691 + }
22692 + break;
22693 +
22694 + default:
22695 + CONSTRUCTEX();
22696 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
22697 + EXCEPTION->message = (void *)"";
22698 + EXCEPTION->decisionNum = 5;
22699 + EXCEPTION->state = 3;
22700 +
22701 +
22702 + goto ruledatevalEx;
22703 + }
22704 +
22705 + }
22706 + break;
22707 +
22708 + default:
22709 + CONSTRUCTEX();
22710 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
22711 + EXCEPTION->message = (void *)"";
22712 + EXCEPTION->decisionNum = 5;
22713 + EXCEPTION->state = 2;
22714 +
22715 +
22716 + goto ruledatevalEx;
22717 + }
22718 +
22719 + }
22720 + break;
22721 +
22722 + default:
22723 + CONSTRUCTEX();
22724 + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
22725 + EXCEPTION->message = (void *)"";
22726 + EXCEPTION->decisionNum = 5;
22727 + EXCEPTION->state = 0;
22728 +
22729 +
22730 + goto ruledatevalEx;
22731 + }
22732 +
22733 + switch (alt5)
22734 + {
22735 + case 1:
22736 + // SMARTPL.g:47:12: DATE
22737 + {
22738 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22739 +
22740 + DATE30 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval200);
22741 + if (HASEXCEPTION())
22742 + {
22743 + goto ruledatevalEx;
22744 + }
22745 +
22746 + DATE30_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE30));
22747 + ADAPTOR->addChild(ADAPTOR, root_0, DATE30_tree);
22748 +
22749 +
22750 + }
22751 + break;
22752 + case 2:
22753 + // SMARTPL.g:48:6: interval BEFORE DATE
22754 + {
22755 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22756 +
22757 + FOLLOWPUSH(FOLLOW_interval_in_dateval207);
22758 + interval31=interval(ctx);
22759 +
22760 + FOLLOWPOP();
22761 + if (HASEXCEPTION())
22762 + {
22763 + goto ruledatevalEx;
22764 + }
22765 +
22766 + ADAPTOR->addChild(ADAPTOR, root_0, interval31.tree);
22767 + BEFORE32 = (pANTLR3_COMMON_TOKEN) MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateval209);
22768 + if (HASEXCEPTION())
22769 + {
22770 + goto ruledatevalEx;
22771 + }
22772 +
22773 + BEFORE32_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, BEFORE32));
22774 + ADAPTOR->addChild(ADAPTOR, root_0, BEFORE32_tree);
22775 +
22776 + DATE33 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval211);
22777 + if (HASEXCEPTION())
22778 + {
22779 + goto ruledatevalEx;
22780 + }
22781 +
22782 + DATE33_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE33));
22783 + ADAPTOR->addChild(ADAPTOR, root_0, DATE33_tree);
22784 +
22785 +
22786 + }
22787 + break;
22788 + case 3:
22789 + // SMARTPL.g:49:6: interval AFTER DATE
22790 + {
22791 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22792 +
22793 + FOLLOWPUSH(FOLLOW_interval_in_dateval218);
22794 + interval34=interval(ctx);
22795 +
22796 + FOLLOWPOP();
22797 + if (HASEXCEPTION())
22798 + {
22799 + goto ruledatevalEx;
22800 + }
22801 +
22802 + ADAPTOR->addChild(ADAPTOR, root_0, interval34.tree);
22803 + AFTER35 = (pANTLR3_COMMON_TOKEN) MATCHT(AFTER, &FOLLOW_AFTER_in_dateval220);
22804 + if (HASEXCEPTION())
22805 + {
22806 + goto ruledatevalEx;
22807 + }
22808 +
22809 + AFTER35_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AFTER35));
22810 + ADAPTOR->addChild(ADAPTOR, root_0, AFTER35_tree);
22811 +
22812 + DATE36 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval222);
22813 + if (HASEXCEPTION())
22814 + {
22815 + goto ruledatevalEx;
22816 + }
22817 +
22818 + DATE36_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE36));
22819 + ADAPTOR->addChild(ADAPTOR, root_0, DATE36_tree);
22820 +
22821 +
22822 + }
22823 + break;
22824 + case 4:
22825 + // SMARTPL.g:50:6: interval AGO
22826 + {
22827 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22828 +
22829 + FOLLOWPUSH(FOLLOW_interval_in_dateval229);
22830 + interval37=interval(ctx);
22831 +
22832 + FOLLOWPOP();
22833 + if (HASEXCEPTION())
22834 + {
22835 + goto ruledatevalEx;
22836 + }
22837 +
22838 + ADAPTOR->addChild(ADAPTOR, root_0, interval37.tree);
22839 + AGO38 = (pANTLR3_COMMON_TOKEN) MATCHT(AGO, &FOLLOW_AGO_in_dateval231);
22840 + if (HASEXCEPTION())
22841 + {
22842 + goto ruledatevalEx;
22843 + }
22844 +
22845 + AGO38_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AGO38));
22846 + ADAPTOR->addChild(ADAPTOR, root_0, AGO38_tree);
22847 +
22848 +
22849 + }
22850 + break;
22851 +
22852 + }
22853 + }
22854 + }
22855 +
22856 +
22857 + // This is where rules clean up and exit
22858 + //
22859 + goto ruledatevalEx; /* Prevent compiler warnings */
22860 + ruledatevalEx: ;
22861 + retval.stop = LT(-1);
22862 +
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);
22866 +
22867 + if (HASEXCEPTION())
22868 + {
22869 + PREPORTERROR();
22870 + PRECOVER();
22871 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
22872 + }
22873 +
22874 +
22875 + return retval;
22876 +}
22877 +/* $ANTLR end dateval */
22878 +
22879 +/**
22880 + * $ANTLR start interval
22881 + * SMARTPL.g:53:1: interval : INT DATINTERVAL ;
22882 + */
22883 +static SMARTPLParser_interval_return
22884 +interval(pSMARTPLParser ctx)
22885 +{
22886 + SMARTPLParser_interval_return retval;
22887 +
22888 + pANTLR3_BASE_TREE root_0;
22889 +
22890 + pANTLR3_COMMON_TOKEN INT39;
22891 + pANTLR3_COMMON_TOKEN DATINTERVAL40;
22892 +
22893 + pANTLR3_BASE_TREE INT39_tree;
22894 + pANTLR3_BASE_TREE DATINTERVAL40_tree;
22895 +
22896 + /* Initialize rule variables
22897 + */
22898 +
22899 +
22900 + root_0 = NULL;
22901 +
22902 + INT39 = NULL;
22903 + DATINTERVAL40 = NULL;
22904 + retval.start = LT(1); retval.stop = retval.start;
22905 +
22906 + INT39_tree = NULL;
22907 + DATINTERVAL40_tree = NULL;
22908 +
22909 +
22910 + retval.tree = NULL;
22911 + {
22912 + // SMARTPL.g:53:10: ( INT DATINTERVAL )
22913 + // SMARTPL.g:53:12: INT DATINTERVAL
22914 + {
22915 + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
22916 +
22917 + INT39 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_interval243);
22918 + if (HASEXCEPTION())
22919 + {
22920 + goto ruleintervalEx;
22921 + }
22922 +
22923 + INT39_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INT39));
22924 + ADAPTOR->addChild(ADAPTOR, root_0, INT39_tree);
22925 +
22926 + DATINTERVAL40 = (pANTLR3_COMMON_TOKEN) MATCHT(DATINTERVAL, &FOLLOW_DATINTERVAL_in_interval245);
22927 + if (HASEXCEPTION())
22928 + {
22929 + goto ruleintervalEx;
22930 + }
22931 +
22932 + DATINTERVAL40_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATINTERVAL40));
22933 + ADAPTOR->addChild(ADAPTOR, root_0, DATINTERVAL40_tree);
22934 +
22935 +
22936 + }
22937 +
22938 + }
22939 +
22940 +
22941 + // This is where rules clean up and exit
22942 + //
22943 + goto ruleintervalEx; /* Prevent compiler warnings */
22944 + ruleintervalEx: ;
22945 + retval.stop = LT(-1);
22946 +
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);
22950 +
22951 + if (HASEXCEPTION())
22952 + {
22953 + PREPORTERROR();
22954 + PRECOVER();
22955 + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
22956 + }
22957 +
22958 +
22959 + return retval;
22960 +}
22961 +/* $ANTLR end interval */
22962 +/* End of parsing rules
22963 + * ==============================================
22964 + */
22965 +
22966 +/* ==============================================
22967 + * Syntactic predicates
22968 + */
22969 +/* End of syntactic predicates
22970 + * ==============================================
22971 + */
22972 +
22973 +
22974 +
22975 +
22976 +
22977 +
22978 +/* End of code
22979 + * =============================================================================
22980 + */
22981 diff --git a/src/pregen/SMARTPLParser.h b/src/pregen/SMARTPLParser.h
22982 new file mode 100644
22983 index 0000000..5360136
22984 --- /dev/null
22985 +++ b/src/pregen/SMARTPLParser.h
22986 @@ -0,0 +1,285 @@
22987 +/** \file
22988 + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
22989 + *
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.
22994 + *
22995 + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
22996 + *
22997 + *
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
23001 + * this rule.
23002 + *
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.
23007 + *
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().
23010 + *
23011 + * The methods in pSMARTPLParser are as follows:
23012 + *
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)
23020 + *
23021 + * The return type for any particular rule is of course determined by the source
23022 + * grammar file.
23023 + */
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
23028 +//
23029 +// All rights reserved.
23030 +//
23031 +// Redistribution and use in source and binary forms, with or without
23032 +// modification, are permitted provided that the following conditions
23033 +// are met:
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.
23041 +//
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.
23052 +
23053 +#ifndef _SMARTPLParser_H
23054 +#define _SMARTPLParser_H
23055 +/* =============================================================================
23056 + * Standard antlr3 C runtime definitions
23057 + */
23058 +#include <antlr3.h>
23059 +
23060 +/* End of standard antlr 3 runtime definitions
23061 + * =============================================================================
23062 + */
23063 +
23064 +#ifdef __cplusplus
23065 +extern "C" {
23066 +#endif
23067 +
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.
23072 +//
23073 +typedef struct SMARTPLParser_Ctx_struct SMARTPLParser, * pSMARTPLParser;
23074 +
23075 +
23076 +
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
23084 +//
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.
23089 +//
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 )
23096 +#endif
23097 +typedef struct SMARTPLParser_playlist_return_struct
23098 +{
23099 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23100 + */
23101 + pANTLR3_COMMON_TOKEN start;
23102 + pANTLR3_COMMON_TOKEN stop;
23103 + pANTLR3_BASE_TREE tree;
23104 +
23105 +}
23106 + SMARTPLParser_playlist_return;
23107 +
23108 +typedef struct SMARTPLParser_expression_return_struct
23109 +{
23110 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23111 + */
23112 + pANTLR3_COMMON_TOKEN start;
23113 + pANTLR3_COMMON_TOKEN stop;
23114 + pANTLR3_BASE_TREE tree;
23115 +
23116 +}
23117 + SMARTPLParser_expression_return;
23118 +
23119 +typedef struct SMARTPLParser_aexpr_return_struct
23120 +{
23121 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23122 + */
23123 + pANTLR3_COMMON_TOKEN start;
23124 + pANTLR3_COMMON_TOKEN stop;
23125 + pANTLR3_BASE_TREE tree;
23126 +
23127 +}
23128 + SMARTPLParser_aexpr_return;
23129 +
23130 +typedef struct SMARTPLParser_nexpr_return_struct
23131 +{
23132 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23133 + */
23134 + pANTLR3_COMMON_TOKEN start;
23135 + pANTLR3_COMMON_TOKEN stop;
23136 + pANTLR3_BASE_TREE tree;
23137 +
23138 +}
23139 + SMARTPLParser_nexpr_return;
23140 +
23141 +typedef struct SMARTPLParser_crit_return_struct
23142 +{
23143 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23144 + */
23145 + pANTLR3_COMMON_TOKEN start;
23146 + pANTLR3_COMMON_TOKEN stop;
23147 + pANTLR3_BASE_TREE tree;
23148 +
23149 +}
23150 + SMARTPLParser_crit_return;
23151 +
23152 +typedef struct SMARTPLParser_dateval_return_struct
23153 +{
23154 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23155 + */
23156 + pANTLR3_COMMON_TOKEN start;
23157 + pANTLR3_COMMON_TOKEN stop;
23158 + pANTLR3_BASE_TREE tree;
23159 +
23160 +}
23161 + SMARTPLParser_dateval_return;
23162 +
23163 +typedef struct SMARTPLParser_interval_return_struct
23164 +{
23165 + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
23166 + */
23167 + pANTLR3_COMMON_TOKEN start;
23168 + pANTLR3_COMMON_TOKEN stop;
23169 + pANTLR3_BASE_TREE tree;
23170 +
23171 +}
23172 + SMARTPLParser_interval_return;
23173 +
23174 +
23175 +
23176 +/** Context tracking structure for SMARTPLParser
23177 + */
23178 +struct SMARTPLParser_Ctx_struct
23179 +{
23180 + /** Built in ANTLR3 context tracker contains all the generic elements
23181 + * required for context tracking.
23182 + */
23183 + pANTLR3_PARSER pParser;
23184 +
23185 +
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() */
23200 +};
23201 +
23202 +// Function protoypes for the constructor functions that external translation units
23203 +// such as delegators and delegates may wish to call.
23204 +//
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);
23207 +
23208 +/** Symbolic definitions of all the tokens that the parser will work with.
23209 + * \{
23210 + *
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.
23215 + */
23216 +#ifdef EOF
23217 +#undef EOF
23218 +#endif
23219 +#ifdef Tokens
23220 +#undef Tokens
23221 +#endif
23222 +#define INTBOOL 14
23223 +#define STRTAG 10
23224 +#define AGO 22
23225 +#define WHITESPACE 29
23226 +#define GREATEREQUAL 25
23227 +#define BEFORE 18
23228 +#define DATETAG 16
23229 +#define INT 15
23230 +#define NOT 7
23231 +#define AFTER 17
23232 +#define AND 6
23233 +#define EOF -1
23234 +#define INCLUDES 11
23235 +#define STR 4
23236 +#define T__30 30
23237 +#define T__31 31
23238 +#define GREATER 24
23239 +#define LPAR 8
23240 +#define ENUMTAG 19
23241 +#define IS 12
23242 +#define ENUMVAL 20
23243 +#define EQUAL 28
23244 +#define OR 5
23245 +#define LESS 26
23246 +#define RPAR 9
23247 +#define DATE 21
23248 +#define LESSEQUAL 27
23249 +#define DATINTERVAL 23
23250 +#define INTTAG 13
23251 +#ifdef EOF
23252 +#undef EOF
23253 +#define EOF ANTLR3_TOKEN_EOF
23254 +#endif
23255 +
23256 +#ifndef TOKENSOURCE
23257 +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
23258 +#endif
23259 +
23260 +/* End of token definitions for SMARTPLParser
23261 + * =============================================================================
23262 + */
23263 +/** \} */
23264 +
23265 +#ifdef __cplusplus
23266 +}
23267 +#endif
23268 +
23269 +#endif
23270 +
23271 +/* END - Note:Keep extra line feed to satisfy UNIX systems */