summaryrefslogtreecommitdiff
path: root/impl/parser/EquationSystemParser.c
diff options
context:
space:
mode:
Diffstat (limited to 'impl/parser/EquationSystemParser.c')
-rw-r--r--impl/parser/EquationSystemParser.c2460
1 files changed, 2460 insertions, 0 deletions
diff --git a/impl/parser/EquationSystemParser.c b/impl/parser/EquationSystemParser.c
new file mode 100644
index 0000000..8252c19
--- /dev/null
+++ b/impl/parser/EquationSystemParser.c
@@ -0,0 +1,2460 @@
+/** \file
+ * This C source file was generated by $ANTLR version 3.4
+ *
+ * - From the grammar source file : EquationSystem.g
+ * - On : 2012-07-12 15:47:50
+ * - for the parser : EquationSystemParserParser
+ *
+ * Editing it, at least manually, is not wise.
+ *
+ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
+ *
+ *
+*/
+// [The "BSD license"]
+// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
+// http://www.temporal-wave.com
+// http://www.linkedin.com/in/jimidle
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. The name of the author may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/* -----------------------------------------
+ * Include the ANTLR3 generated header file.
+ */
+#include "EquationSystemParser.h"
+/* ----------------------------------------- */
+
+
+
+
+
+/* MACROS that hide the C interface implementations from the
+ * generated code, which makes it a little more understandable to the human eye.
+ * I am very much against using C pre-processor macros for function calls and bits
+ * of code as you cannot see what is happening when single stepping in debuggers
+ * and so on. The exception (in my book at least) is for generated code, where you are
+ * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
+ * hides some indirect calls, but is always referring to the input stream. This is
+ * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
+ * the runtime interfaces without changing the generated code too often, without
+ * confusing the reader of the generated output, who may not wish to know the gory
+ * details of the interface inheritance.
+ */
+
+#define CTX ctx
+
+/* Aids in accessing scopes for grammar programmers
+ */
+#undef SCOPE_TYPE
+#undef SCOPE_STACK
+#undef SCOPE_TOP
+#define SCOPE_TYPE(scope) pEquationSystemParser_##scope##_SCOPE
+#define SCOPE_STACK(scope) pEquationSystemParser_##scope##Stack
+#define SCOPE_TOP(scope) ctx->pEquationSystemParser_##scope##Top
+#define SCOPE_SIZE(scope) ctx->pEquationSystemParser_##scope##Stack_limit
+#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
+
+/* Macros for accessing things in the parser
+ */
+
+#undef PARSER
+#undef RECOGNIZER
+#undef HAVEPARSEDRULE
+#undef MEMOIZE
+#undef INPUT
+#undef STRSTREAM
+#undef HASEXCEPTION
+#undef EXCEPTION
+#undef MATCHT
+#undef MATCHANYT
+#undef FOLLOWSTACK
+#undef FOLLOWPUSH
+#undef FOLLOWPOP
+#undef PRECOVER
+#undef PREPORTERROR
+#undef LA
+#undef LT
+#undef CONSTRUCTEX
+#undef CONSUME
+#undef MARK
+#undef REWIND
+#undef REWINDLAST
+#undef PERRORRECOVERY
+#undef HASFAILED
+#undef FAILEDFLAG
+#undef RECOVERFROMMISMATCHEDSET
+#undef RECOVERFROMMISMATCHEDELEMENT
+#undef INDEX
+#undef ADAPTOR
+#undef SEEK
+#undef RULEMEMO
+#undef DBG
+
+#define PARSER ctx->pParser
+#define RECOGNIZER PARSER->rec
+#define PSRSTATE RECOGNIZER->state
+#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
+#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si)
+#define INPUT PARSER->tstream
+#define STRSTREAM INPUT
+#define ISTREAM INPUT->istream
+#define INDEX() ISTREAM->index(INPUT->istream)
+#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE)
+#define EXCEPTION PSRSTATE->exception
+#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs)
+#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER)
+#define FOLLOWSTACK PSRSTATE->following
+#ifdef SKIP_FOLLOW_SETS
+#define FOLLOWPUSH(x)
+#define FOLLOWPOP()
+#else
+#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
+#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK)
+#endif
+#define PRECOVER() RECOGNIZER->recover(RECOGNIZER)
+#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER)
+#define LA(n) INPUT->istream->_LA(ISTREAM, n)
+#define LT(n) INPUT->_LT(INPUT, n)
+#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER)
+#define CONSUME() ISTREAM->consume(ISTREAM)
+#define MARK() ISTREAM->mark(ISTREAM)
+#define REWIND(m) ISTREAM->rewind(ISTREAM, m)
+#define REWINDLAST() ISTREAM->rewindLast(ISTREAM)
+#define SEEK(n) ISTREAM->seek(ISTREAM, n)
+#define PERRORRECOVERY PSRSTATE->errorRecovery
+#define FAILEDFLAG PSRSTATE->failed
+#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE)
+#define BACKTRACKING PSRSTATE->backtracking
+#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
+#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
+#define ADAPTOR ctx->adaptor
+#define RULEMEMO PSRSTATE->ruleMemo
+#define DBG RECOGNIZER->debugger
+
+
+#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt
+
+/* The 4 tokens defined below may well clash with your own #defines or token types. If so
+ * then for the present you must use different names for your defines as these are hard coded
+ * in the code generator. It would be better not to use such names internally, and maybe
+ * we can change this in a forthcoming release. I deliberately do not #undef these
+ * here as this will at least give you a redefined error somewhere if they clash.
+ */
+#define UP ANTLR3_TOKEN_UP
+#define DOWN ANTLR3_TOKEN_DOWN
+#define EOR ANTLR3_TOKEN_EOR
+#define INVALID ANTLR3_TOKEN_INVALID
+
+
+/* =============================================================================
+ * Functions to create and destroy scopes. First come the rule scopes, followed
+ * by the global declared scopes.
+ */
+
+
+
+/* ============================================================================= */
+
+/* =============================================================================
+ * Start of recognizer
+ */
+
+
+/** \brief Table of all token names in symbolic order, mainly used for
+ * error reporting.
+ */
+pANTLR3_UINT8 EquationSystemParserTokenNames[19+4]
+ = {
+ (pANTLR3_UINT8) "<invalid>", /* String to print to indicate an invalid token */
+ (pANTLR3_UINT8) "<EOR>",
+ (pANTLR3_UINT8) "<DOWN>",
+ (pANTLR3_UINT8) "<UP>",
+ (pANTLR3_UINT8) "COMMA",
+ (pANTLR3_UINT8) "DIGIT",
+ (pANTLR3_UINT8) "GREATER_EQUAL",
+ (pANTLR3_UINT8) "GUARD",
+ (pANTLR3_UINT8) "LETTER",
+ (pANTLR3_UINT8) "MAXIMUM",
+ (pANTLR3_UINT8) "MINIMUM",
+ (pANTLR3_UINT8) "MULT",
+ (pANTLR3_UINT8) "NEWLINE",
+ (pANTLR3_UINT8) "NUMBER",
+ (pANTLR3_UINT8) "PLUS",
+ (pANTLR3_UINT8) "QUESTION_MARK",
+ (pANTLR3_UINT8) "SUB",
+ (pANTLR3_UINT8) "VARIABLE",
+ (pANTLR3_UINT8) "WHITESPACE",
+ (pANTLR3_UINT8) "'('",
+ (pANTLR3_UINT8) "')'",
+ (pANTLR3_UINT8) "','",
+ (pANTLR3_UINT8) "'='"
+ };
+
+
+
+// Forward declare the locally static matching functions we have generated.
+//
+static
+ EquationSystemParser_equation_system_return
+ equation_system (pEquationSystemParser ctx);
+static
+ EquationSystemParser_equation_return
+ equation (pEquationSystemParser ctx);
+static
+ EquationSystemParser_maxExpr_return
+ maxExpr (pEquationSystemParser ctx);
+static
+ EquationSystemParser_minExpr_return
+ minExpr (pEquationSystemParser ctx);
+static
+ EquationSystemParser_expr_return
+ expr (pEquationSystemParser ctx);
+static
+ EquationSystemParser_term_return
+ term (pEquationSystemParser ctx);
+static
+ ANTLR3_BOOLEAN
+ synpred8_EquationSystem (pEquationSystemParser ctx);
+static
+ ANTLR3_BOOLEAN
+ synpred12_EquationSystem (pEquationSystemParser ctx);
+static void EquationSystemParserFree(pEquationSystemParser ctx);
+static void EquationSystemParserReset (pEquationSystemParser ctx);
+
+/* For use in tree output where we are accumulating rule labels via label += ruleRef
+ * we need a function that knows how to free a return scope when the list is destroyed.
+ * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
+ */
+static void ANTLR3_CDECL freeScope(void * scope)
+{
+ ANTLR3_FREE(scope);
+}
+
+/** \brief Name of the grammar file that generated this code
+ */
+static const char fileName[] = "EquationSystem.g";
+
+/** \brief Return the name of the grammar file that generated this code.
+ */
+static const char * getGrammarFileName()
+{
+ return fileName;
+}
+/** \brief Create a new EquationSystemParser parser and return a context for it.
+ *
+ * \param[in] instream Pointer to an input stream interface.
+ *
+ * \return Pointer to new parser context upon success.
+ */
+ANTLR3_API pEquationSystemParser
+EquationSystemParserNew (pANTLR3_COMMON_TOKEN_STREAM instream)
+{
+ // See if we can create a new parser with the standard constructor
+ //
+ return EquationSystemParserNewSSD(instream, NULL);
+}
+
+/** \brief Create a new EquationSystemParser parser and return a context for it.
+ *
+ * \param[in] instream Pointer to an input stream interface.
+ *
+ * \return Pointer to new parser context upon success.
+ */
+ANTLR3_API pEquationSystemParser
+EquationSystemParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
+{
+ pEquationSystemParser ctx; /* Context structure we will build and return */
+
+ ctx = (pEquationSystemParser) ANTLR3_CALLOC(1, sizeof(EquationSystemParser));
+
+ if (ctx == NULL)
+ {
+ // Failed to allocate memory for parser context
+ //
+ return NULL;
+ }
+
+ /* -------------------------------------------------------------------
+ * Memory for basic structure is allocated, now to fill in
+ * the base ANTLR3 structures. We initialize the function pointers
+ * for the standard ANTLR3 parser function set, but upon return
+ * from here, the programmer may set the pointers to provide custom
+ * implementations of each function.
+ *
+ * We don't use the macros defined in EquationSystemParser.h here, in order that you can get a sense
+ * of what goes where.
+ */
+
+ /* Create a base parser/recognizer, using the supplied token stream
+ */
+ ctx->pParser = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state);
+ /* Install the implementation of our EquationSystemParser interface
+ */
+ ctx->equation_system = equation_system;
+ ctx->equation = equation;
+ ctx->maxExpr = maxExpr;
+ ctx->minExpr = minExpr;
+ ctx->expr = expr;
+ ctx->term = term;
+ ctx->synpred8_EquationSystem = synpred8_EquationSystem;
+ ctx->synpred12_EquationSystem = synpred12_EquationSystem;
+ ctx->free = EquationSystemParserFree;
+ ctx->reset = EquationSystemParserReset;
+ ctx->getGrammarFileName = getGrammarFileName;
+
+ /* Install the scope pushing methods.
+ */
+ADAPTOR = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory);
+
+ctx->vectors = antlr3VectorFactoryNew(0);
+ /* Install the token table
+ */
+ PSRSTATE->tokenNames = EquationSystemParserTokenNames;
+
+
+ /* Return the newly built parser to the caller
+ */
+ return ctx;
+}
+
+static void
+EquationSystemParserReset (pEquationSystemParser ctx)
+{
+ RECOGNIZER->reset(RECOGNIZER);
+}
+
+/** Free the parser resources
+ */
+ static void
+ EquationSystemParserFree(pEquationSystemParser ctx)
+ {
+ /* Free any scope memory
+ */
+
+ctx->vectors->close(ctx->vectors);
+/* We created the adaptor so we must free it
+ */
+ADAPTOR->free(ADAPTOR);
+ // Free this parser
+ //
+ ctx->pParser->free(ctx->pParser);
+
+
+ ANTLR3_FREE(ctx);
+
+ /* Everything is released, so we can return
+ */
+ return;
+ }
+
+/** Return token names used by this
+parser
+
+ *
+ * The returned pointer is used as an index into the token names table (using the token
+ * number as the index).
+ *
+ * \return Pointer to first char * in the table.
+ */
+static pANTLR3_UINT8 *getTokenNames()
+{
+ return EquationSystemParserTokenNames;
+}
+
+
+/* Declare the bitsets
+ */
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_equation_in_equation_system141 */
+static ANTLR3_BITWORD FOLLOW_equation_in_equation_system141_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001002) };
+static ANTLR3_BITSET_LIST FOLLOW_equation_in_equation_system141 = { FOLLOW_equation_in_equation_system141_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_NEWLINE_in_equation_system145 */
+static ANTLR3_BITWORD FOLLOW_NEWLINE_in_equation_system145_bits[] = { ANTLR3_UINT64_LIT(0x0000000000021000) };
+static ANTLR3_BITSET_LIST FOLLOW_NEWLINE_in_equation_system145 = { FOLLOW_NEWLINE_in_equation_system145_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_equation_in_equation_system150 */
+static ANTLR3_BITWORD FOLLOW_equation_in_equation_system150_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001002) };
+static ANTLR3_BITSET_LIST FOLLOW_equation_in_equation_system150 = { FOLLOW_equation_in_equation_system150_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_NEWLINE_in_equation_system157 */
+static ANTLR3_BITWORD FOLLOW_NEWLINE_in_equation_system157_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001002) };
+static ANTLR3_BITSET_LIST FOLLOW_NEWLINE_in_equation_system157 = { FOLLOW_NEWLINE_in_equation_system157_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_VARIABLE_in_equation168 */
+static ANTLR3_BITWORD FOLLOW_VARIABLE_in_equation168_bits[] = { ANTLR3_UINT64_LIT(0x0000000000400000) };
+static ANTLR3_BITSET_LIST FOLLOW_VARIABLE_in_equation168 = { FOLLOW_VARIABLE_in_equation168_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_22_in_equation170 */
+static ANTLR3_BITWORD FOLLOW_22_in_equation170_bits[] = { ANTLR3_UINT64_LIT(0x00000000000B2600) };
+static ANTLR3_BITSET_LIST FOLLOW_22_in_equation170 = { FOLLOW_22_in_equation170_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_maxExpr_in_equation173 */
+static ANTLR3_BITWORD FOLLOW_maxExpr_in_equation173_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
+static ANTLR3_BITSET_LIST FOLLOW_maxExpr_in_equation173 = { FOLLOW_maxExpr_in_equation173_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_MAXIMUM_in_maxExpr182 */
+static ANTLR3_BITWORD FOLLOW_MAXIMUM_in_maxExpr182_bits[] = { ANTLR3_UINT64_LIT(0x0000000000080000) };
+static ANTLR3_BITSET_LIST FOLLOW_MAXIMUM_in_maxExpr182 = { FOLLOW_MAXIMUM_in_maxExpr182_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_19_in_maxExpr185 */
+static ANTLR3_BITWORD FOLLOW_19_in_maxExpr185_bits[] = { ANTLR3_UINT64_LIT(0x00000000000B2400) };
+static ANTLR3_BITSET_LIST FOLLOW_19_in_maxExpr185 = { FOLLOW_19_in_maxExpr185_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_minExpr_in_maxExpr188 */
+static ANTLR3_BITWORD FOLLOW_minExpr_in_maxExpr188_bits[] = { ANTLR3_UINT64_LIT(0x0000000000300000) };
+static ANTLR3_BITSET_LIST FOLLOW_minExpr_in_maxExpr188 = { FOLLOW_minExpr_in_maxExpr188_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_21_in_maxExpr192 */
+static ANTLR3_BITWORD FOLLOW_21_in_maxExpr192_bits[] = { ANTLR3_UINT64_LIT(0x00000000000B2400) };
+static ANTLR3_BITSET_LIST FOLLOW_21_in_maxExpr192 = { FOLLOW_21_in_maxExpr192_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_minExpr_in_maxExpr195 */
+static ANTLR3_BITWORD FOLLOW_minExpr_in_maxExpr195_bits[] = { ANTLR3_UINT64_LIT(0x0000000000300000) };
+static ANTLR3_BITSET_LIST FOLLOW_minExpr_in_maxExpr195 = { FOLLOW_minExpr_in_maxExpr195_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_20_in_maxExpr200 */
+static ANTLR3_BITWORD FOLLOW_20_in_maxExpr200_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
+static ANTLR3_BITSET_LIST FOLLOW_20_in_maxExpr200 = { FOLLOW_20_in_maxExpr200_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_minExpr_in_maxExpr205 */
+static ANTLR3_BITWORD FOLLOW_minExpr_in_maxExpr205_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
+static ANTLR3_BITSET_LIST FOLLOW_minExpr_in_maxExpr205 = { FOLLOW_minExpr_in_maxExpr205_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_MINIMUM_in_minExpr213 */
+static ANTLR3_BITWORD FOLLOW_MINIMUM_in_minExpr213_bits[] = { ANTLR3_UINT64_LIT(0x0000000000080000) };
+static ANTLR3_BITSET_LIST FOLLOW_MINIMUM_in_minExpr213 = { FOLLOW_MINIMUM_in_minExpr213_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_19_in_minExpr216 */
+static ANTLR3_BITWORD FOLLOW_19_in_minExpr216_bits[] = { ANTLR3_UINT64_LIT(0x00000000000B2600) };
+static ANTLR3_BITSET_LIST FOLLOW_19_in_minExpr216 = { FOLLOW_19_in_minExpr216_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_maxExpr_in_minExpr219 */
+static ANTLR3_BITWORD FOLLOW_maxExpr_in_minExpr219_bits[] = { ANTLR3_UINT64_LIT(0x0000000000300000) };
+static ANTLR3_BITSET_LIST FOLLOW_maxExpr_in_minExpr219 = { FOLLOW_maxExpr_in_minExpr219_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_21_in_minExpr223 */
+static ANTLR3_BITWORD FOLLOW_21_in_minExpr223_bits[] = { ANTLR3_UINT64_LIT(0x00000000000B2600) };
+static ANTLR3_BITSET_LIST FOLLOW_21_in_minExpr223 = { FOLLOW_21_in_minExpr223_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_maxExpr_in_minExpr226 */
+static ANTLR3_BITWORD FOLLOW_maxExpr_in_minExpr226_bits[] = { ANTLR3_UINT64_LIT(0x0000000000300000) };
+static ANTLR3_BITSET_LIST FOLLOW_maxExpr_in_minExpr226 = { FOLLOW_maxExpr_in_minExpr226_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_20_in_minExpr231 */
+static ANTLR3_BITWORD FOLLOW_20_in_minExpr231_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
+static ANTLR3_BITSET_LIST FOLLOW_20_in_minExpr231 = { FOLLOW_20_in_minExpr231_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_minExpr236 */
+static ANTLR3_BITWORD FOLLOW_expr_in_minExpr236_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
+static ANTLR3_BITSET_LIST FOLLOW_expr_in_minExpr236 = { FOLLOW_expr_in_minExpr236_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_19_in_expr245 */
+static ANTLR3_BITWORD FOLLOW_19_in_expr245_bits[] = { ANTLR3_UINT64_LIT(0x00000000000B2000) };
+static ANTLR3_BITSET_LIST FOLLOW_19_in_expr245 = { FOLLOW_19_in_expr245_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr247 */
+static ANTLR3_BITWORD FOLLOW_expr_in_expr247_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000040) };
+static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr247 = { FOLLOW_expr_in_expr247_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_GREATER_EQUAL_in_expr249 */
+static ANTLR3_BITWORD FOLLOW_GREATER_EQUAL_in_expr249_bits[] = { ANTLR3_UINT64_LIT(0x00000000000B2000) };
+static ANTLR3_BITSET_LIST FOLLOW_GREATER_EQUAL_in_expr249 = { FOLLOW_GREATER_EQUAL_in_expr249_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr251 */
+static ANTLR3_BITWORD FOLLOW_expr_in_expr251_bits[] = { ANTLR3_UINT64_LIT(0x0000000000008000) };
+static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr251 = { FOLLOW_expr_in_expr251_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_QUESTION_MARK_in_expr253 */
+static ANTLR3_BITWORD FOLLOW_QUESTION_MARK_in_expr253_bits[] = { ANTLR3_UINT64_LIT(0x00000000000B2000) };
+static ANTLR3_BITSET_LIST FOLLOW_QUESTION_MARK_in_expr253 = { FOLLOW_QUESTION_MARK_in_expr253_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr255 */
+static ANTLR3_BITWORD FOLLOW_expr_in_expr255_bits[] = { ANTLR3_UINT64_LIT(0x0000000000100000) };
+static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr255 = { FOLLOW_expr_in_expr255_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_20_in_expr257 */
+static ANTLR3_BITWORD FOLLOW_20_in_expr257_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
+static ANTLR3_BITSET_LIST FOLLOW_20_in_expr257 = { FOLLOW_20_in_expr257_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_term_in_expr278 */
+static ANTLR3_BITWORD FOLLOW_term_in_expr278_bits[] = { ANTLR3_UINT64_LIT(0x0000000000014812) };
+static ANTLR3_BITSET_LIST FOLLOW_term_in_expr278 = { FOLLOW_term_in_expr278_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_expr282 */
+static ANTLR3_BITWORD FOLLOW_set_in_expr282_bits[] = { ANTLR3_UINT64_LIT(0x00000000000B2000) };
+static ANTLR3_BITSET_LIST FOLLOW_set_in_expr282 = { FOLLOW_set_in_expr282_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr299 */
+static ANTLR3_BITWORD FOLLOW_expr_in_expr299_bits[] = { ANTLR3_UINT64_LIT(0x0000000000014812) };
+static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr299 = { FOLLOW_expr_in_expr299_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_NUMBER_in_term311 */
+static ANTLR3_BITWORD FOLLOW_NUMBER_in_term311_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
+static ANTLR3_BITSET_LIST FOLLOW_NUMBER_in_term311 = { FOLLOW_NUMBER_in_term311_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_VARIABLE_in_term320 */
+static ANTLR3_BITWORD FOLLOW_VARIABLE_in_term320_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
+static ANTLR3_BITSET_LIST FOLLOW_VARIABLE_in_term320 = { FOLLOW_VARIABLE_in_term320_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_SUB_in_term329 */
+static ANTLR3_BITWORD FOLLOW_SUB_in_term329_bits[] = { ANTLR3_UINT64_LIT(0x00000000000B2000) };
+static ANTLR3_BITSET_LIST FOLLOW_SUB_in_term329 = { FOLLOW_SUB_in_term329_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_term_in_term332 */
+static ANTLR3_BITWORD FOLLOW_term_in_term332_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
+static ANTLR3_BITSET_LIST FOLLOW_term_in_term332 = { FOLLOW_term_in_term332_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_19_in_term341 */
+static ANTLR3_BITWORD FOLLOW_19_in_term341_bits[] = { ANTLR3_UINT64_LIT(0x00000000000B2000) };
+static ANTLR3_BITSET_LIST FOLLOW_19_in_term341 = { FOLLOW_19_in_term341_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_term344 */
+static ANTLR3_BITWORD FOLLOW_expr_in_term344_bits[] = { ANTLR3_UINT64_LIT(0x0000000000100000) };
+static ANTLR3_BITSET_LIST FOLLOW_expr_in_term344 = { FOLLOW_expr_in_term344_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_20_in_term346 */
+static ANTLR3_BITWORD FOLLOW_20_in_term346_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
+static ANTLR3_BITSET_LIST FOLLOW_20_in_term346 = { FOLLOW_20_in_term346_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_19_in_synpred8_EquationSystem245 */
+static ANTLR3_BITWORD FOLLOW_19_in_synpred8_EquationSystem245_bits[] = { ANTLR3_UINT64_LIT(0x00000000000B2000) };
+static ANTLR3_BITSET_LIST FOLLOW_19_in_synpred8_EquationSystem245 = { FOLLOW_19_in_synpred8_EquationSystem245_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_synpred8_EquationSystem247 */
+static ANTLR3_BITWORD FOLLOW_expr_in_synpred8_EquationSystem247_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000040) };
+static ANTLR3_BITSET_LIST FOLLOW_expr_in_synpred8_EquationSystem247 = { FOLLOW_expr_in_synpred8_EquationSystem247_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_GREATER_EQUAL_in_synpred8_EquationSystem249 */
+static ANTLR3_BITWORD FOLLOW_GREATER_EQUAL_in_synpred8_EquationSystem249_bits[] = { ANTLR3_UINT64_LIT(0x00000000000B2000) };
+static ANTLR3_BITSET_LIST FOLLOW_GREATER_EQUAL_in_synpred8_EquationSystem249 = { FOLLOW_GREATER_EQUAL_in_synpred8_EquationSystem249_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_synpred8_EquationSystem251 */
+static ANTLR3_BITWORD FOLLOW_expr_in_synpred8_EquationSystem251_bits[] = { ANTLR3_UINT64_LIT(0x0000000000008000) };
+static ANTLR3_BITSET_LIST FOLLOW_expr_in_synpred8_EquationSystem251 = { FOLLOW_expr_in_synpred8_EquationSystem251_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_QUESTION_MARK_in_synpred8_EquationSystem253 */
+static ANTLR3_BITWORD FOLLOW_QUESTION_MARK_in_synpred8_EquationSystem253_bits[] = { ANTLR3_UINT64_LIT(0x00000000000B2000) };
+static ANTLR3_BITSET_LIST FOLLOW_QUESTION_MARK_in_synpred8_EquationSystem253 = { FOLLOW_QUESTION_MARK_in_synpred8_EquationSystem253_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_synpred8_EquationSystem255 */
+static ANTLR3_BITWORD FOLLOW_expr_in_synpred8_EquationSystem255_bits[] = { ANTLR3_UINT64_LIT(0x0000000000100000) };
+static ANTLR3_BITSET_LIST FOLLOW_expr_in_synpred8_EquationSystem255 = { FOLLOW_expr_in_synpred8_EquationSystem255_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_20_in_synpred8_EquationSystem257 */
+static ANTLR3_BITWORD FOLLOW_20_in_synpred8_EquationSystem257_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
+static ANTLR3_BITSET_LIST FOLLOW_20_in_synpred8_EquationSystem257 = { FOLLOW_20_in_synpred8_EquationSystem257_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_synpred12_EquationSystem282 */
+static ANTLR3_BITWORD FOLLOW_set_in_synpred12_EquationSystem282_bits[] = { ANTLR3_UINT64_LIT(0x00000000000B2000) };
+static ANTLR3_BITSET_LIST FOLLOW_set_in_synpred12_EquationSystem282 = { FOLLOW_set_in_synpred12_EquationSystem282_bits, 1 };
+/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_synpred12_EquationSystem299 */
+static ANTLR3_BITWORD FOLLOW_expr_in_synpred12_EquationSystem299_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
+static ANTLR3_BITSET_LIST FOLLOW_expr_in_synpred12_EquationSystem299 = { FOLLOW_expr_in_synpred12_EquationSystem299_bits, 1 };
+
+
+
+/* =========================================================================
+ * DFA tables for the parser
+ */
+/** Static dfa state tables for Cyclic dfa:
+ * ()* loopback of 22:28: ( ( NEWLINE !)+ equation )*
+ */
+static const ANTLR3_INT32 dfa2_eot[4] =
+ {
+ -1, -1, -1, -1
+ };
+static const ANTLR3_INT32 dfa2_eof[4] =
+ {
+ 2, 2, -1, -1
+ };
+static const ANTLR3_INT32 dfa2_min[4] =
+ {
+ 12, 12, -1, -1
+ };
+static const ANTLR3_INT32 dfa2_max[4] =
+ {
+ 12, 17, -1, -1
+ };
+static const ANTLR3_INT32 dfa2_accept[4] =
+ {
+ -1, -1, 2, 1
+ };
+static const ANTLR3_INT32 dfa2_special[4] =
+ {
+ -1, -1, -1, -1
+ };
+
+/** Used when there is no transition table entry for a particular state */
+#define dfa2_T_empty NULL
+
+static const ANTLR3_INT32 dfa2_T0[] =
+ {
+ 1
+ };
+
+static const ANTLR3_INT32 dfa2_T1[] =
+ {
+ 1, -1, -1, -1, -1, 3
+ };
+
+
+/* Transition tables are a table of sub tables, with some tables
+ * reused for efficiency.
+ */
+static const ANTLR3_INT32 * const dfa2_transitions[] =
+{
+ dfa2_T0, dfa2_T1, NULL, NULL
+};
+
+
+/* Declare tracking structure for Cyclic DFA 2
+ */
+static
+ANTLR3_CYCLIC_DFA cdfa2
+ = {
+ 2, /* Decision number of this dfa */
+ /* Which decision this represents: */
+ (const pANTLR3_UCHAR)"()* loopback of 22:28: ( ( NEWLINE !)+ equation )*",
+ (CDFA_SPECIAL_FUNC) antlr3dfaspecialStateTransition, /* Default special state transition function */
+
+ antlr3dfaspecialTransition, /* DFA specialTransition is currently just a default function in the runtime */
+ antlr3dfapredict, /* DFA simulator function is in the runtime */
+ dfa2_eot, /* EOT table */
+ dfa2_eof, /* EOF table */
+ dfa2_min, /* Minimum tokens for each state */
+ dfa2_max, /* Maximum tokens for each state */
+ dfa2_accept, /* Accept table */
+ dfa2_special, /* Special transition states */
+ dfa2_transitions /* Table of transition tables */
+
+ };
+/* End of Cyclic DFA 2
+ * ---------------------
+ */
+/* =========================================================================
+ * End of DFA tables for the parser
+ */
+
+/* ==============================================
+ * Parsing rules
+ */
+/**
+ * $ANTLR start equation_system
+ * EquationSystem.g:22:1: equation_system : equation ( ( NEWLINE !)+ equation )* ( NEWLINE !)* ;
+ */
+static EquationSystemParser_equation_system_return
+equation_system(pEquationSystemParser ctx)
+{
+ EquationSystemParser_equation_system_return retval;
+
+
+ pANTLR3_BASE_TREE root_0;
+
+ pANTLR3_COMMON_TOKEN NEWLINE2;
+ pANTLR3_COMMON_TOKEN NEWLINE4;
+ EquationSystemParser_equation_return equation1;
+ #undef RETURN_TYPE_equation1
+ #define RETURN_TYPE_equation1 EquationSystemParser_equation_return
+
+ EquationSystemParser_equation_return equation3;
+ #undef RETURN_TYPE_equation3
+ #define RETURN_TYPE_equation3 EquationSystemParser_equation_return
+
+ pANTLR3_BASE_TREE NEWLINE2_tree;
+ pANTLR3_BASE_TREE NEWLINE4_tree;
+
+ /* Initialize rule variables
+ */
+
+ root_0 = NULL;
+
+ NEWLINE2 = NULL;
+ NEWLINE4 = NULL;
+ equation1.tree = NULL;
+
+ equation3.tree = NULL;
+ retval.start = LT(1); retval.stop = retval.start;
+
+
+ NEWLINE2_tree = NULL;
+ NEWLINE4_tree = NULL;
+
+
+ retval.tree = NULL;
+
+ {
+ // EquationSystem.g:22:17: ( equation ( ( NEWLINE !)+ equation )* ( NEWLINE !)* )
+ // EquationSystem.g:22:19: equation ( ( NEWLINE !)+ equation )* ( NEWLINE !)*
+ {
+ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
+
+
+ FOLLOWPUSH(FOLLOW_equation_in_equation_system141);
+ equation1=equation(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto ruleequation_systemEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) ADAPTOR->addChild(ADAPTOR, root_0, equation1.tree);
+
+ // EquationSystem.g:22:28: ( ( NEWLINE !)+ equation )*
+
+ for (;;)
+ {
+ int alt2=2;
+ alt2 = cdfa2.predict(ctx, RECOGNIZER, ISTREAM, &cdfa2);
+ if (HASEXCEPTION())
+ {
+ goto ruleequation_systemEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ switch (alt2)
+ {
+ case 1:
+ // EquationSystem.g:22:30: ( NEWLINE !)+ equation
+ {
+ // EquationSystem.g:22:37: ( NEWLINE !)+
+ {
+ int cnt1=0;
+
+ for (;;)
+ {
+ int alt1=2;
+ switch ( LA(1) )
+ {
+ case NEWLINE:
+ {
+ alt1=1;
+ }
+ break;
+
+ }
+
+ switch (alt1)
+ {
+ case 1:
+ // EquationSystem.g:22:37: NEWLINE !
+ {
+ NEWLINE2 = (pANTLR3_COMMON_TOKEN) MATCHT(NEWLINE, &FOLLOW_NEWLINE_in_equation_system145);
+ if (HASEXCEPTION())
+ {
+ goto ruleequation_systemEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+
+ }
+ break;
+
+ default:
+
+ if ( cnt1 >= 1 )
+ {
+ goto loop1;
+ }
+ if (BACKTRACKING>0)
+ {
+ FAILEDFLAG = ANTLR3_TRUE;
+ return retval;
+ }
+
+ /* mismatchedSetEx()
+ */
+ CONSTRUCTEX();
+ EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
+ EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
+
+
+ goto ruleequation_systemEx;
+ }
+ cnt1++;
+ }
+ loop1: ; /* Jump to here if this rule does not match */
+ }
+
+ FOLLOWPUSH(FOLLOW_equation_in_equation_system150);
+ equation3=equation(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto ruleequation_systemEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) ADAPTOR->addChild(ADAPTOR, root_0, equation3.tree);
+
+ }
+ break;
+
+ default:
+ goto loop2; /* break out of the loop */
+ break;
+ }
+ }
+ loop2: ; /* Jump out to here if this rule does not match */
+
+
+ // EquationSystem.g:22:54: ( NEWLINE !)*
+
+ for (;;)
+ {
+ int alt3=2;
+ switch ( LA(1) )
+ {
+ case NEWLINE:
+ {
+ alt3=1;
+ }
+ break;
+
+ }
+
+ switch (alt3)
+ {
+ case 1:
+ // EquationSystem.g:22:55: NEWLINE !
+ {
+ NEWLINE4 = (pANTLR3_COMMON_TOKEN) MATCHT(NEWLINE, &FOLLOW_NEWLINE_in_equation_system157);
+ if (HASEXCEPTION())
+ {
+ goto ruleequation_systemEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+
+ }
+ break;
+
+ default:
+ goto loop3; /* break out of the loop */
+ break;
+ }
+ }
+ loop3: ; /* Jump out to here if this rule does not match */
+
+
+ }
+
+ }
+
+ // This is where rules clean up and exit
+ //
+ goto ruleequation_systemEx; /* Prevent compiler warnings */
+ ruleequation_systemEx: ;
+ retval.stop = LT(-1);
+
+
+ if ( BACKTRACKING==0 )
+ {
+
+ retval.stop = LT(-1);
+
+ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
+ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
+ }
+
+
+ if (HASEXCEPTION())
+ {
+ PREPORTERROR();
+ PRECOVER();
+ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
+ }
+ return retval;
+}
+/* $ANTLR end equation_system */
+
+/**
+ * $ANTLR start equation
+ * EquationSystem.g:23:1: equation : VARIABLE '=' ! maxExpr ;
+ */
+static EquationSystemParser_equation_return
+equation(pEquationSystemParser ctx)
+{
+ EquationSystemParser_equation_return retval;
+
+
+ pANTLR3_BASE_TREE root_0;
+
+ pANTLR3_COMMON_TOKEN VARIABLE5;
+ pANTLR3_COMMON_TOKEN char_literal6;
+ EquationSystemParser_maxExpr_return maxExpr7;
+ #undef RETURN_TYPE_maxExpr7
+ #define RETURN_TYPE_maxExpr7 EquationSystemParser_maxExpr_return
+
+ pANTLR3_BASE_TREE VARIABLE5_tree;
+ pANTLR3_BASE_TREE char_literal6_tree;
+
+ /* Initialize rule variables
+ */
+
+ root_0 = NULL;
+
+ VARIABLE5 = NULL;
+ char_literal6 = NULL;
+ maxExpr7.tree = NULL;
+ retval.start = LT(1); retval.stop = retval.start;
+
+
+ VARIABLE5_tree = NULL;
+ char_literal6_tree = NULL;
+
+
+ retval.tree = NULL;
+
+ {
+ // EquationSystem.g:23:10: ( VARIABLE '=' ! maxExpr )
+ // EquationSystem.g:23:12: VARIABLE '=' ! maxExpr
+ {
+ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
+
+
+ VARIABLE5 = (pANTLR3_COMMON_TOKEN) MATCHT(VARIABLE, &FOLLOW_VARIABLE_in_equation168);
+ if (HASEXCEPTION())
+ {
+ goto ruleequationEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) {
+ VARIABLE5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, VARIABLE5));
+ ADAPTOR->addChild(ADAPTOR, root_0, VARIABLE5_tree);
+ }
+
+ char_literal6 = (pANTLR3_COMMON_TOKEN) MATCHT(22, &FOLLOW_22_in_equation170);
+ if (HASEXCEPTION())
+ {
+ goto ruleequationEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+
+ FOLLOWPUSH(FOLLOW_maxExpr_in_equation173);
+ maxExpr7=maxExpr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto ruleequationEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) ADAPTOR->addChild(ADAPTOR, root_0, maxExpr7.tree);
+
+ }
+
+ }
+
+ // This is where rules clean up and exit
+ //
+ goto ruleequationEx; /* Prevent compiler warnings */
+ ruleequationEx: ;
+ retval.stop = LT(-1);
+
+
+ if ( BACKTRACKING==0 )
+ {
+
+ retval.stop = LT(-1);
+
+ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
+ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
+ }
+
+
+ if (HASEXCEPTION())
+ {
+ PREPORTERROR();
+ PRECOVER();
+ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
+ }
+ return retval;
+}
+/* $ANTLR end equation */
+
+/**
+ * $ANTLR start maxExpr
+ * EquationSystem.g:25:1: maxExpr : ( MAXIMUM ^ '(' ! minExpr ( ',' ! minExpr )* ')' !| minExpr );
+ */
+static EquationSystemParser_maxExpr_return
+maxExpr(pEquationSystemParser ctx)
+{
+ EquationSystemParser_maxExpr_return retval;
+
+
+ pANTLR3_BASE_TREE root_0;
+
+ pANTLR3_COMMON_TOKEN MAXIMUM8;
+ pANTLR3_COMMON_TOKEN char_literal9;
+ pANTLR3_COMMON_TOKEN char_literal11;
+ pANTLR3_COMMON_TOKEN char_literal13;
+ EquationSystemParser_minExpr_return minExpr10;
+ #undef RETURN_TYPE_minExpr10
+ #define RETURN_TYPE_minExpr10 EquationSystemParser_minExpr_return
+
+ EquationSystemParser_minExpr_return minExpr12;
+ #undef RETURN_TYPE_minExpr12
+ #define RETURN_TYPE_minExpr12 EquationSystemParser_minExpr_return
+
+ EquationSystemParser_minExpr_return minExpr14;
+ #undef RETURN_TYPE_minExpr14
+ #define RETURN_TYPE_minExpr14 EquationSystemParser_minExpr_return
+
+ pANTLR3_BASE_TREE MAXIMUM8_tree;
+ pANTLR3_BASE_TREE char_literal9_tree;
+ pANTLR3_BASE_TREE char_literal11_tree;
+ pANTLR3_BASE_TREE char_literal13_tree;
+
+ /* Initialize rule variables
+ */
+
+ root_0 = NULL;
+
+ MAXIMUM8 = NULL;
+ char_literal9 = NULL;
+ char_literal11 = NULL;
+ char_literal13 = NULL;
+ minExpr10.tree = NULL;
+
+ minExpr12.tree = NULL;
+
+ minExpr14.tree = NULL;
+ retval.start = LT(1); retval.stop = retval.start;
+
+
+ MAXIMUM8_tree = NULL;
+ char_literal9_tree = NULL;
+ char_literal11_tree = NULL;
+ char_literal13_tree = NULL;
+
+
+ retval.tree = NULL;
+
+ {
+ {
+ // EquationSystem.g:25:9: ( MAXIMUM ^ '(' ! minExpr ( ',' ! minExpr )* ')' !| minExpr )
+
+ ANTLR3_UINT32 alt5;
+
+ alt5=2;
+
+ switch ( LA(1) )
+ {
+ case MAXIMUM:
+ {
+ alt5=1;
+ }
+ break;
+ case MINIMUM:
+ case NUMBER:
+ case SUB:
+ case VARIABLE:
+ case 19:
+ {
+ alt5=2;
+ }
+ break;
+
+ default:
+ if (BACKTRACKING>0)
+ {
+ FAILEDFLAG = ANTLR3_TRUE;
+ return retval;
+ }
+
+ CONSTRUCTEX();
+ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
+ EXCEPTION->message = (void *)"";
+ EXCEPTION->decisionNum = 5;
+ EXCEPTION->state = 0;
+
+
+ goto rulemaxExprEx;
+
+ }
+
+ switch (alt5)
+ {
+ case 1:
+ // EquationSystem.g:25:11: MAXIMUM ^ '(' ! minExpr ( ',' ! minExpr )* ')' !
+ {
+ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
+
+
+ MAXIMUM8 = (pANTLR3_COMMON_TOKEN) MATCHT(MAXIMUM, &FOLLOW_MAXIMUM_in_maxExpr182);
+ if (HASEXCEPTION())
+ {
+ goto rulemaxExprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) {
+ MAXIMUM8_tree =
+ (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, MAXIMUM8))
+ ;
+ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, MAXIMUM8_tree, root_0));
+ }
+
+ char_literal9 = (pANTLR3_COMMON_TOKEN) MATCHT(19, &FOLLOW_19_in_maxExpr185);
+ if (HASEXCEPTION())
+ {
+ goto rulemaxExprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+
+ FOLLOWPUSH(FOLLOW_minExpr_in_maxExpr188);
+ minExpr10=minExpr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto rulemaxExprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) ADAPTOR->addChild(ADAPTOR, root_0, minExpr10.tree);
+
+ // EquationSystem.g:25:33: ( ',' ! minExpr )*
+
+ for (;;)
+ {
+ int alt4=2;
+ switch ( LA(1) )
+ {
+ case 21:
+ {
+ alt4=1;
+ }
+ break;
+
+ }
+
+ switch (alt4)
+ {
+ case 1:
+ // EquationSystem.g:25:35: ',' ! minExpr
+ {
+ char_literal11 = (pANTLR3_COMMON_TOKEN) MATCHT(21, &FOLLOW_21_in_maxExpr192);
+ if (HASEXCEPTION())
+ {
+ goto rulemaxExprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+
+ FOLLOWPUSH(FOLLOW_minExpr_in_maxExpr195);
+ minExpr12=minExpr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto rulemaxExprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) ADAPTOR->addChild(ADAPTOR, root_0, minExpr12.tree);
+
+ }
+ break;
+
+ default:
+ goto loop4; /* break out of the loop */
+ break;
+ }
+ }
+ loop4: ; /* Jump out to here if this rule does not match */
+
+
+ char_literal13 = (pANTLR3_COMMON_TOKEN) MATCHT(20, &FOLLOW_20_in_maxExpr200);
+ if (HASEXCEPTION())
+ {
+ goto rulemaxExprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+
+ }
+ break;
+ case 2:
+ // EquationSystem.g:25:58: minExpr
+ {
+ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
+
+
+ FOLLOWPUSH(FOLLOW_minExpr_in_maxExpr205);
+ minExpr14=minExpr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto rulemaxExprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) ADAPTOR->addChild(ADAPTOR, root_0, minExpr14.tree);
+
+ }
+ break;
+
+ }
+ }
+ }
+
+ // This is where rules clean up and exit
+ //
+ goto rulemaxExprEx; /* Prevent compiler warnings */
+ rulemaxExprEx: ;
+ retval.stop = LT(-1);
+
+
+ if ( BACKTRACKING==0 )
+ {
+
+ retval.stop = LT(-1);
+
+ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
+ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
+ }
+
+
+ if (HASEXCEPTION())
+ {
+ PREPORTERROR();
+ PRECOVER();
+ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
+ }
+ return retval;
+}
+/* $ANTLR end maxExpr */
+
+/**
+ * $ANTLR start minExpr
+ * EquationSystem.g:26:1: minExpr : ( MINIMUM ^ '(' ! maxExpr ( ',' ! maxExpr )* ')' !| expr );
+ */
+static EquationSystemParser_minExpr_return
+minExpr(pEquationSystemParser ctx)
+{
+ EquationSystemParser_minExpr_return retval;
+
+
+ pANTLR3_BASE_TREE root_0;
+
+ pANTLR3_COMMON_TOKEN MINIMUM15;
+ pANTLR3_COMMON_TOKEN char_literal16;
+ pANTLR3_COMMON_TOKEN char_literal18;
+ pANTLR3_COMMON_TOKEN char_literal20;
+ EquationSystemParser_maxExpr_return maxExpr17;
+ #undef RETURN_TYPE_maxExpr17
+ #define RETURN_TYPE_maxExpr17 EquationSystemParser_maxExpr_return
+
+ EquationSystemParser_maxExpr_return maxExpr19;
+ #undef RETURN_TYPE_maxExpr19
+ #define RETURN_TYPE_maxExpr19 EquationSystemParser_maxExpr_return
+
+ EquationSystemParser_expr_return expr21;
+ #undef RETURN_TYPE_expr21
+ #define RETURN_TYPE_expr21 EquationSystemParser_expr_return
+
+ pANTLR3_BASE_TREE MINIMUM15_tree;
+ pANTLR3_BASE_TREE char_literal16_tree;
+ pANTLR3_BASE_TREE char_literal18_tree;
+ pANTLR3_BASE_TREE char_literal20_tree;
+
+ /* Initialize rule variables
+ */
+
+ root_0 = NULL;
+
+ MINIMUM15 = NULL;
+ char_literal16 = NULL;
+ char_literal18 = NULL;
+ char_literal20 = NULL;
+ maxExpr17.tree = NULL;
+
+ maxExpr19.tree = NULL;
+
+ expr21.tree = NULL;
+ retval.start = LT(1); retval.stop = retval.start;
+
+
+ MINIMUM15_tree = NULL;
+ char_literal16_tree = NULL;
+ char_literal18_tree = NULL;
+ char_literal20_tree = NULL;
+
+
+ retval.tree = NULL;
+
+ {
+ {
+ // EquationSystem.g:26:9: ( MINIMUM ^ '(' ! maxExpr ( ',' ! maxExpr )* ')' !| expr )
+
+ ANTLR3_UINT32 alt7;
+
+ alt7=2;
+
+ switch ( LA(1) )
+ {
+ case MINIMUM:
+ {
+ alt7=1;
+ }
+ break;
+ case NUMBER:
+ case SUB:
+ case VARIABLE:
+ case 19:
+ {
+ alt7=2;
+ }
+ break;
+
+ default:
+ if (BACKTRACKING>0)
+ {
+ FAILEDFLAG = ANTLR3_TRUE;
+ return retval;
+ }
+
+ CONSTRUCTEX();
+ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
+ EXCEPTION->message = (void *)"";
+ EXCEPTION->decisionNum = 7;
+ EXCEPTION->state = 0;
+
+
+ goto ruleminExprEx;
+
+ }
+
+ switch (alt7)
+ {
+ case 1:
+ // EquationSystem.g:26:11: MINIMUM ^ '(' ! maxExpr ( ',' ! maxExpr )* ')' !
+ {
+ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
+
+
+ MINIMUM15 = (pANTLR3_COMMON_TOKEN) MATCHT(MINIMUM, &FOLLOW_MINIMUM_in_minExpr213);
+ if (HASEXCEPTION())
+ {
+ goto ruleminExprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) {
+ MINIMUM15_tree =
+ (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, MINIMUM15))
+ ;
+ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, MINIMUM15_tree, root_0));
+ }
+
+ char_literal16 = (pANTLR3_COMMON_TOKEN) MATCHT(19, &FOLLOW_19_in_minExpr216);
+ if (HASEXCEPTION())
+ {
+ goto ruleminExprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+
+ FOLLOWPUSH(FOLLOW_maxExpr_in_minExpr219);
+ maxExpr17=maxExpr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto ruleminExprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) ADAPTOR->addChild(ADAPTOR, root_0, maxExpr17.tree);
+
+ // EquationSystem.g:26:33: ( ',' ! maxExpr )*
+
+ for (;;)
+ {
+ int alt6=2;
+ switch ( LA(1) )
+ {
+ case 21:
+ {
+ alt6=1;
+ }
+ break;
+
+ }
+
+ switch (alt6)
+ {
+ case 1:
+ // EquationSystem.g:26:35: ',' ! maxExpr
+ {
+ char_literal18 = (pANTLR3_COMMON_TOKEN) MATCHT(21, &FOLLOW_21_in_minExpr223);
+ if (HASEXCEPTION())
+ {
+ goto ruleminExprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+
+ FOLLOWPUSH(FOLLOW_maxExpr_in_minExpr226);
+ maxExpr19=maxExpr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto ruleminExprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) ADAPTOR->addChild(ADAPTOR, root_0, maxExpr19.tree);
+
+ }
+ break;
+
+ default:
+ goto loop6; /* break out of the loop */
+ break;
+ }
+ }
+ loop6: ; /* Jump out to here if this rule does not match */
+
+
+ char_literal20 = (pANTLR3_COMMON_TOKEN) MATCHT(20, &FOLLOW_20_in_minExpr231);
+ if (HASEXCEPTION())
+ {
+ goto ruleminExprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+
+ }
+ break;
+ case 2:
+ // EquationSystem.g:26:58: expr
+ {
+ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
+
+
+ FOLLOWPUSH(FOLLOW_expr_in_minExpr236);
+ expr21=expr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto ruleminExprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) ADAPTOR->addChild(ADAPTOR, root_0, expr21.tree);
+
+ }
+ break;
+
+ }
+ }
+ }
+
+ // This is where rules clean up and exit
+ //
+ goto ruleminExprEx; /* Prevent compiler warnings */
+ ruleminExprEx: ;
+ retval.stop = LT(-1);
+
+
+ if ( BACKTRACKING==0 )
+ {
+
+ retval.stop = LT(-1);
+
+ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
+ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
+ }
+
+
+ if (HASEXCEPTION())
+ {
+ PREPORTERROR();
+ PRECOVER();
+ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
+ }
+ return retval;
+}
+/* $ANTLR end minExpr */
+
+/**
+ * $ANTLR start expr
+ * EquationSystem.g:28:1: expr : ( '(' expr GREATER_EQUAL expr QUESTION_MARK expr ')' -> ^( GUARD expr expr expr ) | term ( ( PLUS | MULT | SUB | COMMA ) ^ expr )* );
+ */
+static EquationSystemParser_expr_return
+expr(pEquationSystemParser ctx)
+{
+ EquationSystemParser_expr_return retval;
+
+
+ pANTLR3_BASE_TREE root_0;
+
+ pANTLR3_COMMON_TOKEN char_literal22;
+ pANTLR3_COMMON_TOKEN GREATER_EQUAL24;
+ pANTLR3_COMMON_TOKEN QUESTION_MARK26;
+ pANTLR3_COMMON_TOKEN char_literal28;
+ pANTLR3_COMMON_TOKEN set30;
+ EquationSystemParser_expr_return expr23;
+ #undef RETURN_TYPE_expr23
+ #define RETURN_TYPE_expr23 EquationSystemParser_expr_return
+
+ EquationSystemParser_expr_return expr25;
+ #undef RETURN_TYPE_expr25
+ #define RETURN_TYPE_expr25 EquationSystemParser_expr_return
+
+ EquationSystemParser_expr_return expr27;
+ #undef RETURN_TYPE_expr27
+ #define RETURN_TYPE_expr27 EquationSystemParser_expr_return
+
+ EquationSystemParser_term_return term29;
+ #undef RETURN_TYPE_term29
+ #define RETURN_TYPE_term29 EquationSystemParser_term_return
+
+ EquationSystemParser_expr_return expr31;
+ #undef RETURN_TYPE_expr31
+ #define RETURN_TYPE_expr31 EquationSystemParser_expr_return
+
+ pANTLR3_BASE_TREE char_literal22_tree;
+ pANTLR3_BASE_TREE GREATER_EQUAL24_tree;
+ pANTLR3_BASE_TREE QUESTION_MARK26_tree;
+ pANTLR3_BASE_TREE char_literal28_tree;
+ pANTLR3_BASE_TREE set30_tree;
+ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_20;
+ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_19;
+ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_GREATER_EQUAL;
+ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_QUESTION_MARK;
+ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr;
+ /* Initialize rule variables
+ */
+
+ root_0 = NULL;
+
+ char_literal22 = NULL;
+ GREATER_EQUAL24 = NULL;
+ QUESTION_MARK26 = NULL;
+ char_literal28 = NULL;
+ set30 = NULL;
+ expr23.tree = NULL;
+
+ expr25.tree = NULL;
+
+ expr27.tree = NULL;
+
+ term29.tree = NULL;
+
+ expr31.tree = NULL;
+ retval.start = LT(1); retval.stop = retval.start;
+
+
+ char_literal22_tree = NULL;
+ GREATER_EQUAL24_tree = NULL;
+ QUESTION_MARK26_tree = NULL;
+ char_literal28_tree = NULL;
+ set30_tree = NULL;
+
+ stream_20 = NULL;
+ #define CREATE_stream_20 if (stream_20 == NULL) {stream_20 = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token 20"); }
+ stream_19 = NULL;
+ #define CREATE_stream_19 if (stream_19 == NULL) {stream_19 = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token 19"); }
+ stream_GREATER_EQUAL = NULL;
+ #define CREATE_stream_GREATER_EQUAL if (stream_GREATER_EQUAL == NULL) {stream_GREATER_EQUAL = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token GREATER_EQUAL"); }
+ stream_QUESTION_MARK = NULL;
+ #define CREATE_stream_QUESTION_MARK if (stream_QUESTION_MARK == NULL) {stream_QUESTION_MARK = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token QUESTION_MARK"); }
+ stream_expr = NULL;
+ #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); }
+
+ retval.tree = NULL;
+
+ {
+ {
+ // EquationSystem.g:28:6: ( '(' expr GREATER_EQUAL expr QUESTION_MARK expr ')' -> ^( GUARD expr expr expr ) | term ( ( PLUS | MULT | SUB | COMMA ) ^ expr )* )
+
+ ANTLR3_UINT32 alt9;
+
+ alt9=2;
+
+ switch ( LA(1) )
+ {
+ case 19:
+ {
+ {
+ int LA9_1 = LA(2);
+ if ( (synpred8_EquationSystem(ctx)))
+ {
+ alt9=1;
+ }
+ else if ( (ANTLR3_TRUE))
+ {
+ alt9=2;
+ }
+ else
+ {
+ if (BACKTRACKING>0)
+ {
+ FAILEDFLAG = ANTLR3_TRUE;
+ return retval;
+ }
+
+
+ CONSTRUCTEX();
+ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
+ EXCEPTION->message = (void *)"";
+ EXCEPTION->decisionNum = 9;
+ EXCEPTION->state = 1;
+
+
+ goto ruleexprEx;
+
+ }
+ }
+ }
+ break;
+ case NUMBER:
+ case SUB:
+ case VARIABLE:
+ {
+ alt9=2;
+ }
+ break;
+
+ default:
+ if (BACKTRACKING>0)
+ {
+ FAILEDFLAG = ANTLR3_TRUE;
+ return retval;
+ }
+
+ CONSTRUCTEX();
+ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
+ EXCEPTION->message = (void *)"";
+ EXCEPTION->decisionNum = 9;
+ EXCEPTION->state = 0;
+
+
+ goto ruleexprEx;
+
+ }
+
+ switch (alt9)
+ {
+ case 1:
+ // EquationSystem.g:28:8: '(' expr GREATER_EQUAL expr QUESTION_MARK expr ')'
+ {
+ char_literal22 = (pANTLR3_COMMON_TOKEN) MATCHT(19, &FOLLOW_19_in_expr245);
+ if (HASEXCEPTION())
+ {
+ goto ruleexprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) { CREATE_stream_19; stream_19->add(stream_19, char_literal22, NULL); }
+
+
+ FOLLOWPUSH(FOLLOW_expr_in_expr247);
+ expr23=expr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto ruleexprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) { CREATE_stream_expr; stream_expr->add(stream_expr, expr23.tree, NULL); }
+
+ GREATER_EQUAL24 = (pANTLR3_COMMON_TOKEN) MATCHT(GREATER_EQUAL, &FOLLOW_GREATER_EQUAL_in_expr249);
+ if (HASEXCEPTION())
+ {
+ goto ruleexprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) { CREATE_stream_GREATER_EQUAL; stream_GREATER_EQUAL->add(stream_GREATER_EQUAL, GREATER_EQUAL24, NULL); }
+
+
+ FOLLOWPUSH(FOLLOW_expr_in_expr251);
+ expr25=expr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto ruleexprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) { CREATE_stream_expr; stream_expr->add(stream_expr, expr25.tree, NULL); }
+
+ QUESTION_MARK26 = (pANTLR3_COMMON_TOKEN) MATCHT(QUESTION_MARK, &FOLLOW_QUESTION_MARK_in_expr253);
+ if (HASEXCEPTION())
+ {
+ goto ruleexprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) { CREATE_stream_QUESTION_MARK; stream_QUESTION_MARK->add(stream_QUESTION_MARK, QUESTION_MARK26, NULL); }
+
+
+ FOLLOWPUSH(FOLLOW_expr_in_expr255);
+ expr27=expr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto ruleexprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) { CREATE_stream_expr; stream_expr->add(stream_expr, expr27.tree, NULL); }
+
+ char_literal28 = (pANTLR3_COMMON_TOKEN) MATCHT(20, &FOLLOW_20_in_expr257);
+ if (HASEXCEPTION())
+ {
+ goto ruleexprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) { CREATE_stream_20; stream_20->add(stream_20, char_literal28, NULL); }
+
+
+ /* AST REWRITE
+ * elements : expr, expr, expr
+ * token labels :
+ * rule labels : retval
+ * token list labels :
+ * rule list labels :
+ */
+ if ( BACKTRACKING==0 )
+
+ {
+ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
+
+ stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
+
+ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
+ retval.tree = root_0;
+ // 28:59: -> ^( GUARD expr expr expr )
+ {
+ // EquationSystem.g:28:62: ^( GUARD expr expr expr )
+ {
+ pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
+ root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR,
+ (pANTLR3_BASE_TREE)ADAPTOR->createTypeText(ADAPTOR, GUARD, (pANTLR3_UINT8)"GUARD")
+ , root_1));
+
+ ADAPTOR->addChild(ADAPTOR, root_1, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
+
+ ADAPTOR->addChild(ADAPTOR, root_1, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
+
+ ADAPTOR->addChild(ADAPTOR, root_1, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr));
+
+ ADAPTOR->addChild(ADAPTOR, root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0; // set result root
+ if (stream_retval != NULL) stream_retval->free(stream_retval);
+
+
+ }
+ }
+ break;
+ case 2:
+ // EquationSystem.g:29:8: term ( ( PLUS | MULT | SUB | COMMA ) ^ expr )*
+ {
+ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
+
+
+ FOLLOWPUSH(FOLLOW_term_in_expr278);
+ term29=term(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto ruleexprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) ADAPTOR->addChild(ADAPTOR, root_0, term29.tree);
+
+ // EquationSystem.g:29:13: ( ( PLUS | MULT | SUB | COMMA ) ^ expr )*
+
+ for (;;)
+ {
+ int alt8=2;
+ switch ( LA(1) )
+ {
+ case COMMA:
+ case MULT:
+ case PLUS:
+ case SUB:
+ {
+ {
+ /* dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState)
+ */
+ int LA8_2 = LA(2);
+ if ( (synpred12_EquationSystem(ctx)))
+ {
+ alt8=1;
+ }
+
+ }
+ }
+ break;
+
+ }
+
+ switch (alt8)
+ {
+ case 1:
+ // EquationSystem.g:29:15: ( PLUS | MULT | SUB | COMMA ) ^ expr
+ {
+ set30=(pANTLR3_COMMON_TOKEN)LT(1);
+
+ set30=(pANTLR3_COMMON_TOKEN)LT(1);
+
+ if ( LA(1) == COMMA || LA(1) == MULT || LA(1) == PLUS || LA(1) == SUB )
+ {
+ CONSUME();
+ if ( BACKTRACKING==0 ) root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR,
+ (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set30))
+ , root_0));
+ PERRORRECOVERY=ANTLR3_FALSE;
+ FAILEDFLAG=ANTLR3_FALSE;
+
+ }
+ else
+ {
+ if (BACKTRACKING>0)
+ {
+ FAILEDFLAG = ANTLR3_TRUE;
+ return retval;
+ }
+
+ CONSTRUCTEX();
+ EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
+ EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
+ EXCEPTION->expectingSet = NULL;
+
+ goto ruleexprEx;
+ }
+
+
+ FOLLOWPUSH(FOLLOW_expr_in_expr299);
+ expr31=expr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto ruleexprEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) ADAPTOR->addChild(ADAPTOR, root_0, expr31.tree);
+
+ }
+ break;
+
+ default:
+ goto loop8; /* break out of the loop */
+ break;
+ }
+ }
+ loop8: ; /* Jump out to here if this rule does not match */
+
+
+ }
+ break;
+
+ }
+ }
+ }
+
+ // This is where rules clean up and exit
+ //
+ goto ruleexprEx; /* Prevent compiler warnings */
+ ruleexprEx: ;
+ retval.stop = LT(-1);
+
+
+ if ( BACKTRACKING==0 )
+ {
+
+ retval.stop = LT(-1);
+
+ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
+ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
+ if (stream_20 != NULL) stream_20->free(stream_20);
+ if (stream_19 != NULL) stream_19->free(stream_19);
+ if (stream_GREATER_EQUAL != NULL) stream_GREATER_EQUAL->free(stream_GREATER_EQUAL);
+ if (stream_QUESTION_MARK != NULL) stream_QUESTION_MARK->free(stream_QUESTION_MARK);
+ if (stream_expr != NULL) stream_expr->free(stream_expr);
+ }
+
+
+ if (HASEXCEPTION())
+ {
+ PREPORTERROR();
+ PRECOVER();
+ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
+ }
+ return retval;
+}
+/* $ANTLR end expr */
+
+/**
+ * $ANTLR start term
+ * EquationSystem.g:31:1: term : ( NUMBER | VARIABLE | '-' ^ term | '(' ! expr ')' !);
+ */
+static EquationSystemParser_term_return
+term(pEquationSystemParser ctx)
+{
+ EquationSystemParser_term_return retval;
+
+
+ pANTLR3_BASE_TREE root_0;
+
+ pANTLR3_COMMON_TOKEN NUMBER32;
+ pANTLR3_COMMON_TOKEN VARIABLE33;
+ pANTLR3_COMMON_TOKEN char_literal34;
+ pANTLR3_COMMON_TOKEN char_literal36;
+ pANTLR3_COMMON_TOKEN char_literal38;
+ EquationSystemParser_term_return term35;
+ #undef RETURN_TYPE_term35
+ #define RETURN_TYPE_term35 EquationSystemParser_term_return
+
+ EquationSystemParser_expr_return expr37;
+ #undef RETURN_TYPE_expr37
+ #define RETURN_TYPE_expr37 EquationSystemParser_expr_return
+
+ pANTLR3_BASE_TREE NUMBER32_tree;
+ pANTLR3_BASE_TREE VARIABLE33_tree;
+ pANTLR3_BASE_TREE char_literal34_tree;
+ pANTLR3_BASE_TREE char_literal36_tree;
+ pANTLR3_BASE_TREE char_literal38_tree;
+
+ /* Initialize rule variables
+ */
+
+ root_0 = NULL;
+
+ NUMBER32 = NULL;
+ VARIABLE33 = NULL;
+ char_literal34 = NULL;
+ char_literal36 = NULL;
+ char_literal38 = NULL;
+ term35.tree = NULL;
+
+ expr37.tree = NULL;
+ retval.start = LT(1); retval.stop = retval.start;
+
+
+ NUMBER32_tree = NULL;
+ VARIABLE33_tree = NULL;
+ char_literal34_tree = NULL;
+ char_literal36_tree = NULL;
+ char_literal38_tree = NULL;
+
+
+ retval.tree = NULL;
+
+ {
+ {
+ // EquationSystem.g:31:6: ( NUMBER | VARIABLE | '-' ^ term | '(' ! expr ')' !)
+
+ ANTLR3_UINT32 alt10;
+
+ alt10=4;
+
+ switch ( LA(1) )
+ {
+ case NUMBER:
+ {
+ alt10=1;
+ }
+ break;
+ case VARIABLE:
+ {
+ alt10=2;
+ }
+ break;
+ case SUB:
+ {
+ alt10=3;
+ }
+ break;
+ case 19:
+ {
+ alt10=4;
+ }
+ break;
+
+ default:
+ if (BACKTRACKING>0)
+ {
+ FAILEDFLAG = ANTLR3_TRUE;
+ return retval;
+ }
+
+ CONSTRUCTEX();
+ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
+ EXCEPTION->message = (void *)"";
+ EXCEPTION->decisionNum = 10;
+ EXCEPTION->state = 0;
+
+
+ goto ruletermEx;
+
+ }
+
+ switch (alt10)
+ {
+ case 1:
+ // EquationSystem.g:31:8: NUMBER
+ {
+ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
+
+
+ NUMBER32 = (pANTLR3_COMMON_TOKEN) MATCHT(NUMBER, &FOLLOW_NUMBER_in_term311);
+ if (HASEXCEPTION())
+ {
+ goto ruletermEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) {
+ NUMBER32_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, NUMBER32));
+ ADAPTOR->addChild(ADAPTOR, root_0, NUMBER32_tree);
+ }
+
+ }
+ break;
+ case 2:
+ // EquationSystem.g:32:8: VARIABLE
+ {
+ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
+
+
+ VARIABLE33 = (pANTLR3_COMMON_TOKEN) MATCHT(VARIABLE, &FOLLOW_VARIABLE_in_term320);
+ if (HASEXCEPTION())
+ {
+ goto ruletermEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) {
+ VARIABLE33_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, VARIABLE33));
+ ADAPTOR->addChild(ADAPTOR, root_0, VARIABLE33_tree);
+ }
+
+ }
+ break;
+ case 3:
+ // EquationSystem.g:33:8: '-' ^ term
+ {
+ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
+
+
+ char_literal34 = (pANTLR3_COMMON_TOKEN) MATCHT(SUB, &FOLLOW_SUB_in_term329);
+ if (HASEXCEPTION())
+ {
+ goto ruletermEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) {
+ char_literal34_tree =
+ (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, char_literal34))
+ ;
+ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, char_literal34_tree, root_0));
+ }
+
+ FOLLOWPUSH(FOLLOW_term_in_term332);
+ term35=term(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto ruletermEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) ADAPTOR->addChild(ADAPTOR, root_0, term35.tree);
+
+ }
+ break;
+ case 4:
+ // EquationSystem.g:34:8: '(' ! expr ')' !
+ {
+ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
+
+
+ char_literal36 = (pANTLR3_COMMON_TOKEN) MATCHT(19, &FOLLOW_19_in_term341);
+ if (HASEXCEPTION())
+ {
+ goto ruletermEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+
+ FOLLOWPUSH(FOLLOW_expr_in_term344);
+ expr37=expr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto ruletermEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+ if ( BACKTRACKING==0 ) ADAPTOR->addChild(ADAPTOR, root_0, expr37.tree);
+
+ char_literal38 = (pANTLR3_COMMON_TOKEN) MATCHT(20, &FOLLOW_20_in_term346);
+ if (HASEXCEPTION())
+ {
+ goto ruletermEx;
+ }
+ if (HASFAILED())
+ {
+ return retval;
+ }
+
+
+ }
+ break;
+
+ }
+ }
+ }
+
+ // This is where rules clean up and exit
+ //
+ goto ruletermEx; /* Prevent compiler warnings */
+ ruletermEx: ;
+ retval.stop = LT(-1);
+
+
+ if ( BACKTRACKING==0 )
+ {
+
+ retval.stop = LT(-1);
+
+ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
+ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
+ }
+
+
+ if (HASEXCEPTION())
+ {
+ PREPORTERROR();
+ PRECOVER();
+ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
+ }
+ return retval;
+}
+/* $ANTLR end term */
+
+// $ANTLR start synpred8_EquationSystem
+static void synpred8_EquationSystem_fragment(pEquationSystemParser ctx )
+{
+ // EquationSystem.g:28:8: ( '(' expr GREATER_EQUAL expr QUESTION_MARK expr ')' )
+ // EquationSystem.g:28:8: '(' expr GREATER_EQUAL expr QUESTION_MARK expr ')'
+ {
+ MATCHT(19, &FOLLOW_19_in_synpred8_EquationSystem245);
+ if (HASEXCEPTION())
+ {
+ goto rulesynpred8_EquationSystemEx;
+ }
+ if (HASFAILED())
+ {
+ return ;
+ }
+
+
+ FOLLOWPUSH(FOLLOW_expr_in_synpred8_EquationSystem247);
+ expr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto rulesynpred8_EquationSystemEx;
+ }
+ if (HASFAILED())
+ {
+ return ;
+ }
+
+
+ MATCHT(GREATER_EQUAL, &FOLLOW_GREATER_EQUAL_in_synpred8_EquationSystem249);
+ if (HASEXCEPTION())
+ {
+ goto rulesynpred8_EquationSystemEx;
+ }
+ if (HASFAILED())
+ {
+ return ;
+ }
+
+
+ FOLLOWPUSH(FOLLOW_expr_in_synpred8_EquationSystem251);
+ expr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto rulesynpred8_EquationSystemEx;
+ }
+ if (HASFAILED())
+ {
+ return ;
+ }
+
+
+ MATCHT(QUESTION_MARK, &FOLLOW_QUESTION_MARK_in_synpred8_EquationSystem253);
+ if (HASEXCEPTION())
+ {
+ goto rulesynpred8_EquationSystemEx;
+ }
+ if (HASFAILED())
+ {
+ return ;
+ }
+
+
+ FOLLOWPUSH(FOLLOW_expr_in_synpred8_EquationSystem255);
+ expr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto rulesynpred8_EquationSystemEx;
+ }
+ if (HASFAILED())
+ {
+ return ;
+ }
+
+
+ MATCHT(20, &FOLLOW_20_in_synpred8_EquationSystem257);
+ if (HASEXCEPTION())
+ {
+ goto rulesynpred8_EquationSystemEx;
+ }
+ if (HASFAILED())
+ {
+ return ;
+ }
+
+
+ }
+
+// This is where rules clean up and exit
+//
+goto rulesynpred8_EquationSystemEx; /* Prevent compiler warnings */
+rulesynpred8_EquationSystemEx: ;
+
+}
+// $ANTLR end synpred8_EquationSystem
+
+// $ANTLR start synpred12_EquationSystem
+static void synpred12_EquationSystem_fragment(pEquationSystemParser ctx )
+{
+ // EquationSystem.g:29:15: ( ( PLUS | MULT | SUB | COMMA ) expr )
+ // EquationSystem.g:29:15: ( PLUS | MULT | SUB | COMMA ) expr
+ {
+ if ( LA(1) == COMMA || LA(1) == MULT || LA(1) == PLUS || LA(1) == SUB )
+ {
+ CONSUME();
+ PERRORRECOVERY=ANTLR3_FALSE;
+ FAILEDFLAG=ANTLR3_FALSE;
+
+ }
+ else
+ {
+ if (BACKTRACKING>0)
+ {
+ FAILEDFLAG = ANTLR3_TRUE;
+ return ;
+ }
+
+ CONSTRUCTEX();
+ EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION;
+ EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME;
+ EXCEPTION->expectingSet = NULL;
+
+ goto rulesynpred12_EquationSystemEx;
+ }
+
+
+ FOLLOWPUSH(FOLLOW_expr_in_synpred12_EquationSystem299);
+ expr(ctx);
+
+ FOLLOWPOP();
+ if (HASEXCEPTION())
+ {
+ goto rulesynpred12_EquationSystemEx;
+ }
+ if (HASFAILED())
+ {
+ return ;
+ }
+
+
+ }
+
+// This is where rules clean up and exit
+//
+goto rulesynpred12_EquationSystemEx; /* Prevent compiler warnings */
+rulesynpred12_EquationSystemEx: ;
+
+}
+// $ANTLR end synpred12_EquationSystem
+/* End of parsing rules
+ * ==============================================
+ */
+
+/* ==============================================
+ * Syntactic predicates
+ */
+static ANTLR3_BOOLEAN synpred12_EquationSystem(pEquationSystemParser ctx)
+{
+ ANTLR3_MARKER start;
+ ANTLR3_BOOLEAN success;
+
+ BACKTRACKING++;
+ start = MARK();
+ synpred12_EquationSystem_fragment(ctx); // can never throw exception
+ success = !(FAILEDFLAG);
+ REWIND(start);
+ BACKTRACKING--;
+ FAILEDFLAG = ANTLR3_FALSE;
+ return success;
+}
+static ANTLR3_BOOLEAN synpred8_EquationSystem(pEquationSystemParser ctx)
+{
+ ANTLR3_MARKER start;
+ ANTLR3_BOOLEAN success;
+
+ BACKTRACKING++;
+ start = MARK();
+ synpred8_EquationSystem_fragment(ctx); // can never throw exception
+ success = !(FAILEDFLAG);
+ REWIND(start);
+ BACKTRACKING--;
+ FAILEDFLAG = ANTLR3_FALSE;
+ return success;
+}
+
+/* End of syntactic predicates
+ * ==============================================
+ */
+
+
+
+
+
+
+/* End of code
+ * =============================================================================
+ */