// $ANTLR 3.2 Sep 23, 2009 12:02:23 F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g 2011-01-08 18:26:12 import org.antlr.runtime.*; import java.util.Stack; import java.util.List; import java.util.ArrayList; public class PolyLexer extends Lexer { public static final int WS=7; public static final int INT=5; public static final int MULT=4; public static final int ID=6; public static final int EOF=-1; public static final int T__9=9; public static final int T__8=8; // delegates // delegators public PolyLexer() {;} public PolyLexer(CharStream input) { this(input, new RecognizerSharedState()); } public PolyLexer(CharStream input, RecognizerSharedState state) { super(input,state); } public String getGrammarFileName() { return "F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g"; } // $ANTLR start "T__8" public final void mT__8() throws RecognitionException { try { int _type = T__8; int _channel = DEFAULT_TOKEN_CHANNEL; // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:3:6: ( '+' ) // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:3:8: '+' { match('+'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "T__8" // $ANTLR start "T__9" public final void mT__9() throws RecognitionException { try { int _type = T__9; int _channel = DEFAULT_TOKEN_CHANNEL; // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:4:6: ( '^' ) // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:4:8: '^' { match('^'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "T__9" // $ANTLR start "ID" public final void mID() throws RecognitionException { try { int _type = ID; int _channel = DEFAULT_TOKEN_CHANNEL; // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:18:4: ( ( 'a' .. 'z' )+ ) // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:18:6: ( 'a' .. 'z' )+ { // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:18:6: ( 'a' .. 'z' )+ int cnt1=0; loop1: do { int alt1=2; int LA1_0 = input.LA(1); if ( ((LA1_0>='a' && LA1_0<='z')) ) { alt1=1; } switch (alt1) { case 1 : // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:18:6: 'a' .. 'z' { matchRange('a','z'); } break; default : if ( cnt1 >= 1 ) break loop1; EarlyExitException eee = new EarlyExitException(1, input); throw eee; } cnt1++; } while (true); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "ID" // $ANTLR start "INT" public final void mINT() throws RecognitionException { try { int _type = INT; int _channel = DEFAULT_TOKEN_CHANNEL; // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:20:5: ( ( '0' .. '9' )+ ) // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:20:7: ( '0' .. '9' )+ { // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:20:7: ( '0' .. '9' )+ int cnt2=0; loop2: do { int alt2=2; int LA2_0 = input.LA(1); if ( ((LA2_0>='0' && LA2_0<='9')) ) { alt2=1; } switch (alt2) { case 1 : // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:20:7: '0' .. '9' { matchRange('0','9'); } break; default : if ( cnt2 >= 1 ) break loop2; EarlyExitException eee = new EarlyExitException(2, input); throw eee; } cnt2++; } while (true); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "INT" // $ANTLR start "WS" public final void mWS() throws RecognitionException { try { int _type = WS; int _channel = DEFAULT_TOKEN_CHANNEL; // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:22:4: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:22:6: ( ' ' | '\\t' | '\\r' | '\\n' )+ { // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:22:6: ( ' ' | '\\t' | '\\r' | '\\n' )+ int cnt3=0; loop3: do { int alt3=2; int LA3_0 = input.LA(1); if ( ((LA3_0>='\t' && LA3_0<='\n')||LA3_0=='\r'||LA3_0==' ') ) { alt3=1; } switch (alt3) { case 1 : // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g: { if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ' ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse;} } break; default : if ( cnt3 >= 1 ) break loop3; EarlyExitException eee = new EarlyExitException(3, input); throw eee; } cnt3++; } while (true); skip(); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "WS" public void mTokens() throws RecognitionException { // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:1:8: ( T__8 | T__9 | ID | INT | WS ) int alt4=5; switch ( input.LA(1) ) { case '+': { alt4=1; } break; case '^': { alt4=2; } 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': { alt4=3; } break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { alt4=4; } break; case '\t': case '\n': case '\r': case ' ': { alt4=5; } break; default: NoViableAltException nvae = new NoViableAltException("", 4, 0, input); throw nvae; } switch (alt4) { case 1 : // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:1:10: T__8 { mT__8(); } break; case 2 : // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:1:15: T__9 { mT__9(); } break; case 3 : // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:1:20: ID { mID(); } break; case 4 : // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:1:23: INT { mINT(); } break; case 5 : // F:\\tmp\\antlr3-task - Kopie\\examples\\polydiff-netbeans\\polydiff\\grammar\\Poly.g:1:27: WS { mWS(); } break; } } }