23739 lines
704 KiB

  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..04d6153
  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 : 2016-01-01 12:23:43
  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..e829049
  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 : 2016-01-01 12:23:43
  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..eab3ff4
  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 : 2016-01-01 12:23:41
  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..685a0bc
  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 : 2016-01-01 12:23:41
  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..1091f05
  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 : 2016-01-01 12:23:41
  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..e206694
  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 : 2016-01-01 12:23:41
  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..40958f9
  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 : 2016-01-01 12:23:43
  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..08ac7bb
  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 : 2016-01-01 12:23:43
  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..2e3faae
  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 : 2016-01-01 12:23:42
  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..27bc791
  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 : 2016-01-01 12:23:42
  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..ba8a9d2
  11771. --- /dev/null
  11772. +++ b/src/pregen/RSPParser.c
  11773. @@ -0,0 +1,3152 @@
  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 : 2016-01-01 12:23:42
  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_EQUAL_in_strop188 */
  12218. +static ANTLR3_BITWORD FOLLOW_EQUAL_in_strop188_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12219. +static ANTLR3_BITSET_LIST FOLLOW_EQUAL_in_strop188 = { FOLLOW_EQUAL_in_strop188_bits, 1 };
  12220. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INCLUDES_in_strop195 */
  12221. +static ANTLR3_BITWORD FOLLOW_INCLUDES_in_strop195_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12222. +static ANTLR3_BITSET_LIST FOLLOW_INCLUDES_in_strop195 = { FOLLOW_INCLUDES_in_strop195_bits, 1 };
  12223. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STARTSW_in_strop202 */
  12224. +static ANTLR3_BITWORD FOLLOW_STARTSW_in_strop202_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12225. +static ANTLR3_BITSET_LIST FOLLOW_STARTSW_in_strop202 = { FOLLOW_STARTSW_in_strop202_bits, 1 };
  12226. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENDSW_in_strop209 */
  12227. +static ANTLR3_BITWORD FOLLOW_ENDSW_in_strop209_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12228. +static ANTLR3_BITSET_LIST FOLLOW_ENDSW_in_strop209 = { FOLLOW_ENDSW_in_strop209_bits, 1 };
  12229. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_intcrit219 */
  12230. +static ANTLR3_BITWORD FOLLOW_FIELD_in_intcrit219_bits[] = { ANTLR3_UINT64_LIT(0x00000000001E1000) };
  12231. +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_intcrit219 = { FOLLOW_FIELD_in_intcrit219_bits, 1 };
  12232. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intop_in_intcrit221 */
  12233. +static ANTLR3_BITWORD FOLLOW_intop_in_intcrit221_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) };
  12234. +static ANTLR3_BITSET_LIST FOLLOW_intop_in_intcrit221 = { FOLLOW_intop_in_intcrit221_bits, 1 };
  12235. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_intcrit223 */
  12236. +static ANTLR3_BITWORD FOLLOW_INT_in_intcrit223_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12237. +static ANTLR3_BITSET_LIST FOLLOW_INT_in_intcrit223 = { FOLLOW_INT_in_intcrit223_bits, 1 };
  12238. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_intcrit240 */
  12239. +static ANTLR3_BITWORD FOLLOW_FIELD_in_intcrit240_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000800) };
  12240. +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_intcrit240 = { FOLLOW_FIELD_in_intcrit240_bits, 1 };
  12241. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_intcrit242 */
  12242. +static ANTLR3_BITWORD FOLLOW_NOT_in_intcrit242_bits[] = { ANTLR3_UINT64_LIT(0x00000000001E1000) };
  12243. +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_intcrit242 = { FOLLOW_NOT_in_intcrit242_bits, 1 };
  12244. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_intop_in_intcrit244 */
  12245. +static ANTLR3_BITWORD FOLLOW_intop_in_intcrit244_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) };
  12246. +static ANTLR3_BITSET_LIST FOLLOW_intop_in_intcrit244 = { FOLLOW_intop_in_intcrit244_bits, 1 };
  12247. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_intcrit246 */
  12248. +static ANTLR3_BITWORD FOLLOW_INT_in_intcrit246_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12249. +static ANTLR3_BITSET_LIST FOLLOW_INT_in_intcrit246 = { FOLLOW_INT_in_intcrit246_bits, 1 };
  12250. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_EQUAL_in_intop273 */
  12251. +static ANTLR3_BITWORD FOLLOW_EQUAL_in_intop273_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12252. +static ANTLR3_BITSET_LIST FOLLOW_EQUAL_in_intop273 = { FOLLOW_EQUAL_in_intop273_bits, 1 };
  12253. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_LESS_in_intop280 */
  12254. +static ANTLR3_BITWORD FOLLOW_LESS_in_intop280_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12255. +static ANTLR3_BITSET_LIST FOLLOW_LESS_in_intop280 = { FOLLOW_LESS_in_intop280_bits, 1 };
  12256. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_GREATER_in_intop287 */
  12257. +static ANTLR3_BITWORD FOLLOW_GREATER_in_intop287_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12258. +static ANTLR3_BITSET_LIST FOLLOW_GREATER_in_intop287 = { FOLLOW_GREATER_in_intop287_bits, 1 };
  12259. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_LTE_in_intop294 */
  12260. +static ANTLR3_BITWORD FOLLOW_LTE_in_intop294_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12261. +static ANTLR3_BITSET_LIST FOLLOW_LTE_in_intop294 = { FOLLOW_LTE_in_intop294_bits, 1 };
  12262. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_GTE_in_intop301 */
  12263. +static ANTLR3_BITWORD FOLLOW_GTE_in_intop301_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12264. +static ANTLR3_BITSET_LIST FOLLOW_GTE_in_intop301 = { FOLLOW_GTE_in_intop301_bits, 1 };
  12265. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_datecrit310 */
  12266. +static ANTLR3_BITWORD FOLLOW_FIELD_in_datecrit310_bits[] = { ANTLR3_UINT64_LIT(0x0000000000600000) };
  12267. +static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_datecrit310 = { FOLLOW_FIELD_in_datecrit310_bits, 1 };
  12268. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datecrit312 */
  12269. +static ANTLR3_BITWORD FOLLOW_dateop_in_datecrit312_bits[] = { ANTLR3_UINT64_LIT(0x0000000001810000) };
  12270. +static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datecrit312 = { FOLLOW_dateop_in_datecrit312_bits, 1 };
  12271. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_datespec_in_datecrit314 */
  12272. +static ANTLR3_BITWORD FOLLOW_datespec_in_datecrit314_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12273. +static ANTLR3_BITSET_LIST FOLLOW_datespec_in_datecrit314 = { FOLLOW_datespec_in_datecrit314_bits, 1 };
  12274. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateop337 */
  12275. +static ANTLR3_BITWORD FOLLOW_BEFORE_in_dateop337_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12276. +static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateop337 = { FOLLOW_BEFORE_in_dateop337_bits, 1 };
  12277. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateop344 */
  12278. +static ANTLR3_BITWORD FOLLOW_AFTER_in_dateop344_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12279. +static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateop344 = { FOLLOW_AFTER_in_dateop344_bits, 1 };
  12280. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec353 */
  12281. +static ANTLR3_BITWORD FOLLOW_dateref_in_datespec353_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12282. +static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec353 = { FOLLOW_dateref_in_datespec353_bits, 1 };
  12283. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_datespec358 */
  12284. +static ANTLR3_BITWORD FOLLOW_INT_in_datespec358_bits[] = { ANTLR3_UINT64_LIT(0x000000001E000000) };
  12285. +static ANTLR3_BITSET_LIST FOLLOW_INT_in_datespec358 = { FOLLOW_INT_in_datespec358_bits, 1 };
  12286. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateintval_in_datespec360 */
  12287. +static ANTLR3_BITWORD FOLLOW_dateintval_in_datespec360_bits[] = { ANTLR3_UINT64_LIT(0x0000000000600000) };
  12288. +static ANTLR3_BITSET_LIST FOLLOW_dateintval_in_datespec360 = { FOLLOW_dateintval_in_datespec360_bits, 1 };
  12289. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datespec362 */
  12290. +static ANTLR3_BITWORD FOLLOW_dateop_in_datespec362_bits[] = { ANTLR3_UINT64_LIT(0x0000000001800000) };
  12291. +static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datespec362 = { FOLLOW_dateop_in_datespec362_bits, 1 };
  12292. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec364 */
  12293. +static ANTLR3_BITWORD FOLLOW_dateref_in_datespec364_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12294. +static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec364 = { FOLLOW_dateref_in_datespec364_bits, 1 };
  12295. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateref388 */
  12296. +static ANTLR3_BITWORD FOLLOW_DATE_in_dateref388_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12297. +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateref388 = { FOLLOW_DATE_in_dateref388_bits, 1 };
  12298. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_TODAY_in_dateref395 */
  12299. +static ANTLR3_BITWORD FOLLOW_TODAY_in_dateref395_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12300. +static ANTLR3_BITSET_LIST FOLLOW_TODAY_in_dateref395 = { FOLLOW_TODAY_in_dateref395_bits, 1 };
  12301. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DAY_in_dateintval408 */
  12302. +static ANTLR3_BITWORD FOLLOW_DAY_in_dateintval408_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12303. +static ANTLR3_BITSET_LIST FOLLOW_DAY_in_dateintval408 = { FOLLOW_DAY_in_dateintval408_bits, 1 };
  12304. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_WEEK_in_dateintval415 */
  12305. +static ANTLR3_BITWORD FOLLOW_WEEK_in_dateintval415_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12306. +static ANTLR3_BITSET_LIST FOLLOW_WEEK_in_dateintval415 = { FOLLOW_WEEK_in_dateintval415_bits, 1 };
  12307. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_MONTH_in_dateintval422 */
  12308. +static ANTLR3_BITWORD FOLLOW_MONTH_in_dateintval422_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12309. +static ANTLR3_BITSET_LIST FOLLOW_MONTH_in_dateintval422 = { FOLLOW_MONTH_in_dateintval422_bits, 1 };
  12310. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_YEAR_in_dateintval429 */
  12311. +static ANTLR3_BITWORD FOLLOW_YEAR_in_dateintval429_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  12312. +static ANTLR3_BITSET_LIST FOLLOW_YEAR_in_dateintval429 = { FOLLOW_YEAR_in_dateintval429_bits, 1 };
  12313. +
  12314. +
  12315. +
  12316. +
  12317. +/* ==============================================
  12318. + * Parsing rules
  12319. + */
  12320. +/**
  12321. + * $ANTLR start query
  12322. + * RSP.g:27:1: query : expr ( NEWLINE )? EOF -> expr ;
  12323. + */
  12324. +static RSPParser_query_return
  12325. +query(pRSPParser ctx)
  12326. +{
  12327. + RSPParser_query_return retval;
  12328. +
  12329. + pANTLR3_BASE_TREE root_0;
  12330. +
  12331. + pANTLR3_COMMON_TOKEN NEWLINE2;
  12332. + pANTLR3_COMMON_TOKEN EOF3;
  12333. + RSPParser_expr_return expr1;
  12334. + #undef RETURN_TYPE_expr1
  12335. + #define RETURN_TYPE_expr1 RSPParser_expr_return
  12336. +
  12337. + pANTLR3_BASE_TREE NEWLINE2_tree;
  12338. + pANTLR3_BASE_TREE EOF3_tree;
  12339. + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NEWLINE;
  12340. + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_EOF;
  12341. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr;
  12342. + /* Initialize rule variables
  12343. + */
  12344. +
  12345. +
  12346. + root_0 = NULL;
  12347. +
  12348. + NEWLINE2 = NULL;
  12349. + EOF3 = NULL;
  12350. + expr1.tree = NULL;
  12351. +
  12352. + retval.start = LT(1); retval.stop = retval.start;
  12353. +
  12354. + NEWLINE2_tree = NULL;
  12355. + EOF3_tree = NULL;
  12356. +
  12357. + stream_NEWLINE = NULL;
  12358. + #define CREATE_stream_NEWLINE if (stream_NEWLINE == NULL) {stream_NEWLINE = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NEWLINE"); }
  12359. + stream_EOF = NULL;
  12360. + #define CREATE_stream_EOF if (stream_EOF == NULL) {stream_EOF = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token EOF"); }
  12361. + stream_expr = NULL;
  12362. + #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); }
  12363. +
  12364. + retval.tree = NULL;
  12365. + {
  12366. + // RSP.g:27:7: ( expr ( NEWLINE )? EOF -> expr )
  12367. + // RSP.g:27:9: expr ( NEWLINE )? EOF
  12368. + {
  12369. + FOLLOWPUSH(FOLLOW_expr_in_query42);
  12370. + expr1=expr(ctx);
  12371. +
  12372. + FOLLOWPOP();
  12373. + if (HASEXCEPTION())
  12374. + {
  12375. + goto rulequeryEx;
  12376. + }
  12377. +
  12378. + CREATE_stream_expr; stream_expr->add(stream_expr, expr1.tree, NULL);
  12379. +
  12380. + // RSP.g:27:14: ( NEWLINE )?
  12381. + {
  12382. + int alt1=2;
  12383. + switch ( LA(1) )
  12384. + {
  12385. + case NEWLINE:
  12386. + {
  12387. + alt1=1;
  12388. + }
  12389. + break;
  12390. + }
  12391. +
  12392. + switch (alt1)
  12393. + {
  12394. + case 1:
  12395. + // RSP.g:27:14: NEWLINE
  12396. + {
  12397. + NEWLINE2 = (pANTLR3_COMMON_TOKEN) MATCHT(NEWLINE, &FOLLOW_NEWLINE_in_query44);
  12398. + if (HASEXCEPTION())
  12399. + {
  12400. + goto rulequeryEx;
  12401. + }
  12402. +
  12403. + CREATE_stream_NEWLINE; stream_NEWLINE->add(stream_NEWLINE, NEWLINE2, NULL);
  12404. +
  12405. +
  12406. + }
  12407. + break;
  12408. +
  12409. + }
  12410. + }
  12411. + EOF3 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_query47);
  12412. + if (HASEXCEPTION())
  12413. + {
  12414. + goto rulequeryEx;
  12415. + }
  12416. +
  12417. + CREATE_stream_EOF; stream_EOF->add(stream_EOF, EOF3, NULL);
  12418. +
  12419. +
  12420. +
  12421. + /* AST REWRITE
  12422. + * elements : expr
  12423. + * token labels :
  12424. + * rule labels : retval
  12425. + * token list labels :
  12426. + * rule list labels :
  12427. + */
  12428. + {
  12429. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
  12430. +
  12431. + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
  12432. +
  12433. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  12434. + retval.tree = root_0;
  12435. + // 27:28: -> expr
  12436. + {
  12437. + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
  12438. +
  12439. + }
  12440. +
  12441. + retval.tree = root_0; // set result root
  12442. + if (stream_retval != NULL) stream_retval->free(stream_retval);
  12443. +
  12444. +
  12445. + }
  12446. + }
  12447. +
  12448. + }
  12449. +
  12450. +
  12451. + // This is where rules clean up and exit
  12452. + //
  12453. + goto rulequeryEx; /* Prevent compiler warnings */
  12454. + rulequeryEx: ;
  12455. + retval.stop = LT(-1);
  12456. +
  12457. + retval.stop = LT(-1);
  12458. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  12459. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  12460. + if (stream_NEWLINE != NULL) stream_NEWLINE->free(stream_NEWLINE);
  12461. + if (stream_EOF != NULL) stream_EOF->free(stream_EOF);
  12462. + if (stream_expr != NULL) stream_expr->free(stream_expr);
  12463. +
  12464. + if (HASEXCEPTION())
  12465. + {
  12466. + PREPORTERROR();
  12467. + PRECOVER();
  12468. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  12469. + }
  12470. +
  12471. +
  12472. + return retval;
  12473. +}
  12474. +/* $ANTLR end query */
  12475. +
  12476. +/**
  12477. + * $ANTLR start expr
  12478. + * RSP.g:30:1: expr : aexpr ( OR aexpr )* ;
  12479. + */
  12480. +static RSPParser_expr_return
  12481. +expr(pRSPParser ctx)
  12482. +{
  12483. + RSPParser_expr_return retval;
  12484. +
  12485. + pANTLR3_BASE_TREE root_0;
  12486. +
  12487. + pANTLR3_COMMON_TOKEN OR5;
  12488. + RSPParser_aexpr_return aexpr4;
  12489. + #undef RETURN_TYPE_aexpr4
  12490. + #define RETURN_TYPE_aexpr4 RSPParser_aexpr_return
  12491. +
  12492. + RSPParser_aexpr_return aexpr6;
  12493. + #undef RETURN_TYPE_aexpr6
  12494. + #define RETURN_TYPE_aexpr6 RSPParser_aexpr_return
  12495. +
  12496. + pANTLR3_BASE_TREE OR5_tree;
  12497. +
  12498. + /* Initialize rule variables
  12499. + */
  12500. +
  12501. +
  12502. + root_0 = NULL;
  12503. +
  12504. + OR5 = NULL;
  12505. + aexpr4.tree = NULL;
  12506. +
  12507. + aexpr6.tree = NULL;
  12508. +
  12509. + retval.start = LT(1); retval.stop = retval.start;
  12510. +
  12511. + OR5_tree = NULL;
  12512. +
  12513. +
  12514. + retval.tree = NULL;
  12515. + {
  12516. + // RSP.g:30:6: ( aexpr ( OR aexpr )* )
  12517. + // RSP.g:30:8: aexpr ( OR aexpr )*
  12518. + {
  12519. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  12520. +
  12521. + FOLLOWPUSH(FOLLOW_aexpr_in_expr63);
  12522. + aexpr4=aexpr(ctx);
  12523. +
  12524. + FOLLOWPOP();
  12525. + if (HASEXCEPTION())
  12526. + {
  12527. + goto ruleexprEx;
  12528. + }
  12529. +
  12530. + ADAPTOR->addChild(ADAPTOR, root_0, aexpr4.tree);
  12531. +
  12532. + // RSP.g:30:14: ( OR aexpr )*
  12533. +
  12534. + for (;;)
  12535. + {
  12536. + int alt2=2;
  12537. + switch ( LA(1) )
  12538. + {
  12539. + case OR:
  12540. + {
  12541. + alt2=1;
  12542. + }
  12543. + break;
  12544. +
  12545. + }
  12546. +
  12547. + switch (alt2)
  12548. + {
  12549. + case 1:
  12550. + // RSP.g:30:15: OR aexpr
  12551. + {
  12552. + OR5 = (pANTLR3_COMMON_TOKEN) MATCHT(OR, &FOLLOW_OR_in_expr66);
  12553. + if (HASEXCEPTION())
  12554. + {
  12555. + goto ruleexprEx;
  12556. + }
  12557. +
  12558. + OR5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OR5));
  12559. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OR5_tree, root_0));
  12560. +
  12561. + FOLLOWPUSH(FOLLOW_aexpr_in_expr69);
  12562. + aexpr6=aexpr(ctx);
  12563. +
  12564. + FOLLOWPOP();
  12565. + if (HASEXCEPTION())
  12566. + {
  12567. + goto ruleexprEx;
  12568. + }
  12569. +
  12570. + ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree);
  12571. +
  12572. + }
  12573. + break;
  12574. +
  12575. + default:
  12576. + goto loop2; /* break out of the loop */
  12577. + break;
  12578. + }
  12579. + }
  12580. + loop2: ; /* Jump out to here if this rule does not match */
  12581. +
  12582. +
  12583. + }
  12584. +
  12585. + }
  12586. +
  12587. +
  12588. + // This is where rules clean up and exit
  12589. + //
  12590. + goto ruleexprEx; /* Prevent compiler warnings */
  12591. + ruleexprEx: ;
  12592. + retval.stop = LT(-1);
  12593. +
  12594. + retval.stop = LT(-1);
  12595. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  12596. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  12597. +
  12598. + if (HASEXCEPTION())
  12599. + {
  12600. + PREPORTERROR();
  12601. + PRECOVER();
  12602. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  12603. + }
  12604. +
  12605. +
  12606. + return retval;
  12607. +}
  12608. +/* $ANTLR end expr */
  12609. +
  12610. +/**
  12611. + * $ANTLR start aexpr
  12612. + * RSP.g:33:1: aexpr : crit ( AND crit )* ;
  12613. + */
  12614. +static RSPParser_aexpr_return
  12615. +aexpr(pRSPParser ctx)
  12616. +{
  12617. + RSPParser_aexpr_return retval;
  12618. +
  12619. + pANTLR3_BASE_TREE root_0;
  12620. +
  12621. + pANTLR3_COMMON_TOKEN AND8;
  12622. + RSPParser_crit_return crit7;
  12623. + #undef RETURN_TYPE_crit7
  12624. + #define RETURN_TYPE_crit7 RSPParser_crit_return
  12625. +
  12626. + RSPParser_crit_return crit9;
  12627. + #undef RETURN_TYPE_crit9
  12628. + #define RETURN_TYPE_crit9 RSPParser_crit_return
  12629. +
  12630. + pANTLR3_BASE_TREE AND8_tree;
  12631. +
  12632. + /* Initialize rule variables
  12633. + */
  12634. +
  12635. +
  12636. + root_0 = NULL;
  12637. +
  12638. + AND8 = NULL;
  12639. + crit7.tree = NULL;
  12640. +
  12641. + crit9.tree = NULL;
  12642. +
  12643. + retval.start = LT(1); retval.stop = retval.start;
  12644. +
  12645. + AND8_tree = NULL;
  12646. +
  12647. +
  12648. + retval.tree = NULL;
  12649. + {
  12650. + // RSP.g:33:7: ( crit ( AND crit )* )
  12651. + // RSP.g:33:9: crit ( AND crit )*
  12652. + {
  12653. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  12654. +
  12655. + FOLLOWPUSH(FOLLOW_crit_in_aexpr81);
  12656. + crit7=crit(ctx);
  12657. +
  12658. + FOLLOWPOP();
  12659. + if (HASEXCEPTION())
  12660. + {
  12661. + goto ruleaexprEx;
  12662. + }
  12663. +
  12664. + ADAPTOR->addChild(ADAPTOR, root_0, crit7.tree);
  12665. +
  12666. + // RSP.g:33:14: ( AND crit )*
  12667. +
  12668. + for (;;)
  12669. + {
  12670. + int alt3=2;
  12671. + switch ( LA(1) )
  12672. + {
  12673. + case AND:
  12674. + {
  12675. + alt3=1;
  12676. + }
  12677. + break;
  12678. +
  12679. + }
  12680. +
  12681. + switch (alt3)
  12682. + {
  12683. + case 1:
  12684. + // RSP.g:33:15: AND crit
  12685. + {
  12686. + AND8 = (pANTLR3_COMMON_TOKEN) MATCHT(AND, &FOLLOW_AND_in_aexpr84);
  12687. + if (HASEXCEPTION())
  12688. + {
  12689. + goto ruleaexprEx;
  12690. + }
  12691. +
  12692. + AND8_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AND8));
  12693. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, AND8_tree, root_0));
  12694. +
  12695. + FOLLOWPUSH(FOLLOW_crit_in_aexpr87);
  12696. + crit9=crit(ctx);
  12697. +
  12698. + FOLLOWPOP();
  12699. + if (HASEXCEPTION())
  12700. + {
  12701. + goto ruleaexprEx;
  12702. + }
  12703. +
  12704. + ADAPTOR->addChild(ADAPTOR, root_0, crit9.tree);
  12705. +
  12706. + }
  12707. + break;
  12708. +
  12709. + default:
  12710. + goto loop3; /* break out of the loop */
  12711. + break;
  12712. + }
  12713. + }
  12714. + loop3: ; /* Jump out to here if this rule does not match */
  12715. +
  12716. +
  12717. + }
  12718. +
  12719. + }
  12720. +
  12721. +
  12722. + // This is where rules clean up and exit
  12723. + //
  12724. + goto ruleaexprEx; /* Prevent compiler warnings */
  12725. + ruleaexprEx: ;
  12726. + retval.stop = LT(-1);
  12727. +
  12728. + retval.stop = LT(-1);
  12729. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  12730. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  12731. +
  12732. + if (HASEXCEPTION())
  12733. + {
  12734. + PREPORTERROR();
  12735. + PRECOVER();
  12736. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  12737. + }
  12738. +
  12739. +
  12740. + return retval;
  12741. +}
  12742. +/* $ANTLR end aexpr */
  12743. +
  12744. +/**
  12745. + * $ANTLR start crit
  12746. + * RSP.g:36:1: crit : ( LPAR expr RPAR -> expr | strcrit | intcrit | datecrit );
  12747. + */
  12748. +static RSPParser_crit_return
  12749. +crit(pRSPParser ctx)
  12750. +{
  12751. + RSPParser_crit_return retval;
  12752. +
  12753. + pANTLR3_BASE_TREE root_0;
  12754. +
  12755. + pANTLR3_COMMON_TOKEN LPAR10;
  12756. + pANTLR3_COMMON_TOKEN RPAR12;
  12757. + RSPParser_expr_return expr11;
  12758. + #undef RETURN_TYPE_expr11
  12759. + #define RETURN_TYPE_expr11 RSPParser_expr_return
  12760. +
  12761. + RSPParser_strcrit_return strcrit13;
  12762. + #undef RETURN_TYPE_strcrit13
  12763. + #define RETURN_TYPE_strcrit13 RSPParser_strcrit_return
  12764. +
  12765. + RSPParser_intcrit_return intcrit14;
  12766. + #undef RETURN_TYPE_intcrit14
  12767. + #define RETURN_TYPE_intcrit14 RSPParser_intcrit_return
  12768. +
  12769. + RSPParser_datecrit_return datecrit15;
  12770. + #undef RETURN_TYPE_datecrit15
  12771. + #define RETURN_TYPE_datecrit15 RSPParser_datecrit_return
  12772. +
  12773. + pANTLR3_BASE_TREE LPAR10_tree;
  12774. + pANTLR3_BASE_TREE RPAR12_tree;
  12775. + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_RPAR;
  12776. + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_LPAR;
  12777. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr;
  12778. + /* Initialize rule variables
  12779. + */
  12780. +
  12781. +
  12782. + root_0 = NULL;
  12783. +
  12784. + LPAR10 = NULL;
  12785. + RPAR12 = NULL;
  12786. + expr11.tree = NULL;
  12787. +
  12788. + strcrit13.tree = NULL;
  12789. +
  12790. + intcrit14.tree = NULL;
  12791. +
  12792. + datecrit15.tree = NULL;
  12793. +
  12794. + retval.start = LT(1); retval.stop = retval.start;
  12795. +
  12796. + LPAR10_tree = NULL;
  12797. + RPAR12_tree = NULL;
  12798. +
  12799. + stream_RPAR = NULL;
  12800. + #define CREATE_stream_RPAR if (stream_RPAR == NULL) {stream_RPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token RPAR"); }
  12801. + stream_LPAR = NULL;
  12802. + #define CREATE_stream_LPAR if (stream_LPAR == NULL) {stream_LPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token LPAR"); }
  12803. + stream_expr = NULL;
  12804. + #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); }
  12805. +
  12806. + retval.tree = NULL;
  12807. + {
  12808. + {
  12809. + // RSP.g:36:6: ( LPAR expr RPAR -> expr | strcrit | intcrit | datecrit )
  12810. +
  12811. + ANTLR3_UINT32 alt4;
  12812. +
  12813. + alt4=4;
  12814. +
  12815. + switch ( LA(1) )
  12816. + {
  12817. + case LPAR:
  12818. + {
  12819. + alt4=1;
  12820. + }
  12821. + break;
  12822. + case FIELD:
  12823. + {
  12824. + switch ( LA(2) )
  12825. + {
  12826. + case NOT:
  12827. + {
  12828. + switch ( LA(3) )
  12829. + {
  12830. + case EQUAL:
  12831. + {
  12832. + switch ( LA(4) )
  12833. + {
  12834. + case STR:
  12835. + {
  12836. + alt4=2;
  12837. + }
  12838. + break;
  12839. + case INT:
  12840. + {
  12841. + alt4=3;
  12842. + }
  12843. + break;
  12844. +
  12845. + default:
  12846. + CONSTRUCTEX();
  12847. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  12848. + EXCEPTION->message = (void *)"";
  12849. + EXCEPTION->decisionNum = 4;
  12850. + EXCEPTION->state = 8;
  12851. +
  12852. +
  12853. + goto rulecritEx;
  12854. + }
  12855. +
  12856. + }
  12857. + break;
  12858. + case LESS:
  12859. + case GREATER:
  12860. + case LTE:
  12861. + case GTE:
  12862. + {
  12863. + alt4=3;
  12864. + }
  12865. + break;
  12866. + case INCLUDES:
  12867. + case STARTSW:
  12868. + case ENDSW:
  12869. + {
  12870. + alt4=2;
  12871. + }
  12872. + break;
  12873. +
  12874. + default:
  12875. + CONSTRUCTEX();
  12876. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  12877. + EXCEPTION->message = (void *)"";
  12878. + EXCEPTION->decisionNum = 4;
  12879. + EXCEPTION->state = 3;
  12880. +
  12881. +
  12882. + goto rulecritEx;
  12883. + }
  12884. +
  12885. + }
  12886. + break;
  12887. + case BEFORE:
  12888. + case AFTER:
  12889. + {
  12890. + alt4=4;
  12891. + }
  12892. + break;
  12893. + case EQUAL:
  12894. + {
  12895. + switch ( LA(3) )
  12896. + {
  12897. + case INT:
  12898. + {
  12899. + alt4=3;
  12900. + }
  12901. + break;
  12902. + case STR:
  12903. + {
  12904. + alt4=2;
  12905. + }
  12906. + break;
  12907. +
  12908. + default:
  12909. + CONSTRUCTEX();
  12910. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  12911. + EXCEPTION->message = (void *)"";
  12912. + EXCEPTION->decisionNum = 4;
  12913. + EXCEPTION->state = 5;
  12914. +
  12915. +
  12916. + goto rulecritEx;
  12917. + }
  12918. +
  12919. + }
  12920. + break;
  12921. + case LESS:
  12922. + case GREATER:
  12923. + case LTE:
  12924. + case GTE:
  12925. + {
  12926. + alt4=3;
  12927. + }
  12928. + break;
  12929. + case INCLUDES:
  12930. + case STARTSW:
  12931. + case ENDSW:
  12932. + {
  12933. + alt4=2;
  12934. + }
  12935. + break;
  12936. +
  12937. + default:
  12938. + CONSTRUCTEX();
  12939. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  12940. + EXCEPTION->message = (void *)"";
  12941. + EXCEPTION->decisionNum = 4;
  12942. + EXCEPTION->state = 2;
  12943. +
  12944. +
  12945. + goto rulecritEx;
  12946. + }
  12947. +
  12948. + }
  12949. + break;
  12950. +
  12951. + default:
  12952. + CONSTRUCTEX();
  12953. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  12954. + EXCEPTION->message = (void *)"";
  12955. + EXCEPTION->decisionNum = 4;
  12956. + EXCEPTION->state = 0;
  12957. +
  12958. +
  12959. + goto rulecritEx;
  12960. + }
  12961. +
  12962. + switch (alt4)
  12963. + {
  12964. + case 1:
  12965. + // RSP.g:36:8: LPAR expr RPAR
  12966. + {
  12967. + LPAR10 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit99);
  12968. + if (HASEXCEPTION())
  12969. + {
  12970. + goto rulecritEx;
  12971. + }
  12972. +
  12973. + CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR10, NULL);
  12974. +
  12975. + FOLLOWPUSH(FOLLOW_expr_in_crit101);
  12976. + expr11=expr(ctx);
  12977. +
  12978. + FOLLOWPOP();
  12979. + if (HASEXCEPTION())
  12980. + {
  12981. + goto rulecritEx;
  12982. + }
  12983. +
  12984. + CREATE_stream_expr; stream_expr->add(stream_expr, expr11.tree, NULL);
  12985. + RPAR12 = (pANTLR3_COMMON_TOKEN) MATCHT(RPAR, &FOLLOW_RPAR_in_crit103);
  12986. + if (HASEXCEPTION())
  12987. + {
  12988. + goto rulecritEx;
  12989. + }
  12990. +
  12991. + CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR12, NULL);
  12992. +
  12993. +
  12994. +
  12995. + /* AST REWRITE
  12996. + * elements : expr
  12997. + * token labels :
  12998. + * rule labels : retval
  12999. + * token list labels :
  13000. + * rule list labels :
  13001. + */
  13002. + {
  13003. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
  13004. +
  13005. + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
  13006. +
  13007. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13008. + retval.tree = root_0;
  13009. + // 36:25: -> expr
  13010. + {
  13011. + ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
  13012. +
  13013. + }
  13014. +
  13015. + retval.tree = root_0; // set result root
  13016. + if (stream_retval != NULL) stream_retval->free(stream_retval);
  13017. +
  13018. +
  13019. + }
  13020. + }
  13021. + break;
  13022. + case 2:
  13023. + // RSP.g:37:4: strcrit
  13024. + {
  13025. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13026. +
  13027. + FOLLOWPUSH(FOLLOW_strcrit_in_crit114);
  13028. + strcrit13=strcrit(ctx);
  13029. +
  13030. + FOLLOWPOP();
  13031. + if (HASEXCEPTION())
  13032. + {
  13033. + goto rulecritEx;
  13034. + }
  13035. +
  13036. + ADAPTOR->addChild(ADAPTOR, root_0, strcrit13.tree);
  13037. +
  13038. + }
  13039. + break;
  13040. + case 3:
  13041. + // RSP.g:38:4: intcrit
  13042. + {
  13043. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13044. +
  13045. + FOLLOWPUSH(FOLLOW_intcrit_in_crit119);
  13046. + intcrit14=intcrit(ctx);
  13047. +
  13048. + FOLLOWPOP();
  13049. + if (HASEXCEPTION())
  13050. + {
  13051. + goto rulecritEx;
  13052. + }
  13053. +
  13054. + ADAPTOR->addChild(ADAPTOR, root_0, intcrit14.tree);
  13055. +
  13056. + }
  13057. + break;
  13058. + case 4:
  13059. + // RSP.g:39:4: datecrit
  13060. + {
  13061. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13062. +
  13063. + FOLLOWPUSH(FOLLOW_datecrit_in_crit124);
  13064. + datecrit15=datecrit(ctx);
  13065. +
  13066. + FOLLOWPOP();
  13067. + if (HASEXCEPTION())
  13068. + {
  13069. + goto rulecritEx;
  13070. + }
  13071. +
  13072. + ADAPTOR->addChild(ADAPTOR, root_0, datecrit15.tree);
  13073. +
  13074. + }
  13075. + break;
  13076. +
  13077. + }
  13078. + }
  13079. + }
  13080. +
  13081. +
  13082. + // This is where rules clean up and exit
  13083. + //
  13084. + goto rulecritEx; /* Prevent compiler warnings */
  13085. + rulecritEx: ;
  13086. + retval.stop = LT(-1);
  13087. +
  13088. + retval.stop = LT(-1);
  13089. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  13090. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  13091. + if (stream_RPAR != NULL) stream_RPAR->free(stream_RPAR);
  13092. + if (stream_LPAR != NULL) stream_LPAR->free(stream_LPAR);
  13093. + if (stream_expr != NULL) stream_expr->free(stream_expr);
  13094. +
  13095. + if (HASEXCEPTION())
  13096. + {
  13097. + PREPORTERROR();
  13098. + PRECOVER();
  13099. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  13100. + }
  13101. +
  13102. +
  13103. + return retval;
  13104. +}
  13105. +/* $ANTLR end crit */
  13106. +
  13107. +/**
  13108. + * $ANTLR start strcrit
  13109. + * RSP.g:42:1: strcrit : ( FIELD strop STR -> ^( strop FIELD STR ) | FIELD NOT strop STR -> ^( NOT ^( strop FIELD STR ) ) );
  13110. + */
  13111. +static RSPParser_strcrit_return
  13112. +strcrit(pRSPParser ctx)
  13113. +{
  13114. + RSPParser_strcrit_return retval;
  13115. +
  13116. + pANTLR3_BASE_TREE root_0;
  13117. +
  13118. + pANTLR3_COMMON_TOKEN FIELD16;
  13119. + pANTLR3_COMMON_TOKEN STR18;
  13120. + pANTLR3_COMMON_TOKEN FIELD19;
  13121. + pANTLR3_COMMON_TOKEN NOT20;
  13122. + pANTLR3_COMMON_TOKEN STR22;
  13123. + RSPParser_strop_return strop17;
  13124. + #undef RETURN_TYPE_strop17
  13125. + #define RETURN_TYPE_strop17 RSPParser_strop_return
  13126. +
  13127. + RSPParser_strop_return strop21;
  13128. + #undef RETURN_TYPE_strop21
  13129. + #define RETURN_TYPE_strop21 RSPParser_strop_return
  13130. +
  13131. + pANTLR3_BASE_TREE FIELD16_tree;
  13132. + pANTLR3_BASE_TREE STR18_tree;
  13133. + pANTLR3_BASE_TREE FIELD19_tree;
  13134. + pANTLR3_BASE_TREE NOT20_tree;
  13135. + pANTLR3_BASE_TREE STR22_tree;
  13136. + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_STR;
  13137. + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_FIELD;
  13138. + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NOT;
  13139. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_strop;
  13140. + /* Initialize rule variables
  13141. + */
  13142. +
  13143. +
  13144. + root_0 = NULL;
  13145. +
  13146. + FIELD16 = NULL;
  13147. + STR18 = NULL;
  13148. + FIELD19 = NULL;
  13149. + NOT20 = NULL;
  13150. + STR22 = NULL;
  13151. + strop17.tree = NULL;
  13152. +
  13153. + strop21.tree = NULL;
  13154. +
  13155. + retval.start = LT(1); retval.stop = retval.start;
  13156. +
  13157. + FIELD16_tree = NULL;
  13158. + STR18_tree = NULL;
  13159. + FIELD19_tree = NULL;
  13160. + NOT20_tree = NULL;
  13161. + STR22_tree = NULL;
  13162. +
  13163. + stream_STR = NULL;
  13164. + #define CREATE_stream_STR if (stream_STR == NULL) {stream_STR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token STR"); }
  13165. + stream_FIELD = NULL;
  13166. + #define CREATE_stream_FIELD if (stream_FIELD == NULL) {stream_FIELD = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token FIELD"); }
  13167. + stream_NOT = NULL;
  13168. + #define CREATE_stream_NOT if (stream_NOT == NULL) {stream_NOT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NOT"); }
  13169. + stream_strop = NULL;
  13170. + #define CREATE_stream_strop if (stream_strop == NULL) {stream_strop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule strop"); }
  13171. +
  13172. + retval.tree = NULL;
  13173. + {
  13174. + {
  13175. + // RSP.g:42:9: ( FIELD strop STR -> ^( strop FIELD STR ) | FIELD NOT strop STR -> ^( NOT ^( strop FIELD STR ) ) )
  13176. +
  13177. + ANTLR3_UINT32 alt5;
  13178. +
  13179. + alt5=2;
  13180. +
  13181. + switch ( LA(1) )
  13182. + {
  13183. + case FIELD:
  13184. + {
  13185. + switch ( LA(2) )
  13186. + {
  13187. + case NOT:
  13188. + {
  13189. + alt5=2;
  13190. + }
  13191. + break;
  13192. + case EQUAL:
  13193. + case INCLUDES:
  13194. + case STARTSW:
  13195. + case ENDSW:
  13196. + {
  13197. + alt5=1;
  13198. + }
  13199. + break;
  13200. +
  13201. + default:
  13202. + CONSTRUCTEX();
  13203. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  13204. + EXCEPTION->message = (void *)"";
  13205. + EXCEPTION->decisionNum = 5;
  13206. + EXCEPTION->state = 1;
  13207. +
  13208. +
  13209. + goto rulestrcritEx;
  13210. + }
  13211. +
  13212. + }
  13213. + break;
  13214. +
  13215. + default:
  13216. + CONSTRUCTEX();
  13217. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  13218. + EXCEPTION->message = (void *)"";
  13219. + EXCEPTION->decisionNum = 5;
  13220. + EXCEPTION->state = 0;
  13221. +
  13222. +
  13223. + goto rulestrcritEx;
  13224. + }
  13225. +
  13226. + switch (alt5)
  13227. + {
  13228. + case 1:
  13229. + // RSP.g:42:11: FIELD strop STR
  13230. + {
  13231. + FIELD16 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit134);
  13232. + if (HASEXCEPTION())
  13233. + {
  13234. + goto rulestrcritEx;
  13235. + }
  13236. +
  13237. + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD16, NULL);
  13238. +
  13239. + FOLLOWPUSH(FOLLOW_strop_in_strcrit136);
  13240. + strop17=strop(ctx);
  13241. +
  13242. + FOLLOWPOP();
  13243. + if (HASEXCEPTION())
  13244. + {
  13245. + goto rulestrcritEx;
  13246. + }
  13247. +
  13248. + CREATE_stream_strop; stream_strop->add(stream_strop, strop17.tree, NULL);
  13249. + STR18 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_strcrit138);
  13250. + if (HASEXCEPTION())
  13251. + {
  13252. + goto rulestrcritEx;
  13253. + }
  13254. +
  13255. + CREATE_stream_STR; stream_STR->add(stream_STR, STR18, NULL);
  13256. +
  13257. +
  13258. +
  13259. + /* AST REWRITE
  13260. + * elements : FIELD, STR, strop
  13261. + * token labels :
  13262. + * rule labels : retval
  13263. + * token list labels :
  13264. + * rule list labels :
  13265. + */
  13266. + {
  13267. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
  13268. +
  13269. + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
  13270. +
  13271. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13272. + retval.tree = root_0;
  13273. + // 42:29: -> ^( strop FIELD STR )
  13274. + {
  13275. + // RSP.g:42:32: ^( strop FIELD STR )
  13276. + {
  13277. + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13278. + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_strop == NULL ? NULL : stream_strop->nextNode(stream_strop), root_1));
  13279. +
  13280. + ADAPTOR->addChild(ADAPTOR, root_1, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
  13281. + ADAPTOR->addChild(ADAPTOR, root_1, stream_STR == NULL ? NULL : stream_STR->nextNode(stream_STR));
  13282. +
  13283. + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
  13284. + }
  13285. +
  13286. + }
  13287. +
  13288. + retval.tree = root_0; // set result root
  13289. + if (stream_retval != NULL) stream_retval->free(stream_retval);
  13290. +
  13291. +
  13292. + }
  13293. + }
  13294. + break;
  13295. + case 2:
  13296. + // RSP.g:43:4: FIELD NOT strop STR
  13297. + {
  13298. + FIELD19 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit155);
  13299. + if (HASEXCEPTION())
  13300. + {
  13301. + goto rulestrcritEx;
  13302. + }
  13303. +
  13304. + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD19, NULL);
  13305. +
  13306. + NOT20 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_strcrit157);
  13307. + if (HASEXCEPTION())
  13308. + {
  13309. + goto rulestrcritEx;
  13310. + }
  13311. +
  13312. + CREATE_stream_NOT; stream_NOT->add(stream_NOT, NOT20, NULL);
  13313. +
  13314. + FOLLOWPUSH(FOLLOW_strop_in_strcrit159);
  13315. + strop21=strop(ctx);
  13316. +
  13317. + FOLLOWPOP();
  13318. + if (HASEXCEPTION())
  13319. + {
  13320. + goto rulestrcritEx;
  13321. + }
  13322. +
  13323. + CREATE_stream_strop; stream_strop->add(stream_strop, strop21.tree, NULL);
  13324. + STR22 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_strcrit161);
  13325. + if (HASEXCEPTION())
  13326. + {
  13327. + goto rulestrcritEx;
  13328. + }
  13329. +
  13330. + CREATE_stream_STR; stream_STR->add(stream_STR, STR22, NULL);
  13331. +
  13332. +
  13333. +
  13334. + /* AST REWRITE
  13335. + * elements : STR, FIELD, strop, NOT
  13336. + * token labels :
  13337. + * rule labels : retval
  13338. + * token list labels :
  13339. + * rule list labels :
  13340. + */
  13341. + {
  13342. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
  13343. +
  13344. + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
  13345. +
  13346. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13347. + retval.tree = root_0;
  13348. + // 43:25: -> ^( NOT ^( strop FIELD STR ) )
  13349. + {
  13350. + // RSP.g:43:28: ^( NOT ^( strop FIELD STR ) )
  13351. + {
  13352. + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13353. + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_NOT == NULL ? NULL : stream_NOT->nextNode(stream_NOT), root_1));
  13354. +
  13355. + // RSP.g:43:34: ^( strop FIELD STR )
  13356. + {
  13357. + pANTLR3_BASE_TREE root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13358. + root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_strop == NULL ? NULL : stream_strop->nextNode(stream_strop), root_2));
  13359. +
  13360. + ADAPTOR->addChild(ADAPTOR, root_2, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
  13361. + ADAPTOR->addChild(ADAPTOR, root_2, stream_STR == NULL ? NULL : stream_STR->nextNode(stream_STR));
  13362. +
  13363. + ADAPTOR->addChild(ADAPTOR, root_1, root_2);
  13364. + }
  13365. +
  13366. + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
  13367. + }
  13368. +
  13369. + }
  13370. +
  13371. + retval.tree = root_0; // set result root
  13372. + if (stream_retval != NULL) stream_retval->free(stream_retval);
  13373. +
  13374. +
  13375. + }
  13376. + }
  13377. + break;
  13378. +
  13379. + }
  13380. + }
  13381. + }
  13382. +
  13383. +
  13384. + // This is where rules clean up and exit
  13385. + //
  13386. + goto rulestrcritEx; /* Prevent compiler warnings */
  13387. + rulestrcritEx: ;
  13388. + retval.stop = LT(-1);
  13389. +
  13390. + retval.stop = LT(-1);
  13391. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  13392. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  13393. + if (stream_STR != NULL) stream_STR->free(stream_STR);
  13394. + if (stream_FIELD != NULL) stream_FIELD->free(stream_FIELD);
  13395. + if (stream_NOT != NULL) stream_NOT->free(stream_NOT);
  13396. + if (stream_strop != NULL) stream_strop->free(stream_strop);
  13397. +
  13398. + if (HASEXCEPTION())
  13399. + {
  13400. + PREPORTERROR();
  13401. + PRECOVER();
  13402. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  13403. + }
  13404. +
  13405. +
  13406. + return retval;
  13407. +}
  13408. +/* $ANTLR end strcrit */
  13409. +
  13410. +/**
  13411. + * $ANTLR start strop
  13412. + * RSP.g:46:1: strop : (equal= EQUAL | includes= INCLUDES | startsw= STARTSW | endsw= ENDSW );
  13413. + */
  13414. +static RSPParser_strop_return
  13415. +strop(pRSPParser ctx)
  13416. +{
  13417. + RSPParser_strop_return retval;
  13418. +
  13419. + pANTLR3_BASE_TREE root_0;
  13420. +
  13421. + pANTLR3_COMMON_TOKEN equal;
  13422. + pANTLR3_COMMON_TOKEN includes;
  13423. + pANTLR3_COMMON_TOKEN startsw;
  13424. + pANTLR3_COMMON_TOKEN endsw;
  13425. +
  13426. + pANTLR3_BASE_TREE equal_tree;
  13427. + pANTLR3_BASE_TREE includes_tree;
  13428. + pANTLR3_BASE_TREE startsw_tree;
  13429. + pANTLR3_BASE_TREE endsw_tree;
  13430. +
  13431. + /* Initialize rule variables
  13432. + */
  13433. +
  13434. +
  13435. + root_0 = NULL;
  13436. +
  13437. + equal = NULL;
  13438. + includes = NULL;
  13439. + startsw = NULL;
  13440. + endsw = NULL;
  13441. + retval.start = LT(1); retval.stop = retval.start;
  13442. +
  13443. + equal_tree = NULL;
  13444. + includes_tree = NULL;
  13445. + startsw_tree = NULL;
  13446. + endsw_tree = NULL;
  13447. +
  13448. +
  13449. + retval.tree = NULL;
  13450. + {
  13451. + {
  13452. + // RSP.g:46:7: (equal= EQUAL | includes= INCLUDES | startsw= STARTSW | endsw= ENDSW )
  13453. +
  13454. + ANTLR3_UINT32 alt6;
  13455. +
  13456. + alt6=4;
  13457. +
  13458. + switch ( LA(1) )
  13459. + {
  13460. + case EQUAL:
  13461. + {
  13462. + alt6=1;
  13463. + }
  13464. + break;
  13465. + case INCLUDES:
  13466. + {
  13467. + alt6=2;
  13468. + }
  13469. + break;
  13470. + case STARTSW:
  13471. + {
  13472. + alt6=3;
  13473. + }
  13474. + break;
  13475. + case ENDSW:
  13476. + {
  13477. + alt6=4;
  13478. + }
  13479. + break;
  13480. +
  13481. + default:
  13482. + CONSTRUCTEX();
  13483. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  13484. + EXCEPTION->message = (void *)"";
  13485. + EXCEPTION->decisionNum = 6;
  13486. + EXCEPTION->state = 0;
  13487. +
  13488. +
  13489. + goto rulestropEx;
  13490. + }
  13491. +
  13492. + switch (alt6)
  13493. + {
  13494. + case 1:
  13495. + // RSP.g:46:9: equal= EQUAL
  13496. + {
  13497. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13498. +
  13499. + equal = (pANTLR3_COMMON_TOKEN) MATCHT(EQUAL, &FOLLOW_EQUAL_in_strop188);
  13500. + if (HASEXCEPTION())
  13501. + {
  13502. + goto rulestropEx;
  13503. + }
  13504. +
  13505. + equal_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, equal));
  13506. + ADAPTOR->addChild(ADAPTOR, root_0, equal_tree);
  13507. +
  13508. +
  13509. + }
  13510. + break;
  13511. + case 2:
  13512. + // RSP.g:47:4: includes= INCLUDES
  13513. + {
  13514. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13515. +
  13516. + includes = (pANTLR3_COMMON_TOKEN) MATCHT(INCLUDES, &FOLLOW_INCLUDES_in_strop195);
  13517. + if (HASEXCEPTION())
  13518. + {
  13519. + goto rulestropEx;
  13520. + }
  13521. +
  13522. + includes_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, includes));
  13523. + ADAPTOR->addChild(ADAPTOR, root_0, includes_tree);
  13524. +
  13525. +
  13526. + }
  13527. + break;
  13528. + case 3:
  13529. + // RSP.g:48:4: startsw= STARTSW
  13530. + {
  13531. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13532. +
  13533. + startsw = (pANTLR3_COMMON_TOKEN) MATCHT(STARTSW, &FOLLOW_STARTSW_in_strop202);
  13534. + if (HASEXCEPTION())
  13535. + {
  13536. + goto rulestropEx;
  13537. + }
  13538. +
  13539. + startsw_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, startsw));
  13540. + ADAPTOR->addChild(ADAPTOR, root_0, startsw_tree);
  13541. +
  13542. +
  13543. + }
  13544. + break;
  13545. + case 4:
  13546. + // RSP.g:49:4: endsw= ENDSW
  13547. + {
  13548. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13549. +
  13550. + endsw = (pANTLR3_COMMON_TOKEN) MATCHT(ENDSW, &FOLLOW_ENDSW_in_strop209);
  13551. + if (HASEXCEPTION())
  13552. + {
  13553. + goto rulestropEx;
  13554. + }
  13555. +
  13556. + endsw_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, endsw));
  13557. + ADAPTOR->addChild(ADAPTOR, root_0, endsw_tree);
  13558. +
  13559. +
  13560. + }
  13561. + break;
  13562. +
  13563. + }
  13564. + }
  13565. + }
  13566. +
  13567. +
  13568. + // This is where rules clean up and exit
  13569. + //
  13570. + goto rulestropEx; /* Prevent compiler warnings */
  13571. + rulestropEx: ;
  13572. + retval.stop = LT(-1);
  13573. +
  13574. + retval.stop = LT(-1);
  13575. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  13576. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  13577. +
  13578. + if (HASEXCEPTION())
  13579. + {
  13580. + PREPORTERROR();
  13581. + PRECOVER();
  13582. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  13583. + }
  13584. +
  13585. +
  13586. + return retval;
  13587. +}
  13588. +/* $ANTLR end strop */
  13589. +
  13590. +/**
  13591. + * $ANTLR start intcrit
  13592. + * RSP.g:52:1: intcrit : ( FIELD intop INT -> ^( intop FIELD INT ) | FIELD NOT intop INT -> ^( NOT ^( intop FIELD INT ) ) );
  13593. + */
  13594. +static RSPParser_intcrit_return
  13595. +intcrit(pRSPParser ctx)
  13596. +{
  13597. + RSPParser_intcrit_return retval;
  13598. +
  13599. + pANTLR3_BASE_TREE root_0;
  13600. +
  13601. + pANTLR3_COMMON_TOKEN FIELD23;
  13602. + pANTLR3_COMMON_TOKEN INT25;
  13603. + pANTLR3_COMMON_TOKEN FIELD26;
  13604. + pANTLR3_COMMON_TOKEN NOT27;
  13605. + pANTLR3_COMMON_TOKEN INT29;
  13606. + RSPParser_intop_return intop24;
  13607. + #undef RETURN_TYPE_intop24
  13608. + #define RETURN_TYPE_intop24 RSPParser_intop_return
  13609. +
  13610. + RSPParser_intop_return intop28;
  13611. + #undef RETURN_TYPE_intop28
  13612. + #define RETURN_TYPE_intop28 RSPParser_intop_return
  13613. +
  13614. + pANTLR3_BASE_TREE FIELD23_tree;
  13615. + pANTLR3_BASE_TREE INT25_tree;
  13616. + pANTLR3_BASE_TREE FIELD26_tree;
  13617. + pANTLR3_BASE_TREE NOT27_tree;
  13618. + pANTLR3_BASE_TREE INT29_tree;
  13619. + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_FIELD;
  13620. + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_INT;
  13621. + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NOT;
  13622. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_intop;
  13623. + /* Initialize rule variables
  13624. + */
  13625. +
  13626. +
  13627. + root_0 = NULL;
  13628. +
  13629. + FIELD23 = NULL;
  13630. + INT25 = NULL;
  13631. + FIELD26 = NULL;
  13632. + NOT27 = NULL;
  13633. + INT29 = NULL;
  13634. + intop24.tree = NULL;
  13635. +
  13636. + intop28.tree = NULL;
  13637. +
  13638. + retval.start = LT(1); retval.stop = retval.start;
  13639. +
  13640. + FIELD23_tree = NULL;
  13641. + INT25_tree = NULL;
  13642. + FIELD26_tree = NULL;
  13643. + NOT27_tree = NULL;
  13644. + INT29_tree = NULL;
  13645. +
  13646. + stream_FIELD = NULL;
  13647. + #define CREATE_stream_FIELD if (stream_FIELD == NULL) {stream_FIELD = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token FIELD"); }
  13648. + stream_INT = NULL;
  13649. + #define CREATE_stream_INT if (stream_INT == NULL) {stream_INT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token INT"); }
  13650. + stream_NOT = NULL;
  13651. + #define CREATE_stream_NOT if (stream_NOT == NULL) {stream_NOT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NOT"); }
  13652. + stream_intop = NULL;
  13653. + #define CREATE_stream_intop if (stream_intop == NULL) {stream_intop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule intop"); }
  13654. +
  13655. + retval.tree = NULL;
  13656. + {
  13657. + {
  13658. + // RSP.g:52:9: ( FIELD intop INT -> ^( intop FIELD INT ) | FIELD NOT intop INT -> ^( NOT ^( intop FIELD INT ) ) )
  13659. +
  13660. + ANTLR3_UINT32 alt7;
  13661. +
  13662. + alt7=2;
  13663. +
  13664. + switch ( LA(1) )
  13665. + {
  13666. + case FIELD:
  13667. + {
  13668. + switch ( LA(2) )
  13669. + {
  13670. + case NOT:
  13671. + {
  13672. + alt7=2;
  13673. + }
  13674. + break;
  13675. + case EQUAL:
  13676. + case LESS:
  13677. + case GREATER:
  13678. + case LTE:
  13679. + case GTE:
  13680. + {
  13681. + alt7=1;
  13682. + }
  13683. + break;
  13684. +
  13685. + default:
  13686. + CONSTRUCTEX();
  13687. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  13688. + EXCEPTION->message = (void *)"";
  13689. + EXCEPTION->decisionNum = 7;
  13690. + EXCEPTION->state = 1;
  13691. +
  13692. +
  13693. + goto ruleintcritEx;
  13694. + }
  13695. +
  13696. + }
  13697. + break;
  13698. +
  13699. + default:
  13700. + CONSTRUCTEX();
  13701. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  13702. + EXCEPTION->message = (void *)"";
  13703. + EXCEPTION->decisionNum = 7;
  13704. + EXCEPTION->state = 0;
  13705. +
  13706. +
  13707. + goto ruleintcritEx;
  13708. + }
  13709. +
  13710. + switch (alt7)
  13711. + {
  13712. + case 1:
  13713. + // RSP.g:52:11: FIELD intop INT
  13714. + {
  13715. + FIELD23 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit219);
  13716. + if (HASEXCEPTION())
  13717. + {
  13718. + goto ruleintcritEx;
  13719. + }
  13720. +
  13721. + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD23, NULL);
  13722. +
  13723. + FOLLOWPUSH(FOLLOW_intop_in_intcrit221);
  13724. + intop24=intop(ctx);
  13725. +
  13726. + FOLLOWPOP();
  13727. + if (HASEXCEPTION())
  13728. + {
  13729. + goto ruleintcritEx;
  13730. + }
  13731. +
  13732. + CREATE_stream_intop; stream_intop->add(stream_intop, intop24.tree, NULL);
  13733. + INT25 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_intcrit223);
  13734. + if (HASEXCEPTION())
  13735. + {
  13736. + goto ruleintcritEx;
  13737. + }
  13738. +
  13739. + CREATE_stream_INT; stream_INT->add(stream_INT, INT25, NULL);
  13740. +
  13741. +
  13742. +
  13743. + /* AST REWRITE
  13744. + * elements : FIELD, INT, intop
  13745. + * token labels :
  13746. + * rule labels : retval
  13747. + * token list labels :
  13748. + * rule list labels :
  13749. + */
  13750. + {
  13751. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
  13752. +
  13753. + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
  13754. +
  13755. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13756. + retval.tree = root_0;
  13757. + // 52:29: -> ^( intop FIELD INT )
  13758. + {
  13759. + // RSP.g:52:32: ^( intop FIELD INT )
  13760. + {
  13761. + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13762. + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_intop == NULL ? NULL : stream_intop->nextNode(stream_intop), root_1));
  13763. +
  13764. + ADAPTOR->addChild(ADAPTOR, root_1, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
  13765. + ADAPTOR->addChild(ADAPTOR, root_1, stream_INT == NULL ? NULL : stream_INT->nextNode(stream_INT));
  13766. +
  13767. + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
  13768. + }
  13769. +
  13770. + }
  13771. +
  13772. + retval.tree = root_0; // set result root
  13773. + if (stream_retval != NULL) stream_retval->free(stream_retval);
  13774. +
  13775. +
  13776. + }
  13777. + }
  13778. + break;
  13779. + case 2:
  13780. + // RSP.g:53:4: FIELD NOT intop INT
  13781. + {
  13782. + FIELD26 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit240);
  13783. + if (HASEXCEPTION())
  13784. + {
  13785. + goto ruleintcritEx;
  13786. + }
  13787. +
  13788. + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD26, NULL);
  13789. +
  13790. + NOT27 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_intcrit242);
  13791. + if (HASEXCEPTION())
  13792. + {
  13793. + goto ruleintcritEx;
  13794. + }
  13795. +
  13796. + CREATE_stream_NOT; stream_NOT->add(stream_NOT, NOT27, NULL);
  13797. +
  13798. + FOLLOWPUSH(FOLLOW_intop_in_intcrit244);
  13799. + intop28=intop(ctx);
  13800. +
  13801. + FOLLOWPOP();
  13802. + if (HASEXCEPTION())
  13803. + {
  13804. + goto ruleintcritEx;
  13805. + }
  13806. +
  13807. + CREATE_stream_intop; stream_intop->add(stream_intop, intop28.tree, NULL);
  13808. + INT29 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_intcrit246);
  13809. + if (HASEXCEPTION())
  13810. + {
  13811. + goto ruleintcritEx;
  13812. + }
  13813. +
  13814. + CREATE_stream_INT; stream_INT->add(stream_INT, INT29, NULL);
  13815. +
  13816. +
  13817. +
  13818. + /* AST REWRITE
  13819. + * elements : intop, NOT, INT, FIELD
  13820. + * token labels :
  13821. + * rule labels : retval
  13822. + * token list labels :
  13823. + * rule list labels :
  13824. + */
  13825. + {
  13826. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
  13827. +
  13828. + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
  13829. +
  13830. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13831. + retval.tree = root_0;
  13832. + // 53:25: -> ^( NOT ^( intop FIELD INT ) )
  13833. + {
  13834. + // RSP.g:53:28: ^( NOT ^( intop FIELD INT ) )
  13835. + {
  13836. + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13837. + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_NOT == NULL ? NULL : stream_NOT->nextNode(stream_NOT), root_1));
  13838. +
  13839. + // RSP.g:53:34: ^( intop FIELD INT )
  13840. + {
  13841. + pANTLR3_BASE_TREE root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13842. + root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_intop == NULL ? NULL : stream_intop->nextNode(stream_intop), root_2));
  13843. +
  13844. + ADAPTOR->addChild(ADAPTOR, root_2, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
  13845. + ADAPTOR->addChild(ADAPTOR, root_2, stream_INT == NULL ? NULL : stream_INT->nextNode(stream_INT));
  13846. +
  13847. + ADAPTOR->addChild(ADAPTOR, root_1, root_2);
  13848. + }
  13849. +
  13850. + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
  13851. + }
  13852. +
  13853. + }
  13854. +
  13855. + retval.tree = root_0; // set result root
  13856. + if (stream_retval != NULL) stream_retval->free(stream_retval);
  13857. +
  13858. +
  13859. + }
  13860. + }
  13861. + break;
  13862. +
  13863. + }
  13864. + }
  13865. + }
  13866. +
  13867. +
  13868. + // This is where rules clean up and exit
  13869. + //
  13870. + goto ruleintcritEx; /* Prevent compiler warnings */
  13871. + ruleintcritEx: ;
  13872. + retval.stop = LT(-1);
  13873. +
  13874. + retval.stop = LT(-1);
  13875. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  13876. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  13877. + if (stream_FIELD != NULL) stream_FIELD->free(stream_FIELD);
  13878. + if (stream_INT != NULL) stream_INT->free(stream_INT);
  13879. + if (stream_NOT != NULL) stream_NOT->free(stream_NOT);
  13880. + if (stream_intop != NULL) stream_intop->free(stream_intop);
  13881. +
  13882. + if (HASEXCEPTION())
  13883. + {
  13884. + PREPORTERROR();
  13885. + PRECOVER();
  13886. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  13887. + }
  13888. +
  13889. +
  13890. + return retval;
  13891. +}
  13892. +/* $ANTLR end intcrit */
  13893. +
  13894. +/**
  13895. + * $ANTLR start intop
  13896. + * RSP.g:56:1: intop : (equal= EQUAL | less= LESS | greater= GREATER | lte= LTE | gte= GTE );
  13897. + */
  13898. +static RSPParser_intop_return
  13899. +intop(pRSPParser ctx)
  13900. +{
  13901. + RSPParser_intop_return retval;
  13902. +
  13903. + pANTLR3_BASE_TREE root_0;
  13904. +
  13905. + pANTLR3_COMMON_TOKEN equal;
  13906. + pANTLR3_COMMON_TOKEN less;
  13907. + pANTLR3_COMMON_TOKEN greater;
  13908. + pANTLR3_COMMON_TOKEN lte;
  13909. + pANTLR3_COMMON_TOKEN gte;
  13910. +
  13911. + pANTLR3_BASE_TREE equal_tree;
  13912. + pANTLR3_BASE_TREE less_tree;
  13913. + pANTLR3_BASE_TREE greater_tree;
  13914. + pANTLR3_BASE_TREE lte_tree;
  13915. + pANTLR3_BASE_TREE gte_tree;
  13916. +
  13917. + /* Initialize rule variables
  13918. + */
  13919. +
  13920. +
  13921. + root_0 = NULL;
  13922. +
  13923. + equal = NULL;
  13924. + less = NULL;
  13925. + greater = NULL;
  13926. + lte = NULL;
  13927. + gte = NULL;
  13928. + retval.start = LT(1); retval.stop = retval.start;
  13929. +
  13930. + equal_tree = NULL;
  13931. + less_tree = NULL;
  13932. + greater_tree = NULL;
  13933. + lte_tree = NULL;
  13934. + gte_tree = NULL;
  13935. +
  13936. +
  13937. + retval.tree = NULL;
  13938. + {
  13939. + {
  13940. + // RSP.g:56:7: (equal= EQUAL | less= LESS | greater= GREATER | lte= LTE | gte= GTE )
  13941. +
  13942. + ANTLR3_UINT32 alt8;
  13943. +
  13944. + alt8=5;
  13945. +
  13946. + switch ( LA(1) )
  13947. + {
  13948. + case EQUAL:
  13949. + {
  13950. + alt8=1;
  13951. + }
  13952. + break;
  13953. + case LESS:
  13954. + {
  13955. + alt8=2;
  13956. + }
  13957. + break;
  13958. + case GREATER:
  13959. + {
  13960. + alt8=3;
  13961. + }
  13962. + break;
  13963. + case LTE:
  13964. + {
  13965. + alt8=4;
  13966. + }
  13967. + break;
  13968. + case GTE:
  13969. + {
  13970. + alt8=5;
  13971. + }
  13972. + break;
  13973. +
  13974. + default:
  13975. + CONSTRUCTEX();
  13976. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  13977. + EXCEPTION->message = (void *)"";
  13978. + EXCEPTION->decisionNum = 8;
  13979. + EXCEPTION->state = 0;
  13980. +
  13981. +
  13982. + goto ruleintopEx;
  13983. + }
  13984. +
  13985. + switch (alt8)
  13986. + {
  13987. + case 1:
  13988. + // RSP.g:56:9: equal= EQUAL
  13989. + {
  13990. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  13991. +
  13992. + equal = (pANTLR3_COMMON_TOKEN) MATCHT(EQUAL, &FOLLOW_EQUAL_in_intop273);
  13993. + if (HASEXCEPTION())
  13994. + {
  13995. + goto ruleintopEx;
  13996. + }
  13997. +
  13998. + equal_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, equal));
  13999. + ADAPTOR->addChild(ADAPTOR, root_0, equal_tree);
  14000. +
  14001. +
  14002. + }
  14003. + break;
  14004. + case 2:
  14005. + // RSP.g:57:4: less= LESS
  14006. + {
  14007. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14008. +
  14009. + less = (pANTLR3_COMMON_TOKEN) MATCHT(LESS, &FOLLOW_LESS_in_intop280);
  14010. + if (HASEXCEPTION())
  14011. + {
  14012. + goto ruleintopEx;
  14013. + }
  14014. +
  14015. + less_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, less));
  14016. + ADAPTOR->addChild(ADAPTOR, root_0, less_tree);
  14017. +
  14018. +
  14019. + }
  14020. + break;
  14021. + case 3:
  14022. + // RSP.g:58:4: greater= GREATER
  14023. + {
  14024. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14025. +
  14026. + greater = (pANTLR3_COMMON_TOKEN) MATCHT(GREATER, &FOLLOW_GREATER_in_intop287);
  14027. + if (HASEXCEPTION())
  14028. + {
  14029. + goto ruleintopEx;
  14030. + }
  14031. +
  14032. + greater_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, greater));
  14033. + ADAPTOR->addChild(ADAPTOR, root_0, greater_tree);
  14034. +
  14035. +
  14036. + }
  14037. + break;
  14038. + case 4:
  14039. + // RSP.g:59:4: lte= LTE
  14040. + {
  14041. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14042. +
  14043. + lte = (pANTLR3_COMMON_TOKEN) MATCHT(LTE, &FOLLOW_LTE_in_intop294);
  14044. + if (HASEXCEPTION())
  14045. + {
  14046. + goto ruleintopEx;
  14047. + }
  14048. +
  14049. + lte_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, lte));
  14050. + ADAPTOR->addChild(ADAPTOR, root_0, lte_tree);
  14051. +
  14052. +
  14053. + }
  14054. + break;
  14055. + case 5:
  14056. + // RSP.g:60:4: gte= GTE
  14057. + {
  14058. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14059. +
  14060. + gte = (pANTLR3_COMMON_TOKEN) MATCHT(GTE, &FOLLOW_GTE_in_intop301);
  14061. + if (HASEXCEPTION())
  14062. + {
  14063. + goto ruleintopEx;
  14064. + }
  14065. +
  14066. + gte_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, gte));
  14067. + ADAPTOR->addChild(ADAPTOR, root_0, gte_tree);
  14068. +
  14069. +
  14070. + }
  14071. + break;
  14072. +
  14073. + }
  14074. + }
  14075. + }
  14076. +
  14077. +
  14078. + // This is where rules clean up and exit
  14079. + //
  14080. + goto ruleintopEx; /* Prevent compiler warnings */
  14081. + ruleintopEx: ;
  14082. + retval.stop = LT(-1);
  14083. +
  14084. + retval.stop = LT(-1);
  14085. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  14086. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  14087. +
  14088. + if (HASEXCEPTION())
  14089. + {
  14090. + PREPORTERROR();
  14091. + PRECOVER();
  14092. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  14093. + }
  14094. +
  14095. +
  14096. + return retval;
  14097. +}
  14098. +/* $ANTLR end intop */
  14099. +
  14100. +/**
  14101. + * $ANTLR start datecrit
  14102. + * RSP.g:63:1: datecrit : FIELD dateop datespec -> ^( dateop FIELD datespec ) ;
  14103. + */
  14104. +static RSPParser_datecrit_return
  14105. +datecrit(pRSPParser ctx)
  14106. +{
  14107. + RSPParser_datecrit_return retval;
  14108. +
  14109. + pANTLR3_BASE_TREE root_0;
  14110. +
  14111. + pANTLR3_COMMON_TOKEN FIELD30;
  14112. + RSPParser_dateop_return dateop31;
  14113. + #undef RETURN_TYPE_dateop31
  14114. + #define RETURN_TYPE_dateop31 RSPParser_dateop_return
  14115. +
  14116. + RSPParser_datespec_return datespec32;
  14117. + #undef RETURN_TYPE_datespec32
  14118. + #define RETURN_TYPE_datespec32 RSPParser_datespec_return
  14119. +
  14120. + pANTLR3_BASE_TREE FIELD30_tree;
  14121. + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_FIELD;
  14122. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_datespec;
  14123. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateop;
  14124. + /* Initialize rule variables
  14125. + */
  14126. +
  14127. +
  14128. + root_0 = NULL;
  14129. +
  14130. + FIELD30 = NULL;
  14131. + dateop31.tree = NULL;
  14132. +
  14133. + datespec32.tree = NULL;
  14134. +
  14135. + retval.start = LT(1); retval.stop = retval.start;
  14136. +
  14137. + FIELD30_tree = NULL;
  14138. +
  14139. + stream_FIELD = NULL;
  14140. + #define CREATE_stream_FIELD if (stream_FIELD == NULL) {stream_FIELD = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token FIELD"); }
  14141. + stream_datespec = NULL;
  14142. + #define CREATE_stream_datespec if (stream_datespec == NULL) {stream_datespec = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule datespec"); }
  14143. + stream_dateop = NULL;
  14144. + #define CREATE_stream_dateop if (stream_dateop == NULL) {stream_dateop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateop"); }
  14145. +
  14146. + retval.tree = NULL;
  14147. + {
  14148. + // RSP.g:63:9: ( FIELD dateop datespec -> ^( dateop FIELD datespec ) )
  14149. + // RSP.g:63:11: FIELD dateop datespec
  14150. + {
  14151. + FIELD30 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_datecrit310);
  14152. + if (HASEXCEPTION())
  14153. + {
  14154. + goto ruledatecritEx;
  14155. + }
  14156. +
  14157. + CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD30, NULL);
  14158. +
  14159. + FOLLOWPUSH(FOLLOW_dateop_in_datecrit312);
  14160. + dateop31=dateop(ctx);
  14161. +
  14162. + FOLLOWPOP();
  14163. + if (HASEXCEPTION())
  14164. + {
  14165. + goto ruledatecritEx;
  14166. + }
  14167. +
  14168. + CREATE_stream_dateop; stream_dateop->add(stream_dateop, dateop31.tree, NULL);
  14169. + FOLLOWPUSH(FOLLOW_datespec_in_datecrit314);
  14170. + datespec32=datespec(ctx);
  14171. +
  14172. + FOLLOWPOP();
  14173. + if (HASEXCEPTION())
  14174. + {
  14175. + goto ruledatecritEx;
  14176. + }
  14177. +
  14178. + CREATE_stream_datespec; stream_datespec->add(stream_datespec, datespec32.tree, NULL);
  14179. +
  14180. +
  14181. + /* AST REWRITE
  14182. + * elements : FIELD, dateop, datespec
  14183. + * token labels :
  14184. + * rule labels : retval
  14185. + * token list labels :
  14186. + * rule list labels :
  14187. + */
  14188. + {
  14189. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
  14190. +
  14191. + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
  14192. +
  14193. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14194. + retval.tree = root_0;
  14195. + // 63:34: -> ^( dateop FIELD datespec )
  14196. + {
  14197. + // RSP.g:63:37: ^( dateop FIELD datespec )
  14198. + {
  14199. + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14200. + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_dateop == NULL ? NULL : stream_dateop->nextNode(stream_dateop), root_1));
  14201. +
  14202. + ADAPTOR->addChild(ADAPTOR, root_1, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD));
  14203. + ADAPTOR->addChild(ADAPTOR, root_1, stream_datespec == NULL ? NULL : stream_datespec->nextTree(stream_datespec));
  14204. +
  14205. + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
  14206. + }
  14207. +
  14208. + }
  14209. +
  14210. + retval.tree = root_0; // set result root
  14211. + if (stream_retval != NULL) stream_retval->free(stream_retval);
  14212. +
  14213. +
  14214. + }
  14215. + }
  14216. +
  14217. + }
  14218. +
  14219. +
  14220. + // This is where rules clean up and exit
  14221. + //
  14222. + goto ruledatecritEx; /* Prevent compiler warnings */
  14223. + ruledatecritEx: ;
  14224. + retval.stop = LT(-1);
  14225. +
  14226. + retval.stop = LT(-1);
  14227. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  14228. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  14229. + if (stream_FIELD != NULL) stream_FIELD->free(stream_FIELD);
  14230. + if (stream_datespec != NULL) stream_datespec->free(stream_datespec);
  14231. + if (stream_dateop != NULL) stream_dateop->free(stream_dateop);
  14232. +
  14233. + if (HASEXCEPTION())
  14234. + {
  14235. + PREPORTERROR();
  14236. + PRECOVER();
  14237. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  14238. + }
  14239. +
  14240. +
  14241. + return retval;
  14242. +}
  14243. +/* $ANTLR end datecrit */
  14244. +
  14245. +/**
  14246. + * $ANTLR start dateop
  14247. + * RSP.g:66:1: dateop : (before= BEFORE | after= AFTER );
  14248. + */
  14249. +static RSPParser_dateop_return
  14250. +dateop(pRSPParser ctx)
  14251. +{
  14252. + RSPParser_dateop_return retval;
  14253. +
  14254. + pANTLR3_BASE_TREE root_0;
  14255. +
  14256. + pANTLR3_COMMON_TOKEN before;
  14257. + pANTLR3_COMMON_TOKEN after;
  14258. +
  14259. + pANTLR3_BASE_TREE before_tree;
  14260. + pANTLR3_BASE_TREE after_tree;
  14261. +
  14262. + /* Initialize rule variables
  14263. + */
  14264. +
  14265. +
  14266. + root_0 = NULL;
  14267. +
  14268. + before = NULL;
  14269. + after = NULL;
  14270. + retval.start = LT(1); retval.stop = retval.start;
  14271. +
  14272. + before_tree = NULL;
  14273. + after_tree = NULL;
  14274. +
  14275. +
  14276. + retval.tree = NULL;
  14277. + {
  14278. + {
  14279. + // RSP.g:66:8: (before= BEFORE | after= AFTER )
  14280. +
  14281. + ANTLR3_UINT32 alt9;
  14282. +
  14283. + alt9=2;
  14284. +
  14285. + switch ( LA(1) )
  14286. + {
  14287. + case BEFORE:
  14288. + {
  14289. + alt9=1;
  14290. + }
  14291. + break;
  14292. + case AFTER:
  14293. + {
  14294. + alt9=2;
  14295. + }
  14296. + break;
  14297. +
  14298. + default:
  14299. + CONSTRUCTEX();
  14300. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  14301. + EXCEPTION->message = (void *)"";
  14302. + EXCEPTION->decisionNum = 9;
  14303. + EXCEPTION->state = 0;
  14304. +
  14305. +
  14306. + goto ruledateopEx;
  14307. + }
  14308. +
  14309. + switch (alt9)
  14310. + {
  14311. + case 1:
  14312. + // RSP.g:66:10: before= BEFORE
  14313. + {
  14314. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14315. +
  14316. + before = (pANTLR3_COMMON_TOKEN) MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateop337);
  14317. + if (HASEXCEPTION())
  14318. + {
  14319. + goto ruledateopEx;
  14320. + }
  14321. +
  14322. + before_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, before));
  14323. + ADAPTOR->addChild(ADAPTOR, root_0, before_tree);
  14324. +
  14325. +
  14326. + }
  14327. + break;
  14328. + case 2:
  14329. + // RSP.g:67:4: after= AFTER
  14330. + {
  14331. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14332. +
  14333. + after = (pANTLR3_COMMON_TOKEN) MATCHT(AFTER, &FOLLOW_AFTER_in_dateop344);
  14334. + if (HASEXCEPTION())
  14335. + {
  14336. + goto ruledateopEx;
  14337. + }
  14338. +
  14339. + after_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, after));
  14340. + ADAPTOR->addChild(ADAPTOR, root_0, after_tree);
  14341. +
  14342. +
  14343. + }
  14344. + break;
  14345. +
  14346. + }
  14347. + }
  14348. + }
  14349. +
  14350. +
  14351. + // This is where rules clean up and exit
  14352. + //
  14353. + goto ruledateopEx; /* Prevent compiler warnings */
  14354. + ruledateopEx: ;
  14355. + retval.stop = LT(-1);
  14356. +
  14357. + retval.stop = LT(-1);
  14358. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  14359. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  14360. +
  14361. + if (HASEXCEPTION())
  14362. + {
  14363. + PREPORTERROR();
  14364. + PRECOVER();
  14365. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  14366. + }
  14367. +
  14368. +
  14369. + return retval;
  14370. +}
  14371. +/* $ANTLR end dateop */
  14372. +
  14373. +/**
  14374. + * $ANTLR start datespec
  14375. + * RSP.g:70:1: datespec : ( dateref | INT dateintval dateop dateref -> ^( dateop dateref INT dateintval ) );
  14376. + */
  14377. +static RSPParser_datespec_return
  14378. +datespec(pRSPParser ctx)
  14379. +{
  14380. + RSPParser_datespec_return retval;
  14381. +
  14382. + pANTLR3_BASE_TREE root_0;
  14383. +
  14384. + pANTLR3_COMMON_TOKEN INT34;
  14385. + RSPParser_dateref_return dateref33;
  14386. + #undef RETURN_TYPE_dateref33
  14387. + #define RETURN_TYPE_dateref33 RSPParser_dateref_return
  14388. +
  14389. + RSPParser_dateintval_return dateintval35;
  14390. + #undef RETURN_TYPE_dateintval35
  14391. + #define RETURN_TYPE_dateintval35 RSPParser_dateintval_return
  14392. +
  14393. + RSPParser_dateop_return dateop36;
  14394. + #undef RETURN_TYPE_dateop36
  14395. + #define RETURN_TYPE_dateop36 RSPParser_dateop_return
  14396. +
  14397. + RSPParser_dateref_return dateref37;
  14398. + #undef RETURN_TYPE_dateref37
  14399. + #define RETURN_TYPE_dateref37 RSPParser_dateref_return
  14400. +
  14401. + pANTLR3_BASE_TREE INT34_tree;
  14402. + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_INT;
  14403. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateintval;
  14404. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateref;
  14405. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateop;
  14406. + /* Initialize rule variables
  14407. + */
  14408. +
  14409. +
  14410. + root_0 = NULL;
  14411. +
  14412. + INT34 = NULL;
  14413. + dateref33.tree = NULL;
  14414. +
  14415. + dateintval35.tree = NULL;
  14416. +
  14417. + dateop36.tree = NULL;
  14418. +
  14419. + dateref37.tree = NULL;
  14420. +
  14421. + retval.start = LT(1); retval.stop = retval.start;
  14422. +
  14423. + INT34_tree = NULL;
  14424. +
  14425. + stream_INT = NULL;
  14426. + #define CREATE_stream_INT if (stream_INT == NULL) {stream_INT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token INT"); }
  14427. + stream_dateintval = NULL;
  14428. + #define CREATE_stream_dateintval if (stream_dateintval == NULL) {stream_dateintval = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateintval"); }
  14429. + stream_dateref = NULL;
  14430. + #define CREATE_stream_dateref if (stream_dateref == NULL) {stream_dateref = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateref"); }
  14431. + stream_dateop = NULL;
  14432. + #define CREATE_stream_dateop if (stream_dateop == NULL) {stream_dateop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateop"); }
  14433. +
  14434. + retval.tree = NULL;
  14435. + {
  14436. + {
  14437. + // RSP.g:70:9: ( dateref | INT dateintval dateop dateref -> ^( dateop dateref INT dateintval ) )
  14438. +
  14439. + ANTLR3_UINT32 alt10;
  14440. +
  14441. + alt10=2;
  14442. +
  14443. + switch ( LA(1) )
  14444. + {
  14445. + case DATE:
  14446. + case TODAY:
  14447. + {
  14448. + alt10=1;
  14449. + }
  14450. + break;
  14451. + case INT:
  14452. + {
  14453. + alt10=2;
  14454. + }
  14455. + break;
  14456. +
  14457. + default:
  14458. + CONSTRUCTEX();
  14459. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  14460. + EXCEPTION->message = (void *)"";
  14461. + EXCEPTION->decisionNum = 10;
  14462. + EXCEPTION->state = 0;
  14463. +
  14464. +
  14465. + goto ruledatespecEx;
  14466. + }
  14467. +
  14468. + switch (alt10)
  14469. + {
  14470. + case 1:
  14471. + // RSP.g:70:11: dateref
  14472. + {
  14473. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14474. +
  14475. + FOLLOWPUSH(FOLLOW_dateref_in_datespec353);
  14476. + dateref33=dateref(ctx);
  14477. +
  14478. + FOLLOWPOP();
  14479. + if (HASEXCEPTION())
  14480. + {
  14481. + goto ruledatespecEx;
  14482. + }
  14483. +
  14484. + ADAPTOR->addChild(ADAPTOR, root_0, dateref33.tree);
  14485. +
  14486. + }
  14487. + break;
  14488. + case 2:
  14489. + // RSP.g:71:4: INT dateintval dateop dateref
  14490. + {
  14491. + INT34 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_datespec358);
  14492. + if (HASEXCEPTION())
  14493. + {
  14494. + goto ruledatespecEx;
  14495. + }
  14496. +
  14497. + CREATE_stream_INT; stream_INT->add(stream_INT, INT34, NULL);
  14498. +
  14499. + FOLLOWPUSH(FOLLOW_dateintval_in_datespec360);
  14500. + dateintval35=dateintval(ctx);
  14501. +
  14502. + FOLLOWPOP();
  14503. + if (HASEXCEPTION())
  14504. + {
  14505. + goto ruledatespecEx;
  14506. + }
  14507. +
  14508. + CREATE_stream_dateintval; stream_dateintval->add(stream_dateintval, dateintval35.tree, NULL);
  14509. + FOLLOWPUSH(FOLLOW_dateop_in_datespec362);
  14510. + dateop36=dateop(ctx);
  14511. +
  14512. + FOLLOWPOP();
  14513. + if (HASEXCEPTION())
  14514. + {
  14515. + goto ruledatespecEx;
  14516. + }
  14517. +
  14518. + CREATE_stream_dateop; stream_dateop->add(stream_dateop, dateop36.tree, NULL);
  14519. + FOLLOWPUSH(FOLLOW_dateref_in_datespec364);
  14520. + dateref37=dateref(ctx);
  14521. +
  14522. + FOLLOWPOP();
  14523. + if (HASEXCEPTION())
  14524. + {
  14525. + goto ruledatespecEx;
  14526. + }
  14527. +
  14528. + CREATE_stream_dateref; stream_dateref->add(stream_dateref, dateref37.tree, NULL);
  14529. +
  14530. +
  14531. + /* AST REWRITE
  14532. + * elements : dateop, INT, dateintval, dateref
  14533. + * token labels :
  14534. + * rule labels : retval
  14535. + * token list labels :
  14536. + * rule list labels :
  14537. + */
  14538. + {
  14539. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
  14540. +
  14541. + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
  14542. +
  14543. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14544. + retval.tree = root_0;
  14545. + // 71:34: -> ^( dateop dateref INT dateintval )
  14546. + {
  14547. + // RSP.g:71:37: ^( dateop dateref INT dateintval )
  14548. + {
  14549. + pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14550. + root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_dateop == NULL ? NULL : stream_dateop->nextNode(stream_dateop), root_1));
  14551. +
  14552. + ADAPTOR->addChild(ADAPTOR, root_1, stream_dateref == NULL ? NULL : stream_dateref->nextTree(stream_dateref));
  14553. + ADAPTOR->addChild(ADAPTOR, root_1, stream_INT == NULL ? NULL : stream_INT->nextNode(stream_INT));
  14554. + ADAPTOR->addChild(ADAPTOR, root_1, stream_dateintval == NULL ? NULL : stream_dateintval->nextTree(stream_dateintval));
  14555. +
  14556. + ADAPTOR->addChild(ADAPTOR, root_0, root_1);
  14557. + }
  14558. +
  14559. + }
  14560. +
  14561. + retval.tree = root_0; // set result root
  14562. + if (stream_retval != NULL) stream_retval->free(stream_retval);
  14563. +
  14564. +
  14565. + }
  14566. + }
  14567. + break;
  14568. +
  14569. + }
  14570. + }
  14571. + }
  14572. +
  14573. +
  14574. + // This is where rules clean up and exit
  14575. + //
  14576. + goto ruledatespecEx; /* Prevent compiler warnings */
  14577. + ruledatespecEx: ;
  14578. + retval.stop = LT(-1);
  14579. +
  14580. + retval.stop = LT(-1);
  14581. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  14582. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  14583. + if (stream_INT != NULL) stream_INT->free(stream_INT);
  14584. + if (stream_dateintval != NULL) stream_dateintval->free(stream_dateintval);
  14585. + if (stream_dateref != NULL) stream_dateref->free(stream_dateref);
  14586. + if (stream_dateop != NULL) stream_dateop->free(stream_dateop);
  14587. +
  14588. + if (HASEXCEPTION())
  14589. + {
  14590. + PREPORTERROR();
  14591. + PRECOVER();
  14592. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  14593. + }
  14594. +
  14595. +
  14596. + return retval;
  14597. +}
  14598. +/* $ANTLR end datespec */
  14599. +
  14600. +/**
  14601. + * $ANTLR start dateref
  14602. + * RSP.g:74:1: dateref : (date= DATE | today= TODAY );
  14603. + */
  14604. +static RSPParser_dateref_return
  14605. +dateref(pRSPParser ctx)
  14606. +{
  14607. + RSPParser_dateref_return retval;
  14608. +
  14609. + pANTLR3_BASE_TREE root_0;
  14610. +
  14611. + pANTLR3_COMMON_TOKEN date;
  14612. + pANTLR3_COMMON_TOKEN today;
  14613. +
  14614. + pANTLR3_BASE_TREE date_tree;
  14615. + pANTLR3_BASE_TREE today_tree;
  14616. +
  14617. + /* Initialize rule variables
  14618. + */
  14619. +
  14620. +
  14621. + root_0 = NULL;
  14622. +
  14623. + date = NULL;
  14624. + today = NULL;
  14625. + retval.start = LT(1); retval.stop = retval.start;
  14626. +
  14627. + date_tree = NULL;
  14628. + today_tree = NULL;
  14629. +
  14630. +
  14631. + retval.tree = NULL;
  14632. + {
  14633. + {
  14634. + // RSP.g:74:9: (date= DATE | today= TODAY )
  14635. +
  14636. + ANTLR3_UINT32 alt11;
  14637. +
  14638. + alt11=2;
  14639. +
  14640. + switch ( LA(1) )
  14641. + {
  14642. + case DATE:
  14643. + {
  14644. + alt11=1;
  14645. + }
  14646. + break;
  14647. + case TODAY:
  14648. + {
  14649. + alt11=2;
  14650. + }
  14651. + break;
  14652. +
  14653. + default:
  14654. + CONSTRUCTEX();
  14655. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  14656. + EXCEPTION->message = (void *)"";
  14657. + EXCEPTION->decisionNum = 11;
  14658. + EXCEPTION->state = 0;
  14659. +
  14660. +
  14661. + goto ruledaterefEx;
  14662. + }
  14663. +
  14664. + switch (alt11)
  14665. + {
  14666. + case 1:
  14667. + // RSP.g:74:11: date= DATE
  14668. + {
  14669. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14670. +
  14671. + date = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateref388);
  14672. + if (HASEXCEPTION())
  14673. + {
  14674. + goto ruledaterefEx;
  14675. + }
  14676. +
  14677. + date_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, date));
  14678. + ADAPTOR->addChild(ADAPTOR, root_0, date_tree);
  14679. +
  14680. +
  14681. + }
  14682. + break;
  14683. + case 2:
  14684. + // RSP.g:75:4: today= TODAY
  14685. + {
  14686. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14687. +
  14688. + today = (pANTLR3_COMMON_TOKEN) MATCHT(TODAY, &FOLLOW_TODAY_in_dateref395);
  14689. + if (HASEXCEPTION())
  14690. + {
  14691. + goto ruledaterefEx;
  14692. + }
  14693. +
  14694. + today_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, today));
  14695. + ADAPTOR->addChild(ADAPTOR, root_0, today_tree);
  14696. +
  14697. +
  14698. + }
  14699. + break;
  14700. +
  14701. + }
  14702. + }
  14703. + }
  14704. +
  14705. +
  14706. + // This is where rules clean up and exit
  14707. + //
  14708. + goto ruledaterefEx; /* Prevent compiler warnings */
  14709. + ruledaterefEx: ;
  14710. + retval.stop = LT(-1);
  14711. +
  14712. + retval.stop = LT(-1);
  14713. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  14714. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  14715. +
  14716. + if (HASEXCEPTION())
  14717. + {
  14718. + PREPORTERROR();
  14719. + PRECOVER();
  14720. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  14721. + }
  14722. +
  14723. +
  14724. + return retval;
  14725. +}
  14726. +/* $ANTLR end dateref */
  14727. +
  14728. +/**
  14729. + * $ANTLR start dateintval
  14730. + * RSP.g:78:1: dateintval : (day= DAY | week= WEEK | month= MONTH | year= YEAR );
  14731. + */
  14732. +static RSPParser_dateintval_return
  14733. +dateintval(pRSPParser ctx)
  14734. +{
  14735. + RSPParser_dateintval_return retval;
  14736. +
  14737. + pANTLR3_BASE_TREE root_0;
  14738. +
  14739. + pANTLR3_COMMON_TOKEN day;
  14740. + pANTLR3_COMMON_TOKEN week;
  14741. + pANTLR3_COMMON_TOKEN month;
  14742. + pANTLR3_COMMON_TOKEN year;
  14743. +
  14744. + pANTLR3_BASE_TREE day_tree;
  14745. + pANTLR3_BASE_TREE week_tree;
  14746. + pANTLR3_BASE_TREE month_tree;
  14747. + pANTLR3_BASE_TREE year_tree;
  14748. +
  14749. + /* Initialize rule variables
  14750. + */
  14751. +
  14752. +
  14753. + root_0 = NULL;
  14754. +
  14755. + day = NULL;
  14756. + week = NULL;
  14757. + month = NULL;
  14758. + year = NULL;
  14759. + retval.start = LT(1); retval.stop = retval.start;
  14760. +
  14761. + day_tree = NULL;
  14762. + week_tree = NULL;
  14763. + month_tree = NULL;
  14764. + year_tree = NULL;
  14765. +
  14766. +
  14767. + retval.tree = NULL;
  14768. + {
  14769. + {
  14770. + // RSP.g:79:2: (day= DAY | week= WEEK | month= MONTH | year= YEAR )
  14771. +
  14772. + ANTLR3_UINT32 alt12;
  14773. +
  14774. + alt12=4;
  14775. +
  14776. + switch ( LA(1) )
  14777. + {
  14778. + case DAY:
  14779. + {
  14780. + alt12=1;
  14781. + }
  14782. + break;
  14783. + case WEEK:
  14784. + {
  14785. + alt12=2;
  14786. + }
  14787. + break;
  14788. + case MONTH:
  14789. + {
  14790. + alt12=3;
  14791. + }
  14792. + break;
  14793. + case YEAR:
  14794. + {
  14795. + alt12=4;
  14796. + }
  14797. + break;
  14798. +
  14799. + default:
  14800. + CONSTRUCTEX();
  14801. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  14802. + EXCEPTION->message = (void *)"";
  14803. + EXCEPTION->decisionNum = 12;
  14804. + EXCEPTION->state = 0;
  14805. +
  14806. +
  14807. + goto ruledateintvalEx;
  14808. + }
  14809. +
  14810. + switch (alt12)
  14811. + {
  14812. + case 1:
  14813. + // RSP.g:79:4: day= DAY
  14814. + {
  14815. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14816. +
  14817. + day = (pANTLR3_COMMON_TOKEN) MATCHT(DAY, &FOLLOW_DAY_in_dateintval408);
  14818. + if (HASEXCEPTION())
  14819. + {
  14820. + goto ruledateintvalEx;
  14821. + }
  14822. +
  14823. + day_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, day));
  14824. + ADAPTOR->addChild(ADAPTOR, root_0, day_tree);
  14825. +
  14826. +
  14827. + }
  14828. + break;
  14829. + case 2:
  14830. + // RSP.g:80:4: week= WEEK
  14831. + {
  14832. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14833. +
  14834. + week = (pANTLR3_COMMON_TOKEN) MATCHT(WEEK, &FOLLOW_WEEK_in_dateintval415);
  14835. + if (HASEXCEPTION())
  14836. + {
  14837. + goto ruledateintvalEx;
  14838. + }
  14839. +
  14840. + week_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, week));
  14841. + ADAPTOR->addChild(ADAPTOR, root_0, week_tree);
  14842. +
  14843. +
  14844. + }
  14845. + break;
  14846. + case 3:
  14847. + // RSP.g:81:4: month= MONTH
  14848. + {
  14849. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14850. +
  14851. + month = (pANTLR3_COMMON_TOKEN) MATCHT(MONTH, &FOLLOW_MONTH_in_dateintval422);
  14852. + if (HASEXCEPTION())
  14853. + {
  14854. + goto ruledateintvalEx;
  14855. + }
  14856. +
  14857. + month_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, month));
  14858. + ADAPTOR->addChild(ADAPTOR, root_0, month_tree);
  14859. +
  14860. +
  14861. + }
  14862. + break;
  14863. + case 4:
  14864. + // RSP.g:82:4: year= YEAR
  14865. + {
  14866. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  14867. +
  14868. + year = (pANTLR3_COMMON_TOKEN) MATCHT(YEAR, &FOLLOW_YEAR_in_dateintval429);
  14869. + if (HASEXCEPTION())
  14870. + {
  14871. + goto ruledateintvalEx;
  14872. + }
  14873. +
  14874. + year_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, year));
  14875. + ADAPTOR->addChild(ADAPTOR, root_0, year_tree);
  14876. +
  14877. +
  14878. + }
  14879. + break;
  14880. +
  14881. + }
  14882. + }
  14883. + }
  14884. +
  14885. +
  14886. + // This is where rules clean up and exit
  14887. + //
  14888. + goto ruledateintvalEx; /* Prevent compiler warnings */
  14889. + ruledateintvalEx: ;
  14890. + retval.stop = LT(-1);
  14891. +
  14892. + retval.stop = LT(-1);
  14893. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  14894. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  14895. +
  14896. + if (HASEXCEPTION())
  14897. + {
  14898. + PREPORTERROR();
  14899. + PRECOVER();
  14900. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  14901. + }
  14902. +
  14903. +
  14904. + return retval;
  14905. +}
  14906. +/* $ANTLR end dateintval */
  14907. +/* End of parsing rules
  14908. + * ==============================================
  14909. + */
  14910. +
  14911. +/* ==============================================
  14912. + * Syntactic predicates
  14913. + */
  14914. +/* End of syntactic predicates
  14915. + * ==============================================
  14916. + */
  14917. +
  14918. +
  14919. +
  14920. +
  14921. +
  14922. +
  14923. +/* End of code
  14924. + * =============================================================================
  14925. + */
  14926. diff --git a/src/pregen/RSPParser.h b/src/pregen/RSPParser.h
  14927. new file mode 100644
  14928. index 0000000..1796c0a
  14929. --- /dev/null
  14930. +++ b/src/pregen/RSPParser.h
  14931. @@ -0,0 +1,365 @@
  14932. +/** \file
  14933. + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
  14934. + *
  14935. + * - From the grammar source file : RSP.g
  14936. + * - On : 2016-01-01 12:23:42
  14937. + * - for the parser : RSPParserParser *
  14938. + * Editing it, at least manually, is not wise.
  14939. + *
  14940. + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
  14941. + *
  14942. + *
  14943. + * The parser RSPParser has the callable functions (rules) shown below,
  14944. + * which will invoke the code for the associated rule in the source grammar
  14945. + * assuming that the input stream is pointing to a token/text stream that could begin
  14946. + * this rule.
  14947. + *
  14948. + * For instance if you call the first (topmost) rule in a parser grammar, you will
  14949. + * get the results of a full parse, but calling a rule half way through the grammar will
  14950. + * allow you to pass part of a full token stream to the parser, such as for syntax checking
  14951. + * in editors and so on.
  14952. + *
  14953. + * The parser entry points are called indirectly (by function pointer to function) via
  14954. + * a parser context typedef pRSPParser, which is returned from a call to RSPParserNew().
  14955. + *
  14956. + * The methods in pRSPParser are as follows:
  14957. + *
  14958. + * - RSPParser_query_return pRSPParser->query(pRSPParser)
  14959. + * - RSPParser_expr_return pRSPParser->expr(pRSPParser)
  14960. + * - RSPParser_aexpr_return pRSPParser->aexpr(pRSPParser)
  14961. + * - RSPParser_crit_return pRSPParser->crit(pRSPParser)
  14962. + * - RSPParser_strcrit_return pRSPParser->strcrit(pRSPParser)
  14963. + * - RSPParser_strop_return pRSPParser->strop(pRSPParser)
  14964. + * - RSPParser_intcrit_return pRSPParser->intcrit(pRSPParser)
  14965. + * - RSPParser_intop_return pRSPParser->intop(pRSPParser)
  14966. + * - RSPParser_datecrit_return pRSPParser->datecrit(pRSPParser)
  14967. + * - RSPParser_dateop_return pRSPParser->dateop(pRSPParser)
  14968. + * - RSPParser_datespec_return pRSPParser->datespec(pRSPParser)
  14969. + * - RSPParser_dateref_return pRSPParser->dateref(pRSPParser)
  14970. + * - RSPParser_dateintval_return pRSPParser->dateintval(pRSPParser)
  14971. + *
  14972. + * The return type for any particular rule is of course determined by the source
  14973. + * grammar file.
  14974. + */
  14975. +// [The "BSD licence"]
  14976. +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
  14977. +// http://www.temporal-wave.com
  14978. +// http://www.linkedin.com/in/jimidle
  14979. +//
  14980. +// All rights reserved.
  14981. +//
  14982. +// Redistribution and use in source and binary forms, with or without
  14983. +// modification, are permitted provided that the following conditions
  14984. +// are met:
  14985. +// 1. Redistributions of source code must retain the above copyright
  14986. +// notice, this list of conditions and the following disclaimer.
  14987. +// 2. Redistributions in binary form must reproduce the above copyright
  14988. +// notice, this list of conditions and the following disclaimer in the
  14989. +// documentation and/or other materials provided with the distribution.
  14990. +// 3. The name of the author may not be used to endorse or promote products
  14991. +// derived from this software without specific prior written permission.
  14992. +//
  14993. +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  14994. +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  14995. +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14996. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  14997. +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  14998. +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  14999. +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  15000. +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  15001. +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  15002. +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  15003. +
  15004. +#ifndef _RSPParser_H
  15005. +#define _RSPParser_H
  15006. +/* =============================================================================
  15007. + * Standard antlr3 C runtime definitions
  15008. + */
  15009. +#include <antlr3.h>
  15010. +
  15011. +/* End of standard antlr 3 runtime definitions
  15012. + * =============================================================================
  15013. + */
  15014. +
  15015. +#ifdef __cplusplus
  15016. +extern "C" {
  15017. +#endif
  15018. +
  15019. +// Forward declare the context typedef so that we can use it before it is
  15020. +// properly defined. Delegators and delegates (from import statements) are
  15021. +// interdependent and their context structures contain pointers to each other
  15022. +// C only allows such things to be declared if you pre-declare the typedef.
  15023. +//
  15024. +typedef struct RSPParser_Ctx_struct RSPParser, * pRSPParser;
  15025. +
  15026. +
  15027. +
  15028. +#ifdef ANTLR3_WINDOWS
  15029. +// Disable: Unreferenced parameter, - Rules with parameters that are not used
  15030. +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
  15031. +// initialized but unused variable - tree rewrite variables declared but not needed
  15032. +// Unreferenced local variable - lexer rule declares but does not always use _type
  15033. +// potentially unitialized variable used - retval always returned from a rule
  15034. +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
  15035. +//
  15036. +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
  15037. +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
  15038. +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
  15039. +// this is a matter of orthogonality hence I disable that one.
  15040. +//
  15041. +#pragma warning( disable : 4100 )
  15042. +#pragma warning( disable : 4101 )
  15043. +#pragma warning( disable : 4127 )
  15044. +#pragma warning( disable : 4189 )
  15045. +#pragma warning( disable : 4505 )
  15046. +#pragma warning( disable : 4701 )
  15047. +#endif
  15048. +typedef struct RSPParser_query_return_struct
  15049. +{
  15050. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  15051. + */
  15052. + pANTLR3_COMMON_TOKEN start;
  15053. + pANTLR3_COMMON_TOKEN stop;
  15054. + pANTLR3_BASE_TREE tree;
  15055. +
  15056. +}
  15057. + RSPParser_query_return;
  15058. +
  15059. +typedef struct RSPParser_expr_return_struct
  15060. +{
  15061. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  15062. + */
  15063. + pANTLR3_COMMON_TOKEN start;
  15064. + pANTLR3_COMMON_TOKEN stop;
  15065. + pANTLR3_BASE_TREE tree;
  15066. +
  15067. +}
  15068. + RSPParser_expr_return;
  15069. +
  15070. +typedef struct RSPParser_aexpr_return_struct
  15071. +{
  15072. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  15073. + */
  15074. + pANTLR3_COMMON_TOKEN start;
  15075. + pANTLR3_COMMON_TOKEN stop;
  15076. + pANTLR3_BASE_TREE tree;
  15077. +
  15078. +}
  15079. + RSPParser_aexpr_return;
  15080. +
  15081. +typedef struct RSPParser_crit_return_struct
  15082. +{
  15083. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  15084. + */
  15085. + pANTLR3_COMMON_TOKEN start;
  15086. + pANTLR3_COMMON_TOKEN stop;
  15087. + pANTLR3_BASE_TREE tree;
  15088. +
  15089. +}
  15090. + RSPParser_crit_return;
  15091. +
  15092. +typedef struct RSPParser_strcrit_return_struct
  15093. +{
  15094. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  15095. + */
  15096. + pANTLR3_COMMON_TOKEN start;
  15097. + pANTLR3_COMMON_TOKEN stop;
  15098. + pANTLR3_BASE_TREE tree;
  15099. +
  15100. +}
  15101. + RSPParser_strcrit_return;
  15102. +
  15103. +typedef struct RSPParser_strop_return_struct
  15104. +{
  15105. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  15106. + */
  15107. + pANTLR3_COMMON_TOKEN start;
  15108. + pANTLR3_COMMON_TOKEN stop;
  15109. + pANTLR3_BASE_TREE tree;
  15110. +
  15111. +}
  15112. + RSPParser_strop_return;
  15113. +
  15114. +typedef struct RSPParser_intcrit_return_struct
  15115. +{
  15116. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  15117. + */
  15118. + pANTLR3_COMMON_TOKEN start;
  15119. + pANTLR3_COMMON_TOKEN stop;
  15120. + pANTLR3_BASE_TREE tree;
  15121. +
  15122. +}
  15123. + RSPParser_intcrit_return;
  15124. +
  15125. +typedef struct RSPParser_intop_return_struct
  15126. +{
  15127. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  15128. + */
  15129. + pANTLR3_COMMON_TOKEN start;
  15130. + pANTLR3_COMMON_TOKEN stop;
  15131. + pANTLR3_BASE_TREE tree;
  15132. +
  15133. +}
  15134. + RSPParser_intop_return;
  15135. +
  15136. +typedef struct RSPParser_datecrit_return_struct
  15137. +{
  15138. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  15139. + */
  15140. + pANTLR3_COMMON_TOKEN start;
  15141. + pANTLR3_COMMON_TOKEN stop;
  15142. + pANTLR3_BASE_TREE tree;
  15143. +
  15144. +}
  15145. + RSPParser_datecrit_return;
  15146. +
  15147. +typedef struct RSPParser_dateop_return_struct
  15148. +{
  15149. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  15150. + */
  15151. + pANTLR3_COMMON_TOKEN start;
  15152. + pANTLR3_COMMON_TOKEN stop;
  15153. + pANTLR3_BASE_TREE tree;
  15154. +
  15155. +}
  15156. + RSPParser_dateop_return;
  15157. +
  15158. +typedef struct RSPParser_datespec_return_struct
  15159. +{
  15160. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  15161. + */
  15162. + pANTLR3_COMMON_TOKEN start;
  15163. + pANTLR3_COMMON_TOKEN stop;
  15164. + pANTLR3_BASE_TREE tree;
  15165. +
  15166. +}
  15167. + RSPParser_datespec_return;
  15168. +
  15169. +typedef struct RSPParser_dateref_return_struct
  15170. +{
  15171. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  15172. + */
  15173. + pANTLR3_COMMON_TOKEN start;
  15174. + pANTLR3_COMMON_TOKEN stop;
  15175. + pANTLR3_BASE_TREE tree;
  15176. +
  15177. +}
  15178. + RSPParser_dateref_return;
  15179. +
  15180. +typedef struct RSPParser_dateintval_return_struct
  15181. +{
  15182. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  15183. + */
  15184. + pANTLR3_COMMON_TOKEN start;
  15185. + pANTLR3_COMMON_TOKEN stop;
  15186. + pANTLR3_BASE_TREE tree;
  15187. +
  15188. +}
  15189. + RSPParser_dateintval_return;
  15190. +
  15191. +
  15192. +
  15193. +/** Context tracking structure for RSPParser
  15194. + */
  15195. +struct RSPParser_Ctx_struct
  15196. +{
  15197. + /** Built in ANTLR3 context tracker contains all the generic elements
  15198. + * required for context tracking.
  15199. + */
  15200. + pANTLR3_PARSER pParser;
  15201. +
  15202. +
  15203. + RSPParser_query_return (*query) (struct RSPParser_Ctx_struct * ctx);
  15204. + RSPParser_expr_return (*expr) (struct RSPParser_Ctx_struct * ctx);
  15205. + RSPParser_aexpr_return (*aexpr) (struct RSPParser_Ctx_struct * ctx);
  15206. + RSPParser_crit_return (*crit) (struct RSPParser_Ctx_struct * ctx);
  15207. + RSPParser_strcrit_return (*strcrit) (struct RSPParser_Ctx_struct * ctx);
  15208. + RSPParser_strop_return (*strop) (struct RSPParser_Ctx_struct * ctx);
  15209. + RSPParser_intcrit_return (*intcrit) (struct RSPParser_Ctx_struct * ctx);
  15210. + RSPParser_intop_return (*intop) (struct RSPParser_Ctx_struct * ctx);
  15211. + RSPParser_datecrit_return (*datecrit) (struct RSPParser_Ctx_struct * ctx);
  15212. + RSPParser_dateop_return (*dateop) (struct RSPParser_Ctx_struct * ctx);
  15213. + RSPParser_datespec_return (*datespec) (struct RSPParser_Ctx_struct * ctx);
  15214. + RSPParser_dateref_return (*dateref) (struct RSPParser_Ctx_struct * ctx);
  15215. + RSPParser_dateintval_return (*dateintval) (struct RSPParser_Ctx_struct * ctx);
  15216. + // Delegated rules
  15217. + const char * (*getGrammarFileName)();
  15218. + void (*free) (struct RSPParser_Ctx_struct * ctx);
  15219. + /* @headerFile.members() */
  15220. + pANTLR3_BASE_TREE_ADAPTOR adaptor;
  15221. + pANTLR3_VECTOR_FACTORY vectors;
  15222. + /* End @headerFile.members() */
  15223. +};
  15224. +
  15225. +// Function protoypes for the constructor functions that external translation units
  15226. +// such as delegators and delegates may wish to call.
  15227. +//
  15228. +ANTLR3_API pRSPParser RSPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream);
  15229. +ANTLR3_API pRSPParser RSPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
  15230. +
  15231. +/** Symbolic definitions of all the tokens that the parser will work with.
  15232. + * \{
  15233. + *
  15234. + * Antlr will define EOF, but we can't use that as it it is too common in
  15235. + * in C header files and that would be confusing. There is no way to filter this out at the moment
  15236. + * so we just undef it here for now. That isn't the value we get back from C recognizers
  15237. + * anyway. We are looking for ANTLR3_TOKEN_EOF.
  15238. + */
  15239. +#ifdef EOF
  15240. +#undef EOF
  15241. +#endif
  15242. +#ifdef Tokens
  15243. +#undef Tokens
  15244. +#endif
  15245. +#define STARTSW 14
  15246. +#define WEEK 26
  15247. +#define TODAY 24
  15248. +#define YEAR 28
  15249. +#define ENDSW 15
  15250. +#define GTE 20
  15251. +#define BEFORE 21
  15252. +#define DAY 25
  15253. +#define INT 16
  15254. +#define NOT 11
  15255. +#define AFTER 22
  15256. +#define AND 6
  15257. +#define EOF -1
  15258. +#define LTE 19
  15259. +#define MONTH 27
  15260. +#define DIGIT19 31
  15261. +#define INCLUDES 13
  15262. +#define STR 10
  15263. +#define QUOTE 29
  15264. +#define WS 30
  15265. +#define GREATER 18
  15266. +#define NEWLINE 4
  15267. +#define LPAR 7
  15268. +#define EQUAL 12
  15269. +#define OR 5
  15270. +#define LESS 17
  15271. +#define RPAR 8
  15272. +#define FIELD 9
  15273. +#define ESCAPED 33
  15274. +#define DATE 23
  15275. +#define DIGIT09 32
  15276. +#ifdef EOF
  15277. +#undef EOF
  15278. +#define EOF ANTLR3_TOKEN_EOF
  15279. +#endif
  15280. +
  15281. +#ifndef TOKENSOURCE
  15282. +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
  15283. +#endif
  15284. +
  15285. +/* End of token definitions for RSPParser
  15286. + * =============================================================================
  15287. + */
  15288. +/** \} */
  15289. +
  15290. +#ifdef __cplusplus
  15291. +}
  15292. +#endif
  15293. +
  15294. +#endif
  15295. +
  15296. +/* END - Note:Keep extra line feed to satisfy UNIX systems */
  15297. diff --git a/src/pregen/SMARTPL.u b/src/pregen/SMARTPL.u
  15298. new file mode 100644
  15299. index 0000000..2a66bf3
  15300. --- /dev/null
  15301. +++ b/src/pregen/SMARTPL.u
  15302. @@ -0,0 +1,6 @@
  15303. +SMARTPLParser.c : SMARTPL.g
  15304. +./SMARTPL.tokens : SMARTPL.g
  15305. +SMARTPLParser.h : SMARTPL.g
  15306. +SMARTPLLexer.c : SMARTPL.g
  15307. +SMARTPLLexer.h : SMARTPL.g
  15308. +ANTLR_PRODUCTS += SMARTPLParser.c ./SMARTPL.tokens SMARTPLParser.h SMARTPLLexer.c SMARTPLLexer.h
  15309. \ No newline at end of file
  15310. diff --git a/src/pregen/SMARTPL2SQL.c b/src/pregen/SMARTPL2SQL.c
  15311. new file mode 100644
  15312. index 0000000..bd93752
  15313. --- /dev/null
  15314. +++ b/src/pregen/SMARTPL2SQL.c
  15315. @@ -0,0 +1,1649 @@
  15316. +/** \file
  15317. + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
  15318. + *
  15319. + * - From the grammar source file : SMARTPL2SQL.g
  15320. + * - On : 2016-01-01 12:23:44
  15321. + * - for the tree parser : SMARTPL2SQLTreeParser *
  15322. + * Editing it, at least manually, is not wise.
  15323. + *
  15324. + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
  15325. + *
  15326. + *
  15327. +*/
  15328. +// [The "BSD licence"]
  15329. +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
  15330. +// http://www.temporal-wave.com
  15331. +// http://www.linkedin.com/in/jimidle
  15332. +//
  15333. +// All rights reserved.
  15334. +//
  15335. +// Redistribution and use in source and binary forms, with or without
  15336. +// modification, are permitted provided that the following conditions
  15337. +// are met:
  15338. +// 1. Redistributions of source code must retain the above copyright
  15339. +// notice, this list of conditions and the following disclaimer.
  15340. +// 2. Redistributions in binary form must reproduce the above copyright
  15341. +// notice, this list of conditions and the following disclaimer in the
  15342. +// documentation and/or other materials provided with the distribution.
  15343. +// 3. The name of the author may not be used to endorse or promote products
  15344. +// derived from this software without specific prior written permission.
  15345. +//
  15346. +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  15347. +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  15348. +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15349. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  15350. +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  15351. +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  15352. +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  15353. +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  15354. +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  15355. +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  15356. +
  15357. +
  15358. +/* =============================================================================
  15359. + * This is what the grammar programmer asked us to put at the top of every file.
  15360. + */
  15361. +
  15362. + #include <stdio.h>
  15363. + #include <stdlib.h>
  15364. + #include <string.h>
  15365. + #include <limits.h>
  15366. + #include <errno.h>
  15367. + #include <time.h>
  15368. + #include <sqlite3.h>
  15369. +
  15370. + #include "logger.h"
  15371. + #include "db.h"
  15372. +
  15373. +/* End of Header action.
  15374. + * =============================================================================
  15375. + */
  15376. +/* -----------------------------------------
  15377. + * Include the ANTLR3 generated header file.
  15378. + */
  15379. +#include "SMARTPL2SQL.h"
  15380. +/* ----------------------------------------- */
  15381. +
  15382. +
  15383. +
  15384. +
  15385. +
  15386. +/* MACROS that hide the C interface implementations from the
  15387. + * generated code, which makes it a little more understandable to the human eye.
  15388. + * I am very much against using C pre-processor macros for function calls and bits
  15389. + * of code as you cannot see what is happening when single stepping in debuggers
  15390. + * and so on. The exception (in my book at least) is for generated code, where you are
  15391. + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
  15392. + * hides some indirect calls, but is always referring to the input stream. This is
  15393. + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
  15394. + * the runtime interfaces without changing the generated code too often, without
  15395. + * confusing the reader of the generated output, who may not wish to know the gory
  15396. + * details of the interface inheritance.
  15397. + */
  15398. +
  15399. +#define CTX ctx
  15400. +
  15401. +/* Aids in accessing scopes for grammar programmers
  15402. + */
  15403. +#undef SCOPE_TYPE
  15404. +#undef SCOPE_STACK
  15405. +#undef SCOPE_TOP
  15406. +#define SCOPE_TYPE(scope) pSMARTPL2SQL_##scope##_SCOPE
  15407. +#define SCOPE_STACK(scope) pSMARTPL2SQL_##scope##Stack
  15408. +#define SCOPE_TOP(scope) ctx->pSMARTPL2SQL_##scope##Top
  15409. +#define SCOPE_SIZE(scope) ctx->pSMARTPL2SQL_##scope##Stack_limit
  15410. +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
  15411. +
  15412. +/* Macros for accessing things in the parser
  15413. + */
  15414. +
  15415. +#undef PARSER
  15416. +#undef RECOGNIZER
  15417. +#undef HAVEPARSEDRULE
  15418. +#undef INPUT
  15419. +#undef STRSTREAM
  15420. +#undef HASEXCEPTION
  15421. +#undef EXCEPTION
  15422. +#undef MATCHT
  15423. +#undef MATCHANYT
  15424. +#undef FOLLOWSTACK
  15425. +#undef FOLLOWPUSH
  15426. +#undef FOLLOWPOP
  15427. +#undef PRECOVER
  15428. +#undef PREPORTERROR
  15429. +#undef LA
  15430. +#undef LT
  15431. +#undef CONSTRUCTEX
  15432. +#undef CONSUME
  15433. +#undef MARK
  15434. +#undef REWIND
  15435. +#undef REWINDLAST
  15436. +#undef PERRORRECOVERY
  15437. +#undef HASFAILED
  15438. +#undef FAILEDFLAG
  15439. +#undef RECOVERFROMMISMATCHEDSET
  15440. +#undef RECOVERFROMMISMATCHEDELEMENT
  15441. +#undef BACKTRACKING
  15442. +#undef ADAPTOR
  15443. +#undef RULEMEMO
  15444. +#undef SEEK
  15445. +#undef INDEX
  15446. +#undef DBG
  15447. +
  15448. +#define PARSER ctx->pTreeParser
  15449. +#define RECOGNIZER PARSER->rec
  15450. +#define PSRSTATE RECOGNIZER->state
  15451. +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
  15452. +#define INPUT PARSER->ctnstream
  15453. +#define ISTREAM INPUT->tnstream->istream
  15454. +#define STRSTREAM INPUT->tnstream
  15455. +#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE)
  15456. +#define EXCEPTION PSRSTATE->exception
  15457. +#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs)
  15458. +#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER)
  15459. +#define FOLLOWSTACK PSRSTATE->following
  15460. +#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
  15461. +#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK)
  15462. +#define PRECOVER() RECOGNIZER->recover(RECOGNIZER)
  15463. +#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER)
  15464. +#define LA(n) ISTREAM->_LA(ISTREAM, n)
  15465. +#define LT(n) INPUT->tnstream->_LT(INPUT->tnstream, n)
  15466. +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
  15467. +#define CONSUME() ISTREAM->consume(ISTREAM)
  15468. +#define MARK() ISTREAM->mark(ISTREAM)
  15469. +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
  15470. +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
  15471. +#define PERRORRECOVERY PSRSTATE->errorRecovery
  15472. +#define FAILEDFLAG PSRSTATE->failed
  15473. +#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE)
  15474. +#define BACKTRACKING PSRSTATE->backtracking
  15475. +#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
  15476. +#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
  15477. +#define ADAPTOR INPUT->adaptor
  15478. +#define RULEMEMO PSRSTATE->ruleMemo
  15479. +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
  15480. +#define INDEX() ISTREAM->index(ISTREAM)
  15481. +#define DBG RECOGNIZER->debugger
  15482. +
  15483. +
  15484. +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
  15485. +
  15486. +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
  15487. + * then for the present you must use different names for your defines as these are hard coded
  15488. + * in the code generator. It would be better not to use such names internally, and maybe
  15489. + * we can change this in a forthcoming release. I deliberately do not #undef these
  15490. + * here as this will at least give you a redefined error somewhere if they clash.
  15491. + */
  15492. +#define UP ANTLR3_TOKEN_UP
  15493. +#define DOWN ANTLR3_TOKEN_DOWN
  15494. +#define EOR ANTLR3_TOKEN_EOR
  15495. +#define INVALID ANTLR3_TOKEN_INVALID
  15496. +
  15497. +
  15498. +/* =============================================================================
  15499. + * Functions to create and destroy scopes. First come the rule scopes, followed
  15500. + * by the global declared scopes.
  15501. + */
  15502. +
  15503. +
  15504. +
  15505. +/* ============================================================================= */
  15506. +
  15507. +/* =============================================================================
  15508. + * Start of recognizer
  15509. + */
  15510. +
  15511. +
  15512. +
  15513. +/** \brief Table of all token names in symbolic order, mainly used for
  15514. + * error reporting.
  15515. + */
  15516. +pANTLR3_UINT8 SMARTPL2SQLTokenNames[28+4]
  15517. + = {
  15518. + (pANTLR3_UINT8) "<invalid>", /* String to print to indicate an invalid token */
  15519. + (pANTLR3_UINT8) "<EOR>",
  15520. + (pANTLR3_UINT8) "<DOWN>",
  15521. + (pANTLR3_UINT8) "<UP>",
  15522. + (pANTLR3_UINT8) "STR",
  15523. + (pANTLR3_UINT8) "OR",
  15524. + (pANTLR3_UINT8) "AND",
  15525. + (pANTLR3_UINT8) "NOT",
  15526. + (pANTLR3_UINT8) "LPAR",
  15527. + (pANTLR3_UINT8) "RPAR",
  15528. + (pANTLR3_UINT8) "STRTAG",
  15529. + (pANTLR3_UINT8) "INCLUDES",
  15530. + (pANTLR3_UINT8) "IS",
  15531. + (pANTLR3_UINT8) "INTTAG",
  15532. + (pANTLR3_UINT8) "INTBOOL",
  15533. + (pANTLR3_UINT8) "INT",
  15534. + (pANTLR3_UINT8) "DATETAG",
  15535. + (pANTLR3_UINT8) "AFTER",
  15536. + (pANTLR3_UINT8) "BEFORE",
  15537. + (pANTLR3_UINT8) "ENUMTAG",
  15538. + (pANTLR3_UINT8) "ENUMVAL",
  15539. + (pANTLR3_UINT8) "DATE",
  15540. + (pANTLR3_UINT8) "AGO",
  15541. + (pANTLR3_UINT8) "DATINTERVAL",
  15542. + (pANTLR3_UINT8) "GREATER",
  15543. + (pANTLR3_UINT8) "GREATEREQUAL",
  15544. + (pANTLR3_UINT8) "LESS",
  15545. + (pANTLR3_UINT8) "LESSEQUAL",
  15546. + (pANTLR3_UINT8) "EQUAL",
  15547. + (pANTLR3_UINT8) "WHITESPACE",
  15548. + (pANTLR3_UINT8) "'{'",
  15549. + (pANTLR3_UINT8) "'}'"
  15550. + };
  15551. +
  15552. +
  15553. +
  15554. +// Forward declare the locally static matching functions we have generated.
  15555. +//
  15556. +static SMARTPL2SQL_playlist_return playlist (pSMARTPL2SQL ctx);
  15557. +static pANTLR3_STRING expression (pSMARTPL2SQL ctx);
  15558. +static int dateval (pSMARTPL2SQL ctx);
  15559. +static int interval (pSMARTPL2SQL ctx);
  15560. +static void SMARTPL2SQLFree(pSMARTPL2SQL ctx);
  15561. +/* For use in tree output where we are accumulating rule labels via label += ruleRef
  15562. + * we need a function that knows how to free a return scope when the list is destroyed.
  15563. + * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
  15564. + */
  15565. +static void ANTLR3_CDECL freeScope(void * scope)
  15566. +{
  15567. + ANTLR3_FREE(scope);
  15568. +}
  15569. +
  15570. +/** \brief Name of the grammar file that generated this code
  15571. + */
  15572. +static const char fileName[] = "SMARTPL2SQL.g";
  15573. +
  15574. +/** \brief Return the name of the grammar file that generated this code.
  15575. + */
  15576. +static const char * getGrammarFileName()
  15577. +{
  15578. + return fileName;
  15579. +}
  15580. +/** \brief Create a new SMARTPL2SQL parser and return a context for it.
  15581. + *
  15582. + * \param[in] instream Pointer to an input stream interface.
  15583. + *
  15584. + * \return Pointer to new parser context upon success.
  15585. + */
  15586. +ANTLR3_API pSMARTPL2SQL
  15587. +SMARTPL2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream)
  15588. +{
  15589. + // See if we can create a new parser with the standard constructor
  15590. + //
  15591. + return SMARTPL2SQLNewSSD(instream, NULL);
  15592. +}
  15593. +
  15594. +/** \brief Create a new SMARTPL2SQL parser and return a context for it.
  15595. + *
  15596. + * \param[in] instream Pointer to an input stream interface.
  15597. + *
  15598. + * \return Pointer to new parser context upon success.
  15599. + */
  15600. +ANTLR3_API pSMARTPL2SQL
  15601. +SMARTPL2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
  15602. +{
  15603. + pSMARTPL2SQL ctx; /* Context structure we will build and return */
  15604. +
  15605. + ctx = (pSMARTPL2SQL) ANTLR3_CALLOC(1, sizeof(SMARTPL2SQL));
  15606. +
  15607. + if (ctx == NULL)
  15608. + {
  15609. + // Failed to allocate memory for parser context
  15610. + //
  15611. + return NULL;
  15612. + }
  15613. +
  15614. + /* -------------------------------------------------------------------
  15615. + * Memory for basic structure is allocated, now to fill in
  15616. + * the base ANTLR3 structures. We initialize the function pointers
  15617. + * for the standard ANTLR3 parser function set, but upon return
  15618. + * from here, the programmer may set the pointers to provide custom
  15619. + * implementations of each function.
  15620. + *
  15621. + * We don't use the macros defined in SMARTPL2SQL.h here, in order that you can get a sense
  15622. + * of what goes where.
  15623. + */
  15624. +
  15625. + /* Create a base Tree parser/recognizer, using the supplied tree node stream
  15626. + */
  15627. + ctx->pTreeParser = antlr3TreeParserNewStream(ANTLR3_SIZE_HINT, instream, state);
  15628. + /* Install the implementation of our SMARTPL2SQL interface
  15629. + */
  15630. + ctx->playlist = playlist;
  15631. + ctx->expression = expression;
  15632. + ctx->dateval = dateval;
  15633. + ctx->interval = interval;
  15634. + ctx->free = SMARTPL2SQLFree;
  15635. + ctx->getGrammarFileName = getGrammarFileName;
  15636. +
  15637. + /* Install the scope pushing methods.
  15638. + */
  15639. +
  15640. +
  15641. +
  15642. +
  15643. +
  15644. + /* Install the token table
  15645. + */
  15646. + PSRSTATE->tokenNames = SMARTPL2SQLTokenNames;
  15647. +
  15648. +
  15649. + /* Return the newly built parser to the caller
  15650. + */
  15651. + return ctx;
  15652. +}
  15653. +
  15654. +/** Free the parser resources
  15655. + */
  15656. + static void
  15657. + SMARTPL2SQLFree(pSMARTPL2SQL ctx)
  15658. + {
  15659. + /* Free any scope memory
  15660. + */
  15661. +
  15662. +
  15663. + // Free this parser
  15664. + //
  15665. + ctx->pTreeParser->free(ctx->pTreeParser);
  15666. + ANTLR3_FREE(ctx);
  15667. +
  15668. + /* Everything is released, so we can return
  15669. + */
  15670. + return;
  15671. + }
  15672. +
  15673. +/** Return token names used by this tree parser
  15674. + *
  15675. + * The returned pointer is used as an index into the token names table (using the token
  15676. + * number as the index).
  15677. + *
  15678. + * \return Pointer to first char * in the table.
  15679. + */
  15680. +static pANTLR3_UINT8 *getTokenNames()
  15681. +{
  15682. + return SMARTPL2SQLTokenNames;
  15683. +}
  15684. +
  15685. +
  15686. +
  15687. +
  15688. +/* Declare the bitsets
  15689. + */
  15690. +
  15691. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_playlist66 */
  15692. +static ANTLR3_BITWORD FOLLOW_STR_in_playlist66_bits[] = { ANTLR3_UINT64_LIT(0x0000000040000000) };
  15693. +static ANTLR3_BITSET_LIST FOLLOW_STR_in_playlist66 = { FOLLOW_STR_in_playlist66_bits, 1 };
  15694. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_30_in_playlist68 */
  15695. +static ANTLR3_BITWORD FOLLOW_30_in_playlist68_bits[] = { ANTLR3_UINT64_LIT(0x00000000000924E0) };
  15696. +static ANTLR3_BITSET_LIST FOLLOW_30_in_playlist68 = { FOLLOW_30_in_playlist68_bits, 1 };
  15697. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_playlist74 */
  15698. +static ANTLR3_BITWORD FOLLOW_expression_in_playlist74_bits[] = { ANTLR3_UINT64_LIT(0x0000000080000000) };
  15699. +static ANTLR3_BITSET_LIST FOLLOW_expression_in_playlist74 = { FOLLOW_expression_in_playlist74_bits, 1 };
  15700. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_31_in_playlist76 */
  15701. +static ANTLR3_BITWORD FOLLOW_31_in_playlist76_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  15702. +static ANTLR3_BITSET_LIST FOLLOW_31_in_playlist76 = { FOLLOW_31_in_playlist76_bits, 1 };
  15703. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_expression101 */
  15704. +static ANTLR3_BITWORD FOLLOW_NOT_in_expression101_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
  15705. +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_expression101 = { FOLLOW_NOT_in_expression101_bits, 1 };
  15706. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression107 */
  15707. +static ANTLR3_BITWORD FOLLOW_expression_in_expression107_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
  15708. +static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression107 = { FOLLOW_expression_in_expression107_bits, 1 };
  15709. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_expression118 */
  15710. +static ANTLR3_BITWORD FOLLOW_AND_in_expression118_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
  15711. +static ANTLR3_BITSET_LIST FOLLOW_AND_in_expression118 = { FOLLOW_AND_in_expression118_bits, 1 };
  15712. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression124 */
  15713. +static ANTLR3_BITWORD FOLLOW_expression_in_expression124_bits[] = { ANTLR3_UINT64_LIT(0x00000000000924E0) };
  15714. +static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression124 = { FOLLOW_expression_in_expression124_bits, 1 };
  15715. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression130 */
  15716. +static ANTLR3_BITWORD FOLLOW_expression_in_expression130_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
  15717. +static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression130 = { FOLLOW_expression_in_expression130_bits, 1 };
  15718. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expression141 */
  15719. +static ANTLR3_BITWORD FOLLOW_OR_in_expression141_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) };
  15720. +static ANTLR3_BITSET_LIST FOLLOW_OR_in_expression141 = { FOLLOW_OR_in_expression141_bits, 1 };
  15721. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression147 */
  15722. +static ANTLR3_BITWORD FOLLOW_expression_in_expression147_bits[] = { ANTLR3_UINT64_LIT(0x00000000000924E0) };
  15723. +static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression147 = { FOLLOW_expression_in_expression147_bits, 1 };
  15724. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression153 */
  15725. +static ANTLR3_BITWORD FOLLOW_expression_in_expression153_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) };
  15726. +static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression153 = { FOLLOW_expression_in_expression153_bits, 1 };
  15727. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STRTAG_in_expression163 */
  15728. +static ANTLR3_BITWORD FOLLOW_STRTAG_in_expression163_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000800) };
  15729. +static ANTLR3_BITSET_LIST FOLLOW_STRTAG_in_expression163 = { FOLLOW_STRTAG_in_expression163_bits, 1 };
  15730. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INCLUDES_in_expression165 */
  15731. +static ANTLR3_BITWORD FOLLOW_INCLUDES_in_expression165_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) };
  15732. +static ANTLR3_BITSET_LIST FOLLOW_INCLUDES_in_expression165 = { FOLLOW_INCLUDES_in_expression165_bits, 1 };
  15733. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_expression167 */
  15734. +static ANTLR3_BITWORD FOLLOW_STR_in_expression167_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  15735. +static ANTLR3_BITSET_LIST FOLLOW_STR_in_expression167 = { FOLLOW_STR_in_expression167_bits, 1 };
  15736. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STRTAG_in_expression176 */
  15737. +static ANTLR3_BITWORD FOLLOW_STRTAG_in_expression176_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001000) };
  15738. +static ANTLR3_BITSET_LIST FOLLOW_STRTAG_in_expression176 = { FOLLOW_STRTAG_in_expression176_bits, 1 };
  15739. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_IS_in_expression178 */
  15740. +static ANTLR3_BITWORD FOLLOW_IS_in_expression178_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) };
  15741. +static ANTLR3_BITSET_LIST FOLLOW_IS_in_expression178 = { FOLLOW_IS_in_expression178_bits, 1 };
  15742. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_expression180 */
  15743. +static ANTLR3_BITWORD FOLLOW_STR_in_expression180_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  15744. +static ANTLR3_BITSET_LIST FOLLOW_STR_in_expression180 = { FOLLOW_STR_in_expression180_bits, 1 };
  15745. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTTAG_in_expression189 */
  15746. +static ANTLR3_BITWORD FOLLOW_INTTAG_in_expression189_bits[] = { ANTLR3_UINT64_LIT(0x0000000000004000) };
  15747. +static ANTLR3_BITSET_LIST FOLLOW_INTTAG_in_expression189 = { FOLLOW_INTTAG_in_expression189_bits, 1 };
  15748. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTBOOL_in_expression191 */
  15749. +static ANTLR3_BITWORD FOLLOW_INTBOOL_in_expression191_bits[] = { ANTLR3_UINT64_LIT(0x0000000000008000) };
  15750. +static ANTLR3_BITSET_LIST FOLLOW_INTBOOL_in_expression191 = { FOLLOW_INTBOOL_in_expression191_bits, 1 };
  15751. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_expression193 */
  15752. +static ANTLR3_BITWORD FOLLOW_INT_in_expression193_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  15753. +static ANTLR3_BITSET_LIST FOLLOW_INT_in_expression193 = { FOLLOW_INT_in_expression193_bits, 1 };
  15754. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATETAG_in_expression202 */
  15755. +static ANTLR3_BITWORD FOLLOW_DATETAG_in_expression202_bits[] = { ANTLR3_UINT64_LIT(0x0000000000020000) };
  15756. +static ANTLR3_BITSET_LIST FOLLOW_DATETAG_in_expression202 = { FOLLOW_DATETAG_in_expression202_bits, 1 };
  15757. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_expression204 */
  15758. +static ANTLR3_BITWORD FOLLOW_AFTER_in_expression204_bits[] = { ANTLR3_UINT64_LIT(0x0000000000208000) };
  15759. +static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_expression204 = { FOLLOW_AFTER_in_expression204_bits, 1 };
  15760. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateval_in_expression206 */
  15761. +static ANTLR3_BITWORD FOLLOW_dateval_in_expression206_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  15762. +static ANTLR3_BITSET_LIST FOLLOW_dateval_in_expression206 = { FOLLOW_dateval_in_expression206_bits, 1 };
  15763. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATETAG_in_expression215 */
  15764. +static ANTLR3_BITWORD FOLLOW_DATETAG_in_expression215_bits[] = { ANTLR3_UINT64_LIT(0x0000000000040000) };
  15765. +static ANTLR3_BITSET_LIST FOLLOW_DATETAG_in_expression215 = { FOLLOW_DATETAG_in_expression215_bits, 1 };
  15766. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_expression217 */
  15767. +static ANTLR3_BITWORD FOLLOW_BEFORE_in_expression217_bits[] = { ANTLR3_UINT64_LIT(0x0000000000208000) };
  15768. +static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_expression217 = { FOLLOW_BEFORE_in_expression217_bits, 1 };
  15769. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateval_in_expression219 */
  15770. +static ANTLR3_BITWORD FOLLOW_dateval_in_expression219_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  15771. +static ANTLR3_BITSET_LIST FOLLOW_dateval_in_expression219 = { FOLLOW_dateval_in_expression219_bits, 1 };
  15772. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMTAG_in_expression228 */
  15773. +static ANTLR3_BITWORD FOLLOW_ENUMTAG_in_expression228_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001000) };
  15774. +static ANTLR3_BITSET_LIST FOLLOW_ENUMTAG_in_expression228 = { FOLLOW_ENUMTAG_in_expression228_bits, 1 };
  15775. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_IS_in_expression230 */
  15776. +static ANTLR3_BITWORD FOLLOW_IS_in_expression230_bits[] = { ANTLR3_UINT64_LIT(0x0000000000100000) };
  15777. +static ANTLR3_BITSET_LIST FOLLOW_IS_in_expression230 = { FOLLOW_IS_in_expression230_bits, 1 };
  15778. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMVAL_in_expression232 */
  15779. +static ANTLR3_BITWORD FOLLOW_ENUMVAL_in_expression232_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  15780. +static ANTLR3_BITSET_LIST FOLLOW_ENUMVAL_in_expression232 = { FOLLOW_ENUMVAL_in_expression232_bits, 1 };
  15781. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval257 */
  15782. +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval257_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  15783. +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval257 = { FOLLOW_DATE_in_dateval257_bits, 1 };
  15784. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval266 */
  15785. +static ANTLR3_BITWORD FOLLOW_interval_in_dateval266_bits[] = { ANTLR3_UINT64_LIT(0x0000000000040000) };
  15786. +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval266 = { FOLLOW_interval_in_dateval266_bits, 1 };
  15787. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateval268 */
  15788. +static ANTLR3_BITWORD FOLLOW_BEFORE_in_dateval268_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) };
  15789. +static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateval268 = { FOLLOW_BEFORE_in_dateval268_bits, 1 };
  15790. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval270 */
  15791. +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval270_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  15792. +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval270 = { FOLLOW_DATE_in_dateval270_bits, 1 };
  15793. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval279 */
  15794. +static ANTLR3_BITWORD FOLLOW_interval_in_dateval279_bits[] = { ANTLR3_UINT64_LIT(0x0000000000020000) };
  15795. +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval279 = { FOLLOW_interval_in_dateval279_bits, 1 };
  15796. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateval281 */
  15797. +static ANTLR3_BITWORD FOLLOW_AFTER_in_dateval281_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) };
  15798. +static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateval281 = { FOLLOW_AFTER_in_dateval281_bits, 1 };
  15799. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval283 */
  15800. +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval283_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  15801. +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval283 = { FOLLOW_DATE_in_dateval283_bits, 1 };
  15802. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval292 */
  15803. +static ANTLR3_BITWORD FOLLOW_interval_in_dateval292_bits[] = { ANTLR3_UINT64_LIT(0x0000000000400000) };
  15804. +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval292 = { FOLLOW_interval_in_dateval292_bits, 1 };
  15805. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AGO_in_dateval294 */
  15806. +static ANTLR3_BITWORD FOLLOW_AGO_in_dateval294_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  15807. +static ANTLR3_BITSET_LIST FOLLOW_AGO_in_dateval294 = { FOLLOW_AGO_in_dateval294_bits, 1 };
  15808. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_interval318 */
  15809. +static ANTLR3_BITWORD FOLLOW_INT_in_interval318_bits[] = { ANTLR3_UINT64_LIT(0x0000000000800000) };
  15810. +static ANTLR3_BITSET_LIST FOLLOW_INT_in_interval318 = { FOLLOW_INT_in_interval318_bits, 1 };
  15811. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATINTERVAL_in_interval320 */
  15812. +static ANTLR3_BITWORD FOLLOW_DATINTERVAL_in_interval320_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  15813. +static ANTLR3_BITSET_LIST FOLLOW_DATINTERVAL_in_interval320 = { FOLLOW_DATINTERVAL_in_interval320_bits, 1 };
  15814. +
  15815. +
  15816. +
  15817. +
  15818. +/* ==============================================
  15819. + * Parsing rules
  15820. + */
  15821. +/**
  15822. + * $ANTLR start playlist
  15823. + * SMARTPL2SQL.g:43:1: playlist returns [ pANTLR3_STRING title, pANTLR3_STRING query ] : STR '{' e= expression '}' ;
  15824. + */
  15825. +static SMARTPL2SQL_playlist_return
  15826. +playlist(pSMARTPL2SQL ctx)
  15827. +{
  15828. + SMARTPL2SQL_playlist_return retval;
  15829. +
  15830. + pANTLR3_BASE_TREE STR1;
  15831. + pANTLR3_STRING e;
  15832. + #undef RETURN_TYPE_e
  15833. + #define RETURN_TYPE_e pANTLR3_STRING
  15834. +
  15835. + /* Initialize rule variables
  15836. + */
  15837. +
  15838. +
  15839. + retval.title= NULL; retval.query= NULL;
  15840. + STR1 = NULL;
  15841. + e = NULL;
  15842. + retval.start = LT(1); retval.stop = retval.start;
  15843. +
  15844. + {
  15845. + // SMARTPL2SQL.g:45:2: ( STR '{' e= expression '}' )
  15846. + // SMARTPL2SQL.g:45:4: STR '{' e= expression '}'
  15847. + {
  15848. + STR1 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_playlist66);
  15849. + if (HASEXCEPTION())
  15850. + {
  15851. + goto ruleplaylistEx;
  15852. + }
  15853. +
  15854. + MATCHT(30, &FOLLOW_30_in_playlist68);
  15855. + if (HASEXCEPTION())
  15856. + {
  15857. + goto ruleplaylistEx;
  15858. + }
  15859. +
  15860. + FOLLOWPUSH(FOLLOW_expression_in_playlist74);
  15861. + e=expression(ctx);
  15862. +
  15863. + FOLLOWPOP();
  15864. + if (HASEXCEPTION())
  15865. + {
  15866. + goto ruleplaylistEx;
  15867. + }
  15868. +
  15869. + MATCHT(31, &FOLLOW_31_in_playlist76);
  15870. + if (HASEXCEPTION())
  15871. + {
  15872. + goto ruleplaylistEx;
  15873. + }
  15874. +
  15875. + {
  15876. +
  15877. + pANTLR3_UINT8 val;
  15878. + val = (STR1->getText(STR1))->toUTF8((STR1->getText(STR1)))->chars;
  15879. + val++;
  15880. + val[strlen((const char *)val) - 1] = '\0';
  15881. +
  15882. + retval.title= (STR1->getText(STR1))->factory->newRaw((STR1->getText(STR1))->factory);
  15883. + retval.title->append8(retval.title, (const char *)val);
  15884. +
  15885. + retval.query= e->factory->newRaw(e->factory);
  15886. + retval.query->append8(retval.query, "(");
  15887. + retval.query->appendS(retval.query, e);
  15888. + retval.query->append8(retval.query, ")");
  15889. +
  15890. + }
  15891. +
  15892. + }
  15893. +
  15894. + }
  15895. +
  15896. +
  15897. + // This is where rules clean up and exit
  15898. + //
  15899. + goto ruleplaylistEx; /* Prevent compiler warnings */
  15900. + ruleplaylistEx: ;
  15901. +
  15902. + if (HASEXCEPTION())
  15903. + {
  15904. + PREPORTERROR();
  15905. + PRECOVER();
  15906. + }
  15907. +
  15908. +
  15909. + return retval;
  15910. +}
  15911. +/* $ANTLR end playlist */
  15912. +
  15913. +/**
  15914. + * $ANTLR start expression
  15915. + * SMARTPL2SQL.g:62:1: expression returns [ pANTLR3_STRING result ] : ( ^( NOT a= expression ) | ^( AND a= expression b= expression ) | ^( OR a= expression b= expression ) | STRTAG INCLUDES STR | STRTAG IS STR | INTTAG INTBOOL INT | DATETAG AFTER dateval | DATETAG BEFORE dateval | ENUMTAG IS ENUMVAL );
  15916. + */
  15917. +static pANTLR3_STRING
  15918. +expression(pSMARTPL2SQL ctx)
  15919. +{
  15920. + pANTLR3_STRING result = NULL;
  15921. +
  15922. + pANTLR3_BASE_TREE STR2;
  15923. + pANTLR3_BASE_TREE STRTAG3;
  15924. + pANTLR3_BASE_TREE STR4;
  15925. + pANTLR3_BASE_TREE STRTAG5;
  15926. + pANTLR3_BASE_TREE INTTAG6;
  15927. + pANTLR3_BASE_TREE INTBOOL7;
  15928. + pANTLR3_BASE_TREE INT8;
  15929. + pANTLR3_BASE_TREE DATETAG10;
  15930. + pANTLR3_BASE_TREE DATETAG12;
  15931. + pANTLR3_BASE_TREE ENUMTAG13;
  15932. + pANTLR3_BASE_TREE ENUMVAL14;
  15933. + pANTLR3_STRING a;
  15934. + #undef RETURN_TYPE_a
  15935. + #define RETURN_TYPE_a pANTLR3_STRING
  15936. +
  15937. + pANTLR3_STRING b;
  15938. + #undef RETURN_TYPE_b
  15939. + #define RETURN_TYPE_b pANTLR3_STRING
  15940. +
  15941. + int dateval9;
  15942. + #undef RETURN_TYPE_dateval9
  15943. + #define RETURN_TYPE_dateval9 int
  15944. +
  15945. + int dateval11;
  15946. + #undef RETURN_TYPE_dateval11
  15947. + #define RETURN_TYPE_dateval11 int
  15948. +
  15949. + /* Initialize rule variables
  15950. + */
  15951. +
  15952. +
  15953. + result= NULL;
  15954. + STR2 = NULL;
  15955. + STRTAG3 = NULL;
  15956. + STR4 = NULL;
  15957. + STRTAG5 = NULL;
  15958. + INTTAG6 = NULL;
  15959. + INTBOOL7 = NULL;
  15960. + INT8 = NULL;
  15961. + DATETAG10 = NULL;
  15962. + DATETAG12 = NULL;
  15963. + ENUMTAG13 = NULL;
  15964. + ENUMVAL14 = NULL;
  15965. + a = NULL;
  15966. + b = NULL;
  15967. + dateval9 = 0;
  15968. + dateval11 = 0;
  15969. +
  15970. + {
  15971. + {
  15972. + // SMARTPL2SQL.g:64:2: ( ^( NOT a= expression ) | ^( AND a= expression b= expression ) | ^( OR a= expression b= expression ) | STRTAG INCLUDES STR | STRTAG IS STR | INTTAG INTBOOL INT | DATETAG AFTER dateval | DATETAG BEFORE dateval | ENUMTAG IS ENUMVAL )
  15973. +
  15974. + ANTLR3_UINT32 alt1;
  15975. +
  15976. + alt1=9;
  15977. +
  15978. + switch ( LA(1) )
  15979. + {
  15980. + case NOT:
  15981. + {
  15982. + alt1=1;
  15983. + }
  15984. + break;
  15985. + case AND:
  15986. + {
  15987. + alt1=2;
  15988. + }
  15989. + break;
  15990. + case OR:
  15991. + {
  15992. + alt1=3;
  15993. + }
  15994. + break;
  15995. + case STRTAG:
  15996. + {
  15997. + switch ( LA(2) )
  15998. + {
  15999. + case INCLUDES:
  16000. + {
  16001. + alt1=4;
  16002. + }
  16003. + break;
  16004. + case IS:
  16005. + {
  16006. + alt1=5;
  16007. + }
  16008. + break;
  16009. +
  16010. + default:
  16011. + CONSTRUCTEX();
  16012. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  16013. + EXCEPTION->message = (void *)"";
  16014. + EXCEPTION->decisionNum = 1;
  16015. + EXCEPTION->state = 4;
  16016. +
  16017. +
  16018. + goto ruleexpressionEx;
  16019. + }
  16020. +
  16021. + }
  16022. + break;
  16023. + case INTTAG:
  16024. + {
  16025. + alt1=6;
  16026. + }
  16027. + break;
  16028. + case DATETAG:
  16029. + {
  16030. + switch ( LA(2) )
  16031. + {
  16032. + case AFTER:
  16033. + {
  16034. + alt1=7;
  16035. + }
  16036. + break;
  16037. + case BEFORE:
  16038. + {
  16039. + alt1=8;
  16040. + }
  16041. + break;
  16042. +
  16043. + default:
  16044. + CONSTRUCTEX();
  16045. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  16046. + EXCEPTION->message = (void *)"";
  16047. + EXCEPTION->decisionNum = 1;
  16048. + EXCEPTION->state = 6;
  16049. +
  16050. +
  16051. + goto ruleexpressionEx;
  16052. + }
  16053. +
  16054. + }
  16055. + break;
  16056. + case ENUMTAG:
  16057. + {
  16058. + alt1=9;
  16059. + }
  16060. + break;
  16061. +
  16062. + default:
  16063. + CONSTRUCTEX();
  16064. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  16065. + EXCEPTION->message = (void *)"";
  16066. + EXCEPTION->decisionNum = 1;
  16067. + EXCEPTION->state = 0;
  16068. +
  16069. +
  16070. + goto ruleexpressionEx;
  16071. + }
  16072. +
  16073. + switch (alt1)
  16074. + {
  16075. + case 1:
  16076. + // SMARTPL2SQL.g:64:4: ^( NOT a= expression )
  16077. + {
  16078. + MATCHT(NOT, &FOLLOW_NOT_in_expression101);
  16079. + if (HASEXCEPTION())
  16080. + {
  16081. + goto ruleexpressionEx;
  16082. + }
  16083. +
  16084. +
  16085. + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
  16086. + if (HASEXCEPTION())
  16087. + {
  16088. + goto ruleexpressionEx;
  16089. + }
  16090. +
  16091. + FOLLOWPUSH(FOLLOW_expression_in_expression107);
  16092. + a=expression(ctx);
  16093. +
  16094. + FOLLOWPOP();
  16095. + if (HASEXCEPTION())
  16096. + {
  16097. + goto ruleexpressionEx;
  16098. + }
  16099. +
  16100. +
  16101. + MATCHT(ANTLR3_TOKEN_UP, NULL);
  16102. + if (HASEXCEPTION())
  16103. + {
  16104. + goto ruleexpressionEx;
  16105. + }
  16106. +
  16107. + {
  16108. +
  16109. + result= a->factory->newRaw(a->factory);
  16110. + result->append8(result, "NOT(");
  16111. + result->appendS(result, a);
  16112. + result->append8(result, ")");
  16113. +
  16114. + }
  16115. +
  16116. + }
  16117. + break;
  16118. + case 2:
  16119. + // SMARTPL2SQL.g:71:4: ^( AND a= expression b= expression )
  16120. + {
  16121. + MATCHT(AND, &FOLLOW_AND_in_expression118);
  16122. + if (HASEXCEPTION())
  16123. + {
  16124. + goto ruleexpressionEx;
  16125. + }
  16126. +
  16127. +
  16128. + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
  16129. + if (HASEXCEPTION())
  16130. + {
  16131. + goto ruleexpressionEx;
  16132. + }
  16133. +
  16134. + FOLLOWPUSH(FOLLOW_expression_in_expression124);
  16135. + a=expression(ctx);
  16136. +
  16137. + FOLLOWPOP();
  16138. + if (HASEXCEPTION())
  16139. + {
  16140. + goto ruleexpressionEx;
  16141. + }
  16142. +
  16143. + FOLLOWPUSH(FOLLOW_expression_in_expression130);
  16144. + b=expression(ctx);
  16145. +
  16146. + FOLLOWPOP();
  16147. + if (HASEXCEPTION())
  16148. + {
  16149. + goto ruleexpressionEx;
  16150. + }
  16151. +
  16152. +
  16153. + MATCHT(ANTLR3_TOKEN_UP, NULL);
  16154. + if (HASEXCEPTION())
  16155. + {
  16156. + goto ruleexpressionEx;
  16157. + }
  16158. +
  16159. + {
  16160. +
  16161. + result= a->factory->newRaw(a->factory);
  16162. + result->append8(result, "(");
  16163. + result->appendS(result, a);
  16164. + result->append8(result, " AND ");
  16165. + result->appendS(result, b);
  16166. + result->append8(result, ")");
  16167. +
  16168. + }
  16169. +
  16170. + }
  16171. + break;
  16172. + case 3:
  16173. + // SMARTPL2SQL.g:80:4: ^( OR a= expression b= expression )
  16174. + {
  16175. + MATCHT(OR, &FOLLOW_OR_in_expression141);
  16176. + if (HASEXCEPTION())
  16177. + {
  16178. + goto ruleexpressionEx;
  16179. + }
  16180. +
  16181. +
  16182. + MATCHT(ANTLR3_TOKEN_DOWN, NULL);
  16183. + if (HASEXCEPTION())
  16184. + {
  16185. + goto ruleexpressionEx;
  16186. + }
  16187. +
  16188. + FOLLOWPUSH(FOLLOW_expression_in_expression147);
  16189. + a=expression(ctx);
  16190. +
  16191. + FOLLOWPOP();
  16192. + if (HASEXCEPTION())
  16193. + {
  16194. + goto ruleexpressionEx;
  16195. + }
  16196. +
  16197. + FOLLOWPUSH(FOLLOW_expression_in_expression153);
  16198. + b=expression(ctx);
  16199. +
  16200. + FOLLOWPOP();
  16201. + if (HASEXCEPTION())
  16202. + {
  16203. + goto ruleexpressionEx;
  16204. + }
  16205. +
  16206. +
  16207. + MATCHT(ANTLR3_TOKEN_UP, NULL);
  16208. + if (HASEXCEPTION())
  16209. + {
  16210. + goto ruleexpressionEx;
  16211. + }
  16212. +
  16213. + {
  16214. +
  16215. + result= a->factory->newRaw(a->factory);
  16216. + result->append8(result, "(");
  16217. + result->appendS(result, a);
  16218. + result->append8(result, " OR ");
  16219. + result->appendS(result, b);
  16220. + result->append8(result, ")");
  16221. +
  16222. + }
  16223. +
  16224. + }
  16225. + break;
  16226. + case 4:
  16227. + // SMARTPL2SQL.g:89:4: STRTAG INCLUDES STR
  16228. + {
  16229. + STRTAG3 = (pANTLR3_BASE_TREE) MATCHT(STRTAG, &FOLLOW_STRTAG_in_expression163);
  16230. + if (HASEXCEPTION())
  16231. + {
  16232. + goto ruleexpressionEx;
  16233. + }
  16234. +
  16235. + MATCHT(INCLUDES, &FOLLOW_INCLUDES_in_expression165);
  16236. + if (HASEXCEPTION())
  16237. + {
  16238. + goto ruleexpressionEx;
  16239. + }
  16240. +
  16241. + STR2 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expression167);
  16242. + if (HASEXCEPTION())
  16243. + {
  16244. + goto ruleexpressionEx;
  16245. + }
  16246. +
  16247. + {
  16248. +
  16249. + pANTLR3_UINT8 val;
  16250. + val = (STR2->getText(STR2))->toUTF8((STR2->getText(STR2)))->chars;
  16251. + val++;
  16252. + val[strlen((const char *)val) - 1] = '\0';
  16253. +
  16254. + result= (STR2->getText(STR2))->factory->newRaw((STR2->getText(STR2))->factory);
  16255. + result->append8(result, "f.");
  16256. + result->appendS(result, (STRTAG3->getText(STRTAG3))->toUTF8((STRTAG3->getText(STRTAG3))));
  16257. + result->append8(result, " LIKE '%");
  16258. + result->append8(result, sqlite3_mprintf("%q", (const char *)val));
  16259. + result->append8(result, "%'");
  16260. +
  16261. + }
  16262. +
  16263. + }
  16264. + break;
  16265. + case 5:
  16266. + // SMARTPL2SQL.g:103:4: STRTAG IS STR
  16267. + {
  16268. + STRTAG5 = (pANTLR3_BASE_TREE) MATCHT(STRTAG, &FOLLOW_STRTAG_in_expression176);
  16269. + if (HASEXCEPTION())
  16270. + {
  16271. + goto ruleexpressionEx;
  16272. + }
  16273. +
  16274. + MATCHT(IS, &FOLLOW_IS_in_expression178);
  16275. + if (HASEXCEPTION())
  16276. + {
  16277. + goto ruleexpressionEx;
  16278. + }
  16279. +
  16280. + STR4 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expression180);
  16281. + if (HASEXCEPTION())
  16282. + {
  16283. + goto ruleexpressionEx;
  16284. + }
  16285. +
  16286. + {
  16287. +
  16288. + pANTLR3_UINT8 val;
  16289. + val = (STR4->getText(STR4))->toUTF8((STR4->getText(STR4)))->chars;
  16290. + val++;
  16291. + val[strlen((const char *)val) - 1] = '\0';
  16292. +
  16293. + result= (STR4->getText(STR4))->factory->newRaw((STR4->getText(STR4))->factory);
  16294. + result->append8(result, "f.");
  16295. + result->appendS(result, (STRTAG5->getText(STRTAG5))->toUTF8((STRTAG5->getText(STRTAG5))));
  16296. + result->append8(result, " LIKE '");
  16297. + result->append8(result, sqlite3_mprintf("%q", (const char *)val));
  16298. + result->append8(result, "'");
  16299. +
  16300. + }
  16301. +
  16302. + }
  16303. + break;
  16304. + case 6:
  16305. + // SMARTPL2SQL.g:117:4: INTTAG INTBOOL INT
  16306. + {
  16307. + INTTAG6 = (pANTLR3_BASE_TREE) MATCHT(INTTAG, &FOLLOW_INTTAG_in_expression189);
  16308. + if (HASEXCEPTION())
  16309. + {
  16310. + goto ruleexpressionEx;
  16311. + }
  16312. +
  16313. + INTBOOL7 = (pANTLR3_BASE_TREE) MATCHT(INTBOOL, &FOLLOW_INTBOOL_in_expression191);
  16314. + if (HASEXCEPTION())
  16315. + {
  16316. + goto ruleexpressionEx;
  16317. + }
  16318. +
  16319. + INT8 = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_expression193);
  16320. + if (HASEXCEPTION())
  16321. + {
  16322. + goto ruleexpressionEx;
  16323. + }
  16324. +
  16325. + {
  16326. +
  16327. + result= (INTTAG6->getText(INTTAG6))->factory->newRaw((INTTAG6->getText(INTTAG6))->factory);
  16328. + result->append8(result, "f.");
  16329. + result->appendS(result, (INTTAG6->getText(INTTAG6))->toUTF8((INTTAG6->getText(INTTAG6))));
  16330. + result->append8(result, " ");
  16331. + result->appendS(result, (INTBOOL7->getText(INTBOOL7))->toUTF8((INTBOOL7->getText(INTBOOL7))));
  16332. + result->append8(result, " ");
  16333. + result->appendS(result, (INT8->getText(INT8))->toUTF8((INT8->getText(INT8))));
  16334. +
  16335. + }
  16336. +
  16337. + }
  16338. + break;
  16339. + case 7:
  16340. + // SMARTPL2SQL.g:127:4: DATETAG AFTER dateval
  16341. + {
  16342. + DATETAG10 = (pANTLR3_BASE_TREE) MATCHT(DATETAG, &FOLLOW_DATETAG_in_expression202);
  16343. + if (HASEXCEPTION())
  16344. + {
  16345. + goto ruleexpressionEx;
  16346. + }
  16347. +
  16348. + MATCHT(AFTER, &FOLLOW_AFTER_in_expression204);
  16349. + if (HASEXCEPTION())
  16350. + {
  16351. + goto ruleexpressionEx;
  16352. + }
  16353. +
  16354. + FOLLOWPUSH(FOLLOW_dateval_in_expression206);
  16355. + dateval9=dateval(ctx);
  16356. +
  16357. + FOLLOWPOP();
  16358. + if (HASEXCEPTION())
  16359. + {
  16360. + goto ruleexpressionEx;
  16361. + }
  16362. +
  16363. + {
  16364. +
  16365. + char str[15];
  16366. + sprintf(str, "%d", dateval9);
  16367. +
  16368. + result= (DATETAG10->getText(DATETAG10))->factory->newRaw((DATETAG10->getText(DATETAG10))->factory);
  16369. + result->append8(result, "f.");
  16370. + result->appendS(result, (DATETAG10->getText(DATETAG10))->toUTF8((DATETAG10->getText(DATETAG10))));
  16371. + result->append8(result, " > ");
  16372. + result->append8(result, str);
  16373. +
  16374. + }
  16375. +
  16376. + }
  16377. + break;
  16378. + case 8:
  16379. + // SMARTPL2SQL.g:138:4: DATETAG BEFORE dateval
  16380. + {
  16381. + DATETAG12 = (pANTLR3_BASE_TREE) MATCHT(DATETAG, &FOLLOW_DATETAG_in_expression215);
  16382. + if (HASEXCEPTION())
  16383. + {
  16384. + goto ruleexpressionEx;
  16385. + }
  16386. +
  16387. + MATCHT(BEFORE, &FOLLOW_BEFORE_in_expression217);
  16388. + if (HASEXCEPTION())
  16389. + {
  16390. + goto ruleexpressionEx;
  16391. + }
  16392. +
  16393. + FOLLOWPUSH(FOLLOW_dateval_in_expression219);
  16394. + dateval11=dateval(ctx);
  16395. +
  16396. + FOLLOWPOP();
  16397. + if (HASEXCEPTION())
  16398. + {
  16399. + goto ruleexpressionEx;
  16400. + }
  16401. +
  16402. + {
  16403. +
  16404. + char str[15];
  16405. + sprintf(str, "%d", dateval11);
  16406. +
  16407. + result= (DATETAG12->getText(DATETAG12))->factory->newRaw((DATETAG12->getText(DATETAG12))->factory);
  16408. + result->append8(result, "f.");
  16409. + result->appendS(result, (DATETAG12->getText(DATETAG12))->toUTF8((DATETAG12->getText(DATETAG12))));
  16410. + result->append8(result, " > ");
  16411. + result->append8(result, str);
  16412. +
  16413. + }
  16414. +
  16415. + }
  16416. + break;
  16417. + case 9:
  16418. + // SMARTPL2SQL.g:149:4: ENUMTAG IS ENUMVAL
  16419. + {
  16420. + ENUMTAG13 = (pANTLR3_BASE_TREE) MATCHT(ENUMTAG, &FOLLOW_ENUMTAG_in_expression228);
  16421. + if (HASEXCEPTION())
  16422. + {
  16423. + goto ruleexpressionEx;
  16424. + }
  16425. +
  16426. + MATCHT(IS, &FOLLOW_IS_in_expression230);
  16427. + if (HASEXCEPTION())
  16428. + {
  16429. + goto ruleexpressionEx;
  16430. + }
  16431. +
  16432. + ENUMVAL14 = (pANTLR3_BASE_TREE) MATCHT(ENUMVAL, &FOLLOW_ENUMVAL_in_expression232);
  16433. + if (HASEXCEPTION())
  16434. + {
  16435. + goto ruleexpressionEx;
  16436. + }
  16437. +
  16438. + {
  16439. +
  16440. + pANTLR3_UINT8 tag;
  16441. + pANTLR3_UINT8 val;
  16442. + char str[20];
  16443. +
  16444. + sprintf(str, "1=1");
  16445. +
  16446. + tag = (ENUMTAG13->getText(ENUMTAG13))->chars;
  16447. + val = (ENUMVAL14->getText(ENUMVAL14))->chars;
  16448. + if (strcmp((char *)tag, "media_kind") == 0)
  16449. + {
  16450. + if (strcmp((char *)val, "music") == 0)
  16451. + {
  16452. + sprintf(str, "f.media_kind = %d", MEDIA_KIND_MUSIC);
  16453. + }
  16454. + else if (strcmp((char *)val, "movie") == 0)
  16455. + {
  16456. + sprintf(str, "f.media_kind = %d", MEDIA_KIND_MOVIE);
  16457. + }
  16458. + else if (strcmp((char *)val, "podcast") == 0)
  16459. + {
  16460. + sprintf(str, "f.media_kind = %d", MEDIA_KIND_PODCAST);
  16461. + }
  16462. + else if (strcmp((char *)val, "audiobook") == 0)
  16463. + {
  16464. + sprintf(str, "f.media_kind = %d", MEDIA_KIND_AUDIOBOOK);
  16465. + }
  16466. + else if (strcmp((char *)val, "tvshow") == 0)
  16467. + {
  16468. + sprintf(str, "f.media_kind = %d", MEDIA_KIND_TVSHOW);
  16469. + }
  16470. + }
  16471. + else if (strcmp((char *)tag, "data_kind") == 0)
  16472. + {
  16473. + if (strcmp((char *)val, "file") == 0)
  16474. + {
  16475. + sprintf(str, "f.data_kind = %d", DATA_KIND_FILE);
  16476. + }
  16477. + else if (strcmp((char *)val, "url") == 0)
  16478. + {
  16479. + sprintf(str, "f.data_kind = %d", DATA_KIND_HTTP);
  16480. + }
  16481. + else if (strcmp((char *)val, "spotify") == 0)
  16482. + {
  16483. + sprintf(str, "f.data_kind = %d", DATA_KIND_SPOTIFY);
  16484. + }
  16485. + else if (strcmp((char *)val, "pipe") == 0)
  16486. + {
  16487. + sprintf(str, "f.data_kind = %d", DATA_KIND_PIPE);
  16488. + }
  16489. + }
  16490. +
  16491. + result= (ENUMTAG13->getText(ENUMTAG13))->factory->newRaw((ENUMTAG13->getText(ENUMTAG13))->factory);
  16492. + result->append8(result, str);
  16493. +
  16494. + }
  16495. +
  16496. + }
  16497. + break;
  16498. +
  16499. + }
  16500. + }
  16501. + }
  16502. +
  16503. +
  16504. + // This is where rules clean up and exit
  16505. + //
  16506. + goto ruleexpressionEx; /* Prevent compiler warnings */
  16507. + ruleexpressionEx: ;
  16508. +
  16509. + if (HASEXCEPTION())
  16510. + {
  16511. + PREPORTERROR();
  16512. + PRECOVER();
  16513. + }
  16514. +
  16515. +
  16516. + return result;
  16517. +}
  16518. +/* $ANTLR end expression */
  16519. +
  16520. +/**
  16521. + * $ANTLR start dateval
  16522. + * SMARTPL2SQL.g:207:1: dateval returns [ int result ] : ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO );
  16523. + */
  16524. +static int
  16525. +dateval(pSMARTPL2SQL ctx)
  16526. +{
  16527. + int result = 0;
  16528. +
  16529. + pANTLR3_BASE_TREE DATE15;
  16530. + pANTLR3_BASE_TREE DATE16;
  16531. + pANTLR3_BASE_TREE DATE18;
  16532. + int interval17;
  16533. + #undef RETURN_TYPE_interval17
  16534. + #define RETURN_TYPE_interval17 int
  16535. +
  16536. + int interval19;
  16537. + #undef RETURN_TYPE_interval19
  16538. + #define RETURN_TYPE_interval19 int
  16539. +
  16540. + int interval20;
  16541. + #undef RETURN_TYPE_interval20
  16542. + #define RETURN_TYPE_interval20 int
  16543. +
  16544. + /* Initialize rule variables
  16545. + */
  16546. +
  16547. +
  16548. + result= 0;
  16549. + DATE15 = NULL;
  16550. + DATE16 = NULL;
  16551. + DATE18 = NULL;
  16552. + interval17 = 0;
  16553. + interval19 = 0;
  16554. + interval20 = 0;
  16555. +
  16556. + {
  16557. + {
  16558. + // SMARTPL2SQL.g:209:2: ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO )
  16559. +
  16560. + ANTLR3_UINT32 alt2;
  16561. +
  16562. + alt2=4;
  16563. +
  16564. + switch ( LA(1) )
  16565. + {
  16566. + case DATE:
  16567. + {
  16568. + alt2=1;
  16569. + }
  16570. + break;
  16571. + case INT:
  16572. + {
  16573. + switch ( LA(2) )
  16574. + {
  16575. + case DATINTERVAL:
  16576. + {
  16577. + switch ( LA(3) )
  16578. + {
  16579. + case AGO:
  16580. + {
  16581. + alt2=4;
  16582. + }
  16583. + break;
  16584. + case BEFORE:
  16585. + {
  16586. + alt2=2;
  16587. + }
  16588. + break;
  16589. + case AFTER:
  16590. + {
  16591. + alt2=3;
  16592. + }
  16593. + break;
  16594. +
  16595. + default:
  16596. + CONSTRUCTEX();
  16597. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  16598. + EXCEPTION->message = (void *)"";
  16599. + EXCEPTION->decisionNum = 2;
  16600. + EXCEPTION->state = 3;
  16601. +
  16602. +
  16603. + goto ruledatevalEx;
  16604. + }
  16605. +
  16606. + }
  16607. + break;
  16608. +
  16609. + default:
  16610. + CONSTRUCTEX();
  16611. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  16612. + EXCEPTION->message = (void *)"";
  16613. + EXCEPTION->decisionNum = 2;
  16614. + EXCEPTION->state = 2;
  16615. +
  16616. +
  16617. + goto ruledatevalEx;
  16618. + }
  16619. +
  16620. + }
  16621. + break;
  16622. +
  16623. + default:
  16624. + CONSTRUCTEX();
  16625. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  16626. + EXCEPTION->message = (void *)"";
  16627. + EXCEPTION->decisionNum = 2;
  16628. + EXCEPTION->state = 0;
  16629. +
  16630. +
  16631. + goto ruledatevalEx;
  16632. + }
  16633. +
  16634. + switch (alt2)
  16635. + {
  16636. + case 1:
  16637. + // SMARTPL2SQL.g:209:4: DATE
  16638. + {
  16639. + DATE15 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval257);
  16640. + if (HASEXCEPTION())
  16641. + {
  16642. + goto ruledatevalEx;
  16643. + }
  16644. +
  16645. + {
  16646. +
  16647. + pANTLR3_UINT8 datval;
  16648. +
  16649. + datval = (DATE15->getText(DATE15))->chars;
  16650. +
  16651. + if (strcmp((char *)datval, "today") == 0)
  16652. + {
  16653. + result= time(NULL);
  16654. + }
  16655. + else if (strcmp((char *)datval, "yesterday") == 0)
  16656. + {
  16657. + result= time(NULL) - 24 * 3600;
  16658. + }
  16659. + else if (strcmp((char *)datval, "last week") == 0)
  16660. + {
  16661. + result= time(NULL) - 24 * 3600 * 7;
  16662. + }
  16663. + else if (strcmp((char *)datval, "last month") == 0)
  16664. + {
  16665. + result= time(NULL) - 24 * 3600 * 30;
  16666. + }
  16667. + else if (strcmp((char *)datval, "last year") == 0)
  16668. + {
  16669. + result= time(NULL) - 24 * 3600 * 365;
  16670. + }
  16671. + else
  16672. + {
  16673. + struct tm tm;
  16674. + char year[5];
  16675. + char month[3];
  16676. + char day[3];
  16677. +
  16678. + memset((void*)&tm,0,sizeof(tm));
  16679. + memset(year, 0, sizeof(year));
  16680. + memset(month, 0, sizeof(month));
  16681. + memset(day, 0, sizeof(day));
  16682. +
  16683. + strncpy(year, (const char *)datval, 4);
  16684. + strncpy(month, (const char *)datval + 5, 2);
  16685. + strncpy(day, (const char *)datval + 8, 2);
  16686. +
  16687. + tm.tm_year = atoi(year) - 1900;
  16688. + tm.tm_mon = atoi(month) - 1;
  16689. + tm.tm_mday = atoi(day);
  16690. +
  16691. + result= mktime(&tm);
  16692. + }
  16693. +
  16694. + }
  16695. +
  16696. + }
  16697. + break;
  16698. + case 2:
  16699. + // SMARTPL2SQL.g:258:4: interval BEFORE DATE
  16700. + {
  16701. + FOLLOWPUSH(FOLLOW_interval_in_dateval266);
  16702. + interval17=interval(ctx);
  16703. +
  16704. + FOLLOWPOP();
  16705. + if (HASEXCEPTION())
  16706. + {
  16707. + goto ruledatevalEx;
  16708. + }
  16709. +
  16710. + MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateval268);
  16711. + if (HASEXCEPTION())
  16712. + {
  16713. + goto ruledatevalEx;
  16714. + }
  16715. +
  16716. + DATE16 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval270);
  16717. + if (HASEXCEPTION())
  16718. + {
  16719. + goto ruledatevalEx;
  16720. + }
  16721. +
  16722. + {
  16723. +
  16724. + pANTLR3_UINT8 datval;
  16725. +
  16726. + datval = (DATE16->getText(DATE16))->chars;
  16727. +
  16728. + if (strcmp((char *)datval, "yesterday") == 0)
  16729. + {
  16730. + result= time(NULL) - 24 * 3600;
  16731. + }
  16732. + else if (strcmp((char *)datval, "last week") == 0)
  16733. + {
  16734. + result= time(NULL) - 24 * 3600 * 7;
  16735. + }
  16736. + else if (strcmp((char *)datval, "last month") == 0)
  16737. + {
  16738. + result= time(NULL) - 24 * 3600 * 30;
  16739. + }
  16740. + else if (strcmp((char *)datval, "last year") == 0)
  16741. + {
  16742. + result= time(NULL) - 24 * 3600 * 365;
  16743. + }
  16744. + else
  16745. + {
  16746. + result= time(NULL);
  16747. + }
  16748. +
  16749. + result= result - interval17;
  16750. +
  16751. + }
  16752. +
  16753. + }
  16754. + break;
  16755. + case 3:
  16756. + // SMARTPL2SQL.g:287:4: interval AFTER DATE
  16757. + {
  16758. + FOLLOWPUSH(FOLLOW_interval_in_dateval279);
  16759. + interval19=interval(ctx);
  16760. +
  16761. + FOLLOWPOP();
  16762. + if (HASEXCEPTION())
  16763. + {
  16764. + goto ruledatevalEx;
  16765. + }
  16766. +
  16767. + MATCHT(AFTER, &FOLLOW_AFTER_in_dateval281);
  16768. + if (HASEXCEPTION())
  16769. + {
  16770. + goto ruledatevalEx;
  16771. + }
  16772. +
  16773. + DATE18 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval283);
  16774. + if (HASEXCEPTION())
  16775. + {
  16776. + goto ruledatevalEx;
  16777. + }
  16778. +
  16779. + {
  16780. +
  16781. + pANTLR3_UINT8 datval;
  16782. +
  16783. + datval = (DATE18->getText(DATE18))->chars;
  16784. +
  16785. + if (strcmp((char *)datval, "yesterday") == 0)
  16786. + {
  16787. + result= time(NULL) - 24 * 3600;
  16788. + }
  16789. + else if (strcmp((char *)datval, "last week") == 0)
  16790. + {
  16791. + result= time(NULL) - 24 * 3600 * 7;
  16792. + }
  16793. + else if (strcmp((char *)datval, "last month") == 0)
  16794. + {
  16795. + result= time(NULL) - 24 * 3600 * 30;
  16796. + }
  16797. + else if (strcmp((char *)datval, "last year") == 0)
  16798. + {
  16799. + result= time(NULL) - 24 * 3600 * 365;
  16800. + }
  16801. + else
  16802. + {
  16803. + result= time(NULL);
  16804. + }
  16805. +
  16806. + result= result + interval19;
  16807. +
  16808. + }
  16809. +
  16810. + }
  16811. + break;
  16812. + case 4:
  16813. + // SMARTPL2SQL.g:316:4: interval AGO
  16814. + {
  16815. + FOLLOWPUSH(FOLLOW_interval_in_dateval292);
  16816. + interval20=interval(ctx);
  16817. +
  16818. + FOLLOWPOP();
  16819. + if (HASEXCEPTION())
  16820. + {
  16821. + goto ruledatevalEx;
  16822. + }
  16823. +
  16824. + MATCHT(AGO, &FOLLOW_AGO_in_dateval294);
  16825. + if (HASEXCEPTION())
  16826. + {
  16827. + goto ruledatevalEx;
  16828. + }
  16829. +
  16830. + {
  16831. +
  16832. + result= time(NULL) - interval20;
  16833. +
  16834. + }
  16835. +
  16836. + }
  16837. + break;
  16838. +
  16839. + }
  16840. + }
  16841. + }
  16842. +
  16843. +
  16844. + // This is where rules clean up and exit
  16845. + //
  16846. + goto ruledatevalEx; /* Prevent compiler warnings */
  16847. + ruledatevalEx: ;
  16848. +
  16849. + if (HASEXCEPTION())
  16850. + {
  16851. + PREPORTERROR();
  16852. + PRECOVER();
  16853. + }
  16854. +
  16855. +
  16856. + return result;
  16857. +}
  16858. +/* $ANTLR end dateval */
  16859. +
  16860. +/**
  16861. + * $ANTLR start interval
  16862. + * SMARTPL2SQL.g:322:1: interval returns [ int result ] : INT DATINTERVAL ;
  16863. + */
  16864. +static int
  16865. +interval(pSMARTPL2SQL ctx)
  16866. +{
  16867. + int result = 0;
  16868. +
  16869. + pANTLR3_BASE_TREE INT21;
  16870. + pANTLR3_BASE_TREE DATINTERVAL22;
  16871. +
  16872. + /* Initialize rule variables
  16873. + */
  16874. +
  16875. +
  16876. + result= 0;
  16877. + INT21 = NULL;
  16878. + DATINTERVAL22 = NULL;
  16879. +
  16880. + {
  16881. + // SMARTPL2SQL.g:324:2: ( INT DATINTERVAL )
  16882. + // SMARTPL2SQL.g:324:4: INT DATINTERVAL
  16883. + {
  16884. + INT21 = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_interval318);
  16885. + if (HASEXCEPTION())
  16886. + {
  16887. + goto ruleintervalEx;
  16888. + }
  16889. +
  16890. + DATINTERVAL22 = (pANTLR3_BASE_TREE) MATCHT(DATINTERVAL, &FOLLOW_DATINTERVAL_in_interval320);
  16891. + if (HASEXCEPTION())
  16892. + {
  16893. + goto ruleintervalEx;
  16894. + }
  16895. +
  16896. + {
  16897. +
  16898. + pANTLR3_UINT8 interval;
  16899. +
  16900. + result= atoi((const char *)(INT21->getText(INT21))->chars);
  16901. + interval = (DATINTERVAL22->getText(DATINTERVAL22))->chars;
  16902. +
  16903. + if (strcmp((char *)interval, "days") == 0)
  16904. + {
  16905. + result= result * 24 * 3600;
  16906. + }
  16907. + else if (strcmp((char *)interval, "weeks") == 0)
  16908. + {
  16909. + result= result * 24 * 3600 * 7;
  16910. + }
  16911. + else if (strcmp((char *)interval, "months") == 0)
  16912. + {
  16913. + result= result * 24 * 3600 * 30;
  16914. + }
  16915. + else if (strcmp((char *)interval, "weeks") == 0)
  16916. + {
  16917. + result= result * 24 * 3600 * 365;
  16918. + }
  16919. + else
  16920. + {
  16921. + result= 0;
  16922. + }
  16923. +
  16924. + }
  16925. +
  16926. + }
  16927. +
  16928. + }
  16929. +
  16930. +
  16931. + // This is where rules clean up and exit
  16932. + //
  16933. + goto ruleintervalEx; /* Prevent compiler warnings */
  16934. + ruleintervalEx: ;
  16935. +
  16936. + if (HASEXCEPTION())
  16937. + {
  16938. + PREPORTERROR();
  16939. + PRECOVER();
  16940. + }
  16941. +
  16942. +
  16943. + return result;
  16944. +}
  16945. +/* $ANTLR end interval */
  16946. +/* End of parsing rules
  16947. + * ==============================================
  16948. + */
  16949. +
  16950. +/* ==============================================
  16951. + * Syntactic predicates
  16952. + */
  16953. +/* End of syntactic predicates
  16954. + * ==============================================
  16955. + */
  16956. +
  16957. +
  16958. +
  16959. +
  16960. +
  16961. +
  16962. +/* End of code
  16963. + * =============================================================================
  16964. + */
  16965. diff --git a/src/pregen/SMARTPL2SQL.h b/src/pregen/SMARTPL2SQL.h
  16966. new file mode 100644
  16967. index 0000000..8e06de7
  16968. --- /dev/null
  16969. +++ b/src/pregen/SMARTPL2SQL.h
  16970. @@ -0,0 +1,220 @@
  16971. +/** \file
  16972. + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
  16973. + *
  16974. + * - From the grammar source file : SMARTPL2SQL.g
  16975. + * - On : 2016-01-01 12:23:44
  16976. + * - for the tree parser : SMARTPL2SQLTreeParser *
  16977. + * Editing it, at least manually, is not wise.
  16978. + *
  16979. + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
  16980. + *
  16981. + *
  16982. + * The tree parser SMARTPL2SQL has the callable functions (rules) shown below,
  16983. + * which will invoke the code for the associated rule in the source grammar
  16984. + * assuming that the input stream is pointing to a token/text stream that could begin
  16985. + * this rule.
  16986. + *
  16987. + * For instance if you call the first (topmost) rule in a parser grammar, you will
  16988. + * get the results of a full parse, but calling a rule half way through the grammar will
  16989. + * allow you to pass part of a full token stream to the parser, such as for syntax checking
  16990. + * in editors and so on.
  16991. + *
  16992. + * The parser entry points are called indirectly (by function pointer to function) via
  16993. + * a parser context typedef pSMARTPL2SQL, which is returned from a call to SMARTPL2SQLNew().
  16994. + *
  16995. + * The methods in pSMARTPL2SQL are as follows:
  16996. + *
  16997. + * - SMARTPL2SQL_playlist_return pSMARTPL2SQL->playlist(pSMARTPL2SQL)
  16998. + * - pANTLR3_STRING pSMARTPL2SQL->expression(pSMARTPL2SQL)
  16999. + * - int pSMARTPL2SQL->dateval(pSMARTPL2SQL)
  17000. + * - int pSMARTPL2SQL->interval(pSMARTPL2SQL)
  17001. + *
  17002. + * The return type for any particular rule is of course determined by the source
  17003. + * grammar file.
  17004. + */
  17005. +// [The "BSD licence"]
  17006. +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
  17007. +// http://www.temporal-wave.com
  17008. +// http://www.linkedin.com/in/jimidle
  17009. +//
  17010. +// All rights reserved.
  17011. +//
  17012. +// Redistribution and use in source and binary forms, with or without
  17013. +// modification, are permitted provided that the following conditions
  17014. +// are met:
  17015. +// 1. Redistributions of source code must retain the above copyright
  17016. +// notice, this list of conditions and the following disclaimer.
  17017. +// 2. Redistributions in binary form must reproduce the above copyright
  17018. +// notice, this list of conditions and the following disclaimer in the
  17019. +// documentation and/or other materials provided with the distribution.
  17020. +// 3. The name of the author may not be used to endorse or promote products
  17021. +// derived from this software without specific prior written permission.
  17022. +//
  17023. +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  17024. +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  17025. +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  17026. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  17027. +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  17028. +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  17029. +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  17030. +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  17031. +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  17032. +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  17033. +
  17034. +#ifndef _SMARTPL2SQL_H
  17035. +#define _SMARTPL2SQL_H
  17036. +/* =============================================================================
  17037. + * Standard antlr3 C runtime definitions
  17038. + */
  17039. +#include <antlr3.h>
  17040. +
  17041. +/* End of standard antlr 3 runtime definitions
  17042. + * =============================================================================
  17043. + */
  17044. +
  17045. +#ifdef __cplusplus
  17046. +extern "C" {
  17047. +#endif
  17048. +
  17049. +// Forward declare the context typedef so that we can use it before it is
  17050. +// properly defined. Delegators and delegates (from import statements) are
  17051. +// interdependent and their context structures contain pointers to each other
  17052. +// C only allows such things to be declared if you pre-declare the typedef.
  17053. +//
  17054. +typedef struct SMARTPL2SQL_Ctx_struct SMARTPL2SQL, * pSMARTPL2SQL;
  17055. +
  17056. +
  17057. +
  17058. + #include <stdio.h>
  17059. + #include <stdlib.h>
  17060. + #include <string.h>
  17061. + #include <limits.h>
  17062. + #include <errno.h>
  17063. + #include <time.h>
  17064. + #include <sqlite3.h>
  17065. +
  17066. + #include "logger.h"
  17067. + #include "db.h"
  17068. +
  17069. +
  17070. +#ifdef ANTLR3_WINDOWS
  17071. +// Disable: Unreferenced parameter, - Rules with parameters that are not used
  17072. +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
  17073. +// initialized but unused variable - tree rewrite variables declared but not needed
  17074. +// Unreferenced local variable - lexer rule declares but does not always use _type
  17075. +// potentially unitialized variable used - retval always returned from a rule
  17076. +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
  17077. +//
  17078. +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
  17079. +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
  17080. +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
  17081. +// this is a matter of orthogonality hence I disable that one.
  17082. +//
  17083. +#pragma warning( disable : 4100 )
  17084. +#pragma warning( disable : 4101 )
  17085. +#pragma warning( disable : 4127 )
  17086. +#pragma warning( disable : 4189 )
  17087. +#pragma warning( disable : 4505 )
  17088. +#pragma warning( disable : 4701 )
  17089. +#endif
  17090. +typedef struct SMARTPL2SQL_playlist_return_struct
  17091. +{
  17092. + pANTLR3_BASE_TREE start;
  17093. + pANTLR3_BASE_TREE stop;
  17094. + pANTLR3_STRING title;
  17095. + pANTLR3_STRING query;
  17096. +}
  17097. + SMARTPL2SQL_playlist_return;
  17098. +
  17099. +
  17100. +
  17101. +/** Context tracking structure for SMARTPL2SQL
  17102. + */
  17103. +struct SMARTPL2SQL_Ctx_struct
  17104. +{
  17105. + /** Built in ANTLR3 context tracker contains all the generic elements
  17106. + * required for context tracking.
  17107. + */
  17108. + pANTLR3_TREE_PARSER pTreeParser;
  17109. +
  17110. +
  17111. + SMARTPL2SQL_playlist_return (*playlist) (struct SMARTPL2SQL_Ctx_struct * ctx);
  17112. + pANTLR3_STRING (*expression) (struct SMARTPL2SQL_Ctx_struct * ctx);
  17113. + int (*dateval) (struct SMARTPL2SQL_Ctx_struct * ctx);
  17114. + int (*interval) (struct SMARTPL2SQL_Ctx_struct * ctx);
  17115. + // Delegated rules
  17116. + const char * (*getGrammarFileName)();
  17117. + void (*free) (struct SMARTPL2SQL_Ctx_struct * ctx);
  17118. +
  17119. +};
  17120. +
  17121. +// Function protoypes for the constructor functions that external translation units
  17122. +// such as delegators and delegates may wish to call.
  17123. +//
  17124. +ANTLR3_API pSMARTPL2SQL SMARTPL2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream);
  17125. +ANTLR3_API pSMARTPL2SQL SMARTPL2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
  17126. +
  17127. +/** Symbolic definitions of all the tokens that the tree parser will work with.
  17128. + * \{
  17129. + *
  17130. + * Antlr will define EOF, but we can't use that as it it is too common in
  17131. + * in C header files and that would be confusing. There is no way to filter this out at the moment
  17132. + * so we just undef it here for now. That isn't the value we get back from C recognizers
  17133. + * anyway. We are looking for ANTLR3_TOKEN_EOF.
  17134. + */
  17135. +#ifdef EOF
  17136. +#undef EOF
  17137. +#endif
  17138. +#ifdef Tokens
  17139. +#undef Tokens
  17140. +#endif
  17141. +#define INTBOOL 14
  17142. +#define STRTAG 10
  17143. +#define AGO 22
  17144. +#define WHITESPACE 29
  17145. +#define GREATEREQUAL 25
  17146. +#define BEFORE 18
  17147. +#define DATETAG 16
  17148. +#define INT 15
  17149. +#define NOT 7
  17150. +#define AFTER 17
  17151. +#define AND 6
  17152. +#define EOF -1
  17153. +#define INCLUDES 11
  17154. +#define STR 4
  17155. +#define T__30 30
  17156. +#define T__31 31
  17157. +#define GREATER 24
  17158. +#define LPAR 8
  17159. +#define ENUMTAG 19
  17160. +#define IS 12
  17161. +#define ENUMVAL 20
  17162. +#define EQUAL 28
  17163. +#define OR 5
  17164. +#define LESS 26
  17165. +#define RPAR 9
  17166. +#define DATE 21
  17167. +#define LESSEQUAL 27
  17168. +#define INTTAG 13
  17169. +#define DATINTERVAL 23
  17170. +#ifdef EOF
  17171. +#undef EOF
  17172. +#define EOF ANTLR3_TOKEN_EOF
  17173. +#endif
  17174. +
  17175. +#ifndef TOKENSOURCE
  17176. +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
  17177. +#endif
  17178. +
  17179. +/* End of token definitions for SMARTPL2SQL
  17180. + * =============================================================================
  17181. + */
  17182. +/** \} */
  17183. +
  17184. +#ifdef __cplusplus
  17185. +}
  17186. +#endif
  17187. +
  17188. +#endif
  17189. +
  17190. +/* END - Note:Keep extra line feed to satisfy UNIX systems */
  17191. diff --git a/src/pregen/SMARTPL2SQL.u b/src/pregen/SMARTPL2SQL.u
  17192. new file mode 100644
  17193. index 0000000..85567d1
  17194. --- /dev/null
  17195. +++ b/src/pregen/SMARTPL2SQL.u
  17196. @@ -0,0 +1,5 @@
  17197. +SMARTPL2SQL.g: SMARTPL.tokens
  17198. +SMARTPL2SQL.c : SMARTPL2SQL.g
  17199. +./SMARTPL2SQL.tokens : SMARTPL2SQL.g
  17200. +SMARTPL2SQL.h : SMARTPL2SQL.g
  17201. +ANTLR_PRODUCTS += SMARTPL2SQL.c ./SMARTPL2SQL.tokens SMARTPL2SQL.h
  17202. \ No newline at end of file
  17203. diff --git a/src/pregen/SMARTPLLexer.c b/src/pregen/SMARTPLLexer.c
  17204. new file mode 100644
  17205. index 0000000..91d6e99
  17206. --- /dev/null
  17207. +++ b/src/pregen/SMARTPLLexer.c
  17208. @@ -0,0 +1,4168 @@
  17209. +/** \file
  17210. + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
  17211. + *
  17212. + * - From the grammar source file : SMARTPL.g
  17213. + * - On : 2016-01-01 12:23:40
  17214. + * - for the lexer : SMARTPLLexerLexer *
  17215. + * Editing it, at least manually, is not wise.
  17216. + *
  17217. + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
  17218. + *
  17219. + *
  17220. +*/
  17221. +// [The "BSD licence"]
  17222. +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
  17223. +// http://www.temporal-wave.com
  17224. +// http://www.linkedin.com/in/jimidle
  17225. +//
  17226. +// All rights reserved.
  17227. +//
  17228. +// Redistribution and use in source and binary forms, with or without
  17229. +// modification, are permitted provided that the following conditions
  17230. +// are met:
  17231. +// 1. Redistributions of source code must retain the above copyright
  17232. +// notice, this list of conditions and the following disclaimer.
  17233. +// 2. Redistributions in binary form must reproduce the above copyright
  17234. +// notice, this list of conditions and the following disclaimer in the
  17235. +// documentation and/or other materials provided with the distribution.
  17236. +// 3. The name of the author may not be used to endorse or promote products
  17237. +// derived from this software without specific prior written permission.
  17238. +//
  17239. +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  17240. +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  17241. +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  17242. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  17243. +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  17244. +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  17245. +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  17246. +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  17247. +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  17248. +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  17249. +
  17250. +/* -----------------------------------------
  17251. + * Include the ANTLR3 generated header file.
  17252. + */
  17253. +#include "SMARTPLLexer.h"
  17254. +/* ----------------------------------------- */
  17255. +
  17256. +
  17257. +/** String literals used by SMARTPLLexer that we must do things like MATCHS() with.
  17258. + * C will normally just lay down 8 bit characters, and you can use L"xxx" to
  17259. + * get wchar_t, but wchar_t is 16 bits on Windows, which is not UTF32 and so
  17260. + * we perform this little trick of defining the literals as arrays of UINT32
  17261. + * and passing in the address of these.
  17262. + */
  17263. +static ANTLR3_UCHAR lit_1[] = { 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, ANTLR3_STRING_TERMINATOR};
  17264. +static ANTLR3_UCHAR lit_2[] = { 0x61, 0x6C, 0x62, 0x75, 0x6D, 0x5F, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, ANTLR3_STRING_TERMINATOR};
  17265. +static ANTLR3_UCHAR lit_3[] = { 0x61, 0x6C, 0x62, 0x75, 0x6D, ANTLR3_STRING_TERMINATOR};
  17266. +static ANTLR3_UCHAR lit_4[] = { 0x74, 0x69, 0x74, 0x6C, 0x65, ANTLR3_STRING_TERMINATOR};
  17267. +static ANTLR3_UCHAR lit_5[] = { 0x67, 0x65, 0x6E, 0x72, 0x65, ANTLR3_STRING_TERMINATOR};
  17268. +static ANTLR3_UCHAR lit_6[] = { 0x63, 0x6F, 0x6D, 0x70, 0x6F, 0x73, 0x65, 0x72, ANTLR3_STRING_TERMINATOR};
  17269. +static ANTLR3_UCHAR lit_7[] = { 0x70, 0x61, 0x74, 0x68, ANTLR3_STRING_TERMINATOR};
  17270. +static ANTLR3_UCHAR lit_8[] = { 0x74, 0x79, 0x70, 0x65, ANTLR3_STRING_TERMINATOR};
  17271. +static ANTLR3_UCHAR lit_9[] = { 0x67, 0x72, 0x6F, 0x75, 0x70, 0x69, 0x6E, 0x67, ANTLR3_STRING_TERMINATOR};
  17272. +static ANTLR3_UCHAR lit_10[] = { 0x70, 0x6C, 0x61, 0x79, 0x5F, 0x63, 0x6F, 0x75, 0x6E, 0x74, ANTLR3_STRING_TERMINATOR};
  17273. +static ANTLR3_UCHAR lit_11[] = { 0x72, 0x61, 0x74, 0x69, 0x6E, 0x67, ANTLR3_STRING_TERMINATOR};
  17274. +static ANTLR3_UCHAR lit_12[] = { 0x79, 0x65, 0x61, 0x72, ANTLR3_STRING_TERMINATOR};
  17275. +static ANTLR3_UCHAR lit_13[] = { 0x63, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x61, 0x74, 0x69, 0x6F, 0x6E, ANTLR3_STRING_TERMINATOR};
  17276. +static ANTLR3_UCHAR lit_14[] = { 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x61, 0x64, 0x64, 0x65, 0x64, ANTLR3_STRING_TERMINATOR};
  17277. +static ANTLR3_UCHAR lit_15[] = { 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x70, 0x6C, 0x61, 0x79, 0x65, 0x64, ANTLR3_STRING_TERMINATOR};
  17278. +static ANTLR3_UCHAR lit_16[] = { 0x64, 0x61, 0x74, 0x61, 0x5F, 0x6B, 0x69, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR};
  17279. +static ANTLR3_UCHAR lit_17[] = { 0x6D, 0x65, 0x64, 0x69, 0x61, 0x5F, 0x6B, 0x69, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR};
  17280. +static ANTLR3_UCHAR lit_18[] = { 0x69, 0x6E, 0x63, 0x6C, 0x75, 0x64, 0x65, 0x73, ANTLR3_STRING_TERMINATOR};
  17281. +static ANTLR3_UCHAR lit_19[] = { 0x69, 0x73, ANTLR3_STRING_TERMINATOR};
  17282. +static ANTLR3_UCHAR lit_20[] = { 0x3E, 0x3D, ANTLR3_STRING_TERMINATOR};
  17283. +static ANTLR3_UCHAR lit_21[] = { 0x3C, 0x3D, ANTLR3_STRING_TERMINATOR};
  17284. +static ANTLR3_UCHAR lit_22[] = { 0x61, 0x66, 0x74, 0x65, 0x72, ANTLR3_STRING_TERMINATOR};
  17285. +static ANTLR3_UCHAR lit_23[] = { 0x62, 0x65, 0x66, 0x6F, 0x72, 0x65, ANTLR3_STRING_TERMINATOR};
  17286. +static ANTLR3_UCHAR lit_24[] = { 0x61, 0x67, 0x6F, ANTLR3_STRING_TERMINATOR};
  17287. +static ANTLR3_UCHAR lit_25[] = { 0x41, 0x4E, 0x44, ANTLR3_STRING_TERMINATOR};
  17288. +static ANTLR3_UCHAR lit_26[] = { 0x61, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR};
  17289. +static ANTLR3_UCHAR lit_27[] = { 0x4F, 0x52, ANTLR3_STRING_TERMINATOR};
  17290. +static ANTLR3_UCHAR lit_28[] = { 0x6F, 0x72, ANTLR3_STRING_TERMINATOR};
  17291. +static ANTLR3_UCHAR lit_29[] = { 0x4E, 0x4F, 0x54, ANTLR3_STRING_TERMINATOR};
  17292. +static ANTLR3_UCHAR lit_30[] = { 0x6E, 0x6F, 0x74, ANTLR3_STRING_TERMINATOR};
  17293. +static ANTLR3_UCHAR lit_31[] = { 0x74, 0x6F, 0x64, 0x61, 0x79, ANTLR3_STRING_TERMINATOR};
  17294. +static ANTLR3_UCHAR lit_32[] = { 0x79, 0x65, 0x73, 0x74, 0x65, 0x72, 0x64, 0x61, 0x79, ANTLR3_STRING_TERMINATOR};
  17295. +static ANTLR3_UCHAR lit_33[] = { 0x6C, 0x61, 0x73, 0x74, 0x20, 0x77, 0x65, 0x65, 0x6B, ANTLR3_STRING_TERMINATOR};
  17296. +static ANTLR3_UCHAR lit_34[] = { 0x6C, 0x61, 0x73, 0x74, 0x20, 0x6D, 0x6F, 0x6E, 0x74, 0x68, ANTLR3_STRING_TERMINATOR};
  17297. +static ANTLR3_UCHAR lit_35[] = { 0x6C, 0x61, 0x73, 0x74, 0x20, 0x79, 0x65, 0x61, 0x72, ANTLR3_STRING_TERMINATOR};
  17298. +static ANTLR3_UCHAR lit_36[] = { 0x64, 0x61, 0x79, 0x73, ANTLR3_STRING_TERMINATOR};
  17299. +static ANTLR3_UCHAR lit_37[] = { 0x77, 0x65, 0x65, 0x6B, 0x73, ANTLR3_STRING_TERMINATOR};
  17300. +static ANTLR3_UCHAR lit_38[] = { 0x6D, 0x6F, 0x6E, 0x74, 0x68, 0x73, ANTLR3_STRING_TERMINATOR};
  17301. +static ANTLR3_UCHAR lit_39[] = { 0x79, 0x65, 0x61, 0x72, 0x73, ANTLR3_STRING_TERMINATOR};
  17302. +static ANTLR3_UCHAR lit_40[] = { 0x6D, 0x75, 0x73, 0x69, 0x63, ANTLR3_STRING_TERMINATOR};
  17303. +static ANTLR3_UCHAR lit_41[] = { 0x6D, 0x6F, 0x76, 0x69, 0x65, ANTLR3_STRING_TERMINATOR};
  17304. +static ANTLR3_UCHAR lit_42[] = { 0x70, 0x6F, 0x64, 0x63, 0x61, 0x73, 0x74, ANTLR3_STRING_TERMINATOR};
  17305. +static ANTLR3_UCHAR lit_43[] = { 0x61, 0x75, 0x64, 0x69, 0x6F, 0x62, 0x6F, 0x6F, 0x6B, ANTLR3_STRING_TERMINATOR};
  17306. +static ANTLR3_UCHAR lit_44[] = { 0x74, 0x76, 0x73, 0x68, 0x6F, 0x77, ANTLR3_STRING_TERMINATOR};
  17307. +static ANTLR3_UCHAR lit_45[] = { 0x66, 0x69, 0x6C, 0x65, ANTLR3_STRING_TERMINATOR};
  17308. +static ANTLR3_UCHAR lit_46[] = { 0x75, 0x72, 0x6C, ANTLR3_STRING_TERMINATOR};
  17309. +static ANTLR3_UCHAR lit_47[] = { 0x73, 0x70, 0x6F, 0x74, 0x69, 0x66, 0x79, ANTLR3_STRING_TERMINATOR};
  17310. +static ANTLR3_UCHAR lit_48[] = { 0x70, 0x69, 0x70, 0x65, ANTLR3_STRING_TERMINATOR};
  17311. +
  17312. +
  17313. +
  17314. +
  17315. +/* MACROS that hide the C interface implementations from the
  17316. + * generated code, which makes it a little more understandable to the human eye.
  17317. + * I am very much against using C pre-processor macros for function calls and bits
  17318. + * of code as you cannot see what is happening when single stepping in debuggers
  17319. + * and so on. The exception (in my book at least) is for generated code, where you are
  17320. + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
  17321. + * hides some indirect calls, but is always referring to the input stream. This is
  17322. + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
  17323. + * the runtime interfaces without changing the generated code too often, without
  17324. + * confusing the reader of the generated output, who may not wish to know the gory
  17325. + * details of the interface inheritance.
  17326. + */
  17327. +
  17328. +#define CTX ctx
  17329. +
  17330. +/* Aids in accessing scopes for grammar programmers
  17331. + */
  17332. +#undef SCOPE_TYPE
  17333. +#undef SCOPE_STACK
  17334. +#undef SCOPE_TOP
  17335. +#define SCOPE_TYPE(scope) pSMARTPLLexer_##scope##_SCOPE
  17336. +#define SCOPE_STACK(scope) pSMARTPLLexer_##scope##Stack
  17337. +#define SCOPE_TOP(scope) ctx->pSMARTPLLexer_##scope##Top
  17338. +#define SCOPE_SIZE(scope) ctx->pSMARTPLLexer_##scope##Stack_limit
  17339. +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
  17340. +
  17341. +
  17342. +/* Macros for accessing things in a lexer
  17343. + */
  17344. +#undef LEXER
  17345. +#undef RECOGNIZER
  17346. +#undef RULEMEMO
  17347. +#undef GETCHARINDEX
  17348. +#undef GETLINE
  17349. +#undef GETCHARPOSITIONINLINE
  17350. +#undef EMIT
  17351. +#undef EMITNEW
  17352. +#undef MATCHC
  17353. +#undef MATCHS
  17354. +#undef MATCHRANGE
  17355. +#undef LTOKEN
  17356. +#undef HASFAILED
  17357. +#undef FAILEDFLAG
  17358. +#undef INPUT
  17359. +#undef STRSTREAM
  17360. +#undef LA
  17361. +#undef HASEXCEPTION
  17362. +#undef EXCEPTION
  17363. +#undef CONSTRUCTEX
  17364. +#undef CONSUME
  17365. +#undef LRECOVER
  17366. +#undef MARK
  17367. +#undef REWIND
  17368. +#undef REWINDLAST
  17369. +#undef BACKTRACKING
  17370. +#undef MATCHANY
  17371. +#undef MEMOIZE
  17372. +#undef HAVEPARSEDRULE
  17373. +#undef GETTEXT
  17374. +#undef INDEX
  17375. +#undef SEEK
  17376. +#undef PUSHSTREAM
  17377. +#undef POPSTREAM
  17378. +#undef SETTEXT
  17379. +#undef SETTEXT8
  17380. +
  17381. +#define LEXER ctx->pLexer
  17382. +#define RECOGNIZER LEXER->rec
  17383. +#define LEXSTATE RECOGNIZER->state
  17384. +#define TOKSOURCE LEXSTATE->tokSource
  17385. +#define GETCHARINDEX() LEXER->getCharIndex(LEXER)
  17386. +#define GETLINE() LEXER->getLine(LEXER)
  17387. +#define GETTEXT() LEXER->getText(LEXER)
  17388. +#define GETCHARPOSITIONINLINE() LEXER->getCharPositionInLine(LEXER)
  17389. +#define EMIT() LEXSTATE->type = _type; LEXER->emit(LEXER)
  17390. +#define EMITNEW(t) LEXER->emitNew(LEXER, t)
  17391. +#define MATCHC(c) LEXER->matchc(LEXER, c)
  17392. +#define MATCHS(s) LEXER->matchs(LEXER, s)
  17393. +#define MATCHRANGE(c1,c2) LEXER->matchRange(LEXER, c1, c2)
  17394. +#define MATCHANY() LEXER->matchAny(LEXER)
  17395. +#define LTOKEN LEXSTATE->token
  17396. +#define HASFAILED() (LEXSTATE->failed == ANTLR3_TRUE)
  17397. +#define BACKTRACKING LEXSTATE->backtracking
  17398. +#define FAILEDFLAG LEXSTATE->failed
  17399. +#define INPUT LEXER->input
  17400. +#define STRSTREAM INPUT
  17401. +#define ISTREAM INPUT->istream
  17402. +#define INDEX() ISTREAM->index(ISTREAM)
  17403. +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
  17404. +#define EOF_TOKEN &(LEXSTATE->tokSource->eofToken)
  17405. +#define HASEXCEPTION() (LEXSTATE->error == ANTLR3_TRUE)
  17406. +#define EXCEPTION LEXSTATE->exception
  17407. +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
  17408. +#define LRECOVER() LEXER->recover(LEXER)
  17409. +#define MARK() ISTREAM->mark(ISTREAM)
  17410. +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
  17411. +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
  17412. +#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si)
  17413. +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
  17414. +#define PUSHSTREAM(str) LEXER->pushCharStream(LEXER, str)
  17415. +#define POPSTREAM() LEXER->popCharStream(LEXER)
  17416. +#define SETTEXT(str) LEXSTATE->text = str
  17417. +#define SKIP() LEXSTATE->token = &(TOKSOURCE->skipToken)
  17418. +#define USER1 LEXSTATE->user1
  17419. +#define USER2 LEXSTATE->user2
  17420. +#define USER3 LEXSTATE->user3
  17421. +#define CUSTOM LEXSTATE->custom
  17422. +#define RULEMEMO LEXSTATE->ruleMemo
  17423. +#define DBG RECOGNIZER->debugger
  17424. +
  17425. +/* If we have been told we can rely on the standard 8 bit or 16 bit input
  17426. + * stream, then we can define our macros to use the direct pointers
  17427. + * in the input object, which is much faster than indirect calls. This
  17428. + * is really only significant to lexers with a lot of fragment rules (which
  17429. + * do not place LA(1) in a temporary at the moment) and even then
  17430. + * only if there is a lot of input (order of say 1M or so).
  17431. + */
  17432. +#if defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16)
  17433. +
  17434. +# ifdef ANTLR3_INLINE_INPUT_ASCII
  17435. +
  17436. +/* 8 bit "ASCII" (actually any 8 bit character set) */
  17437. +
  17438. +# define NEXTCHAR ((pANTLR3_UINT8)(INPUT->nextChar))
  17439. +# define DATAP ((pANTLR3_UINT8)(INPUT->data))
  17440. +
  17441. +# else
  17442. +
  17443. +# define NEXTCHAR ((pANTLR3_UINT16)(INPUT->nextChar))
  17444. +# define DATAP ((pANTLR3_UINT16)(INPUT->data))
  17445. +
  17446. +# endif
  17447. +
  17448. +# define LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1)))
  17449. +# define CONSUME() \
  17450. +{ \
  17451. + if (NEXTCHAR < (DATAP + INPUT->sizeBuf)) \
  17452. + { \
  17453. + INPUT->charPositionInLine++; \
  17454. + if ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar) \
  17455. + { \
  17456. + INPUT->line++; \
  17457. + INPUT->charPositionInLine = 0; \
  17458. + INPUT->currentLine = (void *)(NEXTCHAR + 1); \
  17459. + } \
  17460. + INPUT->nextChar = (void *)(NEXTCHAR + 1); \
  17461. + } \
  17462. +}
  17463. +
  17464. +#else
  17465. +
  17466. +// Pick up the input character by calling the input stream implementation.
  17467. +//
  17468. +#define CONSUME() INPUT->istream->consume(INPUT->istream)
  17469. +#define LA(n) INPUT->istream->_LA(INPUT->istream, n)
  17470. +
  17471. +#endif
  17472. +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
  17473. +
  17474. +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
  17475. + * then for the present you must use different names for your defines as these are hard coded
  17476. + * in the code generator. It would be better not to use such names internally, and maybe
  17477. + * we can change this in a forthcoming release. I deliberately do not #undef these
  17478. + * here as this will at least give you a redefined error somewhere if they clash.
  17479. + */
  17480. +#define UP ANTLR3_TOKEN_UP
  17481. +#define DOWN ANTLR3_TOKEN_DOWN
  17482. +#define EOR ANTLR3_TOKEN_EOR
  17483. +#define INVALID ANTLR3_TOKEN_INVALID
  17484. +
  17485. +
  17486. +/* =============================================================================
  17487. + * Functions to create and destroy scopes. First come the rule scopes, followed
  17488. + * by the global declared scopes.
  17489. + */
  17490. +
  17491. +
  17492. +
  17493. +/* ============================================================================= */
  17494. +
  17495. +/* =============================================================================
  17496. + * Start of recognizer
  17497. + */
  17498. +
  17499. +
  17500. +/* Forward declare the locally static matching functions we have generated and any predicate functions.
  17501. + */
  17502. +static ANTLR3_INLINE void mT__30 (pSMARTPLLexer ctx);
  17503. +static ANTLR3_INLINE void mT__31 (pSMARTPLLexer ctx);
  17504. +static ANTLR3_INLINE void mSTRTAG (pSMARTPLLexer ctx);
  17505. +static ANTLR3_INLINE void mINTTAG (pSMARTPLLexer ctx);
  17506. +static ANTLR3_INLINE void mDATETAG (pSMARTPLLexer ctx);
  17507. +static ANTLR3_INLINE void mENUMTAG (pSMARTPLLexer ctx);
  17508. +static ANTLR3_INLINE void mINCLUDES (pSMARTPLLexer ctx);
  17509. +static ANTLR3_INLINE void mIS (pSMARTPLLexer ctx);
  17510. +static ANTLR3_INLINE void mINTBOOL (pSMARTPLLexer ctx);
  17511. +static ANTLR3_INLINE void mGREATER (pSMARTPLLexer ctx);
  17512. +static ANTLR3_INLINE void mGREATEREQUAL (pSMARTPLLexer ctx);
  17513. +static ANTLR3_INLINE void mLESS (pSMARTPLLexer ctx);
  17514. +static ANTLR3_INLINE void mLESSEQUAL (pSMARTPLLexer ctx);
  17515. +static ANTLR3_INLINE void mEQUAL (pSMARTPLLexer ctx);
  17516. +static ANTLR3_INLINE void mAFTER (pSMARTPLLexer ctx);
  17517. +static ANTLR3_INLINE void mBEFORE (pSMARTPLLexer ctx);
  17518. +static ANTLR3_INLINE void mAGO (pSMARTPLLexer ctx);
  17519. +static ANTLR3_INLINE void mAND (pSMARTPLLexer ctx);
  17520. +static ANTLR3_INLINE void mOR (pSMARTPLLexer ctx);
  17521. +static ANTLR3_INLINE void mNOT (pSMARTPLLexer ctx);
  17522. +static ANTLR3_INLINE void mLPAR (pSMARTPLLexer ctx);
  17523. +static ANTLR3_INLINE void mRPAR (pSMARTPLLexer ctx);
  17524. +static ANTLR3_INLINE void mDATE (pSMARTPLLexer ctx);
  17525. +static ANTLR3_INLINE void mDATINTERVAL (pSMARTPLLexer ctx);
  17526. +static ANTLR3_INLINE void mENUMVAL (pSMARTPLLexer ctx);
  17527. +static ANTLR3_INLINE void mSTR (pSMARTPLLexer ctx);
  17528. +static ANTLR3_INLINE void mINT (pSMARTPLLexer ctx);
  17529. +static ANTLR3_INLINE void mWHITESPACE (pSMARTPLLexer ctx);
  17530. +static ANTLR3_INLINE void mTokens (pSMARTPLLexer ctx);
  17531. +static void SMARTPLLexerFree(pSMARTPLLexer ctx);
  17532. +
  17533. +/* =========================================================================
  17534. + * Lexer matching rules end.
  17535. + * =========================================================================
  17536. + */
  17537. +
  17538. +
  17539. +
  17540. +static void
  17541. +SMARTPLLexerFree (pSMARTPLLexer ctx)
  17542. +{
  17543. + LEXER->free(LEXER);
  17544. +
  17545. + ANTLR3_FREE(ctx);
  17546. +}
  17547. +
  17548. +/** \brief Name of the grammar file that generated this code
  17549. + */
  17550. +static const char fileName[] = "SMARTPL.g";
  17551. +
  17552. +/** \brief Return the name of the grammar file that generated this code.
  17553. + */
  17554. +static const char * getGrammarFileName()
  17555. +{
  17556. + return fileName;
  17557. +}
  17558. +
  17559. +/** \brief Create a new lexer called SMARTPLLexer
  17560. + *
  17561. + * \param[in] instream Pointer to an initialized input stream
  17562. + * \return
  17563. + * - Success pSMARTPLLexer initialized for the lex start
  17564. + * - Fail NULL
  17565. + */
  17566. +ANTLR3_API pSMARTPLLexer SMARTPLLexerNew
  17567. +(pANTLR3_INPUT_STREAM instream)
  17568. +{
  17569. + // See if we can create a new lexer with the standard constructor
  17570. + //
  17571. + return SMARTPLLexerNewSSD(instream, NULL);
  17572. +}
  17573. +
  17574. +/** \brief Create a new lexer called SMARTPLLexer
  17575. + *
  17576. + * \param[in] instream Pointer to an initialized input stream
  17577. + * \param[state] state Previously created shared recognizer stat
  17578. + * \return
  17579. + * - Success pSMARTPLLexer initialized for the lex start
  17580. + * - Fail NULL
  17581. + */
  17582. +ANTLR3_API pSMARTPLLexer SMARTPLLexerNewSSD
  17583. +(pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
  17584. +{
  17585. + pSMARTPLLexer ctx; // Context structure we will build and return
  17586. +
  17587. + ctx = (pSMARTPLLexer) ANTLR3_CALLOC(1, sizeof(SMARTPLLexer));
  17588. +
  17589. + if (ctx == NULL)
  17590. + {
  17591. + // Failed to allocate memory for lexer context
  17592. + return NULL;
  17593. + }
  17594. +
  17595. + /* -------------------------------------------------------------------
  17596. + * Memory for basic structure is allocated, now to fill in
  17597. + * in base ANTLR3 structures. We initialize the function pointers
  17598. + * for the standard ANTLR3 lexer function set, but upon return
  17599. + * from here, the programmer may set the pointers to provide custom
  17600. + * implementations of each function.
  17601. + *
  17602. + * We don't use the macros defined in SMARTPLLexer.h here so you can get a sense
  17603. + * of what goes where.
  17604. + */
  17605. +
  17606. + /* Create a base lexer, using the supplied input stream
  17607. + */
  17608. + ctx->pLexer = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state);
  17609. +
  17610. + /* Check that we allocated the memory correctly
  17611. + */
  17612. + if (ctx->pLexer == NULL)
  17613. + {
  17614. + ANTLR3_FREE(ctx);
  17615. + return NULL;
  17616. + }
  17617. + /* Install the implementation of our SMARTPLLexer interface
  17618. + */
  17619. + ctx->mT__30 = mT__30;
  17620. + ctx->mT__31 = mT__31;
  17621. + ctx->mSTRTAG = mSTRTAG;
  17622. + ctx->mINTTAG = mINTTAG;
  17623. + ctx->mDATETAG = mDATETAG;
  17624. + ctx->mENUMTAG = mENUMTAG;
  17625. + ctx->mINCLUDES = mINCLUDES;
  17626. + ctx->mIS = mIS;
  17627. + ctx->mINTBOOL = mINTBOOL;
  17628. + ctx->mGREATER = mGREATER;
  17629. + ctx->mGREATEREQUAL = mGREATEREQUAL;
  17630. + ctx->mLESS = mLESS;
  17631. + ctx->mLESSEQUAL = mLESSEQUAL;
  17632. + ctx->mEQUAL = mEQUAL;
  17633. + ctx->mAFTER = mAFTER;
  17634. + ctx->mBEFORE = mBEFORE;
  17635. + ctx->mAGO = mAGO;
  17636. + ctx->mAND = mAND;
  17637. + ctx->mOR = mOR;
  17638. + ctx->mNOT = mNOT;
  17639. + ctx->mLPAR = mLPAR;
  17640. + ctx->mRPAR = mRPAR;
  17641. + ctx->mDATE = mDATE;
  17642. + ctx->mDATINTERVAL = mDATINTERVAL;
  17643. + ctx->mENUMVAL = mENUMVAL;
  17644. + ctx->mSTR = mSTR;
  17645. + ctx->mINT = mINT;
  17646. + ctx->mWHITESPACE = mWHITESPACE;
  17647. + ctx->mTokens = mTokens;
  17648. +
  17649. + /** When the nextToken() call is made to this lexer's pANTLR3_TOKEN_SOURCE
  17650. + * it will call mTokens() in this generated code, and will pass it the ctx
  17651. + * pointer of this lexer, not the context of the base lexer, so store that now.
  17652. + */
  17653. + ctx->pLexer->ctx = ctx;
  17654. +
  17655. + /**Install the token matching function
  17656. + */
  17657. + ctx->pLexer->mTokens = (void (*) (void *))(mTokens);
  17658. +
  17659. + ctx->getGrammarFileName = getGrammarFileName;
  17660. + ctx->free = SMARTPLLexerFree;
  17661. +
  17662. +
  17663. +
  17664. +
  17665. +
  17666. + /* Return the newly built lexer to the caller
  17667. + */
  17668. + return ctx;
  17669. +}
  17670. +
  17671. +
  17672. +/* =========================================================================
  17673. + * Functions to match the lexer grammar defined tokens from the input stream
  17674. + */
  17675. +
  17676. +// Comes from: 7:7: ( '{' )
  17677. +/** \brief Lexer rule generated by ANTLR3
  17678. + *
  17679. + * $ANTLR start T__30
  17680. + *
  17681. + * Looks to match the characters the constitute the token T__30
  17682. + * from the attached input stream.
  17683. + *
  17684. + *
  17685. + * \remark
  17686. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  17687. + */
  17688. +static ANTLR3_INLINE
  17689. +void mT__30(pSMARTPLLexer ctx)
  17690. +{
  17691. + ANTLR3_UINT32 _type;
  17692. +
  17693. + _type = T__30;
  17694. +
  17695. +
  17696. + // SMARTPL.g:7:7: ( '{' )
  17697. + // SMARTPL.g:7:9: '{'
  17698. + {
  17699. + MATCHC('{');
  17700. + if (HASEXCEPTION())
  17701. + {
  17702. + goto ruleT__30Ex;
  17703. + }
  17704. +
  17705. +
  17706. + }
  17707. +
  17708. + LEXSTATE->type = _type;
  17709. +
  17710. + // This is where rules clean up and exit
  17711. + //
  17712. + goto ruleT__30Ex; /* Prevent compiler warnings */
  17713. + ruleT__30Ex: ;
  17714. +
  17715. +}
  17716. +// $ANTLR end T__30
  17717. +
  17718. +// Comes from: 8:7: ( '}' )
  17719. +/** \brief Lexer rule generated by ANTLR3
  17720. + *
  17721. + * $ANTLR start T__31
  17722. + *
  17723. + * Looks to match the characters the constitute the token T__31
  17724. + * from the attached input stream.
  17725. + *
  17726. + *
  17727. + * \remark
  17728. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  17729. + */
  17730. +static ANTLR3_INLINE
  17731. +void mT__31(pSMARTPLLexer ctx)
  17732. +{
  17733. + ANTLR3_UINT32 _type;
  17734. +
  17735. + _type = T__31;
  17736. +
  17737. +
  17738. + // SMARTPL.g:8:7: ( '}' )
  17739. + // SMARTPL.g:8:9: '}'
  17740. + {
  17741. + MATCHC('}');
  17742. + if (HASEXCEPTION())
  17743. + {
  17744. + goto ruleT__31Ex;
  17745. + }
  17746. +
  17747. +
  17748. + }
  17749. +
  17750. + LEXSTATE->type = _type;
  17751. +
  17752. + // This is where rules clean up and exit
  17753. + //
  17754. + goto ruleT__31Ex; /* Prevent compiler warnings */
  17755. + ruleT__31Ex: ;
  17756. +
  17757. +}
  17758. +// $ANTLR end T__31
  17759. +
  17760. +// Comes from: 56:9: ( 'artist' | 'album_artist' | 'album' | 'title' | 'genre' | 'composer' | 'path' | 'type' | 'grouping' )
  17761. +/** \brief Lexer rule generated by ANTLR3
  17762. + *
  17763. + * $ANTLR start STRTAG
  17764. + *
  17765. + * Looks to match the characters the constitute the token STRTAG
  17766. + * from the attached input stream.
  17767. + *
  17768. + *
  17769. + * \remark
  17770. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  17771. + */
  17772. +static ANTLR3_INLINE
  17773. +void mSTRTAG(pSMARTPLLexer ctx)
  17774. +{
  17775. + ANTLR3_UINT32 _type;
  17776. +
  17777. + _type = STRTAG;
  17778. +
  17779. +
  17780. + {
  17781. + // SMARTPL.g:56:9: ( 'artist' | 'album_artist' | 'album' | 'title' | 'genre' | 'composer' | 'path' | 'type' | 'grouping' )
  17782. +
  17783. + ANTLR3_UINT32 alt1;
  17784. +
  17785. + alt1=9;
  17786. +
  17787. + switch ( LA(1) )
  17788. + {
  17789. + case 'a':
  17790. + {
  17791. + switch ( LA(2) )
  17792. + {
  17793. + case 'r':
  17794. + {
  17795. + alt1=1;
  17796. + }
  17797. + break;
  17798. + case 'l':
  17799. + {
  17800. + switch ( LA(3) )
  17801. + {
  17802. + case 'b':
  17803. + {
  17804. + switch ( LA(4) )
  17805. + {
  17806. + case 'u':
  17807. + {
  17808. + switch ( LA(5) )
  17809. + {
  17810. + case 'm':
  17811. + {
  17812. + switch ( LA(6) )
  17813. + {
  17814. + case '_':
  17815. + {
  17816. + alt1=2;
  17817. + }
  17818. + break;
  17819. +
  17820. + default:
  17821. + alt1=3;}
  17822. +
  17823. + }
  17824. + break;
  17825. +
  17826. + default:
  17827. + CONSTRUCTEX();
  17828. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  17829. + EXCEPTION->message = (void *)"";
  17830. + EXCEPTION->decisionNum = 1;
  17831. + EXCEPTION->state = 13;
  17832. +
  17833. +
  17834. + goto ruleSTRTAGEx;
  17835. + }
  17836. +
  17837. + }
  17838. + break;
  17839. +
  17840. + default:
  17841. + CONSTRUCTEX();
  17842. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  17843. + EXCEPTION->message = (void *)"";
  17844. + EXCEPTION->decisionNum = 1;
  17845. + EXCEPTION->state = 12;
  17846. +
  17847. +
  17848. + goto ruleSTRTAGEx;
  17849. + }
  17850. +
  17851. + }
  17852. + break;
  17853. +
  17854. + default:
  17855. + CONSTRUCTEX();
  17856. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  17857. + EXCEPTION->message = (void *)"";
  17858. + EXCEPTION->decisionNum = 1;
  17859. + EXCEPTION->state = 7;
  17860. +
  17861. +
  17862. + goto ruleSTRTAGEx;
  17863. + }
  17864. +
  17865. + }
  17866. + break;
  17867. +
  17868. + default:
  17869. + CONSTRUCTEX();
  17870. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  17871. + EXCEPTION->message = (void *)"";
  17872. + EXCEPTION->decisionNum = 1;
  17873. + EXCEPTION->state = 1;
  17874. +
  17875. +
  17876. + goto ruleSTRTAGEx;
  17877. + }
  17878. +
  17879. + }
  17880. + break;
  17881. + case 't':
  17882. + {
  17883. + switch ( LA(2) )
  17884. + {
  17885. + case 'i':
  17886. + {
  17887. + alt1=4;
  17888. + }
  17889. + break;
  17890. + case 'y':
  17891. + {
  17892. + alt1=8;
  17893. + }
  17894. + break;
  17895. +
  17896. + default:
  17897. + CONSTRUCTEX();
  17898. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  17899. + EXCEPTION->message = (void *)"";
  17900. + EXCEPTION->decisionNum = 1;
  17901. + EXCEPTION->state = 2;
  17902. +
  17903. +
  17904. + goto ruleSTRTAGEx;
  17905. + }
  17906. +
  17907. + }
  17908. + break;
  17909. + case 'g':
  17910. + {
  17911. + switch ( LA(2) )
  17912. + {
  17913. + case 'e':
  17914. + {
  17915. + alt1=5;
  17916. + }
  17917. + break;
  17918. + case 'r':
  17919. + {
  17920. + alt1=9;
  17921. + }
  17922. + break;
  17923. +
  17924. + default:
  17925. + CONSTRUCTEX();
  17926. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  17927. + EXCEPTION->message = (void *)"";
  17928. + EXCEPTION->decisionNum = 1;
  17929. + EXCEPTION->state = 3;
  17930. +
  17931. +
  17932. + goto ruleSTRTAGEx;
  17933. + }
  17934. +
  17935. + }
  17936. + break;
  17937. + case 'c':
  17938. + {
  17939. + alt1=6;
  17940. + }
  17941. + break;
  17942. + case 'p':
  17943. + {
  17944. + alt1=7;
  17945. + }
  17946. + break;
  17947. +
  17948. + default:
  17949. + CONSTRUCTEX();
  17950. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  17951. + EXCEPTION->message = (void *)"";
  17952. + EXCEPTION->decisionNum = 1;
  17953. + EXCEPTION->state = 0;
  17954. +
  17955. +
  17956. + goto ruleSTRTAGEx;
  17957. + }
  17958. +
  17959. + switch (alt1)
  17960. + {
  17961. + case 1:
  17962. + // SMARTPL.g:56:11: 'artist'
  17963. + {
  17964. + MATCHS(lit_1);
  17965. + if (HASEXCEPTION())
  17966. + {
  17967. + goto ruleSTRTAGEx;
  17968. + }
  17969. +
  17970. +
  17971. +
  17972. + }
  17973. + break;
  17974. + case 2:
  17975. + // SMARTPL.g:57:6: 'album_artist'
  17976. + {
  17977. + MATCHS(lit_2);
  17978. + if (HASEXCEPTION())
  17979. + {
  17980. + goto ruleSTRTAGEx;
  17981. + }
  17982. +
  17983. +
  17984. +
  17985. + }
  17986. + break;
  17987. + case 3:
  17988. + // SMARTPL.g:58:6: 'album'
  17989. + {
  17990. + MATCHS(lit_3);
  17991. + if (HASEXCEPTION())
  17992. + {
  17993. + goto ruleSTRTAGEx;
  17994. + }
  17995. +
  17996. +
  17997. +
  17998. + }
  17999. + break;
  18000. + case 4:
  18001. + // SMARTPL.g:59:6: 'title'
  18002. + {
  18003. + MATCHS(lit_4);
  18004. + if (HASEXCEPTION())
  18005. + {
  18006. + goto ruleSTRTAGEx;
  18007. + }
  18008. +
  18009. +
  18010. +
  18011. + }
  18012. + break;
  18013. + case 5:
  18014. + // SMARTPL.g:60:6: 'genre'
  18015. + {
  18016. + MATCHS(lit_5);
  18017. + if (HASEXCEPTION())
  18018. + {
  18019. + goto ruleSTRTAGEx;
  18020. + }
  18021. +
  18022. +
  18023. +
  18024. + }
  18025. + break;
  18026. + case 6:
  18027. + // SMARTPL.g:61:6: 'composer'
  18028. + {
  18029. + MATCHS(lit_6);
  18030. + if (HASEXCEPTION())
  18031. + {
  18032. + goto ruleSTRTAGEx;
  18033. + }
  18034. +
  18035. +
  18036. +
  18037. + }
  18038. + break;
  18039. + case 7:
  18040. + // SMARTPL.g:62:6: 'path'
  18041. + {
  18042. + MATCHS(lit_7);
  18043. + if (HASEXCEPTION())
  18044. + {
  18045. + goto ruleSTRTAGEx;
  18046. + }
  18047. +
  18048. +
  18049. +
  18050. + }
  18051. + break;
  18052. + case 8:
  18053. + // SMARTPL.g:63:6: 'type'
  18054. + {
  18055. + MATCHS(lit_8);
  18056. + if (HASEXCEPTION())
  18057. + {
  18058. + goto ruleSTRTAGEx;
  18059. + }
  18060. +
  18061. +
  18062. +
  18063. + }
  18064. + break;
  18065. + case 9:
  18066. + // SMARTPL.g:64:6: 'grouping'
  18067. + {
  18068. + MATCHS(lit_9);
  18069. + if (HASEXCEPTION())
  18070. + {
  18071. + goto ruleSTRTAGEx;
  18072. + }
  18073. +
  18074. +
  18075. +
  18076. + }
  18077. + break;
  18078. +
  18079. + }
  18080. + }
  18081. + LEXSTATE->type = _type;
  18082. +
  18083. + // This is where rules clean up and exit
  18084. + //
  18085. + goto ruleSTRTAGEx; /* Prevent compiler warnings */
  18086. + ruleSTRTAGEx: ;
  18087. +
  18088. +}
  18089. +// $ANTLR end STRTAG
  18090. +
  18091. +// Comes from: 67:9: ( 'play_count' | 'rating' | 'year' | 'compilation' )
  18092. +/** \brief Lexer rule generated by ANTLR3
  18093. + *
  18094. + * $ANTLR start INTTAG
  18095. + *
  18096. + * Looks to match the characters the constitute the token INTTAG
  18097. + * from the attached input stream.
  18098. + *
  18099. + *
  18100. + * \remark
  18101. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  18102. + */
  18103. +static ANTLR3_INLINE
  18104. +void mINTTAG(pSMARTPLLexer ctx)
  18105. +{
  18106. + ANTLR3_UINT32 _type;
  18107. +
  18108. + _type = INTTAG;
  18109. +
  18110. +
  18111. + {
  18112. + // SMARTPL.g:67:9: ( 'play_count' | 'rating' | 'year' | 'compilation' )
  18113. +
  18114. + ANTLR3_UINT32 alt2;
  18115. +
  18116. + alt2=4;
  18117. +
  18118. + switch ( LA(1) )
  18119. + {
  18120. + case 'p':
  18121. + {
  18122. + alt2=1;
  18123. + }
  18124. + break;
  18125. + case 'r':
  18126. + {
  18127. + alt2=2;
  18128. + }
  18129. + break;
  18130. + case 'y':
  18131. + {
  18132. + alt2=3;
  18133. + }
  18134. + break;
  18135. + case 'c':
  18136. + {
  18137. + alt2=4;
  18138. + }
  18139. + break;
  18140. +
  18141. + default:
  18142. + CONSTRUCTEX();
  18143. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  18144. + EXCEPTION->message = (void *)"";
  18145. + EXCEPTION->decisionNum = 2;
  18146. + EXCEPTION->state = 0;
  18147. +
  18148. +
  18149. + goto ruleINTTAGEx;
  18150. + }
  18151. +
  18152. + switch (alt2)
  18153. + {
  18154. + case 1:
  18155. + // SMARTPL.g:67:11: 'play_count'
  18156. + {
  18157. + MATCHS(lit_10);
  18158. + if (HASEXCEPTION())
  18159. + {
  18160. + goto ruleINTTAGEx;
  18161. + }
  18162. +
  18163. +
  18164. +
  18165. + }
  18166. + break;
  18167. + case 2:
  18168. + // SMARTPL.g:68:6: 'rating'
  18169. + {
  18170. + MATCHS(lit_11);
  18171. + if (HASEXCEPTION())
  18172. + {
  18173. + goto ruleINTTAGEx;
  18174. + }
  18175. +
  18176. +
  18177. +
  18178. + }
  18179. + break;
  18180. + case 3:
  18181. + // SMARTPL.g:69:6: 'year'
  18182. + {
  18183. + MATCHS(lit_12);
  18184. + if (HASEXCEPTION())
  18185. + {
  18186. + goto ruleINTTAGEx;
  18187. + }
  18188. +
  18189. +
  18190. +
  18191. + }
  18192. + break;
  18193. + case 4:
  18194. + // SMARTPL.g:70:6: 'compilation'
  18195. + {
  18196. + MATCHS(lit_13);
  18197. + if (HASEXCEPTION())
  18198. + {
  18199. + goto ruleINTTAGEx;
  18200. + }
  18201. +
  18202. +
  18203. +
  18204. + }
  18205. + break;
  18206. +
  18207. + }
  18208. + }
  18209. + LEXSTATE->type = _type;
  18210. +
  18211. + // This is where rules clean up and exit
  18212. + //
  18213. + goto ruleINTTAGEx; /* Prevent compiler warnings */
  18214. + ruleINTTAGEx: ;
  18215. +
  18216. +}
  18217. +// $ANTLR end INTTAG
  18218. +
  18219. +// Comes from: 73:10: ( 'time_added' | 'time_played' )
  18220. +/** \brief Lexer rule generated by ANTLR3
  18221. + *
  18222. + * $ANTLR start DATETAG
  18223. + *
  18224. + * Looks to match the characters the constitute the token DATETAG
  18225. + * from the attached input stream.
  18226. + *
  18227. + *
  18228. + * \remark
  18229. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  18230. + */
  18231. +static ANTLR3_INLINE
  18232. +void mDATETAG(pSMARTPLLexer ctx)
  18233. +{
  18234. + ANTLR3_UINT32 _type;
  18235. +
  18236. + _type = DATETAG;
  18237. +
  18238. +
  18239. + {
  18240. + // SMARTPL.g:73:10: ( 'time_added' | 'time_played' )
  18241. +
  18242. + ANTLR3_UINT32 alt3;
  18243. +
  18244. + alt3=2;
  18245. +
  18246. + switch ( LA(1) )
  18247. + {
  18248. + case 't':
  18249. + {
  18250. + switch ( LA(2) )
  18251. + {
  18252. + case 'i':
  18253. + {
  18254. + switch ( LA(3) )
  18255. + {
  18256. + case 'm':
  18257. + {
  18258. + switch ( LA(4) )
  18259. + {
  18260. + case 'e':
  18261. + {
  18262. + switch ( LA(5) )
  18263. + {
  18264. + case '_':
  18265. + {
  18266. + switch ( LA(6) )
  18267. + {
  18268. + case 'a':
  18269. + {
  18270. + alt3=1;
  18271. + }
  18272. + break;
  18273. + case 'p':
  18274. + {
  18275. + alt3=2;
  18276. + }
  18277. + break;
  18278. +
  18279. + default:
  18280. + CONSTRUCTEX();
  18281. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  18282. + EXCEPTION->message = (void *)"";
  18283. + EXCEPTION->decisionNum = 3;
  18284. + EXCEPTION->state = 5;
  18285. +
  18286. +
  18287. + goto ruleDATETAGEx;
  18288. + }
  18289. +
  18290. + }
  18291. + break;
  18292. +
  18293. + default:
  18294. + CONSTRUCTEX();
  18295. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  18296. + EXCEPTION->message = (void *)"";
  18297. + EXCEPTION->decisionNum = 3;
  18298. + EXCEPTION->state = 4;
  18299. +
  18300. +
  18301. + goto ruleDATETAGEx;
  18302. + }
  18303. +
  18304. + }
  18305. + break;
  18306. +
  18307. + default:
  18308. + CONSTRUCTEX();
  18309. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  18310. + EXCEPTION->message = (void *)"";
  18311. + EXCEPTION->decisionNum = 3;
  18312. + EXCEPTION->state = 3;
  18313. +
  18314. +
  18315. + goto ruleDATETAGEx;
  18316. + }
  18317. +
  18318. + }
  18319. + break;
  18320. +
  18321. + default:
  18322. + CONSTRUCTEX();
  18323. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  18324. + EXCEPTION->message = (void *)"";
  18325. + EXCEPTION->decisionNum = 3;
  18326. + EXCEPTION->state = 2;
  18327. +
  18328. +
  18329. + goto ruleDATETAGEx;
  18330. + }
  18331. +
  18332. + }
  18333. + break;
  18334. +
  18335. + default:
  18336. + CONSTRUCTEX();
  18337. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  18338. + EXCEPTION->message = (void *)"";
  18339. + EXCEPTION->decisionNum = 3;
  18340. + EXCEPTION->state = 1;
  18341. +
  18342. +
  18343. + goto ruleDATETAGEx;
  18344. + }
  18345. +
  18346. + }
  18347. + break;
  18348. +
  18349. + default:
  18350. + CONSTRUCTEX();
  18351. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  18352. + EXCEPTION->message = (void *)"";
  18353. + EXCEPTION->decisionNum = 3;
  18354. + EXCEPTION->state = 0;
  18355. +
  18356. +
  18357. + goto ruleDATETAGEx;
  18358. + }
  18359. +
  18360. + switch (alt3)
  18361. + {
  18362. + case 1:
  18363. + // SMARTPL.g:73:12: 'time_added'
  18364. + {
  18365. + MATCHS(lit_14);
  18366. + if (HASEXCEPTION())
  18367. + {
  18368. + goto ruleDATETAGEx;
  18369. + }
  18370. +
  18371. +
  18372. +
  18373. + }
  18374. + break;
  18375. + case 2:
  18376. + // SMARTPL.g:74:6: 'time_played'
  18377. + {
  18378. + MATCHS(lit_15);
  18379. + if (HASEXCEPTION())
  18380. + {
  18381. + goto ruleDATETAGEx;
  18382. + }
  18383. +
  18384. +
  18385. +
  18386. + }
  18387. + break;
  18388. +
  18389. + }
  18390. + }
  18391. + LEXSTATE->type = _type;
  18392. +
  18393. + // This is where rules clean up and exit
  18394. + //
  18395. + goto ruleDATETAGEx; /* Prevent compiler warnings */
  18396. + ruleDATETAGEx: ;
  18397. +
  18398. +}
  18399. +// $ANTLR end DATETAG
  18400. +
  18401. +// Comes from: 77:10: ( 'data_kind' | 'media_kind' )
  18402. +/** \brief Lexer rule generated by ANTLR3
  18403. + *
  18404. + * $ANTLR start ENUMTAG
  18405. + *
  18406. + * Looks to match the characters the constitute the token ENUMTAG
  18407. + * from the attached input stream.
  18408. + *
  18409. + *
  18410. + * \remark
  18411. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  18412. + */
  18413. +static ANTLR3_INLINE
  18414. +void mENUMTAG(pSMARTPLLexer ctx)
  18415. +{
  18416. + ANTLR3_UINT32 _type;
  18417. +
  18418. + _type = ENUMTAG;
  18419. +
  18420. +
  18421. + {
  18422. + // SMARTPL.g:77:10: ( 'data_kind' | 'media_kind' )
  18423. +
  18424. + ANTLR3_UINT32 alt4;
  18425. +
  18426. + alt4=2;
  18427. +
  18428. + switch ( LA(1) )
  18429. + {
  18430. + case 'd':
  18431. + {
  18432. + alt4=1;
  18433. + }
  18434. + break;
  18435. + case 'm':
  18436. + {
  18437. + alt4=2;
  18438. + }
  18439. + break;
  18440. +
  18441. + default:
  18442. + CONSTRUCTEX();
  18443. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  18444. + EXCEPTION->message = (void *)"";
  18445. + EXCEPTION->decisionNum = 4;
  18446. + EXCEPTION->state = 0;
  18447. +
  18448. +
  18449. + goto ruleENUMTAGEx;
  18450. + }
  18451. +
  18452. + switch (alt4)
  18453. + {
  18454. + case 1:
  18455. + // SMARTPL.g:77:12: 'data_kind'
  18456. + {
  18457. + MATCHS(lit_16);
  18458. + if (HASEXCEPTION())
  18459. + {
  18460. + goto ruleENUMTAGEx;
  18461. + }
  18462. +
  18463. +
  18464. +
  18465. + }
  18466. + break;
  18467. + case 2:
  18468. + // SMARTPL.g:78:6: 'media_kind'
  18469. + {
  18470. + MATCHS(lit_17);
  18471. + if (HASEXCEPTION())
  18472. + {
  18473. + goto ruleENUMTAGEx;
  18474. + }
  18475. +
  18476. +
  18477. +
  18478. + }
  18479. + break;
  18480. +
  18481. + }
  18482. + }
  18483. + LEXSTATE->type = _type;
  18484. +
  18485. + // This is where rules clean up and exit
  18486. + //
  18487. + goto ruleENUMTAGEx; /* Prevent compiler warnings */
  18488. + ruleENUMTAGEx: ;
  18489. +
  18490. +}
  18491. +// $ANTLR end ENUMTAG
  18492. +
  18493. +// Comes from: 81:10: ( 'includes' )
  18494. +/** \brief Lexer rule generated by ANTLR3
  18495. + *
  18496. + * $ANTLR start INCLUDES
  18497. + *
  18498. + * Looks to match the characters the constitute the token INCLUDES
  18499. + * from the attached input stream.
  18500. + *
  18501. + *
  18502. + * \remark
  18503. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  18504. + */
  18505. +static ANTLR3_INLINE
  18506. +void mINCLUDES(pSMARTPLLexer ctx)
  18507. +{
  18508. + ANTLR3_UINT32 _type;
  18509. +
  18510. + _type = INCLUDES;
  18511. +
  18512. +
  18513. + // SMARTPL.g:81:10: ( 'includes' )
  18514. + // SMARTPL.g:81:12: 'includes'
  18515. + {
  18516. + MATCHS(lit_18);
  18517. + if (HASEXCEPTION())
  18518. + {
  18519. + goto ruleINCLUDESEx;
  18520. + }
  18521. +
  18522. +
  18523. +
  18524. + }
  18525. +
  18526. + LEXSTATE->type = _type;
  18527. +
  18528. + // This is where rules clean up and exit
  18529. + //
  18530. + goto ruleINCLUDESEx; /* Prevent compiler warnings */
  18531. + ruleINCLUDESEx: ;
  18532. +
  18533. +}
  18534. +// $ANTLR end INCLUDES
  18535. +
  18536. +// Comes from: 84:6: ( 'is' )
  18537. +/** \brief Lexer rule generated by ANTLR3
  18538. + *
  18539. + * $ANTLR start IS
  18540. + *
  18541. + * Looks to match the characters the constitute the token IS
  18542. + * from the attached input stream.
  18543. + *
  18544. + *
  18545. + * \remark
  18546. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  18547. + */
  18548. +static ANTLR3_INLINE
  18549. +void mIS(pSMARTPLLexer ctx)
  18550. +{
  18551. + ANTLR3_UINT32 _type;
  18552. +
  18553. + _type = IS;
  18554. +
  18555. +
  18556. + // SMARTPL.g:84:6: ( 'is' )
  18557. + // SMARTPL.g:84:8: 'is'
  18558. + {
  18559. + MATCHS(lit_19);
  18560. + if (HASEXCEPTION())
  18561. + {
  18562. + goto ruleISEx;
  18563. + }
  18564. +
  18565. +
  18566. +
  18567. + }
  18568. +
  18569. + LEXSTATE->type = _type;
  18570. +
  18571. + // This is where rules clean up and exit
  18572. + //
  18573. + goto ruleISEx; /* Prevent compiler warnings */
  18574. + ruleISEx: ;
  18575. +
  18576. +}
  18577. +// $ANTLR end IS
  18578. +
  18579. +// Comes from: 87:10: ( ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL ) )
  18580. +/** \brief Lexer rule generated by ANTLR3
  18581. + *
  18582. + * $ANTLR start INTBOOL
  18583. + *
  18584. + * Looks to match the characters the constitute the token INTBOOL
  18585. + * from the attached input stream.
  18586. + *
  18587. + *
  18588. + * \remark
  18589. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  18590. + */
  18591. +static ANTLR3_INLINE
  18592. +void mINTBOOL(pSMARTPLLexer ctx)
  18593. +{
  18594. + ANTLR3_UINT32 _type;
  18595. +
  18596. + _type = INTBOOL;
  18597. +
  18598. +
  18599. + // SMARTPL.g:87:10: ( ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL ) )
  18600. + // SMARTPL.g:87:12: ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL )
  18601. + {
  18602. +
  18603. + // SMARTPL.g:87:12: ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL )
  18604. + {
  18605. + int alt5=5;
  18606. + switch ( LA(1) )
  18607. + {
  18608. + case '>':
  18609. + {
  18610. + switch ( LA(2) )
  18611. + {
  18612. + case '=':
  18613. + {
  18614. + alt5=2;
  18615. + }
  18616. + break;
  18617. +
  18618. + default:
  18619. + alt5=1;}
  18620. +
  18621. + }
  18622. + break;
  18623. + case '<':
  18624. + {
  18625. + switch ( LA(2) )
  18626. + {
  18627. + case '=':
  18628. + {
  18629. + alt5=4;
  18630. + }
  18631. + break;
  18632. +
  18633. + default:
  18634. + alt5=3;}
  18635. +
  18636. + }
  18637. + break;
  18638. + case '=':
  18639. + {
  18640. + alt5=5;
  18641. + }
  18642. + break;
  18643. +
  18644. + default:
  18645. + CONSTRUCTEX();
  18646. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  18647. + EXCEPTION->message = (void *)"";
  18648. + EXCEPTION->decisionNum = 5;
  18649. + EXCEPTION->state = 0;
  18650. +
  18651. +
  18652. + goto ruleINTBOOLEx;
  18653. + }
  18654. +
  18655. + switch (alt5)
  18656. + {
  18657. + case 1:
  18658. + // SMARTPL.g:87:13: GREATER
  18659. + {
  18660. + /* 87:13: GREATER */
  18661. + mGREATER(ctx );
  18662. + if (HASEXCEPTION())
  18663. + {
  18664. + goto ruleINTBOOLEx;
  18665. + }
  18666. +
  18667. +
  18668. + }
  18669. + break;
  18670. + case 2:
  18671. + // SMARTPL.g:87:21: GREATEREQUAL
  18672. + {
  18673. + /* 87:21: GREATEREQUAL */
  18674. + mGREATEREQUAL(ctx );
  18675. + if (HASEXCEPTION())
  18676. + {
  18677. + goto ruleINTBOOLEx;
  18678. + }
  18679. +
  18680. +
  18681. + }
  18682. + break;
  18683. + case 3:
  18684. + // SMARTPL.g:87:34: LESS
  18685. + {
  18686. + /* 87:34: LESS */
  18687. + mLESS(ctx );
  18688. + if (HASEXCEPTION())
  18689. + {
  18690. + goto ruleINTBOOLEx;
  18691. + }
  18692. +
  18693. +
  18694. + }
  18695. + break;
  18696. + case 4:
  18697. + // SMARTPL.g:87:39: LESSEQUAL
  18698. + {
  18699. + /* 87:39: LESSEQUAL */
  18700. + mLESSEQUAL(ctx );
  18701. + if (HASEXCEPTION())
  18702. + {
  18703. + goto ruleINTBOOLEx;
  18704. + }
  18705. +
  18706. +
  18707. + }
  18708. + break;
  18709. + case 5:
  18710. + // SMARTPL.g:87:49: EQUAL
  18711. + {
  18712. + /* 87:49: EQUAL */
  18713. + mEQUAL(ctx );
  18714. + if (HASEXCEPTION())
  18715. + {
  18716. + goto ruleINTBOOLEx;
  18717. + }
  18718. +
  18719. +
  18720. + }
  18721. + break;
  18722. +
  18723. + }
  18724. + }
  18725. +
  18726. + }
  18727. +
  18728. + LEXSTATE->type = _type;
  18729. +
  18730. + // This is where rules clean up and exit
  18731. + //
  18732. + goto ruleINTBOOLEx; /* Prevent compiler warnings */
  18733. + ruleINTBOOLEx: ;
  18734. +
  18735. +}
  18736. +// $ANTLR end INTBOOL
  18737. +
  18738. +// Comes from: 91:10: ( '>' )
  18739. +/** \brief Lexer rule generated by ANTLR3
  18740. + *
  18741. + * $ANTLR start GREATER
  18742. + *
  18743. + * Looks to match the characters the constitute the token GREATER
  18744. + * from the attached input stream.
  18745. + *
  18746. + *
  18747. + * \remark
  18748. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  18749. + */
  18750. +static ANTLR3_INLINE
  18751. +void mGREATER(pSMARTPLLexer ctx)
  18752. +{
  18753. + ANTLR3_UINT32 _type;
  18754. +
  18755. +
  18756. + // SMARTPL.g:91:10: ( '>' )
  18757. + // SMARTPL.g:91:12: '>'
  18758. + {
  18759. + MATCHC('>');
  18760. + if (HASEXCEPTION())
  18761. + {
  18762. + goto ruleGREATEREx;
  18763. + }
  18764. +
  18765. +
  18766. + }
  18767. +
  18768. +
  18769. +
  18770. + // This is where rules clean up and exit
  18771. + //
  18772. + goto ruleGREATEREx; /* Prevent compiler warnings */
  18773. + ruleGREATEREx: ;
  18774. +
  18775. +}
  18776. +// $ANTLR end GREATER
  18777. +
  18778. +// Comes from: 95:13: ( '>=' )
  18779. +/** \brief Lexer rule generated by ANTLR3
  18780. + *
  18781. + * $ANTLR start GREATEREQUAL
  18782. + *
  18783. + * Looks to match the characters the constitute the token GREATEREQUAL
  18784. + * from the attached input stream.
  18785. + *
  18786. + *
  18787. + * \remark
  18788. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  18789. + */
  18790. +static ANTLR3_INLINE
  18791. +void mGREATEREQUAL(pSMARTPLLexer ctx)
  18792. +{
  18793. + ANTLR3_UINT32 _type;
  18794. +
  18795. +
  18796. + // SMARTPL.g:95:13: ( '>=' )
  18797. + // SMARTPL.g:95:15: '>='
  18798. + {
  18799. + MATCHS(lit_20);
  18800. + if (HASEXCEPTION())
  18801. + {
  18802. + goto ruleGREATEREQUALEx;
  18803. + }
  18804. +
  18805. +
  18806. +
  18807. + }
  18808. +
  18809. +
  18810. +
  18811. + // This is where rules clean up and exit
  18812. + //
  18813. + goto ruleGREATEREQUALEx; /* Prevent compiler warnings */
  18814. + ruleGREATEREQUALEx: ;
  18815. +
  18816. +}
  18817. +// $ANTLR end GREATEREQUAL
  18818. +
  18819. +// Comes from: 99:7: ( '<' )
  18820. +/** \brief Lexer rule generated by ANTLR3
  18821. + *
  18822. + * $ANTLR start LESS
  18823. + *
  18824. + * Looks to match the characters the constitute the token LESS
  18825. + * from the attached input stream.
  18826. + *
  18827. + *
  18828. + * \remark
  18829. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  18830. + */
  18831. +static ANTLR3_INLINE
  18832. +void mLESS(pSMARTPLLexer ctx)
  18833. +{
  18834. + ANTLR3_UINT32 _type;
  18835. +
  18836. +
  18837. + // SMARTPL.g:99:7: ( '<' )
  18838. + // SMARTPL.g:99:9: '<'
  18839. + {
  18840. + MATCHC('<');
  18841. + if (HASEXCEPTION())
  18842. + {
  18843. + goto ruleLESSEx;
  18844. + }
  18845. +
  18846. +
  18847. + }
  18848. +
  18849. +
  18850. +
  18851. + // This is where rules clean up and exit
  18852. + //
  18853. + goto ruleLESSEx; /* Prevent compiler warnings */
  18854. + ruleLESSEx: ;
  18855. +
  18856. +}
  18857. +// $ANTLR end LESS
  18858. +
  18859. +// Comes from: 103:11: ( '<=' )
  18860. +/** \brief Lexer rule generated by ANTLR3
  18861. + *
  18862. + * $ANTLR start LESSEQUAL
  18863. + *
  18864. + * Looks to match the characters the constitute the token LESSEQUAL
  18865. + * from the attached input stream.
  18866. + *
  18867. + *
  18868. + * \remark
  18869. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  18870. + */
  18871. +static ANTLR3_INLINE
  18872. +void mLESSEQUAL(pSMARTPLLexer ctx)
  18873. +{
  18874. + ANTLR3_UINT32 _type;
  18875. +
  18876. +
  18877. + // SMARTPL.g:103:11: ( '<=' )
  18878. + // SMARTPL.g:103:13: '<='
  18879. + {
  18880. + MATCHS(lit_21);
  18881. + if (HASEXCEPTION())
  18882. + {
  18883. + goto ruleLESSEQUALEx;
  18884. + }
  18885. +
  18886. +
  18887. +
  18888. + }
  18889. +
  18890. +
  18891. +
  18892. + // This is where rules clean up and exit
  18893. + //
  18894. + goto ruleLESSEQUALEx; /* Prevent compiler warnings */
  18895. + ruleLESSEQUALEx: ;
  18896. +
  18897. +}
  18898. +// $ANTLR end LESSEQUAL
  18899. +
  18900. +// Comes from: 107:8: ( '=' )
  18901. +/** \brief Lexer rule generated by ANTLR3
  18902. + *
  18903. + * $ANTLR start EQUAL
  18904. + *
  18905. + * Looks to match the characters the constitute the token EQUAL
  18906. + * from the attached input stream.
  18907. + *
  18908. + *
  18909. + * \remark
  18910. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  18911. + */
  18912. +static ANTLR3_INLINE
  18913. +void mEQUAL(pSMARTPLLexer ctx)
  18914. +{
  18915. + ANTLR3_UINT32 _type;
  18916. +
  18917. +
  18918. + // SMARTPL.g:107:8: ( '=' )
  18919. + // SMARTPL.g:107:10: '='
  18920. + {
  18921. + MATCHC('=');
  18922. + if (HASEXCEPTION())
  18923. + {
  18924. + goto ruleEQUALEx;
  18925. + }
  18926. +
  18927. +
  18928. + }
  18929. +
  18930. +
  18931. +
  18932. + // This is where rules clean up and exit
  18933. + //
  18934. + goto ruleEQUALEx; /* Prevent compiler warnings */
  18935. + ruleEQUALEx: ;
  18936. +
  18937. +}
  18938. +// $ANTLR end EQUAL
  18939. +
  18940. +// Comes from: 110:8: ( 'after' )
  18941. +/** \brief Lexer rule generated by ANTLR3
  18942. + *
  18943. + * $ANTLR start AFTER
  18944. + *
  18945. + * Looks to match the characters the constitute the token AFTER
  18946. + * from the attached input stream.
  18947. + *
  18948. + *
  18949. + * \remark
  18950. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  18951. + */
  18952. +static ANTLR3_INLINE
  18953. +void mAFTER(pSMARTPLLexer ctx)
  18954. +{
  18955. + ANTLR3_UINT32 _type;
  18956. +
  18957. + _type = AFTER;
  18958. +
  18959. +
  18960. + // SMARTPL.g:110:8: ( 'after' )
  18961. + // SMARTPL.g:110:10: 'after'
  18962. + {
  18963. + MATCHS(lit_22);
  18964. + if (HASEXCEPTION())
  18965. + {
  18966. + goto ruleAFTEREx;
  18967. + }
  18968. +
  18969. +
  18970. +
  18971. + }
  18972. +
  18973. + LEXSTATE->type = _type;
  18974. +
  18975. + // This is where rules clean up and exit
  18976. + //
  18977. + goto ruleAFTEREx; /* Prevent compiler warnings */
  18978. + ruleAFTEREx: ;
  18979. +
  18980. +}
  18981. +// $ANTLR end AFTER
  18982. +
  18983. +// Comes from: 113:9: ( 'before' )
  18984. +/** \brief Lexer rule generated by ANTLR3
  18985. + *
  18986. + * $ANTLR start BEFORE
  18987. + *
  18988. + * Looks to match the characters the constitute the token BEFORE
  18989. + * from the attached input stream.
  18990. + *
  18991. + *
  18992. + * \remark
  18993. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  18994. + */
  18995. +static ANTLR3_INLINE
  18996. +void mBEFORE(pSMARTPLLexer ctx)
  18997. +{
  18998. + ANTLR3_UINT32 _type;
  18999. +
  19000. + _type = BEFORE;
  19001. +
  19002. +
  19003. + // SMARTPL.g:113:9: ( 'before' )
  19004. + // SMARTPL.g:113:11: 'before'
  19005. + {
  19006. + MATCHS(lit_23);
  19007. + if (HASEXCEPTION())
  19008. + {
  19009. + goto ruleBEFOREEx;
  19010. + }
  19011. +
  19012. +
  19013. +
  19014. + }
  19015. +
  19016. + LEXSTATE->type = _type;
  19017. +
  19018. + // This is where rules clean up and exit
  19019. + //
  19020. + goto ruleBEFOREEx; /* Prevent compiler warnings */
  19021. + ruleBEFOREEx: ;
  19022. +
  19023. +}
  19024. +// $ANTLR end BEFORE
  19025. +
  19026. +// Comes from: 116:7: ( 'ago' )
  19027. +/** \brief Lexer rule generated by ANTLR3
  19028. + *
  19029. + * $ANTLR start AGO
  19030. + *
  19031. + * Looks to match the characters the constitute the token AGO
  19032. + * from the attached input stream.
  19033. + *
  19034. + *
  19035. + * \remark
  19036. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  19037. + */
  19038. +static ANTLR3_INLINE
  19039. +void mAGO(pSMARTPLLexer ctx)
  19040. +{
  19041. + ANTLR3_UINT32 _type;
  19042. +
  19043. + _type = AGO;
  19044. +
  19045. +
  19046. + // SMARTPL.g:116:7: ( 'ago' )
  19047. + // SMARTPL.g:116:9: 'ago'
  19048. + {
  19049. + MATCHS(lit_24);
  19050. + if (HASEXCEPTION())
  19051. + {
  19052. + goto ruleAGOEx;
  19053. + }
  19054. +
  19055. +
  19056. +
  19057. + }
  19058. +
  19059. + LEXSTATE->type = _type;
  19060. +
  19061. + // This is where rules clean up and exit
  19062. + //
  19063. + goto ruleAGOEx; /* Prevent compiler warnings */
  19064. + ruleAGOEx: ;
  19065. +
  19066. +}
  19067. +// $ANTLR end AGO
  19068. +
  19069. +// Comes from: 119:7: ( 'AND' | 'and' )
  19070. +/** \brief Lexer rule generated by ANTLR3
  19071. + *
  19072. + * $ANTLR start AND
  19073. + *
  19074. + * Looks to match the characters the constitute the token AND
  19075. + * from the attached input stream.
  19076. + *
  19077. + *
  19078. + * \remark
  19079. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  19080. + */
  19081. +static ANTLR3_INLINE
  19082. +void mAND(pSMARTPLLexer ctx)
  19083. +{
  19084. + ANTLR3_UINT32 _type;
  19085. +
  19086. + _type = AND;
  19087. +
  19088. +
  19089. + {
  19090. + // SMARTPL.g:119:7: ( 'AND' | 'and' )
  19091. +
  19092. + ANTLR3_UINT32 alt6;
  19093. +
  19094. + alt6=2;
  19095. +
  19096. + switch ( LA(1) )
  19097. + {
  19098. + case 'A':
  19099. + {
  19100. + alt6=1;
  19101. + }
  19102. + break;
  19103. + case 'a':
  19104. + {
  19105. + alt6=2;
  19106. + }
  19107. + break;
  19108. +
  19109. + default:
  19110. + CONSTRUCTEX();
  19111. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  19112. + EXCEPTION->message = (void *)"";
  19113. + EXCEPTION->decisionNum = 6;
  19114. + EXCEPTION->state = 0;
  19115. +
  19116. +
  19117. + goto ruleANDEx;
  19118. + }
  19119. +
  19120. + switch (alt6)
  19121. + {
  19122. + case 1:
  19123. + // SMARTPL.g:119:9: 'AND'
  19124. + {
  19125. + MATCHS(lit_25);
  19126. + if (HASEXCEPTION())
  19127. + {
  19128. + goto ruleANDEx;
  19129. + }
  19130. +
  19131. +
  19132. +
  19133. + }
  19134. + break;
  19135. + case 2:
  19136. + // SMARTPL.g:120:6: 'and'
  19137. + {
  19138. + MATCHS(lit_26);
  19139. + if (HASEXCEPTION())
  19140. + {
  19141. + goto ruleANDEx;
  19142. + }
  19143. +
  19144. +
  19145. +
  19146. + }
  19147. + break;
  19148. +
  19149. + }
  19150. + }
  19151. + LEXSTATE->type = _type;
  19152. +
  19153. + // This is where rules clean up and exit
  19154. + //
  19155. + goto ruleANDEx; /* Prevent compiler warnings */
  19156. + ruleANDEx: ;
  19157. +
  19158. +}
  19159. +// $ANTLR end AND
  19160. +
  19161. +// Comes from: 123:6: ( 'OR' | 'or' )
  19162. +/** \brief Lexer rule generated by ANTLR3
  19163. + *
  19164. + * $ANTLR start OR
  19165. + *
  19166. + * Looks to match the characters the constitute the token OR
  19167. + * from the attached input stream.
  19168. + *
  19169. + *
  19170. + * \remark
  19171. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  19172. + */
  19173. +static ANTLR3_INLINE
  19174. +void mOR(pSMARTPLLexer ctx)
  19175. +{
  19176. + ANTLR3_UINT32 _type;
  19177. +
  19178. + _type = OR;
  19179. +
  19180. +
  19181. + {
  19182. + // SMARTPL.g:123:6: ( 'OR' | 'or' )
  19183. +
  19184. + ANTLR3_UINT32 alt7;
  19185. +
  19186. + alt7=2;
  19187. +
  19188. + switch ( LA(1) )
  19189. + {
  19190. + case 'O':
  19191. + {
  19192. + alt7=1;
  19193. + }
  19194. + break;
  19195. + case 'o':
  19196. + {
  19197. + alt7=2;
  19198. + }
  19199. + break;
  19200. +
  19201. + default:
  19202. + CONSTRUCTEX();
  19203. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  19204. + EXCEPTION->message = (void *)"";
  19205. + EXCEPTION->decisionNum = 7;
  19206. + EXCEPTION->state = 0;
  19207. +
  19208. +
  19209. + goto ruleOREx;
  19210. + }
  19211. +
  19212. + switch (alt7)
  19213. + {
  19214. + case 1:
  19215. + // SMARTPL.g:123:8: 'OR'
  19216. + {
  19217. + MATCHS(lit_27);
  19218. + if (HASEXCEPTION())
  19219. + {
  19220. + goto ruleOREx;
  19221. + }
  19222. +
  19223. +
  19224. +
  19225. + }
  19226. + break;
  19227. + case 2:
  19228. + // SMARTPL.g:124:6: 'or'
  19229. + {
  19230. + MATCHS(lit_28);
  19231. + if (HASEXCEPTION())
  19232. + {
  19233. + goto ruleOREx;
  19234. + }
  19235. +
  19236. +
  19237. +
  19238. + }
  19239. + break;
  19240. +
  19241. + }
  19242. + }
  19243. + LEXSTATE->type = _type;
  19244. +
  19245. + // This is where rules clean up and exit
  19246. + //
  19247. + goto ruleOREx; /* Prevent compiler warnings */
  19248. + ruleOREx: ;
  19249. +
  19250. +}
  19251. +// $ANTLR end OR
  19252. +
  19253. +// Comes from: 127:7: ( 'NOT' | 'not' )
  19254. +/** \brief Lexer rule generated by ANTLR3
  19255. + *
  19256. + * $ANTLR start NOT
  19257. + *
  19258. + * Looks to match the characters the constitute the token NOT
  19259. + * from the attached input stream.
  19260. + *
  19261. + *
  19262. + * \remark
  19263. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  19264. + */
  19265. +static ANTLR3_INLINE
  19266. +void mNOT(pSMARTPLLexer ctx)
  19267. +{
  19268. + ANTLR3_UINT32 _type;
  19269. +
  19270. + _type = NOT;
  19271. +
  19272. +
  19273. + {
  19274. + // SMARTPL.g:127:7: ( 'NOT' | 'not' )
  19275. +
  19276. + ANTLR3_UINT32 alt8;
  19277. +
  19278. + alt8=2;
  19279. +
  19280. + switch ( LA(1) )
  19281. + {
  19282. + case 'N':
  19283. + {
  19284. + alt8=1;
  19285. + }
  19286. + break;
  19287. + case 'n':
  19288. + {
  19289. + alt8=2;
  19290. + }
  19291. + break;
  19292. +
  19293. + default:
  19294. + CONSTRUCTEX();
  19295. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  19296. + EXCEPTION->message = (void *)"";
  19297. + EXCEPTION->decisionNum = 8;
  19298. + EXCEPTION->state = 0;
  19299. +
  19300. +
  19301. + goto ruleNOTEx;
  19302. + }
  19303. +
  19304. + switch (alt8)
  19305. + {
  19306. + case 1:
  19307. + // SMARTPL.g:127:9: 'NOT'
  19308. + {
  19309. + MATCHS(lit_29);
  19310. + if (HASEXCEPTION())
  19311. + {
  19312. + goto ruleNOTEx;
  19313. + }
  19314. +
  19315. +
  19316. +
  19317. + }
  19318. + break;
  19319. + case 2:
  19320. + // SMARTPL.g:128:6: 'not'
  19321. + {
  19322. + MATCHS(lit_30);
  19323. + if (HASEXCEPTION())
  19324. + {
  19325. + goto ruleNOTEx;
  19326. + }
  19327. +
  19328. +
  19329. +
  19330. + }
  19331. + break;
  19332. +
  19333. + }
  19334. + }
  19335. + LEXSTATE->type = _type;
  19336. +
  19337. + // This is where rules clean up and exit
  19338. + //
  19339. + goto ruleNOTEx; /* Prevent compiler warnings */
  19340. + ruleNOTEx: ;
  19341. +
  19342. +}
  19343. +// $ANTLR end NOT
  19344. +
  19345. +// Comes from: 131:7: ( '(' )
  19346. +/** \brief Lexer rule generated by ANTLR3
  19347. + *
  19348. + * $ANTLR start LPAR
  19349. + *
  19350. + * Looks to match the characters the constitute the token LPAR
  19351. + * from the attached input stream.
  19352. + *
  19353. + *
  19354. + * \remark
  19355. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  19356. + */
  19357. +static ANTLR3_INLINE
  19358. +void mLPAR(pSMARTPLLexer ctx)
  19359. +{
  19360. + ANTLR3_UINT32 _type;
  19361. +
  19362. + _type = LPAR;
  19363. +
  19364. +
  19365. + // SMARTPL.g:131:7: ( '(' )
  19366. + // SMARTPL.g:131:9: '('
  19367. + {
  19368. + MATCHC('(');
  19369. + if (HASEXCEPTION())
  19370. + {
  19371. + goto ruleLPAREx;
  19372. + }
  19373. +
  19374. +
  19375. + }
  19376. +
  19377. + LEXSTATE->type = _type;
  19378. +
  19379. + // This is where rules clean up and exit
  19380. + //
  19381. + goto ruleLPAREx; /* Prevent compiler warnings */
  19382. + ruleLPAREx: ;
  19383. +
  19384. +}
  19385. +// $ANTLR end LPAR
  19386. +
  19387. +// Comes from: 134:7: ( ')' )
  19388. +/** \brief Lexer rule generated by ANTLR3
  19389. + *
  19390. + * $ANTLR start RPAR
  19391. + *
  19392. + * Looks to match the characters the constitute the token RPAR
  19393. + * from the attached input stream.
  19394. + *
  19395. + *
  19396. + * \remark
  19397. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  19398. + */
  19399. +static ANTLR3_INLINE
  19400. +void mRPAR(pSMARTPLLexer ctx)
  19401. +{
  19402. + ANTLR3_UINT32 _type;
  19403. +
  19404. + _type = RPAR;
  19405. +
  19406. +
  19407. + // SMARTPL.g:134:7: ( ')' )
  19408. + // SMARTPL.g:134:9: ')'
  19409. + {
  19410. + MATCHC(')');
  19411. + if (HASEXCEPTION())
  19412. + {
  19413. + goto ruleRPAREx;
  19414. + }
  19415. +
  19416. +
  19417. + }
  19418. +
  19419. + LEXSTATE->type = _type;
  19420. +
  19421. + // This is where rules clean up and exit
  19422. + //
  19423. + goto ruleRPAREx; /* Prevent compiler warnings */
  19424. + ruleRPAREx: ;
  19425. +
  19426. +}
  19427. +// $ANTLR end RPAR
  19428. +
  19429. +// Comes from: 137:7: ( ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) '-' ( '0' .. '1' ) ( '0' .. '9' ) '-' ( '0' .. '3' ) ( '0' .. '9' ) | 'today' | 'yesterday' | 'last week' | 'last month' | 'last year' )
  19430. +/** \brief Lexer rule generated by ANTLR3
  19431. + *
  19432. + * $ANTLR start DATE
  19433. + *
  19434. + * Looks to match the characters the constitute the token DATE
  19435. + * from the attached input stream.
  19436. + *
  19437. + *
  19438. + * \remark
  19439. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  19440. + */
  19441. +static ANTLR3_INLINE
  19442. +void mDATE(pSMARTPLLexer ctx)
  19443. +{
  19444. + ANTLR3_UINT32 _type;
  19445. +
  19446. + _type = DATE;
  19447. +
  19448. +
  19449. + {
  19450. + // SMARTPL.g:137:7: ( ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) '-' ( '0' .. '1' ) ( '0' .. '9' ) '-' ( '0' .. '3' ) ( '0' .. '9' ) | 'today' | 'yesterday' | 'last week' | 'last month' | 'last year' )
  19451. +
  19452. + ANTLR3_UINT32 alt9;
  19453. +
  19454. + alt9=6;
  19455. +
  19456. + switch ( LA(1) )
  19457. + {
  19458. + case '0':
  19459. + case '1':
  19460. + case '2':
  19461. + case '3':
  19462. + case '4':
  19463. + case '5':
  19464. + case '6':
  19465. + case '7':
  19466. + case '8':
  19467. + case '9':
  19468. + {
  19469. + alt9=1;
  19470. + }
  19471. + break;
  19472. + case 't':
  19473. + {
  19474. + alt9=2;
  19475. + }
  19476. + break;
  19477. + case 'y':
  19478. + {
  19479. + alt9=3;
  19480. + }
  19481. + break;
  19482. + case 'l':
  19483. + {
  19484. + switch ( LA(2) )
  19485. + {
  19486. + case 'a':
  19487. + {
  19488. + switch ( LA(3) )
  19489. + {
  19490. + case 's':
  19491. + {
  19492. + switch ( LA(4) )
  19493. + {
  19494. + case 't':
  19495. + {
  19496. + switch ( LA(5) )
  19497. + {
  19498. + case ' ':
  19499. + {
  19500. + switch ( LA(6) )
  19501. + {
  19502. + case 'w':
  19503. + {
  19504. + alt9=4;
  19505. + }
  19506. + break;
  19507. + case 'm':
  19508. + {
  19509. + alt9=5;
  19510. + }
  19511. + break;
  19512. + case 'y':
  19513. + {
  19514. + alt9=6;
  19515. + }
  19516. + break;
  19517. +
  19518. + default:
  19519. + CONSTRUCTEX();
  19520. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  19521. + EXCEPTION->message = (void *)"";
  19522. + EXCEPTION->decisionNum = 9;
  19523. + EXCEPTION->state = 8;
  19524. +
  19525. +
  19526. + goto ruleDATEEx;
  19527. + }
  19528. +
  19529. + }
  19530. + break;
  19531. +
  19532. + default:
  19533. + CONSTRUCTEX();
  19534. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  19535. + EXCEPTION->message = (void *)"";
  19536. + EXCEPTION->decisionNum = 9;
  19537. + EXCEPTION->state = 7;
  19538. +
  19539. +
  19540. + goto ruleDATEEx;
  19541. + }
  19542. +
  19543. + }
  19544. + break;
  19545. +
  19546. + default:
  19547. + CONSTRUCTEX();
  19548. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  19549. + EXCEPTION->message = (void *)"";
  19550. + EXCEPTION->decisionNum = 9;
  19551. + EXCEPTION->state = 6;
  19552. +
  19553. +
  19554. + goto ruleDATEEx;
  19555. + }
  19556. +
  19557. + }
  19558. + break;
  19559. +
  19560. + default:
  19561. + CONSTRUCTEX();
  19562. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  19563. + EXCEPTION->message = (void *)"";
  19564. + EXCEPTION->decisionNum = 9;
  19565. + EXCEPTION->state = 5;
  19566. +
  19567. +
  19568. + goto ruleDATEEx;
  19569. + }
  19570. +
  19571. + }
  19572. + break;
  19573. +
  19574. + default:
  19575. + CONSTRUCTEX();
  19576. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  19577. + EXCEPTION->message = (void *)"";
  19578. + EXCEPTION->decisionNum = 9;
  19579. + EXCEPTION->state = 4;
  19580. +
  19581. +
  19582. + goto ruleDATEEx;
  19583. + }
  19584. +
  19585. + }
  19586. + break;
  19587. +
  19588. + default:
  19589. + CONSTRUCTEX();
  19590. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  19591. + EXCEPTION->message = (void *)"";
  19592. + EXCEPTION->decisionNum = 9;
  19593. + EXCEPTION->state = 0;
  19594. +
  19595. +
  19596. + goto ruleDATEEx;
  19597. + }
  19598. +
  19599. + switch (alt9)
  19600. + {
  19601. + case 1:
  19602. + // SMARTPL.g:137:9: ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) '-' ( '0' .. '1' ) ( '0' .. '9' ) '-' ( '0' .. '3' ) ( '0' .. '9' )
  19603. + {
  19604. + // SMARTPL.g:137:9: ( '0' .. '9' )
  19605. + // SMARTPL.g:137:10: '0' .. '9'
  19606. + {
  19607. + MATCHRANGE('0', '9');
  19608. + if (HASEXCEPTION())
  19609. + {
  19610. + goto ruleDATEEx;
  19611. + }
  19612. +
  19613. +
  19614. + }
  19615. +
  19616. + // SMARTPL.g:137:19: ( '0' .. '9' )
  19617. + // SMARTPL.g:137:20: '0' .. '9'
  19618. + {
  19619. + MATCHRANGE('0', '9');
  19620. + if (HASEXCEPTION())
  19621. + {
  19622. + goto ruleDATEEx;
  19623. + }
  19624. +
  19625. +
  19626. + }
  19627. +
  19628. + // SMARTPL.g:137:29: ( '0' .. '9' )
  19629. + // SMARTPL.g:137:30: '0' .. '9'
  19630. + {
  19631. + MATCHRANGE('0', '9');
  19632. + if (HASEXCEPTION())
  19633. + {
  19634. + goto ruleDATEEx;
  19635. + }
  19636. +
  19637. +
  19638. + }
  19639. +
  19640. + // SMARTPL.g:137:39: ( '0' .. '9' )
  19641. + // SMARTPL.g:137:40: '0' .. '9'
  19642. + {
  19643. + MATCHRANGE('0', '9');
  19644. + if (HASEXCEPTION())
  19645. + {
  19646. + goto ruleDATEEx;
  19647. + }
  19648. +
  19649. +
  19650. + }
  19651. +
  19652. + MATCHC('-');
  19653. + if (HASEXCEPTION())
  19654. + {
  19655. + goto ruleDATEEx;
  19656. + }
  19657. +
  19658. + // SMARTPL.g:137:52: ( '0' .. '1' )
  19659. + // SMARTPL.g:137:53: '0' .. '1'
  19660. + {
  19661. + MATCHRANGE('0', '1');
  19662. + if (HASEXCEPTION())
  19663. + {
  19664. + goto ruleDATEEx;
  19665. + }
  19666. +
  19667. +
  19668. + }
  19669. +
  19670. + // SMARTPL.g:137:62: ( '0' .. '9' )
  19671. + // SMARTPL.g:137:63: '0' .. '9'
  19672. + {
  19673. + MATCHRANGE('0', '9');
  19674. + if (HASEXCEPTION())
  19675. + {
  19676. + goto ruleDATEEx;
  19677. + }
  19678. +
  19679. +
  19680. + }
  19681. +
  19682. + MATCHC('-');
  19683. + if (HASEXCEPTION())
  19684. + {
  19685. + goto ruleDATEEx;
  19686. + }
  19687. +
  19688. + // SMARTPL.g:137:75: ( '0' .. '3' )
  19689. + // SMARTPL.g:137:76: '0' .. '3'
  19690. + {
  19691. + MATCHRANGE('0', '3');
  19692. + if (HASEXCEPTION())
  19693. + {
  19694. + goto ruleDATEEx;
  19695. + }
  19696. +
  19697. +
  19698. + }
  19699. +
  19700. + // SMARTPL.g:137:85: ( '0' .. '9' )
  19701. + // SMARTPL.g:137:86: '0' .. '9'
  19702. + {
  19703. + MATCHRANGE('0', '9');
  19704. + if (HASEXCEPTION())
  19705. + {
  19706. + goto ruleDATEEx;
  19707. + }
  19708. +
  19709. +
  19710. + }
  19711. +
  19712. +
  19713. + }
  19714. + break;
  19715. + case 2:
  19716. + // SMARTPL.g:138:6: 'today'
  19717. + {
  19718. + MATCHS(lit_31);
  19719. + if (HASEXCEPTION())
  19720. + {
  19721. + goto ruleDATEEx;
  19722. + }
  19723. +
  19724. +
  19725. +
  19726. + }
  19727. + break;
  19728. + case 3:
  19729. + // SMARTPL.g:139:6: 'yesterday'
  19730. + {
  19731. + MATCHS(lit_32);
  19732. + if (HASEXCEPTION())
  19733. + {
  19734. + goto ruleDATEEx;
  19735. + }
  19736. +
  19737. +
  19738. +
  19739. + }
  19740. + break;
  19741. + case 4:
  19742. + // SMARTPL.g:140:6: 'last week'
  19743. + {
  19744. + MATCHS(lit_33);
  19745. + if (HASEXCEPTION())
  19746. + {
  19747. + goto ruleDATEEx;
  19748. + }
  19749. +
  19750. +
  19751. +
  19752. + }
  19753. + break;
  19754. + case 5:
  19755. + // SMARTPL.g:141:6: 'last month'
  19756. + {
  19757. + MATCHS(lit_34);
  19758. + if (HASEXCEPTION())
  19759. + {
  19760. + goto ruleDATEEx;
  19761. + }
  19762. +
  19763. +
  19764. +
  19765. + }
  19766. + break;
  19767. + case 6:
  19768. + // SMARTPL.g:142:6: 'last year'
  19769. + {
  19770. + MATCHS(lit_35);
  19771. + if (HASEXCEPTION())
  19772. + {
  19773. + goto ruleDATEEx;
  19774. + }
  19775. +
  19776. +
  19777. +
  19778. + }
  19779. + break;
  19780. +
  19781. + }
  19782. + }
  19783. + LEXSTATE->type = _type;
  19784. +
  19785. + // This is where rules clean up and exit
  19786. + //
  19787. + goto ruleDATEEx; /* Prevent compiler warnings */
  19788. + ruleDATEEx: ;
  19789. +
  19790. +}
  19791. +// $ANTLR end DATE
  19792. +
  19793. +// Comes from: 145:13: ( 'days' | 'weeks' | 'months' | 'years' )
  19794. +/** \brief Lexer rule generated by ANTLR3
  19795. + *
  19796. + * $ANTLR start DATINTERVAL
  19797. + *
  19798. + * Looks to match the characters the constitute the token DATINTERVAL
  19799. + * from the attached input stream.
  19800. + *
  19801. + *
  19802. + * \remark
  19803. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  19804. + */
  19805. +static ANTLR3_INLINE
  19806. +void mDATINTERVAL(pSMARTPLLexer ctx)
  19807. +{
  19808. + ANTLR3_UINT32 _type;
  19809. +
  19810. + _type = DATINTERVAL;
  19811. +
  19812. +
  19813. + {
  19814. + // SMARTPL.g:145:13: ( 'days' | 'weeks' | 'months' | 'years' )
  19815. +
  19816. + ANTLR3_UINT32 alt10;
  19817. +
  19818. + alt10=4;
  19819. +
  19820. + switch ( LA(1) )
  19821. + {
  19822. + case 'd':
  19823. + {
  19824. + alt10=1;
  19825. + }
  19826. + break;
  19827. + case 'w':
  19828. + {
  19829. + alt10=2;
  19830. + }
  19831. + break;
  19832. + case 'm':
  19833. + {
  19834. + alt10=3;
  19835. + }
  19836. + break;
  19837. + case 'y':
  19838. + {
  19839. + alt10=4;
  19840. + }
  19841. + break;
  19842. +
  19843. + default:
  19844. + CONSTRUCTEX();
  19845. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  19846. + EXCEPTION->message = (void *)"";
  19847. + EXCEPTION->decisionNum = 10;
  19848. + EXCEPTION->state = 0;
  19849. +
  19850. +
  19851. + goto ruleDATINTERVALEx;
  19852. + }
  19853. +
  19854. + switch (alt10)
  19855. + {
  19856. + case 1:
  19857. + // SMARTPL.g:145:15: 'days'
  19858. + {
  19859. + MATCHS(lit_36);
  19860. + if (HASEXCEPTION())
  19861. + {
  19862. + goto ruleDATINTERVALEx;
  19863. + }
  19864. +
  19865. +
  19866. +
  19867. + }
  19868. + break;
  19869. + case 2:
  19870. + // SMARTPL.g:146:6: 'weeks'
  19871. + {
  19872. + MATCHS(lit_37);
  19873. + if (HASEXCEPTION())
  19874. + {
  19875. + goto ruleDATINTERVALEx;
  19876. + }
  19877. +
  19878. +
  19879. +
  19880. + }
  19881. + break;
  19882. + case 3:
  19883. + // SMARTPL.g:147:6: 'months'
  19884. + {
  19885. + MATCHS(lit_38);
  19886. + if (HASEXCEPTION())
  19887. + {
  19888. + goto ruleDATINTERVALEx;
  19889. + }
  19890. +
  19891. +
  19892. +
  19893. + }
  19894. + break;
  19895. + case 4:
  19896. + // SMARTPL.g:148:6: 'years'
  19897. + {
  19898. + MATCHS(lit_39);
  19899. + if (HASEXCEPTION())
  19900. + {
  19901. + goto ruleDATINTERVALEx;
  19902. + }
  19903. +
  19904. +
  19905. +
  19906. + }
  19907. + break;
  19908. +
  19909. + }
  19910. + }
  19911. + LEXSTATE->type = _type;
  19912. +
  19913. + // This is where rules clean up and exit
  19914. + //
  19915. + goto ruleDATINTERVALEx; /* Prevent compiler warnings */
  19916. + ruleDATINTERVALEx: ;
  19917. +
  19918. +}
  19919. +// $ANTLR end DATINTERVAL
  19920. +
  19921. +// Comes from: 151:10: ( 'music' | 'movie' | 'podcast' | 'audiobook' | 'tvshow' | 'file' | 'url' | 'spotify' | 'pipe' )
  19922. +/** \brief Lexer rule generated by ANTLR3
  19923. + *
  19924. + * $ANTLR start ENUMVAL
  19925. + *
  19926. + * Looks to match the characters the constitute the token ENUMVAL
  19927. + * from the attached input stream.
  19928. + *
  19929. + *
  19930. + * \remark
  19931. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  19932. + */
  19933. +static ANTLR3_INLINE
  19934. +void mENUMVAL(pSMARTPLLexer ctx)
  19935. +{
  19936. + ANTLR3_UINT32 _type;
  19937. +
  19938. + _type = ENUMVAL;
  19939. +
  19940. +
  19941. + {
  19942. + // SMARTPL.g:151:10: ( 'music' | 'movie' | 'podcast' | 'audiobook' | 'tvshow' | 'file' | 'url' | 'spotify' | 'pipe' )
  19943. +
  19944. + ANTLR3_UINT32 alt11;
  19945. +
  19946. + alt11=9;
  19947. +
  19948. + switch ( LA(1) )
  19949. + {
  19950. + case 'm':
  19951. + {
  19952. + switch ( LA(2) )
  19953. + {
  19954. + case 'u':
  19955. + {
  19956. + alt11=1;
  19957. + }
  19958. + break;
  19959. + case 'o':
  19960. + {
  19961. + alt11=2;
  19962. + }
  19963. + break;
  19964. +
  19965. + default:
  19966. + CONSTRUCTEX();
  19967. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  19968. + EXCEPTION->message = (void *)"";
  19969. + EXCEPTION->decisionNum = 11;
  19970. + EXCEPTION->state = 1;
  19971. +
  19972. +
  19973. + goto ruleENUMVALEx;
  19974. + }
  19975. +
  19976. + }
  19977. + break;
  19978. + case 'p':
  19979. + {
  19980. + switch ( LA(2) )
  19981. + {
  19982. + case 'o':
  19983. + {
  19984. + alt11=3;
  19985. + }
  19986. + break;
  19987. + case 'i':
  19988. + {
  19989. + alt11=9;
  19990. + }
  19991. + break;
  19992. +
  19993. + default:
  19994. + CONSTRUCTEX();
  19995. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  19996. + EXCEPTION->message = (void *)"";
  19997. + EXCEPTION->decisionNum = 11;
  19998. + EXCEPTION->state = 2;
  19999. +
  20000. +
  20001. + goto ruleENUMVALEx;
  20002. + }
  20003. +
  20004. + }
  20005. + break;
  20006. + case 'a':
  20007. + {
  20008. + alt11=4;
  20009. + }
  20010. + break;
  20011. + case 't':
  20012. + {
  20013. + alt11=5;
  20014. + }
  20015. + break;
  20016. + case 'f':
  20017. + {
  20018. + alt11=6;
  20019. + }
  20020. + break;
  20021. + case 'u':
  20022. + {
  20023. + alt11=7;
  20024. + }
  20025. + break;
  20026. + case 's':
  20027. + {
  20028. + alt11=8;
  20029. + }
  20030. + break;
  20031. +
  20032. + default:
  20033. + CONSTRUCTEX();
  20034. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20035. + EXCEPTION->message = (void *)"";
  20036. + EXCEPTION->decisionNum = 11;
  20037. + EXCEPTION->state = 0;
  20038. +
  20039. +
  20040. + goto ruleENUMVALEx;
  20041. + }
  20042. +
  20043. + switch (alt11)
  20044. + {
  20045. + case 1:
  20046. + // SMARTPL.g:151:12: 'music'
  20047. + {
  20048. + MATCHS(lit_40);
  20049. + if (HASEXCEPTION())
  20050. + {
  20051. + goto ruleENUMVALEx;
  20052. + }
  20053. +
  20054. +
  20055. +
  20056. + }
  20057. + break;
  20058. + case 2:
  20059. + // SMARTPL.g:152:6: 'movie'
  20060. + {
  20061. + MATCHS(lit_41);
  20062. + if (HASEXCEPTION())
  20063. + {
  20064. + goto ruleENUMVALEx;
  20065. + }
  20066. +
  20067. +
  20068. +
  20069. + }
  20070. + break;
  20071. + case 3:
  20072. + // SMARTPL.g:153:6: 'podcast'
  20073. + {
  20074. + MATCHS(lit_42);
  20075. + if (HASEXCEPTION())
  20076. + {
  20077. + goto ruleENUMVALEx;
  20078. + }
  20079. +
  20080. +
  20081. +
  20082. + }
  20083. + break;
  20084. + case 4:
  20085. + // SMARTPL.g:154:6: 'audiobook'
  20086. + {
  20087. + MATCHS(lit_43);
  20088. + if (HASEXCEPTION())
  20089. + {
  20090. + goto ruleENUMVALEx;
  20091. + }
  20092. +
  20093. +
  20094. +
  20095. + }
  20096. + break;
  20097. + case 5:
  20098. + // SMARTPL.g:155:6: 'tvshow'
  20099. + {
  20100. + MATCHS(lit_44);
  20101. + if (HASEXCEPTION())
  20102. + {
  20103. + goto ruleENUMVALEx;
  20104. + }
  20105. +
  20106. +
  20107. +
  20108. + }
  20109. + break;
  20110. + case 6:
  20111. + // SMARTPL.g:156:6: 'file'
  20112. + {
  20113. + MATCHS(lit_45);
  20114. + if (HASEXCEPTION())
  20115. + {
  20116. + goto ruleENUMVALEx;
  20117. + }
  20118. +
  20119. +
  20120. +
  20121. + }
  20122. + break;
  20123. + case 7:
  20124. + // SMARTPL.g:157:6: 'url'
  20125. + {
  20126. + MATCHS(lit_46);
  20127. + if (HASEXCEPTION())
  20128. + {
  20129. + goto ruleENUMVALEx;
  20130. + }
  20131. +
  20132. +
  20133. +
  20134. + }
  20135. + break;
  20136. + case 8:
  20137. + // SMARTPL.g:158:6: 'spotify'
  20138. + {
  20139. + MATCHS(lit_47);
  20140. + if (HASEXCEPTION())
  20141. + {
  20142. + goto ruleENUMVALEx;
  20143. + }
  20144. +
  20145. +
  20146. +
  20147. + }
  20148. + break;
  20149. + case 9:
  20150. + // SMARTPL.g:159:6: 'pipe'
  20151. + {
  20152. + MATCHS(lit_48);
  20153. + if (HASEXCEPTION())
  20154. + {
  20155. + goto ruleENUMVALEx;
  20156. + }
  20157. +
  20158. +
  20159. +
  20160. + }
  20161. + break;
  20162. +
  20163. + }
  20164. + }
  20165. + LEXSTATE->type = _type;
  20166. +
  20167. + // This is where rules clean up and exit
  20168. + //
  20169. + goto ruleENUMVALEx; /* Prevent compiler warnings */
  20170. + ruleENUMVALEx: ;
  20171. +
  20172. +}
  20173. +// $ANTLR end ENUMVAL
  20174. +
  20175. +// Comes from: 162:7: ( '\"' (~ ( '\"' ) )+ '\"' )
  20176. +/** \brief Lexer rule generated by ANTLR3
  20177. + *
  20178. + * $ANTLR start STR
  20179. + *
  20180. + * Looks to match the characters the constitute the token STR
  20181. + * from the attached input stream.
  20182. + *
  20183. + *
  20184. + * \remark
  20185. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  20186. + */
  20187. +static ANTLR3_INLINE
  20188. +void mSTR(pSMARTPLLexer ctx)
  20189. +{
  20190. + ANTLR3_UINT32 _type;
  20191. +
  20192. + _type = STR;
  20193. +
  20194. +
  20195. + // SMARTPL.g:162:7: ( '\"' (~ ( '\"' ) )+ '\"' )
  20196. + // SMARTPL.g:162:9: '\"' (~ ( '\"' ) )+ '\"'
  20197. + {
  20198. + MATCHC('"');
  20199. + if (HASEXCEPTION())
  20200. + {
  20201. + goto ruleSTREx;
  20202. + }
  20203. +
  20204. + // SMARTPL.g:162:13: (~ ( '\"' ) )+
  20205. + {
  20206. + int cnt12=0;
  20207. +
  20208. + for (;;)
  20209. + {
  20210. + int alt12=2;
  20211. + {
  20212. + /* dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState)
  20213. + */
  20214. + int LA12_0 = LA(1);
  20215. + if ( (((LA12_0 >= 0x0000) && (LA12_0 <= '!')) || ((LA12_0 >= '#') && (LA12_0 <= 0xFFFF))) )
  20216. + {
  20217. + alt12=1;
  20218. + }
  20219. +
  20220. + }
  20221. + switch (alt12)
  20222. + {
  20223. + case 1:
  20224. + // SMARTPL.g:162:13: ~ ( '\"' )
  20225. + {
  20226. + if ( ((LA(1) >= 0x0000) && (LA(1) <= '!')) || ((LA(1) >= '#') && (LA(1) <= 0xFFFF)) )
  20227. + {
  20228. + CONSUME();
  20229. +
  20230. + }
  20231. + else
  20232. + {
  20233. + CONSTRUCTEX();
  20234. + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
  20235. + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
  20236. +
  20237. + LRECOVER(); goto ruleSTREx;
  20238. + }
  20239. +
  20240. +
  20241. + }
  20242. + break;
  20243. +
  20244. + default:
  20245. +
  20246. + if ( cnt12 >= 1 )
  20247. + {
  20248. + goto loop12;
  20249. + }
  20250. + /* mismatchedSetEx()
  20251. + */
  20252. + CONSTRUCTEX();
  20253. + EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
  20254. + EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
  20255. +
  20256. +
  20257. + goto ruleSTREx;
  20258. + }
  20259. + cnt12++;
  20260. + }
  20261. + loop12: ; /* Jump to here if this rule does not match */
  20262. + }
  20263. + MATCHC('"');
  20264. + if (HASEXCEPTION())
  20265. + {
  20266. + goto ruleSTREx;
  20267. + }
  20268. +
  20269. +
  20270. + }
  20271. +
  20272. + LEXSTATE->type = _type;
  20273. +
  20274. + // This is where rules clean up and exit
  20275. + //
  20276. + goto ruleSTREx; /* Prevent compiler warnings */
  20277. + ruleSTREx: ;
  20278. +
  20279. +}
  20280. +// $ANTLR end STR
  20281. +
  20282. +// Comes from: 165:7: ( ( '0' .. '9' )+ )
  20283. +/** \brief Lexer rule generated by ANTLR3
  20284. + *
  20285. + * $ANTLR start INT
  20286. + *
  20287. + * Looks to match the characters the constitute the token INT
  20288. + * from the attached input stream.
  20289. + *
  20290. + *
  20291. + * \remark
  20292. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  20293. + */
  20294. +static ANTLR3_INLINE
  20295. +void mINT(pSMARTPLLexer ctx)
  20296. +{
  20297. + ANTLR3_UINT32 _type;
  20298. +
  20299. + _type = INT;
  20300. +
  20301. +
  20302. + // SMARTPL.g:165:7: ( ( '0' .. '9' )+ )
  20303. + // SMARTPL.g:165:9: ( '0' .. '9' )+
  20304. + {
  20305. + // SMARTPL.g:165:9: ( '0' .. '9' )+
  20306. + {
  20307. + int cnt13=0;
  20308. +
  20309. + for (;;)
  20310. + {
  20311. + int alt13=2;
  20312. + switch ( LA(1) )
  20313. + {
  20314. + case '0':
  20315. + case '1':
  20316. + case '2':
  20317. + case '3':
  20318. + case '4':
  20319. + case '5':
  20320. + case '6':
  20321. + case '7':
  20322. + case '8':
  20323. + case '9':
  20324. + {
  20325. + alt13=1;
  20326. + }
  20327. + break;
  20328. +
  20329. + }
  20330. +
  20331. + switch (alt13)
  20332. + {
  20333. + case 1:
  20334. + // SMARTPL.g:165:10: '0' .. '9'
  20335. + {
  20336. + MATCHRANGE('0', '9');
  20337. + if (HASEXCEPTION())
  20338. + {
  20339. + goto ruleINTEx;
  20340. + }
  20341. +
  20342. +
  20343. + }
  20344. + break;
  20345. +
  20346. + default:
  20347. +
  20348. + if ( cnt13 >= 1 )
  20349. + {
  20350. + goto loop13;
  20351. + }
  20352. + /* mismatchedSetEx()
  20353. + */
  20354. + CONSTRUCTEX();
  20355. + EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
  20356. + EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
  20357. +
  20358. +
  20359. + goto ruleINTEx;
  20360. + }
  20361. + cnt13++;
  20362. + }
  20363. + loop13: ; /* Jump to here if this rule does not match */
  20364. + }
  20365. +
  20366. + }
  20367. +
  20368. + LEXSTATE->type = _type;
  20369. +
  20370. + // This is where rules clean up and exit
  20371. + //
  20372. + goto ruleINTEx; /* Prevent compiler warnings */
  20373. + ruleINTEx: ;
  20374. +
  20375. +}
  20376. +// $ANTLR end INT
  20377. +
  20378. +// Comes from: 168:12: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' ) )
  20379. +/** \brief Lexer rule generated by ANTLR3
  20380. + *
  20381. + * $ANTLR start WHITESPACE
  20382. + *
  20383. + * Looks to match the characters the constitute the token WHITESPACE
  20384. + * from the attached input stream.
  20385. + *
  20386. + *
  20387. + * \remark
  20388. + * - lexer->error == ANTLR3_TRUE if an exception was thrown.
  20389. + */
  20390. +static ANTLR3_INLINE
  20391. +void mWHITESPACE(pSMARTPLLexer ctx)
  20392. +{
  20393. + ANTLR3_UINT32 _type;
  20394. +
  20395. + _type = WHITESPACE;
  20396. +
  20397. +
  20398. + // SMARTPL.g:168:12: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' ) )
  20399. + // SMARTPL.g:168:14: ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' )
  20400. + {
  20401. + if ( ((LA(1) >= '\t') && (LA(1) <= '\n')) || ((LA(1) >= '\f') && (LA(1) <= '\r')) || LA(1) == ' ' )
  20402. + {
  20403. + CONSUME();
  20404. +
  20405. + }
  20406. + else
  20407. + {
  20408. + CONSTRUCTEX();
  20409. + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
  20410. + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
  20411. +
  20412. + LRECOVER(); goto ruleWHITESPACEEx;
  20413. + }
  20414. +
  20415. + {
  20416. + LEXSTATE->channel = HIDDEN;
  20417. + }
  20418. +
  20419. + }
  20420. +
  20421. + LEXSTATE->type = _type;
  20422. +
  20423. + // This is where rules clean up and exit
  20424. + //
  20425. + goto ruleWHITESPACEEx; /* Prevent compiler warnings */
  20426. + ruleWHITESPACEEx: ;
  20427. +
  20428. +}
  20429. +// $ANTLR end WHITESPACE
  20430. +
  20431. +/** This is the entry point in to the lexer from an object that
  20432. + * wants to generate the next token, such as a pCOMMON_TOKEN_STREAM
  20433. + */
  20434. +static void
  20435. +mTokens(pSMARTPLLexer ctx)
  20436. +{
  20437. + {
  20438. + // SMARTPL.g:1:8: ( T__30 | T__31 | STRTAG | INTTAG | DATETAG | ENUMTAG | INCLUDES | IS | INTBOOL | AFTER | BEFORE | AGO | AND | OR | NOT | LPAR | RPAR | DATE | DATINTERVAL | ENUMVAL | STR | INT | WHITESPACE )
  20439. +
  20440. + ANTLR3_UINT32 alt14;
  20441. +
  20442. + alt14=23;
  20443. +
  20444. + switch ( LA(1) )
  20445. + {
  20446. + case '{':
  20447. + {
  20448. + alt14=1;
  20449. + }
  20450. + break;
  20451. + case '}':
  20452. + {
  20453. + alt14=2;
  20454. + }
  20455. + break;
  20456. + case 'a':
  20457. + {
  20458. + switch ( LA(2) )
  20459. + {
  20460. + case 'l':
  20461. + case 'r':
  20462. + {
  20463. + alt14=3;
  20464. + }
  20465. + break;
  20466. + case 'f':
  20467. + {
  20468. + alt14=10;
  20469. + }
  20470. + break;
  20471. + case 'g':
  20472. + {
  20473. + alt14=12;
  20474. + }
  20475. + break;
  20476. + case 'n':
  20477. + {
  20478. + alt14=13;
  20479. + }
  20480. + break;
  20481. + case 'u':
  20482. + {
  20483. + alt14=20;
  20484. + }
  20485. + break;
  20486. +
  20487. + default:
  20488. + CONSTRUCTEX();
  20489. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20490. + EXCEPTION->message = (void *)"";
  20491. + EXCEPTION->decisionNum = 14;
  20492. + EXCEPTION->state = 3;
  20493. +
  20494. +
  20495. + goto ruleTokensEx;
  20496. + }
  20497. +
  20498. + }
  20499. + break;
  20500. + case 't':
  20501. + {
  20502. + switch ( LA(2) )
  20503. + {
  20504. + case 'i':
  20505. + {
  20506. + switch ( LA(3) )
  20507. + {
  20508. + case 't':
  20509. + {
  20510. + alt14=3;
  20511. + }
  20512. + break;
  20513. + case 'm':
  20514. + {
  20515. + alt14=5;
  20516. + }
  20517. + break;
  20518. +
  20519. + default:
  20520. + CONSTRUCTEX();
  20521. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20522. + EXCEPTION->message = (void *)"";
  20523. + EXCEPTION->decisionNum = 14;
  20524. + EXCEPTION->state = 28;
  20525. +
  20526. +
  20527. + goto ruleTokensEx;
  20528. + }
  20529. +
  20530. + }
  20531. + break;
  20532. + case 'y':
  20533. + {
  20534. + alt14=3;
  20535. + }
  20536. + break;
  20537. + case 'o':
  20538. + {
  20539. + alt14=18;
  20540. + }
  20541. + break;
  20542. + case 'v':
  20543. + {
  20544. + alt14=20;
  20545. + }
  20546. + break;
  20547. +
  20548. + default:
  20549. + CONSTRUCTEX();
  20550. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20551. + EXCEPTION->message = (void *)"";
  20552. + EXCEPTION->decisionNum = 14;
  20553. + EXCEPTION->state = 4;
  20554. +
  20555. +
  20556. + goto ruleTokensEx;
  20557. + }
  20558. +
  20559. + }
  20560. + break;
  20561. + case 'g':
  20562. + {
  20563. + alt14=3;
  20564. + }
  20565. + break;
  20566. + case 'c':
  20567. + {
  20568. + switch ( LA(2) )
  20569. + {
  20570. + case 'o':
  20571. + {
  20572. + switch ( LA(3) )
  20573. + {
  20574. + case 'm':
  20575. + {
  20576. + switch ( LA(4) )
  20577. + {
  20578. + case 'p':
  20579. + {
  20580. + switch ( LA(5) )
  20581. + {
  20582. + case 'o':
  20583. + {
  20584. + alt14=3;
  20585. + }
  20586. + break;
  20587. + case 'i':
  20588. + {
  20589. + alt14=4;
  20590. + }
  20591. + break;
  20592. +
  20593. + default:
  20594. + CONSTRUCTEX();
  20595. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20596. + EXCEPTION->message = (void *)"";
  20597. + EXCEPTION->decisionNum = 14;
  20598. + EXCEPTION->state = 42;
  20599. +
  20600. +
  20601. + goto ruleTokensEx;
  20602. + }
  20603. +
  20604. + }
  20605. + break;
  20606. +
  20607. + default:
  20608. + CONSTRUCTEX();
  20609. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20610. + EXCEPTION->message = (void *)"";
  20611. + EXCEPTION->decisionNum = 14;
  20612. + EXCEPTION->state = 39;
  20613. +
  20614. +
  20615. + goto ruleTokensEx;
  20616. + }
  20617. +
  20618. + }
  20619. + break;
  20620. +
  20621. + default:
  20622. + CONSTRUCTEX();
  20623. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20624. + EXCEPTION->message = (void *)"";
  20625. + EXCEPTION->decisionNum = 14;
  20626. + EXCEPTION->state = 29;
  20627. +
  20628. +
  20629. + goto ruleTokensEx;
  20630. + }
  20631. +
  20632. + }
  20633. + break;
  20634. +
  20635. + default:
  20636. + CONSTRUCTEX();
  20637. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20638. + EXCEPTION->message = (void *)"";
  20639. + EXCEPTION->decisionNum = 14;
  20640. + EXCEPTION->state = 6;
  20641. +
  20642. +
  20643. + goto ruleTokensEx;
  20644. + }
  20645. +
  20646. + }
  20647. + break;
  20648. + case 'p':
  20649. + {
  20650. + switch ( LA(2) )
  20651. + {
  20652. + case 'a':
  20653. + {
  20654. + alt14=3;
  20655. + }
  20656. + break;
  20657. + case 'l':
  20658. + {
  20659. + alt14=4;
  20660. + }
  20661. + break;
  20662. + case 'i':
  20663. + case 'o':
  20664. + {
  20665. + alt14=20;
  20666. + }
  20667. + break;
  20668. +
  20669. + default:
  20670. + CONSTRUCTEX();
  20671. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20672. + EXCEPTION->message = (void *)"";
  20673. + EXCEPTION->decisionNum = 14;
  20674. + EXCEPTION->state = 7;
  20675. +
  20676. +
  20677. + goto ruleTokensEx;
  20678. + }
  20679. +
  20680. + }
  20681. + break;
  20682. + case 'r':
  20683. + {
  20684. + alt14=4;
  20685. + }
  20686. + break;
  20687. + case 'y':
  20688. + {
  20689. + switch ( LA(2) )
  20690. + {
  20691. + case 'e':
  20692. + {
  20693. + switch ( LA(3) )
  20694. + {
  20695. + case 'a':
  20696. + {
  20697. + switch ( LA(4) )
  20698. + {
  20699. + case 'r':
  20700. + {
  20701. + switch ( LA(5) )
  20702. + {
  20703. + case 's':
  20704. + {
  20705. + alt14=19;
  20706. + }
  20707. + break;
  20708. +
  20709. + default:
  20710. + alt14=4;}
  20711. +
  20712. + }
  20713. + break;
  20714. +
  20715. + default:
  20716. + CONSTRUCTEX();
  20717. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20718. + EXCEPTION->message = (void *)"";
  20719. + EXCEPTION->decisionNum = 14;
  20720. + EXCEPTION->state = 40;
  20721. +
  20722. +
  20723. + goto ruleTokensEx;
  20724. + }
  20725. +
  20726. + }
  20727. + break;
  20728. + case 's':
  20729. + {
  20730. + alt14=18;
  20731. + }
  20732. + break;
  20733. +
  20734. + default:
  20735. + CONSTRUCTEX();
  20736. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20737. + EXCEPTION->message = (void *)"";
  20738. + EXCEPTION->decisionNum = 14;
  20739. + EXCEPTION->state = 30;
  20740. +
  20741. +
  20742. + goto ruleTokensEx;
  20743. + }
  20744. +
  20745. + }
  20746. + break;
  20747. +
  20748. + default:
  20749. + CONSTRUCTEX();
  20750. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20751. + EXCEPTION->message = (void *)"";
  20752. + EXCEPTION->decisionNum = 14;
  20753. + EXCEPTION->state = 9;
  20754. +
  20755. +
  20756. + goto ruleTokensEx;
  20757. + }
  20758. +
  20759. + }
  20760. + break;
  20761. + case 'd':
  20762. + {
  20763. + switch ( LA(2) )
  20764. + {
  20765. + case 'a':
  20766. + {
  20767. + switch ( LA(3) )
  20768. + {
  20769. + case 't':
  20770. + {
  20771. + alt14=6;
  20772. + }
  20773. + break;
  20774. + case 'y':
  20775. + {
  20776. + alt14=19;
  20777. + }
  20778. + break;
  20779. +
  20780. + default:
  20781. + CONSTRUCTEX();
  20782. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20783. + EXCEPTION->message = (void *)"";
  20784. + EXCEPTION->decisionNum = 14;
  20785. + EXCEPTION->state = 31;
  20786. +
  20787. +
  20788. + goto ruleTokensEx;
  20789. + }
  20790. +
  20791. + }
  20792. + break;
  20793. +
  20794. + default:
  20795. + CONSTRUCTEX();
  20796. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20797. + EXCEPTION->message = (void *)"";
  20798. + EXCEPTION->decisionNum = 14;
  20799. + EXCEPTION->state = 10;
  20800. +
  20801. +
  20802. + goto ruleTokensEx;
  20803. + }
  20804. +
  20805. + }
  20806. + break;
  20807. + case 'm':
  20808. + {
  20809. + switch ( LA(2) )
  20810. + {
  20811. + case 'e':
  20812. + {
  20813. + alt14=6;
  20814. + }
  20815. + break;
  20816. + case 'o':
  20817. + {
  20818. + switch ( LA(3) )
  20819. + {
  20820. + case 'n':
  20821. + {
  20822. + alt14=19;
  20823. + }
  20824. + break;
  20825. + case 'v':
  20826. + {
  20827. + alt14=20;
  20828. + }
  20829. + break;
  20830. +
  20831. + default:
  20832. + CONSTRUCTEX();
  20833. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20834. + EXCEPTION->message = (void *)"";
  20835. + EXCEPTION->decisionNum = 14;
  20836. + EXCEPTION->state = 33;
  20837. +
  20838. +
  20839. + goto ruleTokensEx;
  20840. + }
  20841. +
  20842. + }
  20843. + break;
  20844. + case 'u':
  20845. + {
  20846. + alt14=20;
  20847. + }
  20848. + break;
  20849. +
  20850. + default:
  20851. + CONSTRUCTEX();
  20852. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20853. + EXCEPTION->message = (void *)"";
  20854. + EXCEPTION->decisionNum = 14;
  20855. + EXCEPTION->state = 11;
  20856. +
  20857. +
  20858. + goto ruleTokensEx;
  20859. + }
  20860. +
  20861. + }
  20862. + break;
  20863. + case 'i':
  20864. + {
  20865. + switch ( LA(2) )
  20866. + {
  20867. + case 'n':
  20868. + {
  20869. + alt14=7;
  20870. + }
  20871. + break;
  20872. + case 's':
  20873. + {
  20874. + alt14=8;
  20875. + }
  20876. + break;
  20877. +
  20878. + default:
  20879. + CONSTRUCTEX();
  20880. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  20881. + EXCEPTION->message = (void *)"";
  20882. + EXCEPTION->decisionNum = 14;
  20883. + EXCEPTION->state = 12;
  20884. +
  20885. +
  20886. + goto ruleTokensEx;
  20887. + }
  20888. +
  20889. + }
  20890. + break;
  20891. + case '<':
  20892. + case '=':
  20893. + case '>':
  20894. + {
  20895. + alt14=9;
  20896. + }
  20897. + break;
  20898. + case 'b':
  20899. + {
  20900. + alt14=11;
  20901. + }
  20902. + break;
  20903. + case 'A':
  20904. + {
  20905. + alt14=13;
  20906. + }
  20907. + break;
  20908. + case 'O':
  20909. + case 'o':
  20910. + {
  20911. + alt14=14;
  20912. + }
  20913. + break;
  20914. + case 'N':
  20915. + case 'n':
  20916. + {
  20917. + alt14=15;
  20918. + }
  20919. + break;
  20920. + case '(':
  20921. + {
  20922. + alt14=16;
  20923. + }
  20924. + break;
  20925. + case ')':
  20926. + {
  20927. + alt14=17;
  20928. + }
  20929. + break;
  20930. + case '0':
  20931. + case '1':
  20932. + case '2':
  20933. + case '3':
  20934. + case '4':
  20935. + case '5':
  20936. + case '6':
  20937. + case '7':
  20938. + case '8':
  20939. + case '9':
  20940. + {
  20941. + switch ( LA(2) )
  20942. + {
  20943. + case '0':
  20944. + case '1':
  20945. + case '2':
  20946. + case '3':
  20947. + case '4':
  20948. + case '5':
  20949. + case '6':
  20950. + case '7':
  20951. + case '8':
  20952. + case '9':
  20953. + {
  20954. + switch ( LA(3) )
  20955. + {
  20956. + case '0':
  20957. + case '1':
  20958. + case '2':
  20959. + case '3':
  20960. + case '4':
  20961. + case '5':
  20962. + case '6':
  20963. + case '7':
  20964. + case '8':
  20965. + case '9':
  20966. + {
  20967. + switch ( LA(4) )
  20968. + {
  20969. + case '0':
  20970. + case '1':
  20971. + case '2':
  20972. + case '3':
  20973. + case '4':
  20974. + case '5':
  20975. + case '6':
  20976. + case '7':
  20977. + case '8':
  20978. + case '9':
  20979. + {
  20980. + switch ( LA(5) )
  20981. + {
  20982. + case '-':
  20983. + {
  20984. + alt14=18;
  20985. + }
  20986. + break;
  20987. +
  20988. + default:
  20989. + alt14=22;}
  20990. +
  20991. + }
  20992. + break;
  20993. +
  20994. + default:
  20995. + alt14=22;}
  20996. +
  20997. + }
  20998. + break;
  20999. +
  21000. + default:
  21001. + alt14=22;}
  21002. +
  21003. + }
  21004. + break;
  21005. +
  21006. + default:
  21007. + alt14=22;}
  21008. +
  21009. + }
  21010. + break;
  21011. + case 'l':
  21012. + {
  21013. + alt14=18;
  21014. + }
  21015. + break;
  21016. + case 'w':
  21017. + {
  21018. + alt14=19;
  21019. + }
  21020. + break;
  21021. + case 'f':
  21022. + case 's':
  21023. + case 'u':
  21024. + {
  21025. + alt14=20;
  21026. + }
  21027. + break;
  21028. + case '"':
  21029. + {
  21030. + alt14=21;
  21031. + }
  21032. + break;
  21033. + case '\t':
  21034. + case '\n':
  21035. + case '\f':
  21036. + case '\r':
  21037. + case ' ':
  21038. + {
  21039. + alt14=23;
  21040. + }
  21041. + break;
  21042. +
  21043. + default:
  21044. + CONSTRUCTEX();
  21045. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  21046. + EXCEPTION->message = (void *)"";
  21047. + EXCEPTION->decisionNum = 14;
  21048. + EXCEPTION->state = 0;
  21049. +
  21050. +
  21051. + goto ruleTokensEx;
  21052. + }
  21053. +
  21054. + switch (alt14)
  21055. + {
  21056. + case 1:
  21057. + // SMARTPL.g:1:10: T__30
  21058. + {
  21059. + /* 1:10: T__30 */
  21060. + mT__30(ctx );
  21061. + if (HASEXCEPTION())
  21062. + {
  21063. + goto ruleTokensEx;
  21064. + }
  21065. +
  21066. +
  21067. + }
  21068. + break;
  21069. + case 2:
  21070. + // SMARTPL.g:1:16: T__31
  21071. + {
  21072. + /* 1:16: T__31 */
  21073. + mT__31(ctx );
  21074. + if (HASEXCEPTION())
  21075. + {
  21076. + goto ruleTokensEx;
  21077. + }
  21078. +
  21079. +
  21080. + }
  21081. + break;
  21082. + case 3:
  21083. + // SMARTPL.g:1:22: STRTAG
  21084. + {
  21085. + /* 1:22: STRTAG */
  21086. + mSTRTAG(ctx );
  21087. + if (HASEXCEPTION())
  21088. + {
  21089. + goto ruleTokensEx;
  21090. + }
  21091. +
  21092. +
  21093. + }
  21094. + break;
  21095. + case 4:
  21096. + // SMARTPL.g:1:29: INTTAG
  21097. + {
  21098. + /* 1:29: INTTAG */
  21099. + mINTTAG(ctx );
  21100. + if (HASEXCEPTION())
  21101. + {
  21102. + goto ruleTokensEx;
  21103. + }
  21104. +
  21105. +
  21106. + }
  21107. + break;
  21108. + case 5:
  21109. + // SMARTPL.g:1:36: DATETAG
  21110. + {
  21111. + /* 1:36: DATETAG */
  21112. + mDATETAG(ctx );
  21113. + if (HASEXCEPTION())
  21114. + {
  21115. + goto ruleTokensEx;
  21116. + }
  21117. +
  21118. +
  21119. + }
  21120. + break;
  21121. + case 6:
  21122. + // SMARTPL.g:1:44: ENUMTAG
  21123. + {
  21124. + /* 1:44: ENUMTAG */
  21125. + mENUMTAG(ctx );
  21126. + if (HASEXCEPTION())
  21127. + {
  21128. + goto ruleTokensEx;
  21129. + }
  21130. +
  21131. +
  21132. + }
  21133. + break;
  21134. + case 7:
  21135. + // SMARTPL.g:1:52: INCLUDES
  21136. + {
  21137. + /* 1:52: INCLUDES */
  21138. + mINCLUDES(ctx );
  21139. + if (HASEXCEPTION())
  21140. + {
  21141. + goto ruleTokensEx;
  21142. + }
  21143. +
  21144. +
  21145. + }
  21146. + break;
  21147. + case 8:
  21148. + // SMARTPL.g:1:61: IS
  21149. + {
  21150. + /* 1:61: IS */
  21151. + mIS(ctx );
  21152. + if (HASEXCEPTION())
  21153. + {
  21154. + goto ruleTokensEx;
  21155. + }
  21156. +
  21157. +
  21158. + }
  21159. + break;
  21160. + case 9:
  21161. + // SMARTPL.g:1:64: INTBOOL
  21162. + {
  21163. + /* 1:64: INTBOOL */
  21164. + mINTBOOL(ctx );
  21165. + if (HASEXCEPTION())
  21166. + {
  21167. + goto ruleTokensEx;
  21168. + }
  21169. +
  21170. +
  21171. + }
  21172. + break;
  21173. + case 10:
  21174. + // SMARTPL.g:1:72: AFTER
  21175. + {
  21176. + /* 1:72: AFTER */
  21177. + mAFTER(ctx );
  21178. + if (HASEXCEPTION())
  21179. + {
  21180. + goto ruleTokensEx;
  21181. + }
  21182. +
  21183. +
  21184. + }
  21185. + break;
  21186. + case 11:
  21187. + // SMARTPL.g:1:78: BEFORE
  21188. + {
  21189. + /* 1:78: BEFORE */
  21190. + mBEFORE(ctx );
  21191. + if (HASEXCEPTION())
  21192. + {
  21193. + goto ruleTokensEx;
  21194. + }
  21195. +
  21196. +
  21197. + }
  21198. + break;
  21199. + case 12:
  21200. + // SMARTPL.g:1:85: AGO
  21201. + {
  21202. + /* 1:85: AGO */
  21203. + mAGO(ctx );
  21204. + if (HASEXCEPTION())
  21205. + {
  21206. + goto ruleTokensEx;
  21207. + }
  21208. +
  21209. +
  21210. + }
  21211. + break;
  21212. + case 13:
  21213. + // SMARTPL.g:1:89: AND
  21214. + {
  21215. + /* 1:89: AND */
  21216. + mAND(ctx );
  21217. + if (HASEXCEPTION())
  21218. + {
  21219. + goto ruleTokensEx;
  21220. + }
  21221. +
  21222. +
  21223. + }
  21224. + break;
  21225. + case 14:
  21226. + // SMARTPL.g:1:93: OR
  21227. + {
  21228. + /* 1:93: OR */
  21229. + mOR(ctx );
  21230. + if (HASEXCEPTION())
  21231. + {
  21232. + goto ruleTokensEx;
  21233. + }
  21234. +
  21235. +
  21236. + }
  21237. + break;
  21238. + case 15:
  21239. + // SMARTPL.g:1:96: NOT
  21240. + {
  21241. + /* 1:96: NOT */
  21242. + mNOT(ctx );
  21243. + if (HASEXCEPTION())
  21244. + {
  21245. + goto ruleTokensEx;
  21246. + }
  21247. +
  21248. +
  21249. + }
  21250. + break;
  21251. + case 16:
  21252. + // SMARTPL.g:1:100: LPAR
  21253. + {
  21254. + /* 1:100: LPAR */
  21255. + mLPAR(ctx );
  21256. + if (HASEXCEPTION())
  21257. + {
  21258. + goto ruleTokensEx;
  21259. + }
  21260. +
  21261. +
  21262. + }
  21263. + break;
  21264. + case 17:
  21265. + // SMARTPL.g:1:105: RPAR
  21266. + {
  21267. + /* 1:105: RPAR */
  21268. + mRPAR(ctx );
  21269. + if (HASEXCEPTION())
  21270. + {
  21271. + goto ruleTokensEx;
  21272. + }
  21273. +
  21274. +
  21275. + }
  21276. + break;
  21277. + case 18:
  21278. + // SMARTPL.g:1:110: DATE
  21279. + {
  21280. + /* 1:110: DATE */
  21281. + mDATE(ctx );
  21282. + if (HASEXCEPTION())
  21283. + {
  21284. + goto ruleTokensEx;
  21285. + }
  21286. +
  21287. +
  21288. + }
  21289. + break;
  21290. + case 19:
  21291. + // SMARTPL.g:1:115: DATINTERVAL
  21292. + {
  21293. + /* 1:115: DATINTERVAL */
  21294. + mDATINTERVAL(ctx );
  21295. + if (HASEXCEPTION())
  21296. + {
  21297. + goto ruleTokensEx;
  21298. + }
  21299. +
  21300. +
  21301. + }
  21302. + break;
  21303. + case 20:
  21304. + // SMARTPL.g:1:127: ENUMVAL
  21305. + {
  21306. + /* 1:127: ENUMVAL */
  21307. + mENUMVAL(ctx );
  21308. + if (HASEXCEPTION())
  21309. + {
  21310. + goto ruleTokensEx;
  21311. + }
  21312. +
  21313. +
  21314. + }
  21315. + break;
  21316. + case 21:
  21317. + // SMARTPL.g:1:135: STR
  21318. + {
  21319. + /* 1:135: STR */
  21320. + mSTR(ctx );
  21321. + if (HASEXCEPTION())
  21322. + {
  21323. + goto ruleTokensEx;
  21324. + }
  21325. +
  21326. +
  21327. + }
  21328. + break;
  21329. + case 22:
  21330. + // SMARTPL.g:1:139: INT
  21331. + {
  21332. + /* 1:139: INT */
  21333. + mINT(ctx );
  21334. + if (HASEXCEPTION())
  21335. + {
  21336. + goto ruleTokensEx;
  21337. + }
  21338. +
  21339. +
  21340. + }
  21341. + break;
  21342. + case 23:
  21343. + // SMARTPL.g:1:143: WHITESPACE
  21344. + {
  21345. + /* 1:143: WHITESPACE */
  21346. + mWHITESPACE(ctx );
  21347. + if (HASEXCEPTION())
  21348. + {
  21349. + goto ruleTokensEx;
  21350. + }
  21351. +
  21352. +
  21353. + }
  21354. + break;
  21355. +
  21356. + }
  21357. + }
  21358. +
  21359. +
  21360. + goto ruleTokensEx; /* Prevent compiler warnings */
  21361. +ruleTokensEx: ;
  21362. +}
  21363. +
  21364. +/* =========================================================================
  21365. + * Lexer matching rules end.
  21366. + * =========================================================================
  21367. + */
  21368. +/* End of Lexer code
  21369. + * ================================================
  21370. + * ================================================
  21371. + */
  21372. +
  21373. +
  21374. +/* End of code
  21375. + * =============================================================================
  21376. + */
  21377. diff --git a/src/pregen/SMARTPLLexer.h b/src/pregen/SMARTPLLexer.h
  21378. new file mode 100644
  21379. index 0000000..87e8c7e
  21380. --- /dev/null
  21381. +++ b/src/pregen/SMARTPLLexer.h
  21382. @@ -0,0 +1,248 @@
  21383. +/** \file
  21384. + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
  21385. + *
  21386. + * - From the grammar source file : SMARTPL.g
  21387. + * - On : 2016-01-01 12:23:40
  21388. + * - for the lexer : SMARTPLLexerLexer *
  21389. + * Editing it, at least manually, is not wise.
  21390. + *
  21391. + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
  21392. + *
  21393. + *
  21394. + * The lexer SMARTPLLexer has the callable functions (rules) shown below,
  21395. + * which will invoke the code for the associated rule in the source grammar
  21396. + * assuming that the input stream is pointing to a token/text stream that could begin
  21397. + * this rule.
  21398. + *
  21399. + * For instance if you call the first (topmost) rule in a parser grammar, you will
  21400. + * get the results of a full parse, but calling a rule half way through the grammar will
  21401. + * allow you to pass part of a full token stream to the parser, such as for syntax checking
  21402. + * in editors and so on.
  21403. + *
  21404. + * The parser entry points are called indirectly (by function pointer to function) via
  21405. + * a parser context typedef pSMARTPLLexer, which is returned from a call to SMARTPLLexerNew().
  21406. + *
  21407. + * As this is a generated lexer, it is unlikely you will call it 'manually'. However
  21408. + * the methods are provided anyway.
  21409. + * * The methods in pSMARTPLLexer are as follows:
  21410. + *
  21411. + * - void pSMARTPLLexer->T__30(pSMARTPLLexer)
  21412. + * - void pSMARTPLLexer->T__31(pSMARTPLLexer)
  21413. + * - void pSMARTPLLexer->STRTAG(pSMARTPLLexer)
  21414. + * - void pSMARTPLLexer->INTTAG(pSMARTPLLexer)
  21415. + * - void pSMARTPLLexer->DATETAG(pSMARTPLLexer)
  21416. + * - void pSMARTPLLexer->ENUMTAG(pSMARTPLLexer)
  21417. + * - void pSMARTPLLexer->INCLUDES(pSMARTPLLexer)
  21418. + * - void pSMARTPLLexer->IS(pSMARTPLLexer)
  21419. + * - void pSMARTPLLexer->INTBOOL(pSMARTPLLexer)
  21420. + * - void pSMARTPLLexer->GREATER(pSMARTPLLexer)
  21421. + * - void pSMARTPLLexer->GREATEREQUAL(pSMARTPLLexer)
  21422. + * - void pSMARTPLLexer->LESS(pSMARTPLLexer)
  21423. + * - void pSMARTPLLexer->LESSEQUAL(pSMARTPLLexer)
  21424. + * - void pSMARTPLLexer->EQUAL(pSMARTPLLexer)
  21425. + * - void pSMARTPLLexer->AFTER(pSMARTPLLexer)
  21426. + * - void pSMARTPLLexer->BEFORE(pSMARTPLLexer)
  21427. + * - void pSMARTPLLexer->AGO(pSMARTPLLexer)
  21428. + * - void pSMARTPLLexer->AND(pSMARTPLLexer)
  21429. + * - void pSMARTPLLexer->OR(pSMARTPLLexer)
  21430. + * - void pSMARTPLLexer->NOT(pSMARTPLLexer)
  21431. + * - void pSMARTPLLexer->LPAR(pSMARTPLLexer)
  21432. + * - void pSMARTPLLexer->RPAR(pSMARTPLLexer)
  21433. + * - void pSMARTPLLexer->DATE(pSMARTPLLexer)
  21434. + * - void pSMARTPLLexer->DATINTERVAL(pSMARTPLLexer)
  21435. + * - void pSMARTPLLexer->ENUMVAL(pSMARTPLLexer)
  21436. + * - void pSMARTPLLexer->STR(pSMARTPLLexer)
  21437. + * - void pSMARTPLLexer->INT(pSMARTPLLexer)
  21438. + * - void pSMARTPLLexer->WHITESPACE(pSMARTPLLexer)
  21439. + * - void pSMARTPLLexer->Tokens(pSMARTPLLexer)
  21440. + *
  21441. + * The return type for any particular rule is of course determined by the source
  21442. + * grammar file.
  21443. + */
  21444. +// [The "BSD licence"]
  21445. +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
  21446. +// http://www.temporal-wave.com
  21447. +// http://www.linkedin.com/in/jimidle
  21448. +//
  21449. +// All rights reserved.
  21450. +//
  21451. +// Redistribution and use in source and binary forms, with or without
  21452. +// modification, are permitted provided that the following conditions
  21453. +// are met:
  21454. +// 1. Redistributions of source code must retain the above copyright
  21455. +// notice, this list of conditions and the following disclaimer.
  21456. +// 2. Redistributions in binary form must reproduce the above copyright
  21457. +// notice, this list of conditions and the following disclaimer in the
  21458. +// documentation and/or other materials provided with the distribution.
  21459. +// 3. The name of the author may not be used to endorse or promote products
  21460. +// derived from this software without specific prior written permission.
  21461. +//
  21462. +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  21463. +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  21464. +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  21465. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21466. +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  21467. +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  21468. +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  21469. +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  21470. +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  21471. +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21472. +
  21473. +#ifndef _SMARTPLLexer_H
  21474. +#define _SMARTPLLexer_H
  21475. +/* =============================================================================
  21476. + * Standard antlr3 C runtime definitions
  21477. + */
  21478. +#include <antlr3.h>
  21479. +
  21480. +/* End of standard antlr 3 runtime definitions
  21481. + * =============================================================================
  21482. + */
  21483. +
  21484. +#ifdef __cplusplus
  21485. +extern "C" {
  21486. +#endif
  21487. +
  21488. +// Forward declare the context typedef so that we can use it before it is
  21489. +// properly defined. Delegators and delegates (from import statements) are
  21490. +// interdependent and their context structures contain pointers to each other
  21491. +// C only allows such things to be declared if you pre-declare the typedef.
  21492. +//
  21493. +typedef struct SMARTPLLexer_Ctx_struct SMARTPLLexer, * pSMARTPLLexer;
  21494. +
  21495. +
  21496. +
  21497. +#ifdef ANTLR3_WINDOWS
  21498. +// Disable: Unreferenced parameter, - Rules with parameters that are not used
  21499. +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
  21500. +// initialized but unused variable - tree rewrite variables declared but not needed
  21501. +// Unreferenced local variable - lexer rule declares but does not always use _type
  21502. +// potentially unitialized variable used - retval always returned from a rule
  21503. +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
  21504. +//
  21505. +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
  21506. +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
  21507. +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
  21508. +// this is a matter of orthogonality hence I disable that one.
  21509. +//
  21510. +#pragma warning( disable : 4100 )
  21511. +#pragma warning( disable : 4101 )
  21512. +#pragma warning( disable : 4127 )
  21513. +#pragma warning( disable : 4189 )
  21514. +#pragma warning( disable : 4505 )
  21515. +#pragma warning( disable : 4701 )
  21516. +#endif
  21517. +
  21518. +/** Context tracking structure for SMARTPLLexer
  21519. + */
  21520. +struct SMARTPLLexer_Ctx_struct
  21521. +{
  21522. + /** Built in ANTLR3 context tracker contains all the generic elements
  21523. + * required for context tracking.
  21524. + */
  21525. + pANTLR3_LEXER pLexer;
  21526. +
  21527. +
  21528. + void (*mT__30) (struct SMARTPLLexer_Ctx_struct * ctx);
  21529. + void (*mT__31) (struct SMARTPLLexer_Ctx_struct * ctx);
  21530. + void (*mSTRTAG) (struct SMARTPLLexer_Ctx_struct * ctx);
  21531. + void (*mINTTAG) (struct SMARTPLLexer_Ctx_struct * ctx);
  21532. + void (*mDATETAG) (struct SMARTPLLexer_Ctx_struct * ctx);
  21533. + void (*mENUMTAG) (struct SMARTPLLexer_Ctx_struct * ctx);
  21534. + void (*mINCLUDES) (struct SMARTPLLexer_Ctx_struct * ctx);
  21535. + void (*mIS) (struct SMARTPLLexer_Ctx_struct * ctx);
  21536. + void (*mINTBOOL) (struct SMARTPLLexer_Ctx_struct * ctx);
  21537. + void (*mGREATER) (struct SMARTPLLexer_Ctx_struct * ctx);
  21538. + void (*mGREATEREQUAL) (struct SMARTPLLexer_Ctx_struct * ctx);
  21539. + void (*mLESS) (struct SMARTPLLexer_Ctx_struct * ctx);
  21540. + void (*mLESSEQUAL) (struct SMARTPLLexer_Ctx_struct * ctx);
  21541. + void (*mEQUAL) (struct SMARTPLLexer_Ctx_struct * ctx);
  21542. + void (*mAFTER) (struct SMARTPLLexer_Ctx_struct * ctx);
  21543. + void (*mBEFORE) (struct SMARTPLLexer_Ctx_struct * ctx);
  21544. + void (*mAGO) (struct SMARTPLLexer_Ctx_struct * ctx);
  21545. + void (*mAND) (struct SMARTPLLexer_Ctx_struct * ctx);
  21546. + void (*mOR) (struct SMARTPLLexer_Ctx_struct * ctx);
  21547. + void (*mNOT) (struct SMARTPLLexer_Ctx_struct * ctx);
  21548. + void (*mLPAR) (struct SMARTPLLexer_Ctx_struct * ctx);
  21549. + void (*mRPAR) (struct SMARTPLLexer_Ctx_struct * ctx);
  21550. + void (*mDATE) (struct SMARTPLLexer_Ctx_struct * ctx);
  21551. + void (*mDATINTERVAL) (struct SMARTPLLexer_Ctx_struct * ctx);
  21552. + void (*mENUMVAL) (struct SMARTPLLexer_Ctx_struct * ctx);
  21553. + void (*mSTR) (struct SMARTPLLexer_Ctx_struct * ctx);
  21554. + void (*mINT) (struct SMARTPLLexer_Ctx_struct * ctx);
  21555. + void (*mWHITESPACE) (struct SMARTPLLexer_Ctx_struct * ctx);
  21556. + void (*mTokens) (struct SMARTPLLexer_Ctx_struct * ctx); const char * (*getGrammarFileName)();
  21557. + void (*free) (struct SMARTPLLexer_Ctx_struct * ctx);
  21558. +
  21559. +};
  21560. +
  21561. +// Function protoypes for the constructor functions that external translation units
  21562. +// such as delegators and delegates may wish to call.
  21563. +//
  21564. +ANTLR3_API pSMARTPLLexer SMARTPLLexerNew (pANTLR3_INPUT_STREAM instream);
  21565. +ANTLR3_API pSMARTPLLexer SMARTPLLexerNewSSD (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
  21566. +
  21567. +/** Symbolic definitions of all the tokens that the lexer will work with.
  21568. + * \{
  21569. + *
  21570. + * Antlr will define EOF, but we can't use that as it it is too common in
  21571. + * in C header files and that would be confusing. There is no way to filter this out at the moment
  21572. + * so we just undef it here for now. That isn't the value we get back from C recognizers
  21573. + * anyway. We are looking for ANTLR3_TOKEN_EOF.
  21574. + */
  21575. +#ifdef EOF
  21576. +#undef EOF
  21577. +#endif
  21578. +#ifdef Tokens
  21579. +#undef Tokens
  21580. +#endif
  21581. +#define INTBOOL 14
  21582. +#define STRTAG 10
  21583. +#define AGO 22
  21584. +#define WHITESPACE 29
  21585. +#define GREATEREQUAL 25
  21586. +#define BEFORE 18
  21587. +#define DATETAG 16
  21588. +#define INT 15
  21589. +#define NOT 7
  21590. +#define AFTER 17
  21591. +#define AND 6
  21592. +#define EOF -1
  21593. +#define INCLUDES 11
  21594. +#define STR 4
  21595. +#define T__30 30
  21596. +#define T__31 31
  21597. +#define GREATER 24
  21598. +#define LPAR 8
  21599. +#define ENUMTAG 19
  21600. +#define IS 12
  21601. +#define ENUMVAL 20
  21602. +#define EQUAL 28
  21603. +#define OR 5
  21604. +#define LESS 26
  21605. +#define RPAR 9
  21606. +#define DATE 21
  21607. +#define LESSEQUAL 27
  21608. +#define INTTAG 13
  21609. +#define DATINTERVAL 23
  21610. +#ifdef EOF
  21611. +#undef EOF
  21612. +#define EOF ANTLR3_TOKEN_EOF
  21613. +#endif
  21614. +
  21615. +#ifndef TOKENSOURCE
  21616. +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
  21617. +#endif
  21618. +
  21619. +/* End of token definitions for SMARTPLLexer
  21620. + * =============================================================================
  21621. + */
  21622. +/** \} */
  21623. +
  21624. +#ifdef __cplusplus
  21625. +}
  21626. +#endif
  21627. +
  21628. +#endif
  21629. +
  21630. +/* END - Note:Keep extra line feed to satisfy UNIX systems */
  21631. diff --git a/src/pregen/SMARTPLParser.c b/src/pregen/SMARTPLParser.c
  21632. new file mode 100644
  21633. index 0000000..f39e5ae
  21634. --- /dev/null
  21635. +++ b/src/pregen/SMARTPLParser.c
  21636. @@ -0,0 +1,1812 @@
  21637. +/** \file
  21638. + * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
  21639. + *
  21640. + * - From the grammar source file : SMARTPL.g
  21641. + * - On : 2016-01-01 12:23:40
  21642. + * - for the parser : SMARTPLParserParser *
  21643. + * Editing it, at least manually, is not wise.
  21644. + *
  21645. + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
  21646. + *
  21647. + *
  21648. +*/
  21649. +// [The "BSD licence"]
  21650. +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
  21651. +// http://www.temporal-wave.com
  21652. +// http://www.linkedin.com/in/jimidle
  21653. +//
  21654. +// All rights reserved.
  21655. +//
  21656. +// Redistribution and use in source and binary forms, with or without
  21657. +// modification, are permitted provided that the following conditions
  21658. +// are met:
  21659. +// 1. Redistributions of source code must retain the above copyright
  21660. +// notice, this list of conditions and the following disclaimer.
  21661. +// 2. Redistributions in binary form must reproduce the above copyright
  21662. +// notice, this list of conditions and the following disclaimer in the
  21663. +// documentation and/or other materials provided with the distribution.
  21664. +// 3. The name of the author may not be used to endorse or promote products
  21665. +// derived from this software without specific prior written permission.
  21666. +//
  21667. +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  21668. +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  21669. +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  21670. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21671. +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  21672. +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  21673. +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  21674. +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  21675. +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  21676. +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21677. +
  21678. +/* -----------------------------------------
  21679. + * Include the ANTLR3 generated header file.
  21680. + */
  21681. +#include "SMARTPLParser.h"
  21682. +/* ----------------------------------------- */
  21683. +
  21684. +
  21685. +
  21686. +
  21687. +
  21688. +/* MACROS that hide the C interface implementations from the
  21689. + * generated code, which makes it a little more understandable to the human eye.
  21690. + * I am very much against using C pre-processor macros for function calls and bits
  21691. + * of code as you cannot see what is happening when single stepping in debuggers
  21692. + * and so on. The exception (in my book at least) is for generated code, where you are
  21693. + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
  21694. + * hides some indirect calls, but is always referring to the input stream. This is
  21695. + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
  21696. + * the runtime interfaces without changing the generated code too often, without
  21697. + * confusing the reader of the generated output, who may not wish to know the gory
  21698. + * details of the interface inheritance.
  21699. + */
  21700. +
  21701. +#define CTX ctx
  21702. +
  21703. +/* Aids in accessing scopes for grammar programmers
  21704. + */
  21705. +#undef SCOPE_TYPE
  21706. +#undef SCOPE_STACK
  21707. +#undef SCOPE_TOP
  21708. +#define SCOPE_TYPE(scope) pSMARTPLParser_##scope##_SCOPE
  21709. +#define SCOPE_STACK(scope) pSMARTPLParser_##scope##Stack
  21710. +#define SCOPE_TOP(scope) ctx->pSMARTPLParser_##scope##Top
  21711. +#define SCOPE_SIZE(scope) ctx->pSMARTPLParser_##scope##Stack_limit
  21712. +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
  21713. +
  21714. +/* Macros for accessing things in the parser
  21715. + */
  21716. +
  21717. +#undef PARSER
  21718. +#undef RECOGNIZER
  21719. +#undef HAVEPARSEDRULE
  21720. +#undef MEMOIZE
  21721. +#undef INPUT
  21722. +#undef STRSTREAM
  21723. +#undef HASEXCEPTION
  21724. +#undef EXCEPTION
  21725. +#undef MATCHT
  21726. +#undef MATCHANYT
  21727. +#undef FOLLOWSTACK
  21728. +#undef FOLLOWPUSH
  21729. +#undef FOLLOWPOP
  21730. +#undef PRECOVER
  21731. +#undef PREPORTERROR
  21732. +#undef LA
  21733. +#undef LT
  21734. +#undef CONSTRUCTEX
  21735. +#undef CONSUME
  21736. +#undef MARK
  21737. +#undef REWIND
  21738. +#undef REWINDLAST
  21739. +#undef PERRORRECOVERY
  21740. +#undef HASFAILED
  21741. +#undef FAILEDFLAG
  21742. +#undef RECOVERFROMMISMATCHEDSET
  21743. +#undef RECOVERFROMMISMATCHEDELEMENT
  21744. +#undef INDEX
  21745. +#undef ADAPTOR
  21746. +#undef SEEK
  21747. +#undef RULEMEMO
  21748. +#undef DBG
  21749. +
  21750. +#define PARSER ctx->pParser
  21751. +#define RECOGNIZER PARSER->rec
  21752. +#define PSRSTATE RECOGNIZER->state
  21753. +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
  21754. +#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si)
  21755. +#define INPUT PARSER->tstream
  21756. +#define STRSTREAM INPUT
  21757. +#define ISTREAM INPUT->istream
  21758. +#define INDEX() ISTREAM->index(INPUT->istream)
  21759. +#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE)
  21760. +#define EXCEPTION PSRSTATE->exception
  21761. +#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs)
  21762. +#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER)
  21763. +#define FOLLOWSTACK PSRSTATE->following
  21764. +#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
  21765. +#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK)
  21766. +#define PRECOVER() RECOGNIZER->recover(RECOGNIZER)
  21767. +#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER)
  21768. +#define LA(n) INPUT->istream->_LA(ISTREAM, n)
  21769. +#define LT(n) INPUT->_LT(INPUT, n)
  21770. +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
  21771. +#define CONSUME() ISTREAM->consume(ISTREAM)
  21772. +#define MARK() ISTREAM->mark(ISTREAM)
  21773. +#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
  21774. +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
  21775. +#define SEEK(n) ISTREAM->seek(ISTREAM, n)
  21776. +#define PERRORRECOVERY PSRSTATE->errorRecovery
  21777. +#define FAILEDFLAG PSRSTATE->failed
  21778. +#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE)
  21779. +#define BACKTRACKING PSRSTATE->backtracking
  21780. +#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
  21781. +#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
  21782. +#define ADAPTOR ctx->adaptor
  21783. +#define RULEMEMO PSRSTATE->ruleMemo
  21784. +#define DBG RECOGNIZER->debugger
  21785. +
  21786. +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
  21787. +
  21788. +/* The 4 tokens defined below may well clash with your own #defines or token types. If so
  21789. + * then for the present you must use different names for your defines as these are hard coded
  21790. + * in the code generator. It would be better not to use such names internally, and maybe
  21791. + * we can change this in a forthcoming release. I deliberately do not #undef these
  21792. + * here as this will at least give you a redefined error somewhere if they clash.
  21793. + */
  21794. +#define UP ANTLR3_TOKEN_UP
  21795. +#define DOWN ANTLR3_TOKEN_DOWN
  21796. +#define EOR ANTLR3_TOKEN_EOR
  21797. +#define INVALID ANTLR3_TOKEN_INVALID
  21798. +
  21799. +
  21800. +/* =============================================================================
  21801. + * Functions to create and destroy scopes. First come the rule scopes, followed
  21802. + * by the global declared scopes.
  21803. + */
  21804. +
  21805. +
  21806. +
  21807. +/* ============================================================================= */
  21808. +
  21809. +/* =============================================================================
  21810. + * Start of recognizer
  21811. + */
  21812. +
  21813. +
  21814. +
  21815. +/** \brief Table of all token names in symbolic order, mainly used for
  21816. + * error reporting.
  21817. + */
  21818. +pANTLR3_UINT8 SMARTPLParserTokenNames[28+4]
  21819. + = {
  21820. + (pANTLR3_UINT8) "<invalid>", /* String to print to indicate an invalid token */
  21821. + (pANTLR3_UINT8) "<EOR>",
  21822. + (pANTLR3_UINT8) "<DOWN>",
  21823. + (pANTLR3_UINT8) "<UP>",
  21824. + (pANTLR3_UINT8) "STR",
  21825. + (pANTLR3_UINT8) "OR",
  21826. + (pANTLR3_UINT8) "AND",
  21827. + (pANTLR3_UINT8) "NOT",
  21828. + (pANTLR3_UINT8) "LPAR",
  21829. + (pANTLR3_UINT8) "RPAR",
  21830. + (pANTLR3_UINT8) "STRTAG",
  21831. + (pANTLR3_UINT8) "INCLUDES",
  21832. + (pANTLR3_UINT8) "IS",
  21833. + (pANTLR3_UINT8) "INTTAG",
  21834. + (pANTLR3_UINT8) "INTBOOL",
  21835. + (pANTLR3_UINT8) "INT",
  21836. + (pANTLR3_UINT8) "DATETAG",
  21837. + (pANTLR3_UINT8) "AFTER",
  21838. + (pANTLR3_UINT8) "BEFORE",
  21839. + (pANTLR3_UINT8) "ENUMTAG",
  21840. + (pANTLR3_UINT8) "ENUMVAL",
  21841. + (pANTLR3_UINT8) "DATE",
  21842. + (pANTLR3_UINT8) "AGO",
  21843. + (pANTLR3_UINT8) "DATINTERVAL",
  21844. + (pANTLR3_UINT8) "GREATER",
  21845. + (pANTLR3_UINT8) "GREATEREQUAL",
  21846. + (pANTLR3_UINT8) "LESS",
  21847. + (pANTLR3_UINT8) "LESSEQUAL",
  21848. + (pANTLR3_UINT8) "EQUAL",
  21849. + (pANTLR3_UINT8) "WHITESPACE",
  21850. + (pANTLR3_UINT8) "'{'",
  21851. + (pANTLR3_UINT8) "'}'"
  21852. + };
  21853. +
  21854. +
  21855. +
  21856. +// Forward declare the locally static matching functions we have generated.
  21857. +//
  21858. +static SMARTPLParser_playlist_return playlist (pSMARTPLParser ctx);
  21859. +static SMARTPLParser_expression_return expression (pSMARTPLParser ctx);
  21860. +static SMARTPLParser_aexpr_return aexpr (pSMARTPLParser ctx);
  21861. +static SMARTPLParser_nexpr_return nexpr (pSMARTPLParser ctx);
  21862. +static SMARTPLParser_crit_return crit (pSMARTPLParser ctx);
  21863. +static SMARTPLParser_dateval_return dateval (pSMARTPLParser ctx);
  21864. +static SMARTPLParser_interval_return interval (pSMARTPLParser ctx);
  21865. +static void SMARTPLParserFree(pSMARTPLParser ctx);
  21866. +/* For use in tree output where we are accumulating rule labels via label += ruleRef
  21867. + * we need a function that knows how to free a return scope when the list is destroyed.
  21868. + * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
  21869. + */
  21870. +static void ANTLR3_CDECL freeScope(void * scope)
  21871. +{
  21872. + ANTLR3_FREE(scope);
  21873. +}
  21874. +
  21875. +/** \brief Name of the grammar file that generated this code
  21876. + */
  21877. +static const char fileName[] = "SMARTPL.g";
  21878. +
  21879. +/** \brief Return the name of the grammar file that generated this code.
  21880. + */
  21881. +static const char * getGrammarFileName()
  21882. +{
  21883. + return fileName;
  21884. +}
  21885. +/** \brief Create a new SMARTPLParser parser and return a context for it.
  21886. + *
  21887. + * \param[in] instream Pointer to an input stream interface.
  21888. + *
  21889. + * \return Pointer to new parser context upon success.
  21890. + */
  21891. +ANTLR3_API pSMARTPLParser
  21892. +SMARTPLParserNew (pANTLR3_COMMON_TOKEN_STREAM instream)
  21893. +{
  21894. + // See if we can create a new parser with the standard constructor
  21895. + //
  21896. + return SMARTPLParserNewSSD(instream, NULL);
  21897. +}
  21898. +
  21899. +/** \brief Create a new SMARTPLParser parser and return a context for it.
  21900. + *
  21901. + * \param[in] instream Pointer to an input stream interface.
  21902. + *
  21903. + * \return Pointer to new parser context upon success.
  21904. + */
  21905. +ANTLR3_API pSMARTPLParser
  21906. +SMARTPLParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
  21907. +{
  21908. + pSMARTPLParser ctx; /* Context structure we will build and return */
  21909. +
  21910. + ctx = (pSMARTPLParser) ANTLR3_CALLOC(1, sizeof(SMARTPLParser));
  21911. +
  21912. + if (ctx == NULL)
  21913. + {
  21914. + // Failed to allocate memory for parser context
  21915. + //
  21916. + return NULL;
  21917. + }
  21918. +
  21919. + /* -------------------------------------------------------------------
  21920. + * Memory for basic structure is allocated, now to fill in
  21921. + * the base ANTLR3 structures. We initialize the function pointers
  21922. + * for the standard ANTLR3 parser function set, but upon return
  21923. + * from here, the programmer may set the pointers to provide custom
  21924. + * implementations of each function.
  21925. + *
  21926. + * We don't use the macros defined in SMARTPLParser.h here, in order that you can get a sense
  21927. + * of what goes where.
  21928. + */
  21929. +
  21930. + /* Create a base parser/recognizer, using the supplied token stream
  21931. + */
  21932. + ctx->pParser = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state);
  21933. + /* Install the implementation of our SMARTPLParser interface
  21934. + */
  21935. + ctx->playlist = playlist;
  21936. + ctx->expression = expression;
  21937. + ctx->aexpr = aexpr;
  21938. + ctx->nexpr = nexpr;
  21939. + ctx->crit = crit;
  21940. + ctx->dateval = dateval;
  21941. + ctx->interval = interval;
  21942. + ctx->free = SMARTPLParserFree;
  21943. + ctx->getGrammarFileName = getGrammarFileName;
  21944. +
  21945. + /* Install the scope pushing methods.
  21946. + */
  21947. + ADAPTOR = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory);
  21948. + ctx->vectors = antlr3VectorFactoryNew(0);
  21949. +
  21950. +
  21951. +
  21952. + /* Install the token table
  21953. + */
  21954. + PSRSTATE->tokenNames = SMARTPLParserTokenNames;
  21955. +
  21956. +
  21957. + /* Return the newly built parser to the caller
  21958. + */
  21959. + return ctx;
  21960. +}
  21961. +
  21962. +/** Free the parser resources
  21963. + */
  21964. + static void
  21965. + SMARTPLParserFree(pSMARTPLParser ctx)
  21966. + {
  21967. + /* Free any scope memory
  21968. + */
  21969. +
  21970. + ctx->vectors->close(ctx->vectors);
  21971. + /* We created the adaptor so we must free it
  21972. + */
  21973. + ADAPTOR->free(ADAPTOR);
  21974. + // Free this parser
  21975. + //
  21976. + ctx->pParser->free(ctx->pParser);
  21977. + ANTLR3_FREE(ctx);
  21978. +
  21979. + /* Everything is released, so we can return
  21980. + */
  21981. + return;
  21982. + }
  21983. +
  21984. +/** Return token names used by this parser
  21985. + *
  21986. + * The returned pointer is used as an index into the token names table (using the token
  21987. + * number as the index).
  21988. + *
  21989. + * \return Pointer to first char * in the table.
  21990. + */
  21991. +static pANTLR3_UINT8 *getTokenNames()
  21992. +{
  21993. + return SMARTPLParserTokenNames;
  21994. +}
  21995. +
  21996. +
  21997. +/* Declare the bitsets
  21998. + */
  21999. +
  22000. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_playlist42 */
  22001. +static ANTLR3_BITWORD FOLLOW_STR_in_playlist42_bits[] = { ANTLR3_UINT64_LIT(0x0000000040000000) };
  22002. +static ANTLR3_BITSET_LIST FOLLOW_STR_in_playlist42 = { FOLLOW_STR_in_playlist42_bits, 1 };
  22003. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_30_in_playlist44 */
  22004. +static ANTLR3_BITWORD FOLLOW_30_in_playlist44_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
  22005. +static ANTLR3_BITSET_LIST FOLLOW_30_in_playlist44 = { FOLLOW_30_in_playlist44_bits, 1 };
  22006. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_playlist46 */
  22007. +static ANTLR3_BITWORD FOLLOW_expression_in_playlist46_bits[] = { ANTLR3_UINT64_LIT(0x0000000080000000) };
  22008. +static ANTLR3_BITSET_LIST FOLLOW_expression_in_playlist46 = { FOLLOW_expression_in_playlist46_bits, 1 };
  22009. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_31_in_playlist48 */
  22010. +static ANTLR3_BITWORD FOLLOW_31_in_playlist48_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000000) };
  22011. +static ANTLR3_BITSET_LIST FOLLOW_31_in_playlist48 = { FOLLOW_31_in_playlist48_bits, 1 };
  22012. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_EOF_in_playlist50 */
  22013. +static ANTLR3_BITWORD FOLLOW_EOF_in_playlist50_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  22014. +static ANTLR3_BITSET_LIST FOLLOW_EOF_in_playlist50 = { FOLLOW_EOF_in_playlist50_bits, 1 };
  22015. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expression62 */
  22016. +static ANTLR3_BITWORD FOLLOW_aexpr_in_expression62_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) };
  22017. +static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expression62 = { FOLLOW_aexpr_in_expression62_bits, 1 };
  22018. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expression65 */
  22019. +static ANTLR3_BITWORD FOLLOW_OR_in_expression65_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
  22020. +static ANTLR3_BITSET_LIST FOLLOW_OR_in_expression65 = { FOLLOW_OR_in_expression65_bits, 1 };
  22021. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expression68 */
  22022. +static ANTLR3_BITWORD FOLLOW_aexpr_in_expression68_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) };
  22023. +static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expression68 = { FOLLOW_aexpr_in_expression68_bits, 1 };
  22024. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_nexpr_in_aexpr83 */
  22025. +static ANTLR3_BITWORD FOLLOW_nexpr_in_aexpr83_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) };
  22026. +static ANTLR3_BITSET_LIST FOLLOW_nexpr_in_aexpr83 = { FOLLOW_nexpr_in_aexpr83_bits, 1 };
  22027. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_aexpr86 */
  22028. +static ANTLR3_BITWORD FOLLOW_AND_in_aexpr86_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
  22029. +static ANTLR3_BITSET_LIST FOLLOW_AND_in_aexpr86 = { FOLLOW_AND_in_aexpr86_bits, 1 };
  22030. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_nexpr_in_aexpr89 */
  22031. +static ANTLR3_BITWORD FOLLOW_nexpr_in_aexpr89_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) };
  22032. +static ANTLR3_BITSET_LIST FOLLOW_nexpr_in_aexpr89 = { FOLLOW_nexpr_in_aexpr89_bits, 1 };
  22033. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_nexpr104 */
  22034. +static ANTLR3_BITWORD FOLLOW_NOT_in_nexpr104_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
  22035. +static ANTLR3_BITSET_LIST FOLLOW_NOT_in_nexpr104 = { FOLLOW_NOT_in_nexpr104_bits, 1 };
  22036. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_nexpr107 */
  22037. +static ANTLR3_BITWORD FOLLOW_crit_in_nexpr107_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  22038. +static ANTLR3_BITSET_LIST FOLLOW_crit_in_nexpr107 = { FOLLOW_crit_in_nexpr107_bits, 1 };
  22039. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_nexpr114 */
  22040. +static ANTLR3_BITWORD FOLLOW_crit_in_nexpr114_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  22041. +static ANTLR3_BITSET_LIST FOLLOW_crit_in_nexpr114 = { FOLLOW_crit_in_nexpr114_bits, 1 };
  22042. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_LPAR_in_crit127 */
  22043. +static ANTLR3_BITWORD FOLLOW_LPAR_in_crit127_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
  22044. +static ANTLR3_BITSET_LIST FOLLOW_LPAR_in_crit127 = { FOLLOW_LPAR_in_crit127_bits, 1 };
  22045. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_crit129 */
  22046. +static ANTLR3_BITWORD FOLLOW_expression_in_crit129_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000200) };
  22047. +static ANTLR3_BITSET_LIST FOLLOW_expression_in_crit129 = { FOLLOW_expression_in_crit129_bits, 1 };
  22048. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_RPAR_in_crit131 */
  22049. +static ANTLR3_BITWORD FOLLOW_RPAR_in_crit131_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  22050. +static ANTLR3_BITSET_LIST FOLLOW_RPAR_in_crit131 = { FOLLOW_RPAR_in_crit131_bits, 1 };
  22051. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STRTAG_in_crit142 */
  22052. +static ANTLR3_BITWORD FOLLOW_STRTAG_in_crit142_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001800) };
  22053. +static ANTLR3_BITSET_LIST FOLLOW_STRTAG_in_crit142 = { FOLLOW_STRTAG_in_crit142_bits, 1 };
  22054. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_crit144 */
  22055. +static ANTLR3_BITWORD FOLLOW_set_in_crit144_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) };
  22056. +static ANTLR3_BITSET_LIST FOLLOW_set_in_crit144 = { FOLLOW_set_in_crit144_bits, 1 };
  22057. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_crit150 */
  22058. +static ANTLR3_BITWORD FOLLOW_STR_in_crit150_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  22059. +static ANTLR3_BITSET_LIST FOLLOW_STR_in_crit150 = { FOLLOW_STR_in_crit150_bits, 1 };
  22060. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTTAG_in_crit157 */
  22061. +static ANTLR3_BITWORD FOLLOW_INTTAG_in_crit157_bits[] = { ANTLR3_UINT64_LIT(0x0000000000004000) };
  22062. +static ANTLR3_BITSET_LIST FOLLOW_INTTAG_in_crit157 = { FOLLOW_INTTAG_in_crit157_bits, 1 };
  22063. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTBOOL_in_crit159 */
  22064. +static ANTLR3_BITWORD FOLLOW_INTBOOL_in_crit159_bits[] = { ANTLR3_UINT64_LIT(0x0000000000008000) };
  22065. +static ANTLR3_BITSET_LIST FOLLOW_INTBOOL_in_crit159 = { FOLLOW_INTBOOL_in_crit159_bits, 1 };
  22066. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_crit161 */
  22067. +static ANTLR3_BITWORD FOLLOW_INT_in_crit161_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  22068. +static ANTLR3_BITSET_LIST FOLLOW_INT_in_crit161 = { FOLLOW_INT_in_crit161_bits, 1 };
  22069. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATETAG_in_crit168 */
  22070. +static ANTLR3_BITWORD FOLLOW_DATETAG_in_crit168_bits[] = { ANTLR3_UINT64_LIT(0x0000000000060000) };
  22071. +static ANTLR3_BITSET_LIST FOLLOW_DATETAG_in_crit168 = { FOLLOW_DATETAG_in_crit168_bits, 1 };
  22072. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_crit170 */
  22073. +static ANTLR3_BITWORD FOLLOW_set_in_crit170_bits[] = { ANTLR3_UINT64_LIT(0x0000000000208000) };
  22074. +static ANTLR3_BITSET_LIST FOLLOW_set_in_crit170 = { FOLLOW_set_in_crit170_bits, 1 };
  22075. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateval_in_crit176 */
  22076. +static ANTLR3_BITWORD FOLLOW_dateval_in_crit176_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  22077. +static ANTLR3_BITSET_LIST FOLLOW_dateval_in_crit176 = { FOLLOW_dateval_in_crit176_bits, 1 };
  22078. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMTAG_in_crit183 */
  22079. +static ANTLR3_BITWORD FOLLOW_ENUMTAG_in_crit183_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001000) };
  22080. +static ANTLR3_BITSET_LIST FOLLOW_ENUMTAG_in_crit183 = { FOLLOW_ENUMTAG_in_crit183_bits, 1 };
  22081. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_IS_in_crit185 */
  22082. +static ANTLR3_BITWORD FOLLOW_IS_in_crit185_bits[] = { ANTLR3_UINT64_LIT(0x0000000000100000) };
  22083. +static ANTLR3_BITSET_LIST FOLLOW_IS_in_crit185 = { FOLLOW_IS_in_crit185_bits, 1 };
  22084. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMVAL_in_crit187 */
  22085. +static ANTLR3_BITWORD FOLLOW_ENUMVAL_in_crit187_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  22086. +static ANTLR3_BITSET_LIST FOLLOW_ENUMVAL_in_crit187 = { FOLLOW_ENUMVAL_in_crit187_bits, 1 };
  22087. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval200 */
  22088. +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval200_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  22089. +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval200 = { FOLLOW_DATE_in_dateval200_bits, 1 };
  22090. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval207 */
  22091. +static ANTLR3_BITWORD FOLLOW_interval_in_dateval207_bits[] = { ANTLR3_UINT64_LIT(0x0000000000040000) };
  22092. +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval207 = { FOLLOW_interval_in_dateval207_bits, 1 };
  22093. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateval209 */
  22094. +static ANTLR3_BITWORD FOLLOW_BEFORE_in_dateval209_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) };
  22095. +static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateval209 = { FOLLOW_BEFORE_in_dateval209_bits, 1 };
  22096. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval211 */
  22097. +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval211_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  22098. +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval211 = { FOLLOW_DATE_in_dateval211_bits, 1 };
  22099. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval218 */
  22100. +static ANTLR3_BITWORD FOLLOW_interval_in_dateval218_bits[] = { ANTLR3_UINT64_LIT(0x0000000000020000) };
  22101. +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval218 = { FOLLOW_interval_in_dateval218_bits, 1 };
  22102. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateval220 */
  22103. +static ANTLR3_BITWORD FOLLOW_AFTER_in_dateval220_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) };
  22104. +static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateval220 = { FOLLOW_AFTER_in_dateval220_bits, 1 };
  22105. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval222 */
  22106. +static ANTLR3_BITWORD FOLLOW_DATE_in_dateval222_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  22107. +static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval222 = { FOLLOW_DATE_in_dateval222_bits, 1 };
  22108. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval229 */
  22109. +static ANTLR3_BITWORD FOLLOW_interval_in_dateval229_bits[] = { ANTLR3_UINT64_LIT(0x0000000000400000) };
  22110. +static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval229 = { FOLLOW_interval_in_dateval229_bits, 1 };
  22111. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_AGO_in_dateval231 */
  22112. +static ANTLR3_BITWORD FOLLOW_AGO_in_dateval231_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  22113. +static ANTLR3_BITSET_LIST FOLLOW_AGO_in_dateval231 = { FOLLOW_AGO_in_dateval231_bits, 1 };
  22114. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_interval243 */
  22115. +static ANTLR3_BITWORD FOLLOW_INT_in_interval243_bits[] = { ANTLR3_UINT64_LIT(0x0000000000800000) };
  22116. +static ANTLR3_BITSET_LIST FOLLOW_INT_in_interval243 = { FOLLOW_INT_in_interval243_bits, 1 };
  22117. +/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATINTERVAL_in_interval245 */
  22118. +static ANTLR3_BITWORD FOLLOW_DATINTERVAL_in_interval245_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
  22119. +static ANTLR3_BITSET_LIST FOLLOW_DATINTERVAL_in_interval245 = { FOLLOW_DATINTERVAL_in_interval245_bits, 1 };
  22120. +
  22121. +
  22122. +
  22123. +
  22124. +/* ==============================================
  22125. + * Parsing rules
  22126. + */
  22127. +/**
  22128. + * $ANTLR start playlist
  22129. + * SMARTPL.g:27:1: playlist : STR '{' expression '}' EOF ;
  22130. + */
  22131. +static SMARTPLParser_playlist_return
  22132. +playlist(pSMARTPLParser ctx)
  22133. +{
  22134. + SMARTPLParser_playlist_return retval;
  22135. +
  22136. + pANTLR3_BASE_TREE root_0;
  22137. +
  22138. + pANTLR3_COMMON_TOKEN STR1;
  22139. + pANTLR3_COMMON_TOKEN char_literal2;
  22140. + pANTLR3_COMMON_TOKEN char_literal4;
  22141. + pANTLR3_COMMON_TOKEN EOF5;
  22142. + SMARTPLParser_expression_return expression3;
  22143. + #undef RETURN_TYPE_expression3
  22144. + #define RETURN_TYPE_expression3 SMARTPLParser_expression_return
  22145. +
  22146. + pANTLR3_BASE_TREE STR1_tree;
  22147. + pANTLR3_BASE_TREE char_literal2_tree;
  22148. + pANTLR3_BASE_TREE char_literal4_tree;
  22149. + pANTLR3_BASE_TREE EOF5_tree;
  22150. +
  22151. + /* Initialize rule variables
  22152. + */
  22153. +
  22154. +
  22155. + root_0 = NULL;
  22156. +
  22157. + STR1 = NULL;
  22158. + char_literal2 = NULL;
  22159. + char_literal4 = NULL;
  22160. + EOF5 = NULL;
  22161. + expression3.tree = NULL;
  22162. +
  22163. + retval.start = LT(1); retval.stop = retval.start;
  22164. +
  22165. + STR1_tree = NULL;
  22166. + char_literal2_tree = NULL;
  22167. + char_literal4_tree = NULL;
  22168. + EOF5_tree = NULL;
  22169. +
  22170. +
  22171. + retval.tree = NULL;
  22172. + {
  22173. + // SMARTPL.g:27:10: ( STR '{' expression '}' EOF )
  22174. + // SMARTPL.g:27:12: STR '{' expression '}' EOF
  22175. + {
  22176. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  22177. +
  22178. + STR1 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_playlist42);
  22179. + if (HASEXCEPTION())
  22180. + {
  22181. + goto ruleplaylistEx;
  22182. + }
  22183. +
  22184. + STR1_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR1));
  22185. + ADAPTOR->addChild(ADAPTOR, root_0, STR1_tree);
  22186. +
  22187. + char_literal2 = (pANTLR3_COMMON_TOKEN) MATCHT(30, &FOLLOW_30_in_playlist44);
  22188. + if (HASEXCEPTION())
  22189. + {
  22190. + goto ruleplaylistEx;
  22191. + }
  22192. +
  22193. + char_literal2_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, char_literal2));
  22194. + ADAPTOR->addChild(ADAPTOR, root_0, char_literal2_tree);
  22195. +
  22196. + FOLLOWPUSH(FOLLOW_expression_in_playlist46);
  22197. + expression3=expression(ctx);
  22198. +
  22199. + FOLLOWPOP();
  22200. + if (HASEXCEPTION())
  22201. + {
  22202. + goto ruleplaylistEx;
  22203. + }
  22204. +
  22205. + ADAPTOR->addChild(ADAPTOR, root_0, expression3.tree);
  22206. + char_literal4 = (pANTLR3_COMMON_TOKEN) MATCHT(31, &FOLLOW_31_in_playlist48);
  22207. + if (HASEXCEPTION())
  22208. + {
  22209. + goto ruleplaylistEx;
  22210. + }
  22211. +
  22212. + char_literal4_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, char_literal4));
  22213. + ADAPTOR->addChild(ADAPTOR, root_0, char_literal4_tree);
  22214. +
  22215. + EOF5 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_playlist50);
  22216. + if (HASEXCEPTION())
  22217. + {
  22218. + goto ruleplaylistEx;
  22219. + }
  22220. +
  22221. + EOF5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, EOF5));
  22222. + ADAPTOR->addChild(ADAPTOR, root_0, EOF5_tree);
  22223. +
  22224. +
  22225. + }
  22226. +
  22227. + }
  22228. +
  22229. +
  22230. + // This is where rules clean up and exit
  22231. + //
  22232. + goto ruleplaylistEx; /* Prevent compiler warnings */
  22233. + ruleplaylistEx: ;
  22234. + retval.stop = LT(-1);
  22235. +
  22236. + retval.stop = LT(-1);
  22237. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  22238. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  22239. +
  22240. + if (HASEXCEPTION())
  22241. + {
  22242. + PREPORTERROR();
  22243. + PRECOVER();
  22244. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  22245. + }
  22246. +
  22247. +
  22248. + return retval;
  22249. +}
  22250. +/* $ANTLR end playlist */
  22251. +
  22252. +/**
  22253. + * $ANTLR start expression
  22254. + * SMARTPL.g:30:1: expression : aexpr ( OR aexpr )* ;
  22255. + */
  22256. +static SMARTPLParser_expression_return
  22257. +expression(pSMARTPLParser ctx)
  22258. +{
  22259. + SMARTPLParser_expression_return retval;
  22260. +
  22261. + pANTLR3_BASE_TREE root_0;
  22262. +
  22263. + pANTLR3_COMMON_TOKEN OR7;
  22264. + SMARTPLParser_aexpr_return aexpr6;
  22265. + #undef RETURN_TYPE_aexpr6
  22266. + #define RETURN_TYPE_aexpr6 SMARTPLParser_aexpr_return
  22267. +
  22268. + SMARTPLParser_aexpr_return aexpr8;
  22269. + #undef RETURN_TYPE_aexpr8
  22270. + #define RETURN_TYPE_aexpr8 SMARTPLParser_aexpr_return
  22271. +
  22272. + pANTLR3_BASE_TREE OR7_tree;
  22273. +
  22274. + /* Initialize rule variables
  22275. + */
  22276. +
  22277. +
  22278. + root_0 = NULL;
  22279. +
  22280. + OR7 = NULL;
  22281. + aexpr6.tree = NULL;
  22282. +
  22283. + aexpr8.tree = NULL;
  22284. +
  22285. + retval.start = LT(1); retval.stop = retval.start;
  22286. +
  22287. + OR7_tree = NULL;
  22288. +
  22289. +
  22290. + retval.tree = NULL;
  22291. + {
  22292. + // SMARTPL.g:30:12: ( aexpr ( OR aexpr )* )
  22293. + // SMARTPL.g:30:14: aexpr ( OR aexpr )*
  22294. + {
  22295. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  22296. +
  22297. + FOLLOWPUSH(FOLLOW_aexpr_in_expression62);
  22298. + aexpr6=aexpr(ctx);
  22299. +
  22300. + FOLLOWPOP();
  22301. + if (HASEXCEPTION())
  22302. + {
  22303. + goto ruleexpressionEx;
  22304. + }
  22305. +
  22306. + ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree);
  22307. +
  22308. + // SMARTPL.g:30:20: ( OR aexpr )*
  22309. +
  22310. + for (;;)
  22311. + {
  22312. + int alt1=2;
  22313. + switch ( LA(1) )
  22314. + {
  22315. + case OR:
  22316. + {
  22317. + alt1=1;
  22318. + }
  22319. + break;
  22320. +
  22321. + }
  22322. +
  22323. + switch (alt1)
  22324. + {
  22325. + case 1:
  22326. + // SMARTPL.g:30:21: OR aexpr
  22327. + {
  22328. + OR7 = (pANTLR3_COMMON_TOKEN) MATCHT(OR, &FOLLOW_OR_in_expression65);
  22329. + if (HASEXCEPTION())
  22330. + {
  22331. + goto ruleexpressionEx;
  22332. + }
  22333. +
  22334. + OR7_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OR7));
  22335. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OR7_tree, root_0));
  22336. +
  22337. + FOLLOWPUSH(FOLLOW_aexpr_in_expression68);
  22338. + aexpr8=aexpr(ctx);
  22339. +
  22340. + FOLLOWPOP();
  22341. + if (HASEXCEPTION())
  22342. + {
  22343. + goto ruleexpressionEx;
  22344. + }
  22345. +
  22346. + ADAPTOR->addChild(ADAPTOR, root_0, aexpr8.tree);
  22347. +
  22348. + }
  22349. + break;
  22350. +
  22351. + default:
  22352. + goto loop1; /* break out of the loop */
  22353. + break;
  22354. + }
  22355. + }
  22356. + loop1: ; /* Jump out to here if this rule does not match */
  22357. +
  22358. +
  22359. + }
  22360. +
  22361. + }
  22362. +
  22363. +
  22364. + // This is where rules clean up and exit
  22365. + //
  22366. + goto ruleexpressionEx; /* Prevent compiler warnings */
  22367. + ruleexpressionEx: ;
  22368. + retval.stop = LT(-1);
  22369. +
  22370. + retval.stop = LT(-1);
  22371. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  22372. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  22373. +
  22374. + if (HASEXCEPTION())
  22375. + {
  22376. + PREPORTERROR();
  22377. + PRECOVER();
  22378. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  22379. + }
  22380. +
  22381. +
  22382. + return retval;
  22383. +}
  22384. +/* $ANTLR end expression */
  22385. +
  22386. +/**
  22387. + * $ANTLR start aexpr
  22388. + * SMARTPL.g:33:1: aexpr : nexpr ( AND nexpr )* ;
  22389. + */
  22390. +static SMARTPLParser_aexpr_return
  22391. +aexpr(pSMARTPLParser ctx)
  22392. +{
  22393. + SMARTPLParser_aexpr_return retval;
  22394. +
  22395. + pANTLR3_BASE_TREE root_0;
  22396. +
  22397. + pANTLR3_COMMON_TOKEN AND10;
  22398. + SMARTPLParser_nexpr_return nexpr9;
  22399. + #undef RETURN_TYPE_nexpr9
  22400. + #define RETURN_TYPE_nexpr9 SMARTPLParser_nexpr_return
  22401. +
  22402. + SMARTPLParser_nexpr_return nexpr11;
  22403. + #undef RETURN_TYPE_nexpr11
  22404. + #define RETURN_TYPE_nexpr11 SMARTPLParser_nexpr_return
  22405. +
  22406. + pANTLR3_BASE_TREE AND10_tree;
  22407. +
  22408. + /* Initialize rule variables
  22409. + */
  22410. +
  22411. +
  22412. + root_0 = NULL;
  22413. +
  22414. + AND10 = NULL;
  22415. + nexpr9.tree = NULL;
  22416. +
  22417. + nexpr11.tree = NULL;
  22418. +
  22419. + retval.start = LT(1); retval.stop = retval.start;
  22420. +
  22421. + AND10_tree = NULL;
  22422. +
  22423. +
  22424. + retval.tree = NULL;
  22425. + {
  22426. + // SMARTPL.g:33:8: ( nexpr ( AND nexpr )* )
  22427. + // SMARTPL.g:33:10: nexpr ( AND nexpr )*
  22428. + {
  22429. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  22430. +
  22431. + FOLLOWPUSH(FOLLOW_nexpr_in_aexpr83);
  22432. + nexpr9=nexpr(ctx);
  22433. +
  22434. + FOLLOWPOP();
  22435. + if (HASEXCEPTION())
  22436. + {
  22437. + goto ruleaexprEx;
  22438. + }
  22439. +
  22440. + ADAPTOR->addChild(ADAPTOR, root_0, nexpr9.tree);
  22441. +
  22442. + // SMARTPL.g:33:16: ( AND nexpr )*
  22443. +
  22444. + for (;;)
  22445. + {
  22446. + int alt2=2;
  22447. + switch ( LA(1) )
  22448. + {
  22449. + case AND:
  22450. + {
  22451. + alt2=1;
  22452. + }
  22453. + break;
  22454. +
  22455. + }
  22456. +
  22457. + switch (alt2)
  22458. + {
  22459. + case 1:
  22460. + // SMARTPL.g:33:17: AND nexpr
  22461. + {
  22462. + AND10 = (pANTLR3_COMMON_TOKEN) MATCHT(AND, &FOLLOW_AND_in_aexpr86);
  22463. + if (HASEXCEPTION())
  22464. + {
  22465. + goto ruleaexprEx;
  22466. + }
  22467. +
  22468. + AND10_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AND10));
  22469. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, AND10_tree, root_0));
  22470. +
  22471. + FOLLOWPUSH(FOLLOW_nexpr_in_aexpr89);
  22472. + nexpr11=nexpr(ctx);
  22473. +
  22474. + FOLLOWPOP();
  22475. + if (HASEXCEPTION())
  22476. + {
  22477. + goto ruleaexprEx;
  22478. + }
  22479. +
  22480. + ADAPTOR->addChild(ADAPTOR, root_0, nexpr11.tree);
  22481. +
  22482. + }
  22483. + break;
  22484. +
  22485. + default:
  22486. + goto loop2; /* break out of the loop */
  22487. + break;
  22488. + }
  22489. + }
  22490. + loop2: ; /* Jump out to here if this rule does not match */
  22491. +
  22492. +
  22493. + }
  22494. +
  22495. + }
  22496. +
  22497. +
  22498. + // This is where rules clean up and exit
  22499. + //
  22500. + goto ruleaexprEx; /* Prevent compiler warnings */
  22501. + ruleaexprEx: ;
  22502. + retval.stop = LT(-1);
  22503. +
  22504. + retval.stop = LT(-1);
  22505. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  22506. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  22507. +
  22508. + if (HASEXCEPTION())
  22509. + {
  22510. + PREPORTERROR();
  22511. + PRECOVER();
  22512. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  22513. + }
  22514. +
  22515. +
  22516. + return retval;
  22517. +}
  22518. +/* $ANTLR end aexpr */
  22519. +
  22520. +/**
  22521. + * $ANTLR start nexpr
  22522. + * SMARTPL.g:36:1: nexpr : ( NOT crit | crit );
  22523. + */
  22524. +static SMARTPLParser_nexpr_return
  22525. +nexpr(pSMARTPLParser ctx)
  22526. +{
  22527. + SMARTPLParser_nexpr_return retval;
  22528. +
  22529. + pANTLR3_BASE_TREE root_0;
  22530. +
  22531. + pANTLR3_COMMON_TOKEN NOT12;
  22532. + SMARTPLParser_crit_return crit13;
  22533. + #undef RETURN_TYPE_crit13
  22534. + #define RETURN_TYPE_crit13 SMARTPLParser_crit_return
  22535. +
  22536. + SMARTPLParser_crit_return crit14;
  22537. + #undef RETURN_TYPE_crit14
  22538. + #define RETURN_TYPE_crit14 SMARTPLParser_crit_return
  22539. +
  22540. + pANTLR3_BASE_TREE NOT12_tree;
  22541. +
  22542. + /* Initialize rule variables
  22543. + */
  22544. +
  22545. +
  22546. + root_0 = NULL;
  22547. +
  22548. + NOT12 = NULL;
  22549. + crit13.tree = NULL;
  22550. +
  22551. + crit14.tree = NULL;
  22552. +
  22553. + retval.start = LT(1); retval.stop = retval.start;
  22554. +
  22555. + NOT12_tree = NULL;
  22556. +
  22557. +
  22558. + retval.tree = NULL;
  22559. + {
  22560. + {
  22561. + // SMARTPL.g:36:8: ( NOT crit | crit )
  22562. +
  22563. + ANTLR3_UINT32 alt3;
  22564. +
  22565. + alt3=2;
  22566. +
  22567. + switch ( LA(1) )
  22568. + {
  22569. + case NOT:
  22570. + {
  22571. + alt3=1;
  22572. + }
  22573. + break;
  22574. + case LPAR:
  22575. + case STRTAG:
  22576. + case INTTAG:
  22577. + case DATETAG:
  22578. + case ENUMTAG:
  22579. + {
  22580. + alt3=2;
  22581. + }
  22582. + break;
  22583. +
  22584. + default:
  22585. + CONSTRUCTEX();
  22586. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  22587. + EXCEPTION->message = (void *)"";
  22588. + EXCEPTION->decisionNum = 3;
  22589. + EXCEPTION->state = 0;
  22590. +
  22591. +
  22592. + goto rulenexprEx;
  22593. + }
  22594. +
  22595. + switch (alt3)
  22596. + {
  22597. + case 1:
  22598. + // SMARTPL.g:36:10: NOT crit
  22599. + {
  22600. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  22601. +
  22602. + NOT12 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_nexpr104);
  22603. + if (HASEXCEPTION())
  22604. + {
  22605. + goto rulenexprEx;
  22606. + }
  22607. +
  22608. + NOT12_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, NOT12));
  22609. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, NOT12_tree, root_0));
  22610. +
  22611. + FOLLOWPUSH(FOLLOW_crit_in_nexpr107);
  22612. + crit13=crit(ctx);
  22613. +
  22614. + FOLLOWPOP();
  22615. + if (HASEXCEPTION())
  22616. + {
  22617. + goto rulenexprEx;
  22618. + }
  22619. +
  22620. + ADAPTOR->addChild(ADAPTOR, root_0, crit13.tree);
  22621. +
  22622. + }
  22623. + break;
  22624. + case 2:
  22625. + // SMARTPL.g:37:6: crit
  22626. + {
  22627. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  22628. +
  22629. + FOLLOWPUSH(FOLLOW_crit_in_nexpr114);
  22630. + crit14=crit(ctx);
  22631. +
  22632. + FOLLOWPOP();
  22633. + if (HASEXCEPTION())
  22634. + {
  22635. + goto rulenexprEx;
  22636. + }
  22637. +
  22638. + ADAPTOR->addChild(ADAPTOR, root_0, crit14.tree);
  22639. +
  22640. + }
  22641. + break;
  22642. +
  22643. + }
  22644. + }
  22645. + }
  22646. +
  22647. +
  22648. + // This is where rules clean up and exit
  22649. + //
  22650. + goto rulenexprEx; /* Prevent compiler warnings */
  22651. + rulenexprEx: ;
  22652. + retval.stop = LT(-1);
  22653. +
  22654. + retval.stop = LT(-1);
  22655. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  22656. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  22657. +
  22658. + if (HASEXCEPTION())
  22659. + {
  22660. + PREPORTERROR();
  22661. + PRECOVER();
  22662. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  22663. + }
  22664. +
  22665. +
  22666. + return retval;
  22667. +}
  22668. +/* $ANTLR end nexpr */
  22669. +
  22670. +/**
  22671. + * $ANTLR start crit
  22672. + * SMARTPL.g:40:1: crit : ( LPAR expression RPAR -> expression | STRTAG ( INCLUDES | IS ) STR | INTTAG INTBOOL INT | DATETAG ( AFTER | BEFORE ) dateval | ENUMTAG IS ENUMVAL );
  22673. + */
  22674. +static SMARTPLParser_crit_return
  22675. +crit(pSMARTPLParser ctx)
  22676. +{
  22677. + SMARTPLParser_crit_return retval;
  22678. +
  22679. + pANTLR3_BASE_TREE root_0;
  22680. +
  22681. + pANTLR3_COMMON_TOKEN LPAR15;
  22682. + pANTLR3_COMMON_TOKEN RPAR17;
  22683. + pANTLR3_COMMON_TOKEN STRTAG18;
  22684. + pANTLR3_COMMON_TOKEN set19;
  22685. + pANTLR3_COMMON_TOKEN STR20;
  22686. + pANTLR3_COMMON_TOKEN INTTAG21;
  22687. + pANTLR3_COMMON_TOKEN INTBOOL22;
  22688. + pANTLR3_COMMON_TOKEN INT23;
  22689. + pANTLR3_COMMON_TOKEN DATETAG24;
  22690. + pANTLR3_COMMON_TOKEN set25;
  22691. + pANTLR3_COMMON_TOKEN ENUMTAG27;
  22692. + pANTLR3_COMMON_TOKEN IS28;
  22693. + pANTLR3_COMMON_TOKEN ENUMVAL29;
  22694. + SMARTPLParser_expression_return expression16;
  22695. + #undef RETURN_TYPE_expression16
  22696. + #define RETURN_TYPE_expression16 SMARTPLParser_expression_return
  22697. +
  22698. + SMARTPLParser_dateval_return dateval26;
  22699. + #undef RETURN_TYPE_dateval26
  22700. + #define RETURN_TYPE_dateval26 SMARTPLParser_dateval_return
  22701. +
  22702. + pANTLR3_BASE_TREE LPAR15_tree;
  22703. + pANTLR3_BASE_TREE RPAR17_tree;
  22704. + pANTLR3_BASE_TREE STRTAG18_tree;
  22705. + pANTLR3_BASE_TREE set19_tree;
  22706. + pANTLR3_BASE_TREE STR20_tree;
  22707. + pANTLR3_BASE_TREE INTTAG21_tree;
  22708. + pANTLR3_BASE_TREE INTBOOL22_tree;
  22709. + pANTLR3_BASE_TREE INT23_tree;
  22710. + pANTLR3_BASE_TREE DATETAG24_tree;
  22711. + pANTLR3_BASE_TREE set25_tree;
  22712. + pANTLR3_BASE_TREE ENUMTAG27_tree;
  22713. + pANTLR3_BASE_TREE IS28_tree;
  22714. + pANTLR3_BASE_TREE ENUMVAL29_tree;
  22715. + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_RPAR;
  22716. + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_LPAR;
  22717. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expression;
  22718. + /* Initialize rule variables
  22719. + */
  22720. +
  22721. +
  22722. + root_0 = NULL;
  22723. +
  22724. + LPAR15 = NULL;
  22725. + RPAR17 = NULL;
  22726. + STRTAG18 = NULL;
  22727. + set19 = NULL;
  22728. + STR20 = NULL;
  22729. + INTTAG21 = NULL;
  22730. + INTBOOL22 = NULL;
  22731. + INT23 = NULL;
  22732. + DATETAG24 = NULL;
  22733. + set25 = NULL;
  22734. + ENUMTAG27 = NULL;
  22735. + IS28 = NULL;
  22736. + ENUMVAL29 = NULL;
  22737. + expression16.tree = NULL;
  22738. +
  22739. + dateval26.tree = NULL;
  22740. +
  22741. + retval.start = LT(1); retval.stop = retval.start;
  22742. +
  22743. + LPAR15_tree = NULL;
  22744. + RPAR17_tree = NULL;
  22745. + STRTAG18_tree = NULL;
  22746. + set19_tree = NULL;
  22747. + STR20_tree = NULL;
  22748. + INTTAG21_tree = NULL;
  22749. + INTBOOL22_tree = NULL;
  22750. + INT23_tree = NULL;
  22751. + DATETAG24_tree = NULL;
  22752. + set25_tree = NULL;
  22753. + ENUMTAG27_tree = NULL;
  22754. + IS28_tree = NULL;
  22755. + ENUMVAL29_tree = NULL;
  22756. +
  22757. + stream_RPAR = NULL;
  22758. + #define CREATE_stream_RPAR if (stream_RPAR == NULL) {stream_RPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token RPAR"); }
  22759. + stream_LPAR = NULL;
  22760. + #define CREATE_stream_LPAR if (stream_LPAR == NULL) {stream_LPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token LPAR"); }
  22761. + stream_expression = NULL;
  22762. + #define CREATE_stream_expression if (stream_expression == NULL) {stream_expression = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expression"); }
  22763. +
  22764. + retval.tree = NULL;
  22765. + {
  22766. + {
  22767. + // SMARTPL.g:40:7: ( LPAR expression RPAR -> expression | STRTAG ( INCLUDES | IS ) STR | INTTAG INTBOOL INT | DATETAG ( AFTER | BEFORE ) dateval | ENUMTAG IS ENUMVAL )
  22768. +
  22769. + ANTLR3_UINT32 alt4;
  22770. +
  22771. + alt4=5;
  22772. +
  22773. + switch ( LA(1) )
  22774. + {
  22775. + case LPAR:
  22776. + {
  22777. + alt4=1;
  22778. + }
  22779. + break;
  22780. + case STRTAG:
  22781. + {
  22782. + alt4=2;
  22783. + }
  22784. + break;
  22785. + case INTTAG:
  22786. + {
  22787. + alt4=3;
  22788. + }
  22789. + break;
  22790. + case DATETAG:
  22791. + {
  22792. + alt4=4;
  22793. + }
  22794. + break;
  22795. + case ENUMTAG:
  22796. + {
  22797. + alt4=5;
  22798. + }
  22799. + break;
  22800. +
  22801. + default:
  22802. + CONSTRUCTEX();
  22803. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  22804. + EXCEPTION->message = (void *)"";
  22805. + EXCEPTION->decisionNum = 4;
  22806. + EXCEPTION->state = 0;
  22807. +
  22808. +
  22809. + goto rulecritEx;
  22810. + }
  22811. +
  22812. + switch (alt4)
  22813. + {
  22814. + case 1:
  22815. + // SMARTPL.g:40:9: LPAR expression RPAR
  22816. + {
  22817. + LPAR15 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit127);
  22818. + if (HASEXCEPTION())
  22819. + {
  22820. + goto rulecritEx;
  22821. + }
  22822. +
  22823. + CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR15, NULL);
  22824. +
  22825. + FOLLOWPUSH(FOLLOW_expression_in_crit129);
  22826. + expression16=expression(ctx);
  22827. +
  22828. + FOLLOWPOP();
  22829. + if (HASEXCEPTION())
  22830. + {
  22831. + goto rulecritEx;
  22832. + }
  22833. +
  22834. + CREATE_stream_expression; stream_expression->add(stream_expression, expression16.tree, NULL);
  22835. + RPAR17 = (pANTLR3_COMMON_TOKEN) MATCHT(RPAR, &FOLLOW_RPAR_in_crit131);
  22836. + if (HASEXCEPTION())
  22837. + {
  22838. + goto rulecritEx;
  22839. + }
  22840. +
  22841. + CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR17, NULL);
  22842. +
  22843. +
  22844. +
  22845. + /* AST REWRITE
  22846. + * elements : expression
  22847. + * token labels :
  22848. + * rule labels : retval
  22849. + * token list labels :
  22850. + * rule list labels :
  22851. + */
  22852. + {
  22853. + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
  22854. +
  22855. + stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
  22856. +
  22857. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  22858. + retval.tree = root_0;
  22859. + // 40:30: -> expression
  22860. + {
  22861. + ADAPTOR->addChild(ADAPTOR, root_0, stream_expression == NULL ? NULL : stream_expression->nextTree(stream_expression));
  22862. +
  22863. + }
  22864. +
  22865. + retval.tree = root_0; // set result root
  22866. + if (stream_retval != NULL) stream_retval->free(stream_retval);
  22867. +
  22868. +
  22869. + }
  22870. + }
  22871. + break;
  22872. + case 2:
  22873. + // SMARTPL.g:41:6: STRTAG ( INCLUDES | IS ) STR
  22874. + {
  22875. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  22876. +
  22877. + STRTAG18 = (pANTLR3_COMMON_TOKEN) MATCHT(STRTAG, &FOLLOW_STRTAG_in_crit142);
  22878. + if (HASEXCEPTION())
  22879. + {
  22880. + goto rulecritEx;
  22881. + }
  22882. +
  22883. + STRTAG18_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STRTAG18));
  22884. + ADAPTOR->addChild(ADAPTOR, root_0, STRTAG18_tree);
  22885. +
  22886. + set19=(pANTLR3_COMMON_TOKEN)LT(1);
  22887. + if ( ((LA(1) >= INCLUDES) && (LA(1) <= IS)) )
  22888. + {
  22889. + CONSUME();
  22890. + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set19)));
  22891. + PERRORRECOVERY=ANTLR3_FALSE;
  22892. + }
  22893. + else
  22894. + {
  22895. + CONSTRUCTEX();
  22896. + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
  22897. + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
  22898. + EXCEPTION->expectingSet = &FOLLOW_set_in_crit144;
  22899. + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_crit144); goto rulecritEx;
  22900. + }
  22901. +
  22902. + STR20 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_crit150);
  22903. + if (HASEXCEPTION())
  22904. + {
  22905. + goto rulecritEx;
  22906. + }
  22907. +
  22908. + STR20_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR20));
  22909. + ADAPTOR->addChild(ADAPTOR, root_0, STR20_tree);
  22910. +
  22911. +
  22912. + }
  22913. + break;
  22914. + case 3:
  22915. + // SMARTPL.g:42:6: INTTAG INTBOOL INT
  22916. + {
  22917. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  22918. +
  22919. + INTTAG21 = (pANTLR3_COMMON_TOKEN) MATCHT(INTTAG, &FOLLOW_INTTAG_in_crit157);
  22920. + if (HASEXCEPTION())
  22921. + {
  22922. + goto rulecritEx;
  22923. + }
  22924. +
  22925. + INTTAG21_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INTTAG21));
  22926. + ADAPTOR->addChild(ADAPTOR, root_0, INTTAG21_tree);
  22927. +
  22928. + INTBOOL22 = (pANTLR3_COMMON_TOKEN) MATCHT(INTBOOL, &FOLLOW_INTBOOL_in_crit159);
  22929. + if (HASEXCEPTION())
  22930. + {
  22931. + goto rulecritEx;
  22932. + }
  22933. +
  22934. + INTBOOL22_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INTBOOL22));
  22935. + ADAPTOR->addChild(ADAPTOR, root_0, INTBOOL22_tree);
  22936. +
  22937. + INT23 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_crit161);
  22938. + if (HASEXCEPTION())
  22939. + {
  22940. + goto rulecritEx;
  22941. + }
  22942. +
  22943. + INT23_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INT23));
  22944. + ADAPTOR->addChild(ADAPTOR, root_0, INT23_tree);
  22945. +
  22946. +
  22947. + }
  22948. + break;
  22949. + case 4:
  22950. + // SMARTPL.g:43:6: DATETAG ( AFTER | BEFORE ) dateval
  22951. + {
  22952. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  22953. +
  22954. + DATETAG24 = (pANTLR3_COMMON_TOKEN) MATCHT(DATETAG, &FOLLOW_DATETAG_in_crit168);
  22955. + if (HASEXCEPTION())
  22956. + {
  22957. + goto rulecritEx;
  22958. + }
  22959. +
  22960. + DATETAG24_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATETAG24));
  22961. + ADAPTOR->addChild(ADAPTOR, root_0, DATETAG24_tree);
  22962. +
  22963. + set25=(pANTLR3_COMMON_TOKEN)LT(1);
  22964. + if ( ((LA(1) >= AFTER) && (LA(1) <= BEFORE)) )
  22965. + {
  22966. + CONSUME();
  22967. + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set25)));
  22968. + PERRORRECOVERY=ANTLR3_FALSE;
  22969. + }
  22970. + else
  22971. + {
  22972. + CONSTRUCTEX();
  22973. + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
  22974. + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
  22975. + EXCEPTION->expectingSet = &FOLLOW_set_in_crit170;
  22976. + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_crit170); goto rulecritEx;
  22977. + }
  22978. +
  22979. + FOLLOWPUSH(FOLLOW_dateval_in_crit176);
  22980. + dateval26=dateval(ctx);
  22981. +
  22982. + FOLLOWPOP();
  22983. + if (HASEXCEPTION())
  22984. + {
  22985. + goto rulecritEx;
  22986. + }
  22987. +
  22988. + ADAPTOR->addChild(ADAPTOR, root_0, dateval26.tree);
  22989. +
  22990. + }
  22991. + break;
  22992. + case 5:
  22993. + // SMARTPL.g:44:6: ENUMTAG IS ENUMVAL
  22994. + {
  22995. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  22996. +
  22997. + ENUMTAG27 = (pANTLR3_COMMON_TOKEN) MATCHT(ENUMTAG, &FOLLOW_ENUMTAG_in_crit183);
  22998. + if (HASEXCEPTION())
  22999. + {
  23000. + goto rulecritEx;
  23001. + }
  23002. +
  23003. + ENUMTAG27_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, ENUMTAG27));
  23004. + ADAPTOR->addChild(ADAPTOR, root_0, ENUMTAG27_tree);
  23005. +
  23006. + IS28 = (pANTLR3_COMMON_TOKEN) MATCHT(IS, &FOLLOW_IS_in_crit185);
  23007. + if (HASEXCEPTION())
  23008. + {
  23009. + goto rulecritEx;
  23010. + }
  23011. +
  23012. + IS28_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, IS28));
  23013. + ADAPTOR->addChild(ADAPTOR, root_0, IS28_tree);
  23014. +
  23015. + ENUMVAL29 = (pANTLR3_COMMON_TOKEN) MATCHT(ENUMVAL, &FOLLOW_ENUMVAL_in_crit187);
  23016. + if (HASEXCEPTION())
  23017. + {
  23018. + goto rulecritEx;
  23019. + }
  23020. +
  23021. + ENUMVAL29_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, ENUMVAL29));
  23022. + ADAPTOR->addChild(ADAPTOR, root_0, ENUMVAL29_tree);
  23023. +
  23024. +
  23025. + }
  23026. + break;
  23027. +
  23028. + }
  23029. + }
  23030. + }
  23031. +
  23032. +
  23033. + // This is where rules clean up and exit
  23034. + //
  23035. + goto rulecritEx; /* Prevent compiler warnings */
  23036. + rulecritEx: ;
  23037. + retval.stop = LT(-1);
  23038. +
  23039. + retval.stop = LT(-1);
  23040. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  23041. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  23042. + if (stream_RPAR != NULL) stream_RPAR->free(stream_RPAR);
  23043. + if (stream_LPAR != NULL) stream_LPAR->free(stream_LPAR);
  23044. + if (stream_expression != NULL) stream_expression->free(stream_expression);
  23045. +
  23046. + if (HASEXCEPTION())
  23047. + {
  23048. + PREPORTERROR();
  23049. + PRECOVER();
  23050. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  23051. + }
  23052. +
  23053. +
  23054. + return retval;
  23055. +}
  23056. +/* $ANTLR end crit */
  23057. +
  23058. +/**
  23059. + * $ANTLR start dateval
  23060. + * SMARTPL.g:47:1: dateval : ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO );
  23061. + */
  23062. +static SMARTPLParser_dateval_return
  23063. +dateval(pSMARTPLParser ctx)
  23064. +{
  23065. + SMARTPLParser_dateval_return retval;
  23066. +
  23067. + pANTLR3_BASE_TREE root_0;
  23068. +
  23069. + pANTLR3_COMMON_TOKEN DATE30;
  23070. + pANTLR3_COMMON_TOKEN BEFORE32;
  23071. + pANTLR3_COMMON_TOKEN DATE33;
  23072. + pANTLR3_COMMON_TOKEN AFTER35;
  23073. + pANTLR3_COMMON_TOKEN DATE36;
  23074. + pANTLR3_COMMON_TOKEN AGO38;
  23075. + SMARTPLParser_interval_return interval31;
  23076. + #undef RETURN_TYPE_interval31
  23077. + #define RETURN_TYPE_interval31 SMARTPLParser_interval_return
  23078. +
  23079. + SMARTPLParser_interval_return interval34;
  23080. + #undef RETURN_TYPE_interval34
  23081. + #define RETURN_TYPE_interval34 SMARTPLParser_interval_return
  23082. +
  23083. + SMARTPLParser_interval_return interval37;
  23084. + #undef RETURN_TYPE_interval37
  23085. + #define RETURN_TYPE_interval37 SMARTPLParser_interval_return
  23086. +
  23087. + pANTLR3_BASE_TREE DATE30_tree;
  23088. + pANTLR3_BASE_TREE BEFORE32_tree;
  23089. + pANTLR3_BASE_TREE DATE33_tree;
  23090. + pANTLR3_BASE_TREE AFTER35_tree;
  23091. + pANTLR3_BASE_TREE DATE36_tree;
  23092. + pANTLR3_BASE_TREE AGO38_tree;
  23093. +
  23094. + /* Initialize rule variables
  23095. + */
  23096. +
  23097. +
  23098. + root_0 = NULL;
  23099. +
  23100. + DATE30 = NULL;
  23101. + BEFORE32 = NULL;
  23102. + DATE33 = NULL;
  23103. + AFTER35 = NULL;
  23104. + DATE36 = NULL;
  23105. + AGO38 = NULL;
  23106. + interval31.tree = NULL;
  23107. +
  23108. + interval34.tree = NULL;
  23109. +
  23110. + interval37.tree = NULL;
  23111. +
  23112. + retval.start = LT(1); retval.stop = retval.start;
  23113. +
  23114. + DATE30_tree = NULL;
  23115. + BEFORE32_tree = NULL;
  23116. + DATE33_tree = NULL;
  23117. + AFTER35_tree = NULL;
  23118. + DATE36_tree = NULL;
  23119. + AGO38_tree = NULL;
  23120. +
  23121. +
  23122. + retval.tree = NULL;
  23123. + {
  23124. + {
  23125. + // SMARTPL.g:47:10: ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO )
  23126. +
  23127. + ANTLR3_UINT32 alt5;
  23128. +
  23129. + alt5=4;
  23130. +
  23131. + switch ( LA(1) )
  23132. + {
  23133. + case DATE:
  23134. + {
  23135. + alt5=1;
  23136. + }
  23137. + break;
  23138. + case INT:
  23139. + {
  23140. + switch ( LA(2) )
  23141. + {
  23142. + case DATINTERVAL:
  23143. + {
  23144. + switch ( LA(3) )
  23145. + {
  23146. + case AGO:
  23147. + {
  23148. + alt5=4;
  23149. + }
  23150. + break;
  23151. + case AFTER:
  23152. + {
  23153. + alt5=3;
  23154. + }
  23155. + break;
  23156. + case BEFORE:
  23157. + {
  23158. + alt5=2;
  23159. + }
  23160. + break;
  23161. +
  23162. + default:
  23163. + CONSTRUCTEX();
  23164. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  23165. + EXCEPTION->message = (void *)"";
  23166. + EXCEPTION->decisionNum = 5;
  23167. + EXCEPTION->state = 3;
  23168. +
  23169. +
  23170. + goto ruledatevalEx;
  23171. + }
  23172. +
  23173. + }
  23174. + break;
  23175. +
  23176. + default:
  23177. + CONSTRUCTEX();
  23178. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  23179. + EXCEPTION->message = (void *)"";
  23180. + EXCEPTION->decisionNum = 5;
  23181. + EXCEPTION->state = 2;
  23182. +
  23183. +
  23184. + goto ruledatevalEx;
  23185. + }
  23186. +
  23187. + }
  23188. + break;
  23189. +
  23190. + default:
  23191. + CONSTRUCTEX();
  23192. + EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
  23193. + EXCEPTION->message = (void *)"";
  23194. + EXCEPTION->decisionNum = 5;
  23195. + EXCEPTION->state = 0;
  23196. +
  23197. +
  23198. + goto ruledatevalEx;
  23199. + }
  23200. +
  23201. + switch (alt5)
  23202. + {
  23203. + case 1:
  23204. + // SMARTPL.g:47:12: DATE
  23205. + {
  23206. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  23207. +
  23208. + DATE30 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval200);
  23209. + if (HASEXCEPTION())
  23210. + {
  23211. + goto ruledatevalEx;
  23212. + }
  23213. +
  23214. + DATE30_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE30));
  23215. + ADAPTOR->addChild(ADAPTOR, root_0, DATE30_tree);
  23216. +
  23217. +
  23218. + }
  23219. + break;
  23220. + case 2:
  23221. + // SMARTPL.g:48:6: interval BEFORE DATE
  23222. + {
  23223. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  23224. +
  23225. + FOLLOWPUSH(FOLLOW_interval_in_dateval207);
  23226. + interval31=interval(ctx);
  23227. +
  23228. + FOLLOWPOP();
  23229. + if (HASEXCEPTION())
  23230. + {
  23231. + goto ruledatevalEx;
  23232. + }
  23233. +
  23234. + ADAPTOR->addChild(ADAPTOR, root_0, interval31.tree);
  23235. + BEFORE32 = (pANTLR3_COMMON_TOKEN) MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateval209);
  23236. + if (HASEXCEPTION())
  23237. + {
  23238. + goto ruledatevalEx;
  23239. + }
  23240. +
  23241. + BEFORE32_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, BEFORE32));
  23242. + ADAPTOR->addChild(ADAPTOR, root_0, BEFORE32_tree);
  23243. +
  23244. + DATE33 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval211);
  23245. + if (HASEXCEPTION())
  23246. + {
  23247. + goto ruledatevalEx;
  23248. + }
  23249. +
  23250. + DATE33_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE33));
  23251. + ADAPTOR->addChild(ADAPTOR, root_0, DATE33_tree);
  23252. +
  23253. +
  23254. + }
  23255. + break;
  23256. + case 3:
  23257. + // SMARTPL.g:49:6: interval AFTER DATE
  23258. + {
  23259. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  23260. +
  23261. + FOLLOWPUSH(FOLLOW_interval_in_dateval218);
  23262. + interval34=interval(ctx);
  23263. +
  23264. + FOLLOWPOP();
  23265. + if (HASEXCEPTION())
  23266. + {
  23267. + goto ruledatevalEx;
  23268. + }
  23269. +
  23270. + ADAPTOR->addChild(ADAPTOR, root_0, interval34.tree);
  23271. + AFTER35 = (pANTLR3_COMMON_TOKEN) MATCHT(AFTER, &FOLLOW_AFTER_in_dateval220);
  23272. + if (HASEXCEPTION())
  23273. + {
  23274. + goto ruledatevalEx;
  23275. + }
  23276. +
  23277. + AFTER35_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AFTER35));
  23278. + ADAPTOR->addChild(ADAPTOR, root_0, AFTER35_tree);
  23279. +
  23280. + DATE36 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval222);
  23281. + if (HASEXCEPTION())
  23282. + {
  23283. + goto ruledatevalEx;
  23284. + }
  23285. +
  23286. + DATE36_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE36));
  23287. + ADAPTOR->addChild(ADAPTOR, root_0, DATE36_tree);
  23288. +
  23289. +
  23290. + }
  23291. + break;
  23292. + case 4:
  23293. + // SMARTPL.g:50:6: interval AGO
  23294. + {
  23295. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  23296. +
  23297. + FOLLOWPUSH(FOLLOW_interval_in_dateval229);
  23298. + interval37=interval(ctx);
  23299. +
  23300. + FOLLOWPOP();
  23301. + if (HASEXCEPTION())
  23302. + {
  23303. + goto ruledatevalEx;
  23304. + }
  23305. +
  23306. + ADAPTOR->addChild(ADAPTOR, root_0, interval37.tree);
  23307. + AGO38 = (pANTLR3_COMMON_TOKEN) MATCHT(AGO, &FOLLOW_AGO_in_dateval231);
  23308. + if (HASEXCEPTION())
  23309. + {
  23310. + goto ruledatevalEx;
  23311. + }
  23312. +
  23313. + AGO38_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AGO38));
  23314. + ADAPTOR->addChild(ADAPTOR, root_0, AGO38_tree);
  23315. +
  23316. +
  23317. + }
  23318. + break;
  23319. +
  23320. + }
  23321. + }
  23322. + }
  23323. +
  23324. +
  23325. + // This is where rules clean up and exit
  23326. + //
  23327. + goto ruledatevalEx; /* Prevent compiler warnings */
  23328. + ruledatevalEx: ;
  23329. + retval.stop = LT(-1);
  23330. +
  23331. + retval.stop = LT(-1);
  23332. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  23333. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  23334. +
  23335. + if (HASEXCEPTION())
  23336. + {
  23337. + PREPORTERROR();
  23338. + PRECOVER();
  23339. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  23340. + }
  23341. +
  23342. +
  23343. + return retval;
  23344. +}
  23345. +/* $ANTLR end dateval */
  23346. +
  23347. +/**
  23348. + * $ANTLR start interval
  23349. + * SMARTPL.g:53:1: interval : INT DATINTERVAL ;
  23350. + */
  23351. +static SMARTPLParser_interval_return
  23352. +interval(pSMARTPLParser ctx)
  23353. +{
  23354. + SMARTPLParser_interval_return retval;
  23355. +
  23356. + pANTLR3_BASE_TREE root_0;
  23357. +
  23358. + pANTLR3_COMMON_TOKEN INT39;
  23359. + pANTLR3_COMMON_TOKEN DATINTERVAL40;
  23360. +
  23361. + pANTLR3_BASE_TREE INT39_tree;
  23362. + pANTLR3_BASE_TREE DATINTERVAL40_tree;
  23363. +
  23364. + /* Initialize rule variables
  23365. + */
  23366. +
  23367. +
  23368. + root_0 = NULL;
  23369. +
  23370. + INT39 = NULL;
  23371. + DATINTERVAL40 = NULL;
  23372. + retval.start = LT(1); retval.stop = retval.start;
  23373. +
  23374. + INT39_tree = NULL;
  23375. + DATINTERVAL40_tree = NULL;
  23376. +
  23377. +
  23378. + retval.tree = NULL;
  23379. + {
  23380. + // SMARTPL.g:53:10: ( INT DATINTERVAL )
  23381. + // SMARTPL.g:53:12: INT DATINTERVAL
  23382. + {
  23383. + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
  23384. +
  23385. + INT39 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_interval243);
  23386. + if (HASEXCEPTION())
  23387. + {
  23388. + goto ruleintervalEx;
  23389. + }
  23390. +
  23391. + INT39_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INT39));
  23392. + ADAPTOR->addChild(ADAPTOR, root_0, INT39_tree);
  23393. +
  23394. + DATINTERVAL40 = (pANTLR3_COMMON_TOKEN) MATCHT(DATINTERVAL, &FOLLOW_DATINTERVAL_in_interval245);
  23395. + if (HASEXCEPTION())
  23396. + {
  23397. + goto ruleintervalEx;
  23398. + }
  23399. +
  23400. + DATINTERVAL40_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATINTERVAL40));
  23401. + ADAPTOR->addChild(ADAPTOR, root_0, DATINTERVAL40_tree);
  23402. +
  23403. +
  23404. + }
  23405. +
  23406. + }
  23407. +
  23408. +
  23409. + // This is where rules clean up and exit
  23410. + //
  23411. + goto ruleintervalEx; /* Prevent compiler warnings */
  23412. + ruleintervalEx: ;
  23413. + retval.stop = LT(-1);
  23414. +
  23415. + retval.stop = LT(-1);
  23416. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
  23417. + ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
  23418. +
  23419. + if (HASEXCEPTION())
  23420. + {
  23421. + PREPORTERROR();
  23422. + PRECOVER();
  23423. + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
  23424. + }
  23425. +
  23426. +
  23427. + return retval;
  23428. +}
  23429. +/* $ANTLR end interval */
  23430. +/* End of parsing rules
  23431. + * ==============================================
  23432. + */
  23433. +
  23434. +/* ==============================================
  23435. + * Syntactic predicates
  23436. + */
  23437. +/* End of syntactic predicates
  23438. + * ==============================================
  23439. + */
  23440. +
  23441. +
  23442. +
  23443. +
  23444. +
  23445. +
  23446. +/* End of code
  23447. + * =============================================================================
  23448. + */
  23449. diff --git a/src/pregen/SMARTPLParser.h b/src/pregen/SMARTPLParser.h
  23450. new file mode 100644
  23451. index 0000000..38ef500
  23452. --- /dev/null
  23453. +++ b/src/pregen/SMARTPLParser.h
  23454. @@ -0,0 +1,285 @@
  23455. +/** \file
  23456. + * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
  23457. + *
  23458. + * - From the grammar source file : SMARTPL.g
  23459. + * - On : 2016-01-01 12:23:40
  23460. + * - for the parser : SMARTPLParserParser *
  23461. + * Editing it, at least manually, is not wise.
  23462. + *
  23463. + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
  23464. + *
  23465. + *
  23466. + * The parser SMARTPLParser has the callable functions (rules) shown below,
  23467. + * which will invoke the code for the associated rule in the source grammar
  23468. + * assuming that the input stream is pointing to a token/text stream that could begin
  23469. + * this rule.
  23470. + *
  23471. + * For instance if you call the first (topmost) rule in a parser grammar, you will
  23472. + * get the results of a full parse, but calling a rule half way through the grammar will
  23473. + * allow you to pass part of a full token stream to the parser, such as for syntax checking
  23474. + * in editors and so on.
  23475. + *
  23476. + * The parser entry points are called indirectly (by function pointer to function) via
  23477. + * a parser context typedef pSMARTPLParser, which is returned from a call to SMARTPLParserNew().
  23478. + *
  23479. + * The methods in pSMARTPLParser are as follows:
  23480. + *
  23481. + * - SMARTPLParser_playlist_return pSMARTPLParser->playlist(pSMARTPLParser)
  23482. + * - SMARTPLParser_expression_return pSMARTPLParser->expression(pSMARTPLParser)
  23483. + * - SMARTPLParser_aexpr_return pSMARTPLParser->aexpr(pSMARTPLParser)
  23484. + * - SMARTPLParser_nexpr_return pSMARTPLParser->nexpr(pSMARTPLParser)
  23485. + * - SMARTPLParser_crit_return pSMARTPLParser->crit(pSMARTPLParser)
  23486. + * - SMARTPLParser_dateval_return pSMARTPLParser->dateval(pSMARTPLParser)
  23487. + * - SMARTPLParser_interval_return pSMARTPLParser->interval(pSMARTPLParser)
  23488. + *
  23489. + * The return type for any particular rule is of course determined by the source
  23490. + * grammar file.
  23491. + */
  23492. +// [The "BSD licence"]
  23493. +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
  23494. +// http://www.temporal-wave.com
  23495. +// http://www.linkedin.com/in/jimidle
  23496. +//
  23497. +// All rights reserved.
  23498. +//
  23499. +// Redistribution and use in source and binary forms, with or without
  23500. +// modification, are permitted provided that the following conditions
  23501. +// are met:
  23502. +// 1. Redistributions of source code must retain the above copyright
  23503. +// notice, this list of conditions and the following disclaimer.
  23504. +// 2. Redistributions in binary form must reproduce the above copyright
  23505. +// notice, this list of conditions and the following disclaimer in the
  23506. +// documentation and/or other materials provided with the distribution.
  23507. +// 3. The name of the author may not be used to endorse or promote products
  23508. +// derived from this software without specific prior written permission.
  23509. +//
  23510. +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  23511. +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  23512. +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  23513. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  23514. +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  23515. +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23516. +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23517. +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23518. +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  23519. +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23520. +
  23521. +#ifndef _SMARTPLParser_H
  23522. +#define _SMARTPLParser_H
  23523. +/* =============================================================================
  23524. + * Standard antlr3 C runtime definitions
  23525. + */
  23526. +#include <antlr3.h>
  23527. +
  23528. +/* End of standard antlr 3 runtime definitions
  23529. + * =============================================================================
  23530. + */
  23531. +
  23532. +#ifdef __cplusplus
  23533. +extern "C" {
  23534. +#endif
  23535. +
  23536. +// Forward declare the context typedef so that we can use it before it is
  23537. +// properly defined. Delegators and delegates (from import statements) are
  23538. +// interdependent and their context structures contain pointers to each other
  23539. +// C only allows such things to be declared if you pre-declare the typedef.
  23540. +//
  23541. +typedef struct SMARTPLParser_Ctx_struct SMARTPLParser, * pSMARTPLParser;
  23542. +
  23543. +
  23544. +
  23545. +#ifdef ANTLR3_WINDOWS
  23546. +// Disable: Unreferenced parameter, - Rules with parameters that are not used
  23547. +// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually)
  23548. +// initialized but unused variable - tree rewrite variables declared but not needed
  23549. +// Unreferenced local variable - lexer rule declares but does not always use _type
  23550. +// potentially unitialized variable used - retval always returned from a rule
  23551. +// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns
  23552. +//
  23553. +// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
  23554. +// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
  23555. +// usually generated when a parser rule is given a parameter that it does not use. Mostly though
  23556. +// this is a matter of orthogonality hence I disable that one.
  23557. +//
  23558. +#pragma warning( disable : 4100 )
  23559. +#pragma warning( disable : 4101 )
  23560. +#pragma warning( disable : 4127 )
  23561. +#pragma warning( disable : 4189 )
  23562. +#pragma warning( disable : 4505 )
  23563. +#pragma warning( disable : 4701 )
  23564. +#endif
  23565. +typedef struct SMARTPLParser_playlist_return_struct
  23566. +{
  23567. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  23568. + */
  23569. + pANTLR3_COMMON_TOKEN start;
  23570. + pANTLR3_COMMON_TOKEN stop;
  23571. + pANTLR3_BASE_TREE tree;
  23572. +
  23573. +}
  23574. + SMARTPLParser_playlist_return;
  23575. +
  23576. +typedef struct SMARTPLParser_expression_return_struct
  23577. +{
  23578. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  23579. + */
  23580. + pANTLR3_COMMON_TOKEN start;
  23581. + pANTLR3_COMMON_TOKEN stop;
  23582. + pANTLR3_BASE_TREE tree;
  23583. +
  23584. +}
  23585. + SMARTPLParser_expression_return;
  23586. +
  23587. +typedef struct SMARTPLParser_aexpr_return_struct
  23588. +{
  23589. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  23590. + */
  23591. + pANTLR3_COMMON_TOKEN start;
  23592. + pANTLR3_COMMON_TOKEN stop;
  23593. + pANTLR3_BASE_TREE tree;
  23594. +
  23595. +}
  23596. + SMARTPLParser_aexpr_return;
  23597. +
  23598. +typedef struct SMARTPLParser_nexpr_return_struct
  23599. +{
  23600. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  23601. + */
  23602. + pANTLR3_COMMON_TOKEN start;
  23603. + pANTLR3_COMMON_TOKEN stop;
  23604. + pANTLR3_BASE_TREE tree;
  23605. +
  23606. +}
  23607. + SMARTPLParser_nexpr_return;
  23608. +
  23609. +typedef struct SMARTPLParser_crit_return_struct
  23610. +{
  23611. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  23612. + */
  23613. + pANTLR3_COMMON_TOKEN start;
  23614. + pANTLR3_COMMON_TOKEN stop;
  23615. + pANTLR3_BASE_TREE tree;
  23616. +
  23617. +}
  23618. + SMARTPLParser_crit_return;
  23619. +
  23620. +typedef struct SMARTPLParser_dateval_return_struct
  23621. +{
  23622. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  23623. + */
  23624. + pANTLR3_COMMON_TOKEN start;
  23625. + pANTLR3_COMMON_TOKEN stop;
  23626. + pANTLR3_BASE_TREE tree;
  23627. +
  23628. +}
  23629. + SMARTPLParser_dateval_return;
  23630. +
  23631. +typedef struct SMARTPLParser_interval_return_struct
  23632. +{
  23633. + /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
  23634. + */
  23635. + pANTLR3_COMMON_TOKEN start;
  23636. + pANTLR3_COMMON_TOKEN stop;
  23637. + pANTLR3_BASE_TREE tree;
  23638. +
  23639. +}
  23640. + SMARTPLParser_interval_return;
  23641. +
  23642. +
  23643. +
  23644. +/** Context tracking structure for SMARTPLParser
  23645. + */
  23646. +struct SMARTPLParser_Ctx_struct
  23647. +{
  23648. + /** Built in ANTLR3 context tracker contains all the generic elements
  23649. + * required for context tracking.
  23650. + */
  23651. + pANTLR3_PARSER pParser;
  23652. +
  23653. +
  23654. + SMARTPLParser_playlist_return (*playlist) (struct SMARTPLParser_Ctx_struct * ctx);
  23655. + SMARTPLParser_expression_return (*expression) (struct SMARTPLParser_Ctx_struct * ctx);
  23656. + SMARTPLParser_aexpr_return (*aexpr) (struct SMARTPLParser_Ctx_struct * ctx);
  23657. + SMARTPLParser_nexpr_return (*nexpr) (struct SMARTPLParser_Ctx_struct * ctx);
  23658. + SMARTPLParser_crit_return (*crit) (struct SMARTPLParser_Ctx_struct * ctx);
  23659. + SMARTPLParser_dateval_return (*dateval) (struct SMARTPLParser_Ctx_struct * ctx);
  23660. + SMARTPLParser_interval_return (*interval) (struct SMARTPLParser_Ctx_struct * ctx);
  23661. + // Delegated rules
  23662. + const char * (*getGrammarFileName)();
  23663. + void (*free) (struct SMARTPLParser_Ctx_struct * ctx);
  23664. + /* @headerFile.members() */
  23665. + pANTLR3_BASE_TREE_ADAPTOR adaptor;
  23666. + pANTLR3_VECTOR_FACTORY vectors;
  23667. + /* End @headerFile.members() */
  23668. +};
  23669. +
  23670. +// Function protoypes for the constructor functions that external translation units
  23671. +// such as delegators and delegates may wish to call.
  23672. +//
  23673. +ANTLR3_API pSMARTPLParser SMARTPLParserNew (pANTLR3_COMMON_TOKEN_STREAM instream);
  23674. +ANTLR3_API pSMARTPLParser SMARTPLParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
  23675. +
  23676. +/** Symbolic definitions of all the tokens that the parser will work with.
  23677. + * \{
  23678. + *
  23679. + * Antlr will define EOF, but we can't use that as it it is too common in
  23680. + * in C header files and that would be confusing. There is no way to filter this out at the moment
  23681. + * so we just undef it here for now. That isn't the value we get back from C recognizers
  23682. + * anyway. We are looking for ANTLR3_TOKEN_EOF.
  23683. + */
  23684. +#ifdef EOF
  23685. +#undef EOF
  23686. +#endif
  23687. +#ifdef Tokens
  23688. +#undef Tokens
  23689. +#endif
  23690. +#define INTBOOL 14
  23691. +#define STRTAG 10
  23692. +#define AGO 22
  23693. +#define WHITESPACE 29
  23694. +#define GREATEREQUAL 25
  23695. +#define BEFORE 18
  23696. +#define DATETAG 16
  23697. +#define INT 15
  23698. +#define NOT 7
  23699. +#define AFTER 17
  23700. +#define AND 6
  23701. +#define EOF -1
  23702. +#define INCLUDES 11
  23703. +#define STR 4
  23704. +#define T__30 30
  23705. +#define T__31 31
  23706. +#define GREATER 24
  23707. +#define LPAR 8
  23708. +#define ENUMTAG 19
  23709. +#define IS 12
  23710. +#define ENUMVAL 20
  23711. +#define EQUAL 28
  23712. +#define OR 5
  23713. +#define LESS 26
  23714. +#define RPAR 9
  23715. +#define DATE 21
  23716. +#define LESSEQUAL 27
  23717. +#define DATINTERVAL 23
  23718. +#define INTTAG 13
  23719. +#ifdef EOF
  23720. +#undef EOF
  23721. +#define EOF ANTLR3_TOKEN_EOF
  23722. +#endif
  23723. +
  23724. +#ifndef TOKENSOURCE
  23725. +#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
  23726. +#endif
  23727. +
  23728. +/* End of token definitions for SMARTPLParser
  23729. + * =============================================================================
  23730. + */
  23731. +/** \} */
  23732. +
  23733. +#ifdef __cplusplus
  23734. +}
  23735. +#endif
  23736. +
  23737. +#endif
  23738. +
  23739. +/* END - Note:Keep extra line feed to satisfy UNIX systems */