X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FLangParser.c;h=641994c0c19fa9a635721ea239dbbafa189500ce;hp=717a59cbd3c1a9ea6663bc95ba3014d1db7c3cbb;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/LangParser.c b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/LangParser.c index 717a59cbd..641994c0c 100644 --- a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/LangParser.c +++ b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/LangParser.c @@ -1,712 +1,712 @@ -/** \file - * This C source file was generated by $ANTLR version 3.2 Sep 23, 2009 12:02:23 - * - * - From the grammar source file : Lang.g - * - On : 2010-02-24 13:27:52 - * - for the parser : LangParserParser * - * Editing it, at least manually, is not wise. - * - * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. - * - * -*/ -// [The "BSD licence"] -// 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 "LangParser.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) pLangParser_##scope##_SCOPE -#define SCOPE_STACK(scope) pLangParser_##scope##Stack -#define SCOPE_TOP(scope) ctx->pLangParser_##scope##Top -#define SCOPE_SIZE(scope) ctx->pLangParser_##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 -#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL) -#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK) -#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 LangParserTokenNames[7+4] - = { - (pANTLR3_UINT8) "", /* String to print to indicate an invalid token */ - (pANTLR3_UINT8) "", - (pANTLR3_UINT8) "", - (pANTLR3_UINT8) "", - (pANTLR3_UINT8) "DECL", - (pANTLR3_UINT8) "ID", - (pANTLR3_UINT8) "INTTYPE", - (pANTLR3_UINT8) "FLOATTYPE", - (pANTLR3_UINT8) "INT", - (pANTLR3_UINT8) "WS", - (pANTLR3_UINT8) "';'" - }; - - - -// Forward declare the locally static matching functions we have generated. -// -static LangParser_start_return start (pLangParser ctx); -static LangParser_decl_return decl (pLangParser ctx); -static LangParser_type_return type (pLangParser ctx); -static void LangParserFree(pLangParser 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[] = "Lang.g"; - -/** \brief Return the name of the grammar file that generated this code. - */ -static const char * getGrammarFileName() -{ - return fileName; -} -/** \brief Create a new LangParser 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 pLangParser -LangParserNew (pANTLR3_COMMON_TOKEN_STREAM instream) -{ - // See if we can create a new parser with the standard constructor - // - return LangParserNewSSD(instream, NULL); -} - -/** \brief Create a new LangParser 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 pLangParser -LangParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state) -{ - pLangParser ctx; /* Context structure we will build and return */ - - ctx = (pLangParser) ANTLR3_CALLOC(1, sizeof(LangParser)); - - 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 LangParser.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 LangParser interface - */ - ctx->start = start; - ctx->decl = decl; - ctx->type = type; - ctx->free = LangParserFree; - 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 = LangParserTokenNames; - - - /* Return the newly built parser to the caller - */ - return ctx; -} - -/** Free the parser resources - */ - static void - LangParserFree(pLangParser 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 LangParserTokenNames; -} - - -/* Declare the bitsets - */ - -/** Bitset defining follow set for error recovery in rule state: FOLLOW_decl_in_start91 */ -static ANTLR3_BITWORD FOLLOW_decl_in_start91_bits[] = { ANTLR3_UINT64_LIT(0x00000000000000C2) }; -static ANTLR3_BITSET_LIST FOLLOW_decl_in_start91 = { FOLLOW_decl_in_start91_bits, 1 }; -/** Bitset defining follow set for error recovery in rule state: FOLLOW_type_in_decl103 */ -static ANTLR3_BITWORD FOLLOW_type_in_decl103_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000020) }; -static ANTLR3_BITSET_LIST FOLLOW_type_in_decl103 = { FOLLOW_type_in_decl103_bits, 1 }; -/** Bitset defining follow set for error recovery in rule state: FOLLOW_ID_in_decl105 */ -static ANTLR3_BITWORD FOLLOW_ID_in_decl105_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000400) }; -static ANTLR3_BITSET_LIST FOLLOW_ID_in_decl105 = { FOLLOW_ID_in_decl105_bits, 1 }; -/** Bitset defining follow set for error recovery in rule state: FOLLOW_10_in_decl107 */ -static ANTLR3_BITWORD FOLLOW_10_in_decl107_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; -static ANTLR3_BITSET_LIST FOLLOW_10_in_decl107 = { FOLLOW_10_in_decl107_bits, 1 }; -/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_type0 */ -static ANTLR3_BITWORD FOLLOW_set_in_type0_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; -static ANTLR3_BITSET_LIST FOLLOW_set_in_type0 = { FOLLOW_set_in_type0_bits, 1 }; - - - - -/* ============================================== - * Parsing rules - */ -/** - * $ANTLR start start - * Lang.g:20:1: start : ( decl )+ ; - */ -static LangParser_start_return -start(pLangParser ctx) -{ - LangParser_start_return retval; - - pANTLR3_BASE_TREE root_0; - - LangParser_decl_return decl1; - #undef RETURN_TYPE_decl1 - #define RETURN_TYPE_decl1 LangParser_decl_return - - - /* Initialize rule variables - */ - - - root_0 = NULL; - - decl1.tree = NULL; - - retval.start = LT(1); retval.stop = retval.start; - - - - retval.tree = NULL; - { - // Lang.g:20:7: ( ( decl )+ ) - // Lang.g:20:9: ( decl )+ - { - root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); - - // Lang.g:20:9: ( decl )+ - { - int cnt1=0; - - for (;;) - { - int alt1=2; - switch ( LA(1) ) - { - case INTTYPE: - case FLOATTYPE: - { - alt1=1; - } - break; - - } - - switch (alt1) - { - case 1: - // Lang.g:20:9: decl - { - FOLLOWPUSH(FOLLOW_decl_in_start91); - decl1=decl(ctx); - - FOLLOWPOP(); - if (HASEXCEPTION()) - { - goto rulestartEx; - } - - ADAPTOR->addChild(ADAPTOR, root_0, decl1.tree); - - } - break; - - default: - - if ( cnt1 >= 1 ) - { - goto loop1; - } - /* mismatchedSetEx() - */ - CONSTRUCTEX(); - EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION; - EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME; - - - goto rulestartEx; - } - cnt1++; - } - loop1: ; /* Jump to here if this rule does not match */ - } - - } - - } - - - // This is where rules clean up and exit - // - goto rulestartEx; /* Prevent compiler warnings */ - rulestartEx: ; - retval.stop = LT(-1); - - 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 start */ - -/** - * $ANTLR start decl - * Lang.g:23:1: decl : type ID ';' -> ^( DECL type ID ) ; - */ -static LangParser_decl_return -decl(pLangParser ctx) -{ - LangParser_decl_return retval; - - pANTLR3_BASE_TREE root_0; - - pANTLR3_COMMON_TOKEN ID3; - pANTLR3_COMMON_TOKEN char_literal4; - LangParser_type_return type2; - #undef RETURN_TYPE_type2 - #define RETURN_TYPE_type2 LangParser_type_return - - pANTLR3_BASE_TREE ID3_tree; - pANTLR3_BASE_TREE char_literal4_tree; - pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_10; - pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_ID; - pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_type; - /* Initialize rule variables - */ - - - root_0 = NULL; - - ID3 = NULL; - char_literal4 = NULL; - type2.tree = NULL; - - retval.start = LT(1); retval.stop = retval.start; - - ID3_tree = NULL; - char_literal4_tree = NULL; - - stream_10 = NULL; - #define CREATE_stream_10 if (stream_10 == NULL) {stream_10 = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token 10"); } - stream_ID = NULL; - #define CREATE_stream_ID if (stream_ID == NULL) {stream_ID = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token ID"); } - stream_type = NULL; - #define CREATE_stream_type if (stream_type == NULL) {stream_type = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule type"); } - - retval.tree = NULL; - { - // Lang.g:23:6: ( type ID ';' -> ^( DECL type ID ) ) - // Lang.g:23:8: type ID ';' - { - FOLLOWPUSH(FOLLOW_type_in_decl103); - type2=type(ctx); - - FOLLOWPOP(); - if (HASEXCEPTION()) - { - goto ruledeclEx; - } - - CREATE_stream_type; stream_type->add(stream_type, type2.tree, NULL); - ID3 = (pANTLR3_COMMON_TOKEN) MATCHT(ID, &FOLLOW_ID_in_decl105); - if (HASEXCEPTION()) - { - goto ruledeclEx; - } - - CREATE_stream_ID; stream_ID->add(stream_ID, ID3, NULL); - - char_literal4 = (pANTLR3_COMMON_TOKEN) MATCHT(10, &FOLLOW_10_in_decl107); - if (HASEXCEPTION()) - { - goto ruledeclEx; - } - - CREATE_stream_10; stream_10->add(stream_10, char_literal4, NULL); - - - - /* AST REWRITE - * elements : ID, type - * token labels : - * rule labels : retval - * token list labels : - * rule list labels : - */ - { - 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; - // 23:20: -> ^( DECL type ID ) - { - // Lang.g:23:23: ^( DECL type ID ) - { - 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, DECL, (pANTLR3_UINT8)"DECL"), root_1)); - - ADAPTOR->addChild(ADAPTOR, root_1, stream_type == NULL ? NULL : stream_type->nextTree(stream_type)); - ADAPTOR->addChild(ADAPTOR, root_1, stream_ID == NULL ? NULL : stream_ID->nextNode(stream_ID)); - - ADAPTOR->addChild(ADAPTOR, root_0, root_1); - } - - } - - retval.tree = root_0; // set result root - if (stream_retval != NULL) stream_retval->free(stream_retval); - - - } - } - - } - - - // This is where rules clean up and exit - // - goto ruledeclEx; /* Prevent compiler warnings */ - ruledeclEx: ; - retval.stop = LT(-1); - - 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_10 != NULL) stream_10->free(stream_10); - if (stream_ID != NULL) stream_ID->free(stream_ID); - if (stream_type != NULL) stream_type->free(stream_type); - - if (HASEXCEPTION()) - { - PREPORTERROR(); - PRECOVER(); - retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); - } - - - return retval; -} -/* $ANTLR end decl */ - -/** - * $ANTLR start type - * Lang.g:26:1: type : ( INTTYPE | FLOATTYPE ); - */ -static LangParser_type_return -type(pLangParser ctx) -{ - LangParser_type_return retval; - - pANTLR3_BASE_TREE root_0; - - pANTLR3_COMMON_TOKEN set5; - - pANTLR3_BASE_TREE set5_tree; - - /* Initialize rule variables - */ - - - root_0 = NULL; - - set5 = NULL; - retval.start = LT(1); retval.stop = retval.start; - - set5_tree = NULL; - - - retval.tree = NULL; - { - // Lang.g:26:6: ( INTTYPE | FLOATTYPE ) - // Lang.g: - { - root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); - - set5=(pANTLR3_COMMON_TOKEN)LT(1); - if ( ((LA(1) >= INTTYPE) && (LA(1) <= FLOATTYPE)) ) - { - CONSUME(); - ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set5))); - PERRORRECOVERY=ANTLR3_FALSE; - } - else - { - CONSTRUCTEX(); - EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION; - EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME; - EXCEPTION->expectingSet = &FOLLOW_set_in_type0; - RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_type0); goto ruletypeEx; - } - - - } - - } - - - // This is where rules clean up and exit - // - goto ruletypeEx; /* Prevent compiler warnings */ - ruletypeEx: ; - retval.stop = LT(-1); - - 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 type */ -/* End of parsing rules - * ============================================== - */ - -/* ============================================== - * Syntactic predicates - */ -/* End of syntactic predicates - * ============================================== - */ - - - - - - -/* End of code - * ============================================================================= - */ +/** \file + * This C source file was generated by $ANTLR version 3.2 Sep 23, 2009 12:02:23 + * + * - From the grammar source file : Lang.g + * - On : 2010-02-24 13:27:52 + * - for the parser : LangParserParser * + * Editing it, at least manually, is not wise. + * + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. + * + * +*/ +// [The "BSD licence"] +// 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 "LangParser.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) pLangParser_##scope##_SCOPE +#define SCOPE_STACK(scope) pLangParser_##scope##Stack +#define SCOPE_TOP(scope) ctx->pLangParser_##scope##Top +#define SCOPE_SIZE(scope) ctx->pLangParser_##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 +#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL) +#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK) +#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 LangParserTokenNames[7+4] + = { + (pANTLR3_UINT8) "", /* String to print to indicate an invalid token */ + (pANTLR3_UINT8) "", + (pANTLR3_UINT8) "", + (pANTLR3_UINT8) "", + (pANTLR3_UINT8) "DECL", + (pANTLR3_UINT8) "ID", + (pANTLR3_UINT8) "INTTYPE", + (pANTLR3_UINT8) "FLOATTYPE", + (pANTLR3_UINT8) "INT", + (pANTLR3_UINT8) "WS", + (pANTLR3_UINT8) "';'" + }; + + + +// Forward declare the locally static matching functions we have generated. +// +static LangParser_start_return start (pLangParser ctx); +static LangParser_decl_return decl (pLangParser ctx); +static LangParser_type_return type (pLangParser ctx); +static void LangParserFree(pLangParser 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[] = "Lang.g"; + +/** \brief Return the name of the grammar file that generated this code. + */ +static const char * getGrammarFileName() +{ + return fileName; +} +/** \brief Create a new LangParser 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 pLangParser +LangParserNew (pANTLR3_COMMON_TOKEN_STREAM instream) +{ + // See if we can create a new parser with the standard constructor + // + return LangParserNewSSD(instream, NULL); +} + +/** \brief Create a new LangParser 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 pLangParser +LangParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state) +{ + pLangParser ctx; /* Context structure we will build and return */ + + ctx = (pLangParser) ANTLR3_CALLOC(1, sizeof(LangParser)); + + 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 LangParser.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 LangParser interface + */ + ctx->start = start; + ctx->decl = decl; + ctx->type = type; + ctx->free = LangParserFree; + 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 = LangParserTokenNames; + + + /* Return the newly built parser to the caller + */ + return ctx; +} + +/** Free the parser resources + */ + static void + LangParserFree(pLangParser 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 LangParserTokenNames; +} + + +/* Declare the bitsets + */ + +/** Bitset defining follow set for error recovery in rule state: FOLLOW_decl_in_start91 */ +static ANTLR3_BITWORD FOLLOW_decl_in_start91_bits[] = { ANTLR3_UINT64_LIT(0x00000000000000C2) }; +static ANTLR3_BITSET_LIST FOLLOW_decl_in_start91 = { FOLLOW_decl_in_start91_bits, 1 }; +/** Bitset defining follow set for error recovery in rule state: FOLLOW_type_in_decl103 */ +static ANTLR3_BITWORD FOLLOW_type_in_decl103_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000020) }; +static ANTLR3_BITSET_LIST FOLLOW_type_in_decl103 = { FOLLOW_type_in_decl103_bits, 1 }; +/** Bitset defining follow set for error recovery in rule state: FOLLOW_ID_in_decl105 */ +static ANTLR3_BITWORD FOLLOW_ID_in_decl105_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000400) }; +static ANTLR3_BITSET_LIST FOLLOW_ID_in_decl105 = { FOLLOW_ID_in_decl105_bits, 1 }; +/** Bitset defining follow set for error recovery in rule state: FOLLOW_10_in_decl107 */ +static ANTLR3_BITWORD FOLLOW_10_in_decl107_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; +static ANTLR3_BITSET_LIST FOLLOW_10_in_decl107 = { FOLLOW_10_in_decl107_bits, 1 }; +/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_type0 */ +static ANTLR3_BITWORD FOLLOW_set_in_type0_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; +static ANTLR3_BITSET_LIST FOLLOW_set_in_type0 = { FOLLOW_set_in_type0_bits, 1 }; + + + + +/* ============================================== + * Parsing rules + */ +/** + * $ANTLR start start + * Lang.g:20:1: start : ( decl )+ ; + */ +static LangParser_start_return +start(pLangParser ctx) +{ + LangParser_start_return retval; + + pANTLR3_BASE_TREE root_0; + + LangParser_decl_return decl1; + #undef RETURN_TYPE_decl1 + #define RETURN_TYPE_decl1 LangParser_decl_return + + + /* Initialize rule variables + */ + + + root_0 = NULL; + + decl1.tree = NULL; + + retval.start = LT(1); retval.stop = retval.start; + + + + retval.tree = NULL; + { + // Lang.g:20:7: ( ( decl )+ ) + // Lang.g:20:9: ( decl )+ + { + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); + + // Lang.g:20:9: ( decl )+ + { + int cnt1=0; + + for (;;) + { + int alt1=2; + switch ( LA(1) ) + { + case INTTYPE: + case FLOATTYPE: + { + alt1=1; + } + break; + + } + + switch (alt1) + { + case 1: + // Lang.g:20:9: decl + { + FOLLOWPUSH(FOLLOW_decl_in_start91); + decl1=decl(ctx); + + FOLLOWPOP(); + if (HASEXCEPTION()) + { + goto rulestartEx; + } + + ADAPTOR->addChild(ADAPTOR, root_0, decl1.tree); + + } + break; + + default: + + if ( cnt1 >= 1 ) + { + goto loop1; + } + /* mismatchedSetEx() + */ + CONSTRUCTEX(); + EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION; + EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME; + + + goto rulestartEx; + } + cnt1++; + } + loop1: ; /* Jump to here if this rule does not match */ + } + + } + + } + + + // This is where rules clean up and exit + // + goto rulestartEx; /* Prevent compiler warnings */ + rulestartEx: ; + retval.stop = LT(-1); + + 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 start */ + +/** + * $ANTLR start decl + * Lang.g:23:1: decl : type ID ';' -> ^( DECL type ID ) ; + */ +static LangParser_decl_return +decl(pLangParser ctx) +{ + LangParser_decl_return retval; + + pANTLR3_BASE_TREE root_0; + + pANTLR3_COMMON_TOKEN ID3; + pANTLR3_COMMON_TOKEN char_literal4; + LangParser_type_return type2; + #undef RETURN_TYPE_type2 + #define RETURN_TYPE_type2 LangParser_type_return + + pANTLR3_BASE_TREE ID3_tree; + pANTLR3_BASE_TREE char_literal4_tree; + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_10; + pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_ID; + pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_type; + /* Initialize rule variables + */ + + + root_0 = NULL; + + ID3 = NULL; + char_literal4 = NULL; + type2.tree = NULL; + + retval.start = LT(1); retval.stop = retval.start; + + ID3_tree = NULL; + char_literal4_tree = NULL; + + stream_10 = NULL; + #define CREATE_stream_10 if (stream_10 == NULL) {stream_10 = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token 10"); } + stream_ID = NULL; + #define CREATE_stream_ID if (stream_ID == NULL) {stream_ID = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token ID"); } + stream_type = NULL; + #define CREATE_stream_type if (stream_type == NULL) {stream_type = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule type"); } + + retval.tree = NULL; + { + // Lang.g:23:6: ( type ID ';' -> ^( DECL type ID ) ) + // Lang.g:23:8: type ID ';' + { + FOLLOWPUSH(FOLLOW_type_in_decl103); + type2=type(ctx); + + FOLLOWPOP(); + if (HASEXCEPTION()) + { + goto ruledeclEx; + } + + CREATE_stream_type; stream_type->add(stream_type, type2.tree, NULL); + ID3 = (pANTLR3_COMMON_TOKEN) MATCHT(ID, &FOLLOW_ID_in_decl105); + if (HASEXCEPTION()) + { + goto ruledeclEx; + } + + CREATE_stream_ID; stream_ID->add(stream_ID, ID3, NULL); + + char_literal4 = (pANTLR3_COMMON_TOKEN) MATCHT(10, &FOLLOW_10_in_decl107); + if (HASEXCEPTION()) + { + goto ruledeclEx; + } + + CREATE_stream_10; stream_10->add(stream_10, char_literal4, NULL); + + + + /* AST REWRITE + * elements : ID, type + * token labels : + * rule labels : retval + * token list labels : + * rule list labels : + */ + { + 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; + // 23:20: -> ^( DECL type ID ) + { + // Lang.g:23:23: ^( DECL type ID ) + { + 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, DECL, (pANTLR3_UINT8)"DECL"), root_1)); + + ADAPTOR->addChild(ADAPTOR, root_1, stream_type == NULL ? NULL : stream_type->nextTree(stream_type)); + ADAPTOR->addChild(ADAPTOR, root_1, stream_ID == NULL ? NULL : stream_ID->nextNode(stream_ID)); + + ADAPTOR->addChild(ADAPTOR, root_0, root_1); + } + + } + + retval.tree = root_0; // set result root + if (stream_retval != NULL) stream_retval->free(stream_retval); + + + } + } + + } + + + // This is where rules clean up and exit + // + goto ruledeclEx; /* Prevent compiler warnings */ + ruledeclEx: ; + retval.stop = LT(-1); + + 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_10 != NULL) stream_10->free(stream_10); + if (stream_ID != NULL) stream_ID->free(stream_ID); + if (stream_type != NULL) stream_type->free(stream_type); + + if (HASEXCEPTION()) + { + PREPORTERROR(); + PRECOVER(); + retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); + } + + + return retval; +} +/* $ANTLR end decl */ + +/** + * $ANTLR start type + * Lang.g:26:1: type : ( INTTYPE | FLOATTYPE ); + */ +static LangParser_type_return +type(pLangParser ctx) +{ + LangParser_type_return retval; + + pANTLR3_BASE_TREE root_0; + + pANTLR3_COMMON_TOKEN set5; + + pANTLR3_BASE_TREE set5_tree; + + /* Initialize rule variables + */ + + + root_0 = NULL; + + set5 = NULL; + retval.start = LT(1); retval.stop = retval.start; + + set5_tree = NULL; + + + retval.tree = NULL; + { + // Lang.g:26:6: ( INTTYPE | FLOATTYPE ) + // Lang.g: + { + root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); + + set5=(pANTLR3_COMMON_TOKEN)LT(1); + if ( ((LA(1) >= INTTYPE) && (LA(1) <= FLOATTYPE)) ) + { + CONSUME(); + ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set5))); + PERRORRECOVERY=ANTLR3_FALSE; + } + else + { + CONSTRUCTEX(); + EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION; + EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME; + EXCEPTION->expectingSet = &FOLLOW_set_in_type0; + RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_type0); goto ruletypeEx; + } + + + } + + } + + + // This is where rules clean up and exit + // + goto ruletypeEx; /* Prevent compiler warnings */ + ruletypeEx: ; + retval.stop = LT(-1); + + 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 type */ +/* End of parsing rules + * ============================================== + */ + +/* ============================================== + * Syntactic predicates + */ +/* End of syntactic predicates + * ============================================== + */ + + + + + + +/* End of code + * ============================================================================= + */