// $ANTLR 3.0.1 C:\\temp\\CSVParsingProject\\src\\CSVParser.g 2008-08-11 15:53:40 import org.antlr.runtime.*; import java.util.Stack; import java.util.List; import java.util.ArrayList; public class CSVParserLexer extends Lexer { public static final int LINE_COMMENT=20; public static final int POINT=10; public static final int LETTER=15; public static final int NUMBER=4; public static final int MINUS=11; public static final int Tokens=22; public static final int EOF=-1; public static final int T21=21; public static final int StringLiteral=6; public static final int SLASH=13; public static final int WS=18; public static final int LPAR=7; public static final int APPOS=12; public static final int IDENTIFIER=5; public static final int FLOATINGPOINT=17; public static final int RPAR=8; public static final int PLUS=9; public static final int DIGIT=16; public static final int COMMENT=19; public static final int DATE=14; public CSVParserLexer() {;} public CSVParserLexer(CharStream input) { super(input); } public String getGrammarFileName() { return "C:\\temp\\CSVParsingProject\\src\\CSVParser.g"; } // $ANTLR start T21 public final void mT21() throws RecognitionException { try { int _type = T21; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:3:5: ( ',' ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:3:7: ',' { match(','); } this.type = _type; } finally { } } // $ANTLR end T21 // $ANTLR start LPAR public final void mLPAR() throws RecognitionException { try { int _type = LPAR; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:30:7: ( '(' ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:30:9: '(' { match('('); } this.type = _type; } finally { } } // $ANTLR end LPAR // $ANTLR start RPAR public final void mRPAR() throws RecognitionException { try { int _type = RPAR; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:31:7: ( ')' ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:31:9: ')' { match(')'); } this.type = _type; } finally { } } // $ANTLR end RPAR // $ANTLR start PLUS public final void mPLUS() throws RecognitionException { try { int _type = PLUS; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:32:6: ( '+' ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:32:8: '+' { match('+'); } this.type = _type; } finally { } } // $ANTLR end PLUS // $ANTLR start POINT public final void mPOINT() throws RecognitionException { try { int _type = POINT; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:33:7: ( '.' ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:33:9: '.' { match('.'); } this.type = _type; } finally { } } // $ANTLR end POINT // $ANTLR start MINUS public final void mMINUS() throws RecognitionException { try { int _type = MINUS; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:34:7: ( '-' ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:34:9: '-' { match('-'); } this.type = _type; } finally { } } // $ANTLR end MINUS // $ANTLR start APPOS public final void mAPPOS() throws RecognitionException { try { int _type = APPOS; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:35:7: ( '\\'' ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:35:9: '\\'' { match('\''); } this.type = _type; } finally { } } // $ANTLR end APPOS // $ANTLR start SLASH public final void mSLASH() throws RecognitionException { try { int _type = SLASH; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:36:7: ( '/' ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:36:9: '/' { match('/'); } this.type = _type; } finally { } } // $ANTLR end SLASH // $ANTLR start DATE public final void mDATE() throws RecognitionException { try { int _type = DATE; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:37:6: ( NUMBER '/' NUMBER ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:37:8: NUMBER '/' NUMBER { mNUMBER(); match('/'); mNUMBER(); } this.type = _type; } finally { } } // $ANTLR end DATE // $ANTLR start StringLiteral public final void mStringLiteral() throws RecognitionException { try { int _type = StringLiteral; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:40:2: ( '\"' ( . )+ '\"' ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:40:4: '\"' ( . )+ '\"' { match('\"'); // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:40:8: ( . )+ int cnt1=0; loop1: do { int alt1=2; int LA1_0 = input.LA(1); if ( (LA1_0=='\"') ) { alt1=2; } else if ( ((LA1_0>='\u0000' && LA1_0<='!')||(LA1_0>='#' && LA1_0<='\uFFFE')) ) { alt1=1; } switch (alt1) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:40:9: . { matchAny(); } break; default : if ( cnt1 >= 1 ) break loop1; EarlyExitException eee = new EarlyExitException(1, input); throw eee; } cnt1++; } while (true); match('\"'); } this.type = _type; } finally { } } // $ANTLR end StringLiteral // $ANTLR start IDENTIFIER public final void mIDENTIFIER() throws RecognitionException { try { int _type = IDENTIFIER; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:43:2: ( LETTER ( LETTER | DIGIT | '_' )* ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:43:5: LETTER ( LETTER | DIGIT | '_' )* { mLETTER(); // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:43:12: ( LETTER | DIGIT | '_' )* loop2: do { int alt2=4; switch ( input.LA(1) ) { 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': { alt2=1; } break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { alt2=2; } break; case '_': { alt2=3; } break; } switch (alt2) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:43:13: LETTER { mLETTER(); } break; case 2 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:43:20: DIGIT { mDIGIT(); } break; case 3 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:43:26: '_' { match('_'); } break; default : break loop2; } } while (true); } this.type = _type; } finally { } } // $ANTLR end IDENTIFIER // $ANTLR start NUMBER public final void mNUMBER() throws RecognitionException { try { int _type = NUMBER; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:46:8: ( DIGIT ( DIGIT )* ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:46:10: DIGIT ( DIGIT )* { mDIGIT(); // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:46:15: ( DIGIT )* loop3: do { int alt3=2; int LA3_0 = input.LA(1); if ( ((LA3_0>='0' && LA3_0<='9')) ) { alt3=1; } switch (alt3) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:46:16: DIGIT { mDIGIT(); } break; default : break loop3; } } while (true); } this.type = _type; } finally { } } // $ANTLR end NUMBER // $ANTLR start FLOATINGPOINT public final void mFLOATINGPOINT() throws RecognitionException { try { int _type = FLOATINGPOINT; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:49:2: ( ( DIGIT )+ ( '.' ) ( DIGIT )+ ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:49:4: ( DIGIT )+ ( '.' ) ( DIGIT )+ { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:49:4: ( DIGIT )+ int cnt4=0; loop4: do { int alt4=2; int LA4_0 = input.LA(1); if ( ((LA4_0>='0' && LA4_0<='9')) ) { alt4=1; } switch (alt4) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:49:4: DIGIT { mDIGIT(); } break; default : if ( cnt4 >= 1 ) break loop4; EarlyExitException eee = new EarlyExitException(4, input); throw eee; } cnt4++; } while (true); // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:49:10: ( '.' ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:49:11: '.' { match('.'); } // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:49:15: ( DIGIT )+ int cnt5=0; loop5: do { int alt5=2; int LA5_0 = input.LA(1); if ( ((LA5_0>='0' && LA5_0<='9')) ) { alt5=1; } switch (alt5) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:49:15: DIGIT { mDIGIT(); } break; default : if ( cnt5 >= 1 ) break loop5; EarlyExitException eee = new EarlyExitException(5, input); throw eee; } cnt5++; } while (true); } this.type = _type; } finally { } } // $ANTLR end FLOATINGPOINT // $ANTLR start LETTER public final void mLETTER() throws RecognitionException { try { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:52:2: ( ( 'a' .. 'z' | 'A' .. 'Z' ) ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:52:4: ( 'a' .. 'z' | 'A' .. 'Z' ) { if ( (input.LA(1)>='A' && input.LA(1)<='Z')||(input.LA(1)>='a' && input.LA(1)<='z') ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse; } } } finally { } } // $ANTLR end LETTER // $ANTLR start DIGIT public final void mDIGIT() throws RecognitionException { try { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:55:2: ( ( '0' .. '9' ) ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:55:4: ( '0' .. '9' ) { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:55:4: ( '0' .. '9' ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:55:5: '0' .. '9' { matchRange('0','9'); } } } finally { } } // $ANTLR end DIGIT // $ANTLR start WS public final void mWS() throws RecognitionException { try { int _type = WS; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:57:6: ( ( ' ' | '\\r' | '\\t' ) ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:57:9: ( ' ' | '\\r' | '\\t' ) { if ( input.LA(1)=='\t'||input.LA(1)=='\r'||input.LA(1)==' ' ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse; } channel=HIDDEN; } this.type = _type; } finally { } } // $ANTLR end WS // $ANTLR start COMMENT public final void mCOMMENT() throws RecognitionException { try { int _type = COMMENT; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:61:6: ( '/*' ( . )* '*/' ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:61:10: '/*' ( . )* '*/' { match("/*"); // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:61:15: ( . )* loop6: do { int alt6=2; int LA6_0 = input.LA(1); if ( (LA6_0=='*') ) { int LA6_1 = input.LA(2); if ( (LA6_1=='/') ) { alt6=2; } else if ( ((LA6_1>='\u0000' && LA6_1<='.')||(LA6_1>='0' && LA6_1<='\uFFFE')) ) { alt6=1; } } else if ( ((LA6_0>='\u0000' && LA6_0<=')')||(LA6_0>='+' && LA6_0<='\uFFFE')) ) { alt6=1; } switch (alt6) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:61:15: . { matchAny(); } break; default : break loop6; } } while (true); match("*/"); channel=HIDDEN; } this.type = _type; } finally { } } // $ANTLR end COMMENT // $ANTLR start LINE_COMMENT public final void mLINE_COMMENT() throws RecognitionException { try { int _type = LINE_COMMENT; // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:65:5: ( '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:65:7: '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' { match("//"); // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:65:12: (~ ( '\\n' | '\\r' ) )* loop7: do { int alt7=2; int LA7_0 = input.LA(1); if ( ((LA7_0>='\u0000' && LA7_0<='\t')||(LA7_0>='\u000B' && LA7_0<='\f')||(LA7_0>='\u000E' && LA7_0<='\uFFFE')) ) { alt7=1; } switch (alt7) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:65:12: ~ ( '\\n' | '\\r' ) { if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFE') ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse; } } break; default : break loop7; } } while (true); // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:65:26: ( '\\r' )? int alt8=2; int LA8_0 = input.LA(1); if ( (LA8_0=='\r') ) { alt8=1; } switch (alt8) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:65:26: '\\r' { match('\r'); } break; } match('\n'); channel=HIDDEN; } this.type = _type; } finally { } } // $ANTLR end LINE_COMMENT public void mTokens() throws RecognitionException { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:8: ( T21 | LPAR | RPAR | PLUS | POINT | MINUS | APPOS | SLASH | DATE | StringLiteral | IDENTIFIER | NUMBER | FLOATINGPOINT | WS | COMMENT | LINE_COMMENT ) int alt9=16; alt9 = dfa9.predict(input); switch (alt9) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:10: T21 { mT21(); } break; case 2 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:14: LPAR { mLPAR(); } break; case 3 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:19: RPAR { mRPAR(); } break; case 4 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:24: PLUS { mPLUS(); } break; case 5 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:29: POINT { mPOINT(); } break; case 6 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:35: MINUS { mMINUS(); } break; case 7 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:41: APPOS { mAPPOS(); } break; case 8 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:47: SLASH { mSLASH(); } break; case 9 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:53: DATE { mDATE(); } break; case 10 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:58: StringLiteral { mStringLiteral(); } break; case 11 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:72: IDENTIFIER { mIDENTIFIER(); } break; case 12 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:83: NUMBER { mNUMBER(); } break; case 13 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:90: FLOATINGPOINT { mFLOATINGPOINT(); } break; case 14 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:104: WS { mWS(); } break; case 15 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:107: COMMENT { mCOMMENT(); } break; case 16 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:1:115: LINE_COMMENT { mLINE_COMMENT(); } break; } } protected DFA9 dfa9 = new DFA9(this); static final String DFA9_eotS = "\10\uffff\1\17\1\20\7\uffff\1\20\2\uffff"; static final String DFA9_eofS = "\24\uffff"; static final String DFA9_minS = "\1\11\7\uffff\1\52\1\56\7\uffff\1\56\2\uffff"; static final String DFA9_maxS = "\1\172\7\uffff\1\57\1\71\7\uffff\1\71\2\uffff"; static final String DFA9_acceptS = "\1\uffff\1\1\1\2\1\3\1\4\1\5\1\6\1\7\2\uffff\1\12\1\13\1\16\1\20"+ "\1\17\1\10\1\14\1\uffff\1\15\1\11"; static final String DFA9_specialS = "\24\uffff}>"; static final String[] DFA9_transitionS = { "\1\14\3\uffff\1\14\22\uffff\1\14\1\uffff\1\12\4\uffff\1\7\1"+ "\2\1\3\1\uffff\1\4\1\1\1\6\1\5\1\10\12\11\7\uffff\32\13\6\uffff"+ "\32\13", "", "", "", "", "", "", "", "\1\16\4\uffff\1\15", "\1\22\1\23\12\21", "", "", "", "", "", "", "", "\1\22\1\23\12\21", "", "" }; static final short[] DFA9_eot = DFA.unpackEncodedString(DFA9_eotS); static final short[] DFA9_eof = DFA.unpackEncodedString(DFA9_eofS); static final char[] DFA9_min = DFA.unpackEncodedStringToUnsignedChars(DFA9_minS); static final char[] DFA9_max = DFA.unpackEncodedStringToUnsignedChars(DFA9_maxS); static final short[] DFA9_accept = DFA.unpackEncodedString(DFA9_acceptS); static final short[] DFA9_special = DFA.unpackEncodedString(DFA9_specialS); static final short[][] DFA9_transition; static { int numStates = DFA9_transitionS.length; DFA9_transition = new short[numStates][]; for (int i=0; i