/** \file
 *  This C source file was generated by $ANTLR version 3.2 Sep 23, 2009 12:02:23
 *
 *     -  From the grammar source file : /home/luca/NetBeansProjects/7.15/PP.g
 *     -                            On : 2010-09-27 15:01:13
 *     -                 for the lexer : PPLexerLexer *
 * 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    "PPLexer.h"
/* ----------------------------------------- */


/** String literals used by PPLexer that we must do things like MATCHS() with.
 *  C will normally just lay down 8 bit characters, and you can use L"xxx" to
 *  get wchar_t, but wchar_t is 16 bits on Windows, which is not UTF32 and so
 *  we perform this little trick of defining the literals as arrays of UINT32
 *  and passing in the address of these.
 */
static ANTLR3_UCHAR	lit_1[]  = { 0x23, 0x64, 0x65, 0x66, 0x69, 0x6E, 0x65,  ANTLR3_STRING_TERMINATOR};




/* 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)   pPPLexer_##scope##_SCOPE
#define SCOPE_STACK(scope)  pPPLexer_##scope##Stack
#define	SCOPE_TOP(scope)    ctx->pPPLexer_##scope##Top
#define	SCOPE_SIZE(scope)		ctx->pPPLexer_##scope##Stack_limit
#define SCOPE_INSTANCE(scope, i)	(ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))

 
/* Macros for accessing things in a lexer
 */
#undef	    LEXER
#undef	    RECOGNIZER		    
#undef	    RULEMEMO		    
#undef	    GETCHARINDEX
#undef	    GETLINE
#undef	    GETCHARPOSITIONINLINE
#undef	    EMIT
#undef	    EMITNEW
#undef	    MATCHC
#undef	    MATCHS
#undef	    MATCHRANGE
#undef	    LTOKEN
#undef	    HASFAILED
#undef	    FAILEDFLAG
#undef	    INPUT
#undef	    STRSTREAM
#undef	    LA
#undef	    HASEXCEPTION
#undef	    EXCEPTION
#undef	    CONSTRUCTEX
#undef	    CONSUME
#undef	    LRECOVER
#undef	    MARK
#undef	    REWIND
#undef	    REWINDLAST
#undef	    BACKTRACKING
#undef		MATCHANY
#undef		MEMOIZE
#undef		HAVEPARSEDRULE
#undef		GETTEXT
#undef		INDEX
#undef		SEEK
#undef		PUSHSTREAM
#undef		POPSTREAM
#undef		SETTEXT
#undef		SETTEXT8

#define	    LEXER					ctx->pLexer
#define	    RECOGNIZER			    LEXER->rec
#define		LEXSTATE				RECOGNIZER->state
#define		TOKSOURCE				LEXSTATE->tokSource
#define	    GETCHARINDEX()			LEXER->getCharIndex(LEXER)
#define	    GETLINE()				LEXER->getLine(LEXER)
#define	    GETTEXT()				LEXER->getText(LEXER)
#define	    GETCHARPOSITIONINLINE() LEXER->getCharPositionInLine(LEXER)
#define	    EMIT()					LEXSTATE->type = _type; LEXER->emit(LEXER)
#define	    EMITNEW(t)				LEXER->emitNew(LEXER, t)
#define	    MATCHC(c)				LEXER->matchc(LEXER, c)
#define	    MATCHS(s)				LEXER->matchs(LEXER, s)
#define	    MATCHRANGE(c1,c2)	    LEXER->matchRange(LEXER, c1, c2)
#define	    MATCHANY()				LEXER->matchAny(LEXER)
#define	    LTOKEN  				LEXSTATE->token
#define	    HASFAILED()				(LEXSTATE->failed == ANTLR3_TRUE)
#define	    BACKTRACKING			LEXSTATE->backtracking
#define	    FAILEDFLAG				LEXSTATE->failed
#define	    INPUT					LEXER->input
#define	    STRSTREAM				INPUT
#define		ISTREAM					INPUT->istream
#define		INDEX()					ISTREAM->index(ISTREAM)
#define		SEEK(n)					ISTREAM->seek(ISTREAM, n)
#define	    EOF_TOKEN				&(LEXSTATE->tokSource->eofToken)
#define	    HASEXCEPTION()			(LEXSTATE->error == ANTLR3_TRUE)
#define	    EXCEPTION				LEXSTATE->exception
#define	    CONSTRUCTEX()			RECOGNIZER->exConstruct(RECOGNIZER)
#define	    LRECOVER()				LEXER->recover(LEXER)
#define	    MARK()					ISTREAM->mark(ISTREAM)
#define	    REWIND(m)				ISTREAM->rewind(ISTREAM, m)
#define	    REWINDLAST()			ISTREAM->rewindLast(ISTREAM)
#define		MEMOIZE(ri,si)			RECOGNIZER->memoize(RECOGNIZER, ri, si)
#define		HAVEPARSEDRULE(r)		RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
#define		PUSHSTREAM(str)			LEXER->pushCharStream(LEXER, str)
#define		POPSTREAM()				LEXER->popCharStream(LEXER)
#define		SETTEXT(str)			LEXSTATE->text = str
#define		SKIP()					LEXSTATE->token = &(TOKSOURCE->skipToken)
#define		USER1					LEXSTATE->user1
#define		USER2					LEXSTATE->user2
#define		USER3					LEXSTATE->user3
#define		CUSTOM					LEXSTATE->custom
#define		RULEMEMO				LEXSTATE->ruleMemo
#define		DBG						RECOGNIZER->debugger

/* If we have been told we can rely on the standard 8 bit or 16 bit input
 * stream, then we can define our macros to use the direct pointers
 * in the input object, which is much faster than indirect calls. This
 * is really only significant to lexers with a lot of fragment rules (which
 * do not place LA(1) in a temporary at the moment) and even then
 * only if there is a lot of input (order of say 1M or so).
 */
#if	defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16)

# ifdef	ANTLR3_INLINE_INPUT_ASCII

/* 8 bit "ASCII" (actually any 8 bit character set) */

#  define	    NEXTCHAR			((pANTLR3_UINT8)(INPUT->nextChar))
#  define	    DATAP				((pANTLR3_UINT8)(INPUT->data))

# else

#  define	    NEXTCHAR			((pANTLR3_UINT16)(INPUT->nextChar)) 
#  define	    DATAP				((pANTLR3_UINT16)(INPUT->data))

# endif

# define	    LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1)))
# define	    CONSUME()											\
{																	\
    if	(NEXTCHAR < (DATAP + INPUT->sizeBuf))						\
    {																\
		INPUT->charPositionInLine++;								\
		if  ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar)		\
		{															\
			INPUT->line++;											\
			INPUT->charPositionInLine	= 0;						\
			INPUT->currentLine		= (void *)(NEXTCHAR + 1);		\
		}															\
		INPUT->nextChar = (void *)(NEXTCHAR + 1);					\
    }																\
}

#else

// Pick up the input character by calling the input stream implementation.
//
#define	    CONSUME()				INPUT->istream->consume(INPUT->istream)
#define	    LA(n)					INPUT->istream->_LA(INPUT->istream, n)

#endif
#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
 */


/* Forward declare the locally static matching functions we have generated and any predicate functions.
 */
static ANTLR3_INLINE  void	mDEFINE    (pPPLexer ctx);
static ANTLR3_INLINE  void	mID    (pPPLexer ctx);
static ANTLR3_INLINE  void	mCOMMA    (pPPLexer ctx);
static ANTLR3_INLINE  void	mLP    (pPPLexer ctx);
static ANTLR3_INLINE  void	mRP    (pPPLexer ctx);
static ANTLR3_INLINE  void	mNEWLINE    (pPPLexer ctx);
static ANTLR3_INLINE  void	mWS    (pPPLexer ctx);
static ANTLR3_INLINE  void	mANYCHAR    (pPPLexer ctx);
static ANTLR3_INLINE  void	mTokens    (pPPLexer ctx);
static void	PPLexerFree(pPPLexer ctx);

/* =========================================================================
 * Lexer matching rules end.
 * =========================================================================
 */



static void
PPLexerFree  (pPPLexer ctx)
{
    LEXER->free(LEXER);
    
    ANTLR3_FREE(ctx);
}

/** \brief Name of the grammar file that generated this code
 */
static const char fileName[] = "/home/luca/NetBeansProjects/7.15/PP.g";

/** \brief Return the name of the grammar file that generated this code.
 */
static const char * getGrammarFileName()
{
	return fileName;
}

/** \brief Create a new lexer called PPLexer
 *
 * \param[in]    instream Pointer to an initialized input stream
 * \return 
 *     - Success pPPLexer initialized for the lex start
 *     - Fail NULL
 */
ANTLR3_API pPPLexer PPLexerNew         
(pANTLR3_INPUT_STREAM instream)
{
	// See if we can create a new lexer with the standard constructor
	//
	return PPLexerNewSSD(instream, NULL);
}

/** \brief Create a new lexer called PPLexer
 *
 * \param[in]    instream Pointer to an initialized input stream
 * \param[state] state Previously created shared recognizer stat
 * \return 
 *     - Success pPPLexer initialized for the lex start
 *     - Fail NULL
 */
ANTLR3_API pPPLexer PPLexerNewSSD         
(pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
{
    pPPLexer ctx; // Context structure we will build and return

    ctx = (pPPLexer) ANTLR3_CALLOC(1, sizeof(PPLexer));

    if  (ctx == NULL)
    {
        // Failed to allocate memory for lexer context
        return  NULL;
    }

    /* -------------------------------------------------------------------
     * Memory for basic structure is allocated, now to fill in
     * in base ANTLR3 structures. We initialize the function pointers
     * for the standard ANTLR3 lexer 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 PPLexer.h here so you can get a sense
     * of what goes where.
     */
    
    /* Create a base lexer, using the supplied input stream
     */
    ctx->pLexer	= antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state);
    
    /* Check that we allocated the memory correctly
     */
    if	(ctx->pLexer == NULL)
    {
		ANTLR3_FREE(ctx);
		return  NULL;
    }
    /* Install the implementation of our PPLexer interface
     */
    ctx->mDEFINE	= mDEFINE;
    ctx->mID	= mID;
    ctx->mCOMMA	= mCOMMA;
    ctx->mLP	= mLP;
    ctx->mRP	= mRP;
    ctx->mNEWLINE	= mNEWLINE;
    ctx->mWS	= mWS;
    ctx->mANYCHAR	= mANYCHAR;
    ctx->mTokens	= mTokens;
    
    /** When the nextToken() call is made to this lexer's pANTLR3_TOKEN_SOURCE
     *  it will call mTokens() in this generated code, and will pass it the ctx
     * pointer of this lexer, not the context of the base lexer, so store that now.
     */
    ctx->pLexer->ctx	    = ctx;
    
    /**Install the token matching function
     */
    ctx->pLexer->mTokens = (void (*) (void *))(mTokens);
    
    ctx->getGrammarFileName	= getGrammarFileName;
    ctx->free		= PPLexerFree;

    
    


    /* Return the newly built lexer to the caller
     */
    return  ctx;
}
 

/* =========================================================================
 * Functions to match the lexer grammar defined tokens from the input stream
 */

//   Comes from: 84:9: ( '#define' )
/** \brief Lexer rule generated by ANTLR3
 *
 * $ANTLR start DEFINE
 *
 * Looks to match the characters the constitute the token DEFINE
 * from the attached input stream.
 *
 *
 * \remark
 *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
 */
static ANTLR3_INLINE
void mDEFINE(pPPLexer ctx)
{
	ANTLR3_UINT32	_type;

    _type	    = DEFINE;
       
    
    // /home/luca/NetBeansProjects/7.15/PP.g:84:9: ( '#define' )
    // /home/luca/NetBeansProjects/7.15/PP.g:84:11: '#define'
    {
        MATCHS(lit_1); 
        if  (HASEXCEPTION())
        {
            goto ruleDEFINEEx;
        }



    }

	LEXSTATE->type = _type;

    // This is where rules clean up and exit
    //
    goto ruleDEFINEEx; /* Prevent compiler warnings */
    ruleDEFINEEx: ;

}
// $ANTLR end DEFINE

//   Comes from: 85:5: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
/** \brief Lexer rule generated by ANTLR3
 *
 * $ANTLR start ID
 *
 * Looks to match the characters the constitute the token ID
 * from the attached input stream.
 *
 *
 * \remark
 *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
 */
static ANTLR3_INLINE
void mID(pPPLexer ctx)
{
	ANTLR3_UINT32	_type;

    _type	    = ID;
       
    
    // /home/luca/NetBeansProjects/7.15/PP.g:85:5: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
    // /home/luca/NetBeansProjects/7.15/PP.g:85:7: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
    {
        if ( ((LA(1) >= 'A') && (LA(1) <= 'Z')) || LA(1) == '_' || ((LA(1) >= 'a') && (LA(1) <= 'z')) )
        {
            CONSUME();

        }
        else 
        {
            CONSTRUCTEX();
            EXCEPTION->type         = ANTLR3_MISMATCHED_SET_EXCEPTION;
            EXCEPTION->name         = (void *)ANTLR3_MISMATCHED_SET_NAME;

            LRECOVER();    goto ruleIDEx;
        }


        // /home/luca/NetBeansProjects/7.15/PP.g:85:31: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*

        for (;;)
        {
            int alt1=2;
            switch ( LA(1) ) 
            {
            case '0':
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
            case 'A':
            case 'B':
            case 'C':
            case 'D':
            case 'E':
            case 'F':
            case 'G':
            case 'H':
            case 'I':
            case 'J':
            case 'K':
            case 'L':
            case 'M':
            case 'N':
            case 'O':
            case 'P':
            case 'Q':
            case 'R':
            case 'S':
            case 'T':
            case 'U':
            case 'V':
            case 'W':
            case 'X':
            case 'Y':
            case 'Z':
            case '_':
            case 'a':
            case 'b':
            case 'c':
            case 'd':
            case 'e':
            case 'f':
            case 'g':
            case 'h':
            case 'i':
            case 'j':
            case 'k':
            case 'l':
            case 'm':
            case 'n':
            case 'o':
            case 'p':
            case 'q':
            case 'r':
            case 's':
            case 't':
            case 'u':
            case 'v':
            case 'w':
            case 'x':
            case 'y':
            case 'z':
            	{
            		alt1=1;
            	}
                break;

            }

            switch (alt1) 
            {
        	case 1:
        	    // /home/luca/NetBeansProjects/7.15/PP.g:
        	    {
        	        if ( ((LA(1) >= '0') && (LA(1) <= '9')) || ((LA(1) >= 'A') && (LA(1) <= 'Z')) || LA(1) == '_' || ((LA(1) >= 'a') && (LA(1) <= 'z')) )
        	        {
        	            CONSUME();

        	        }
        	        else 
        	        {
        	            CONSTRUCTEX();
        	            EXCEPTION->type         = ANTLR3_MISMATCHED_SET_EXCEPTION;
        	            EXCEPTION->name         = (void *)ANTLR3_MISMATCHED_SET_NAME;

        	            LRECOVER();    goto ruleIDEx;
        	        }


        	    }
        	    break;

        	default:
        	    goto loop1;	/* break out of the loop */
        	    break;
            }
        }
        loop1: ; /* Jump out to here if this rule does not match */


    }

	LEXSTATE->type = _type;

    // This is where rules clean up and exit
    //
    goto ruleIDEx; /* Prevent compiler warnings */
    ruleIDEx: ;

}
// $ANTLR end ID

//   Comes from: 86:8: ( ',' )
/** \brief Lexer rule generated by ANTLR3
 *
 * $ANTLR start COMMA
 *
 * Looks to match the characters the constitute the token COMMA
 * from the attached input stream.
 *
 *
 * \remark
 *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
 */
static ANTLR3_INLINE
void mCOMMA(pPPLexer ctx)
{
	ANTLR3_UINT32	_type;

    _type	    = COMMA;
       
    
    // /home/luca/NetBeansProjects/7.15/PP.g:86:8: ( ',' )
    // /home/luca/NetBeansProjects/7.15/PP.g:86:10: ','
    {
        MATCHC(','); 
        if  (HASEXCEPTION())
        {
            goto ruleCOMMAEx;
        }


    }

	LEXSTATE->type = _type;

    // This is where rules clean up and exit
    //
    goto ruleCOMMAEx; /* Prevent compiler warnings */
    ruleCOMMAEx: ;

}
// $ANTLR end COMMA

//   Comes from: 87:5: ( '(' )
/** \brief Lexer rule generated by ANTLR3
 *
 * $ANTLR start LP
 *
 * Looks to match the characters the constitute the token LP
 * from the attached input stream.
 *
 *
 * \remark
 *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
 */
static ANTLR3_INLINE
void mLP(pPPLexer ctx)
{
	ANTLR3_UINT32	_type;

    _type	    = LP;
       
    
    // /home/luca/NetBeansProjects/7.15/PP.g:87:5: ( '(' )
    // /home/luca/NetBeansProjects/7.15/PP.g:87:7: '('
    {
        MATCHC('('); 
        if  (HASEXCEPTION())
        {
            goto ruleLPEx;
        }


    }

	LEXSTATE->type = _type;

    // This is where rules clean up and exit
    //
    goto ruleLPEx; /* Prevent compiler warnings */
    ruleLPEx: ;

}
// $ANTLR end LP

//   Comes from: 88:5: ( ')' )
/** \brief Lexer rule generated by ANTLR3
 *
 * $ANTLR start RP
 *
 * Looks to match the characters the constitute the token RP
 * from the attached input stream.
 *
 *
 * \remark
 *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
 */
static ANTLR3_INLINE
void mRP(pPPLexer ctx)
{
	ANTLR3_UINT32	_type;

    _type	    = RP;
       
    
    // /home/luca/NetBeansProjects/7.15/PP.g:88:5: ( ')' )
    // /home/luca/NetBeansProjects/7.15/PP.g:88:7: ')'
    {
        MATCHC(')'); 
        if  (HASEXCEPTION())
        {
            goto ruleRPEx;
        }


    }

	LEXSTATE->type = _type;

    // This is where rules clean up and exit
    //
    goto ruleRPEx; /* Prevent compiler warnings */
    ruleRPEx: ;

}
// $ANTLR end RP

//   Comes from: 89:10: ( ( '\\r' )? '\\n' )
/** \brief Lexer rule generated by ANTLR3
 *
 * $ANTLR start NEWLINE
 *
 * Looks to match the characters the constitute the token NEWLINE
 * from the attached input stream.
 *
 *
 * \remark
 *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
 */
static ANTLR3_INLINE
void mNEWLINE(pPPLexer ctx)
{
	ANTLR3_UINT32	_type;

    _type	    = NEWLINE;
       
    
    // /home/luca/NetBeansProjects/7.15/PP.g:89:10: ( ( '\\r' )? '\\n' )
    // /home/luca/NetBeansProjects/7.15/PP.g:89:12: ( '\\r' )? '\\n'
    {

        // /home/luca/NetBeansProjects/7.15/PP.g:89:12: ( '\\r' )?
        {
            int alt2=2;
            switch ( LA(1) ) 
            {
                case '\r':
                	{
                		alt2=1;
                	}
                    break;
            }

            switch (alt2) 
            {
        	case 1:
        	    // /home/luca/NetBeansProjects/7.15/PP.g:89:12: '\\r'
        	    {
        	        MATCHC('\r'); 
        	        if  (HASEXCEPTION())
        	        {
        	            goto ruleNEWLINEEx;
        	        }


        	    }
        	    break;

            }
        }
        MATCHC('\n'); 
        if  (HASEXCEPTION())
        {
            goto ruleNEWLINEEx;
        }


    }

	LEXSTATE->type = _type;

    // This is where rules clean up and exit
    //
    goto ruleNEWLINEEx; /* Prevent compiler warnings */
    ruleNEWLINEEx: ;

}
// $ANTLR end NEWLINE

//   Comes from: 90:6: ( ( ' ' | '\\t' )+ )
/** \brief Lexer rule generated by ANTLR3
 *
 * $ANTLR start WS
 *
 * Looks to match the characters the constitute the token WS
 * from the attached input stream.
 *
 *
 * \remark
 *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
 */
static ANTLR3_INLINE
void mWS(pPPLexer ctx)
{
	ANTLR3_UINT32	_type;

    _type	    = WS;
       
    
    // /home/luca/NetBeansProjects/7.15/PP.g:90:6: ( ( ' ' | '\\t' )+ )
    // /home/luca/NetBeansProjects/7.15/PP.g:90:8: ( ' ' | '\\t' )+
    {
        // /home/luca/NetBeansProjects/7.15/PP.g:90:8: ( ' ' | '\\t' )+
        {
            int cnt3=0;

            for (;;)
            {
                int alt3=2;
        	switch ( LA(1) ) 
        	{
        	case '\t':
        	case ' ':
        		{
        			alt3=1;
        		}
        	    break;

        	}

        	switch (alt3) 
        	{
        	    case 1:
        	        // /home/luca/NetBeansProjects/7.15/PP.g:
        	        {
        	            if ( LA(1) == '\t' || LA(1) == ' ' )
        	            {
        	                CONSUME();

        	            }
        	            else 
        	            {
        	                CONSTRUCTEX();
        	                EXCEPTION->type         = ANTLR3_MISMATCHED_SET_EXCEPTION;
        	                EXCEPTION->name         = (void *)ANTLR3_MISMATCHED_SET_NAME;

        	                LRECOVER();    goto ruleWSEx;
        	            }


        	        }
        	        break;

        	    default:
        	    
        		if ( cnt3 >= 1 )
        		{
        		    goto loop3;
        		}
        		/* mismatchedSetEx()
        		 */
        		CONSTRUCTEX();
        		EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
        		EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;


        		goto ruleWSEx;
        	}
        	cnt3++;
            }
            loop3: ;	/* Jump to here if this rule does not match */
        }

    }

	LEXSTATE->type = _type;

    // This is where rules clean up and exit
    //
    goto ruleWSEx; /* Prevent compiler warnings */
    ruleWSEx: ;

}
// $ANTLR end WS

//   Comes from: 91:10: ( '\\u0000' .. '\\uffff' )
/** \brief Lexer rule generated by ANTLR3
 *
 * $ANTLR start ANYCHAR
 *
 * Looks to match the characters the constitute the token ANYCHAR
 * from the attached input stream.
 *
 *
 * \remark
 *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
 */
static ANTLR3_INLINE
void mANYCHAR(pPPLexer ctx)
{
	ANTLR3_UINT32	_type;

    _type	    = ANYCHAR;
       
    
    // /home/luca/NetBeansProjects/7.15/PP.g:91:10: ( '\\u0000' .. '\\uffff' )
    // /home/luca/NetBeansProjects/7.15/PP.g:91:12: '\\u0000' .. '\\uffff'
    {
        MATCHRANGE(0x0000, 0xffff); 
        if  (HASEXCEPTION())
        {
            goto ruleANYCHAREx;
        }


    }

	LEXSTATE->type = _type;

    // This is where rules clean up and exit
    //
    goto ruleANYCHAREx; /* Prevent compiler warnings */
    ruleANYCHAREx: ;

}
// $ANTLR end ANYCHAR

/** This is the entry point in to the lexer from an object that
 *  wants to generate the next token, such as a pCOMMON_TOKEN_STREAM
 */
static void 
mTokens(pPPLexer ctx)
{
    {
        //  /home/luca/NetBeansProjects/7.15/PP.g:1:8: ( DEFINE | ID | COMMA | LP | RP | NEWLINE | WS | ANYCHAR )
        
        ANTLR3_UINT32 alt4;

        alt4=8;


        {
            int LA4_0 = LA(1);
            if ( (LA4_0 == '#') ) 
            {
                switch ( LA(2) ) 
                {
                case 'd':
                	{
                		alt4=1;
                	}
                    break;

                default:
                    alt4=8;}

            }
            else if ( (((LA4_0 >= 'A') && (LA4_0 <= 'Z')) || LA4_0 == '_' || ((LA4_0 >= 'a') && (LA4_0 <= 'z'))) ) 
            {
                alt4=2;
            }
            else if ( (LA4_0 == ',') ) 
            {
                alt4=3;
            }
            else if ( (LA4_0 == '(') ) 
            {
                alt4=4;
            }
            else if ( (LA4_0 == ')') ) 
            {
                alt4=5;
            }
            else if ( (LA4_0 == '\r') ) 
            {
                switch ( LA(2) ) 
                {
                case '\n':
                	{
                		alt4=6;
                	}
                    break;

                default:
                    alt4=8;}

            }
            else if ( (LA4_0 == '\n') ) 
            {
                alt4=6;
            }
            else if ( (LA4_0 == '\t' || LA4_0 == ' ') ) 
            {
                alt4=7;
            }
            else if ( (((LA4_0 >= 0x0000) && (LA4_0 <= '\b')) || ((LA4_0 >= 0x000B) && (LA4_0 <= '\f')) || ((LA4_0 >= 0x000E) && (LA4_0 <= 0x001F)) || ((LA4_0 >= '!') && (LA4_0 <= '"')) || ((LA4_0 >= '$') && (LA4_0 <= '\'')) || ((LA4_0 >= '*') && (LA4_0 <= '+')) || ((LA4_0 >= '-') && (LA4_0 <= '@')) || ((LA4_0 >= '[') && (LA4_0 <= '^')) || LA4_0 == '`' || ((LA4_0 >= '{') && (LA4_0 <= 0xFFFF))) ) 
            {
                alt4=8;
            }
            else 
            {
            
                CONSTRUCTEX();
                EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
                EXCEPTION->message      = (void *)"";
                EXCEPTION->decisionNum  = 4;
                EXCEPTION->state        = 0;


                goto ruleTokensEx;
            }
        }
        switch (alt4) 
        {
    	case 1:
    	    // /home/luca/NetBeansProjects/7.15/PP.g:1:10: DEFINE
    	    {
    	        /* 1:10: DEFINE */
    	        mDEFINE(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 2:
    	    // /home/luca/NetBeansProjects/7.15/PP.g:1:17: ID
    	    {
    	        /* 1:17: ID */
    	        mID(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 3:
    	    // /home/luca/NetBeansProjects/7.15/PP.g:1:20: COMMA
    	    {
    	        /* 1:20: COMMA */
    	        mCOMMA(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 4:
    	    // /home/luca/NetBeansProjects/7.15/PP.g:1:26: LP
    	    {
    	        /* 1:26: LP */
    	        mLP(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 5:
    	    // /home/luca/NetBeansProjects/7.15/PP.g:1:29: RP
    	    {
    	        /* 1:29: RP */
    	        mRP(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 6:
    	    // /home/luca/NetBeansProjects/7.15/PP.g:1:32: NEWLINE
    	    {
    	        /* 1:32: NEWLINE */
    	        mNEWLINE(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 7:
    	    // /home/luca/NetBeansProjects/7.15/PP.g:1:40: WS
    	    {
    	        /* 1:40: WS */
    	        mWS(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 8:
    	    // /home/luca/NetBeansProjects/7.15/PP.g:1:43: ANYCHAR
    	    {
    	        /* 1:43: ANYCHAR */
    	        mANYCHAR(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;

        }
    }

    
    goto ruleTokensEx; /* Prevent compiler warnings */
ruleTokensEx: ;
}

/* =========================================================================
 * Lexer matching rules end.
 * =========================================================================
 */
/* End of Lexer code
 * ================================================
 * ================================================
 */ 


/* End of code
 * =============================================================================
 */
