コード例 #1
0
ファイル: ExprCppTreeLexer.c プロジェクト: egmkang/antlr3-dsl
/** 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(pExprCppTreeLexer ctx)
{
    {
        //  D:\\message\\ExprCppTree.g:1:8: ( T__12 | T__13 | PLUS | MINUS | TIMES | ASSIGN | ID | INT | NEWLINE | WS )
        
        ANTLR3_UINT32 alt6;

        alt6=10;

        switch ( LA(1) ) 
        {
        case '(':
        	{
        		alt6=1;
        	}
            break;
        case ')':
        	{
        		alt6=2;
        	}
            break;
        case '+':
        	{
        		alt6=3;
        	}
            break;
        case '-':
        	{
        		alt6=4;
        	}
            break;
        case '*':
        	{
        		alt6=5;
        	}
            break;
        case '=':
        	{
        		alt6=6;
        	}
            break;
        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 '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':
        	{
        		alt6=7;
        	}
            break;
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
        case '8':
        case '9':
        case '~':
        	{
        		alt6=8;
        	}
            break;
        case '\n':
        case '\r':
        	{
        		alt6=9;
        	}
            break;
        case '\t':
        case ' ':
        	{
        		alt6=10;
        	}
            break;

        default:
            CONSTRUCTEX();
            EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
            EXCEPTION->message      = (void *)"";
            EXCEPTION->decisionNum  = 6;
            EXCEPTION->state        = 0;


            goto ruleTokensEx;
        }

        switch (alt6) 
        {
    	case 1:
    	    // D:\\message\\ExprCppTree.g:1:10: T__12
    	    {
    	        /* 1:10: T__12 */
    	        mT__12(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 2:
    	    // D:\\message\\ExprCppTree.g:1:16: T__13
    	    {
    	        /* 1:16: T__13 */
    	        mT__13(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 3:
    	    // D:\\message\\ExprCppTree.g:1:22: PLUS
    	    {
    	        /* 1:22: PLUS */
    	        mPLUS(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 4:
    	    // D:\\message\\ExprCppTree.g:1:27: MINUS
    	    {
    	        /* 1:27: MINUS */
    	        mMINUS(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 5:
    	    // D:\\message\\ExprCppTree.g:1:33: TIMES
    	    {
    	        /* 1:33: TIMES */
    	        mTIMES(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 6:
    	    // D:\\message\\ExprCppTree.g:1:39: ASSIGN
    	    {
    	        /* 1:39: ASSIGN */
    	        mASSIGN(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 7:
    	    // D:\\message\\ExprCppTree.g:1:46: ID
    	    {
    	        /* 1:46: ID */
    	        mID(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 8:
    	    // D:\\message\\ExprCppTree.g:1:49: INT
    	    {
    	        /* 1:49: INT */
    	        mINT(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 9:
    	    // D:\\message\\ExprCppTree.g:1:53: NEWLINE
    	    {
    	        /* 1:53: NEWLINE */
    	        mNEWLINE(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;
    	case 10:
    	    // D:\\message\\ExprCppTree.g:1:61: WS
    	    {
    	        /* 1:61: WS */
    	        mWS(ctx ); 
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }


    	    }
    	    break;

        }
    }

    
    goto ruleTokensEx; /* Prevent compiler warnings */
ruleTokensEx: ;
}
コード例 #2
0
ファイル: MudLexer.c プロジェクト: copenhas/emud
/** 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(pMudLexer ctx)
{
    {
        //  c_src/Mud.g:1:8: ( T__6 | T__7 | T__8 | T__9 | T__10 | T__11 | T__12 | T__13 | T__14 | WS | TEXT )

        ANTLR3_UINT32 alt3;

        alt3=11;

        switch ( LA(1) )
        {
        case 'a':
        	{
        		switch ( LA(2) )
        		{
        		case 'r':
        			{
        				switch ( LA(3) )
        				{
        				case 'o':
        					{
        						switch ( LA(4) )
        						{
        						case 'u':
        							{
        								switch ( LA(5) )
        								{
        								case 'n':
        									{
        										switch ( LA(6) )
        										{
        										case 'd':
        											{
        												switch ( LA(7) )
        												{
        												case '!':
        												case '#':
        												case '$':
        												case '%':
        												case '&':
        												case '(':
        												case ')':
        												case '*':
        												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':
        												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':
        													{
        														alt3=11;
        													}
        												    break;

        												default:
        												    alt3=1;
        												}

        											}
        										    break;

        										default:
        										    alt3=11;
        										}

        									}
        								    break;

        								default:
        								    alt3=11;
        								}

        							}
        						    break;

        						default:
        						    alt3=11;
        						}

        					}
        				    break;

        				default:
        				    alt3=11;
        				}

        			}
        		    break;
        		case 't':
        			{
        				switch ( LA(3) )
        				{
        				case '!':
        				case '#':
        				case '$':
        				case '%':
        				case '&':
        				case '(':
        				case ')':
        				case '*':
        				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':
        				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':
        					{
        						alt3=11;
        					}
        				    break;

        				default:
        				    alt3=2;
        				}

        			}
        		    break;

        		default:
        		    alt3=11;
        		}

        	}
            break;
        case 'c':
        	{
        		switch ( LA(2) )
        		{
        		case 'r':
        			{
        				switch ( LA(3) )
        				{
        				case 'e':
        					{
        						switch ( LA(4) )
        						{
        						case 'a':
        							{
        								switch ( LA(5) )
        								{
        								case 't':
        									{
        										switch ( LA(6) )
        										{
        										case 'e':
        											{
        												switch ( LA(7) )
        												{
        												case ' ':
        													{
        														alt3=3;
        													}
        												    break;

        												default:
        												    alt3=11;
        												}

        											}
        										    break;

        										default:
        										    alt3=11;
        										}

        									}
        								    break;

        								default:
        								    alt3=11;
        								}

        							}
        						    break;

        						default:
        						    alt3=11;
        						}

        					}
        				    break;

        				default:
        				    alt3=11;
        				}

        			}
        		    break;

        		default:
        		    alt3=11;
        		}

        	}
            break;
        case 'j':
        	{
        		switch ( LA(2) )
        		{
        		case 'o':
        			{
        				switch ( LA(3) )
        				{
        				case 'i':
        					{
        						switch ( LA(4) )
        						{
        						case 'n':
        							{
        								switch ( LA(5) )
        								{
        								case ' ':
        									{
        										alt3=4;
        									}
        								    break;

        								default:
        								    alt3=11;
        								}

        							}
        						    break;

        						default:
        						    alt3=11;
        						}

        					}
        				    break;

        				default:
        				    alt3=11;
        				}

        			}
        		    break;

        		default:
        		    alt3=11;
        		}

        	}
            break;
        case 'l':
        	{
        		switch ( LA(2) )
        		{
        		case 'o':
        			{
        				switch ( LA(3) )
        				{
        				case 'g':
        					{
        						switch ( LA(4) )
        						{
        						case 'i':
        							{
        								switch ( LA(5) )
        								{
        								case 'n':
        									{
        										switch ( LA(6) )
        										{
        										case '!':
        										case '#':
        										case '$':
        										case '%':
        										case '&':
        										case '(':
        										case ')':
        										case '*':
        										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':
        										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':
        											{
        												alt3=11;
        											}
        										    break;

        										default:
        										    alt3=5;
        										}

        									}
        								    break;

        								default:
        								    alt3=11;
        								}

        							}
        						    break;

        						default:
        						    alt3=11;
        						}

        					}
        				    break;
        				case 'o':
        					{
        						switch ( LA(4) )
        						{
        						case 'k':
        							{
        								switch ( LA(5) )
        								{
        								case '!':
        								case '#':
        								case '$':
        								case '%':
        								case '&':
        								case '(':
        								case ')':
        								case '*':
        								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':
        								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':
        									{
        										alt3=11;
        									}
        								    break;

        								default:
        								    alt3=6;
        								}

        							}
        						    break;

        						default:
        						    alt3=11;
        						}

        					}
        				    break;

        				default:
        				    alt3=11;
        				}

        			}
        		    break;

        		default:
        		    alt3=11;
        		}

        	}
            break;
        case 'm':
        	{
        		switch ( LA(2) )
        		{
        		case 'o':
        			{
        				switch ( LA(3) )
        				{
        				case 'v':
        					{
        						switch ( LA(4) )
        						{
        						case 'e':
        							{
        								switch ( LA(5) )
        								{
        								case '!':
        								case '#':
        								case '$':
        								case '%':
        								case '&':
        								case '(':
        								case ')':
        								case '*':
        								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':
        								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':
        									{
        										alt3=11;
        									}
        								    break;

        								default:
        								    alt3=7;
        								}

        							}
        						    break;

        						default:
        						    alt3=11;
        						}

        					}
        				    break;

        				default:
        				    alt3=11;
        				}

        			}
        		    break;
        		case 'y':
        			{
        				switch ( LA(3) )
        				{
        				case ' ':
        					{
        						alt3=8;
        					}
        				    break;

        				default:
        				    alt3=11;
        				}

        			}
        		    break;

        		default:
        		    alt3=11;
        		}

        	}
            break;
        case 'n':
        	{
        		switch ( LA(2) )
        		{
        		case 'e':
        			{
        				switch ( LA(3) )
        				{
        				case 'w':
        					{
        						switch ( LA(4) )
        						{
        						case ' ':
        							{
        								alt3=9;
        							}
        						    break;

        						default:
        						    alt3=11;
        						}

        					}
        				    break;

        				default:
        				    alt3=11;
        				}

        			}
        		    break;

        		default:
        		    alt3=11;
        		}

        	}
            break;
        case '\t':
        case ' ':
        	{
        		alt3=10;
        	}
            break;
        case '!':
        case '#':
        case '$':
        case '%':
        case '&':
        case '(':
        case ')':
        case '*':
        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':
        case '^':
        case 'b':
        case 'd':
        case 'e':
        case 'f':
        case 'g':
        case 'h':
        case 'i':
        case 'k':
        case 'o':
        case 'p':
        case 'q':
        case 'r':
        case 's':
        case 't':
        case 'u':
        case 'v':
        case 'w':
        case 'x':
        case 'y':
        case 'z':
        	{
        		alt3=11;
        	}
            break;

        default:
            CONSTRUCTEX();
            EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
            EXCEPTION->message      = (void *)"";
            EXCEPTION->decisionNum  = 3;
            EXCEPTION->state        = 0;


            goto ruleTokensEx;

        }

        switch (alt3)
        {
    	case 1:
    	    // c_src/Mud.g:1:10: T__6
    	    {
    	        /* 1:10: T__6 */
    	        mT__6(ctx );
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }



    	    }
    	    break;
    	case 2:
    	    // c_src/Mud.g:1:15: T__7
    	    {
    	        /* 1:15: T__7 */
    	        mT__7(ctx );
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }



    	    }
    	    break;
    	case 3:
    	    // c_src/Mud.g:1:20: T__8
    	    {
    	        /* 1:20: T__8 */
    	        mT__8(ctx );
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }



    	    }
    	    break;
    	case 4:
    	    // c_src/Mud.g:1:25: T__9
    	    {
    	        /* 1:25: T__9 */
    	        mT__9(ctx );
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }



    	    }
    	    break;
    	case 5:
    	    // c_src/Mud.g:1:30: T__10
    	    {
    	        /* 1:30: T__10 */
    	        mT__10(ctx );
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }



    	    }
    	    break;
    	case 6:
    	    // c_src/Mud.g:1:36: T__11
    	    {
    	        /* 1:36: T__11 */
    	        mT__11(ctx );
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }



    	    }
    	    break;
    	case 7:
    	    // c_src/Mud.g:1:42: T__12
    	    {
    	        /* 1:42: T__12 */
    	        mT__12(ctx );
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }



    	    }
    	    break;
    	case 8:
    	    // c_src/Mud.g:1:48: T__13
    	    {
    	        /* 1:48: T__13 */
    	        mT__13(ctx );
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }



    	    }
    	    break;
    	case 9:
    	    // c_src/Mud.g:1:54: T__14
    	    {
    	        /* 1:54: T__14 */
    	        mT__14(ctx );
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }



    	    }
    	    break;
    	case 10:
    	    // c_src/Mud.g:1:60: WS
    	    {
    	        /* 1:60: WS */
    	        mWS(ctx );
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }



    	    }
    	    break;
    	case 11:
    	    // c_src/Mud.g:1:63: TEXT
    	    {
    	        /* 1:63: TEXT */
    	        mTEXT(ctx );
    	        if  (HASEXCEPTION())
    	        {
    	            goto ruleTokensEx;
    	        }



    	    }
    	    break;

        }
    }


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