// $ANTLR 3.0.1 C:\\temp\\CSVParsingProject\\src\\CSVParser.g 2008-08-11 15:53:39 //package cruise.runtime.main.generated; //import cruise.runtime.*; import org.antlr.runtime.*; import java.util.Stack; import java.util.List; import java.util.ArrayList; public class CSVParserParser extends Parser { public static final String[] tokenNames = new String[] { "", "", "", "", "NUMBER", "IDENTIFIER", "StringLiteral", "LPAR", "RPAR", "PLUS", "POINT", "MINUS", "APPOS", "SLASH", "DATE", "LETTER", "DIGIT", "FLOATINGPOINT", "WS", "COMMENT", "LINE_COMMENT", "','" }; 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 EOF=-1; 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 DATE=14; public static final int COMMENT=19; public CSVParserParser(TokenStream input) { super(input); } public String[] getTokenNames() { return tokenNames; } public String getGrammarFileName() { return "C:\\temp\\CSVParsingProject\\src\\CSVParser.g"; } // $ANTLR start start // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:7:1: start[Runner rn] : id= flightID ',' arTime= depTime ',' dTime= arrTime ',' sym= symbol ',' code1= code ',' name1= name ',' code2= code ',' name2= name ',' valDat= validDates ',' plane= planeType ',' freq= frequency ; public final void start(Runner rn) throws RecognitionException { flightID_return id = null; depTime_return arTime = null; arrTime_return dTime = null; symbol_return sym = null; code_return code1 = null; name_return name1 = null; code_return code2 = null; name_return name2 = null; validDates_return valDat = null; planeType_return plane = null; frequency_return freq = null; try { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:7:18: (id= flightID ',' arTime= depTime ',' dTime= arrTime ',' sym= symbol ',' code1= code ',' name1= name ',' code2= code ',' name2= name ',' valDat= validDates ',' plane= planeType ',' freq= frequency ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:7:20: id= flightID ',' arTime= depTime ',' dTime= arrTime ',' sym= symbol ',' code1= code ',' name1= name ',' code2= code ',' name2= name ',' valDat= validDates ',' plane= planeType ',' freq= frequency { pushFollow(FOLLOW_flightID_in_start17); id=flightID(); _fsp--; match(input,21,FOLLOW_21_in_start19); pushFollow(FOLLOW_depTime_in_start23); arTime=depTime(); _fsp--; match(input,21,FOLLOW_21_in_start25); pushFollow(FOLLOW_arrTime_in_start29); dTime=arrTime(); _fsp--; match(input,21,FOLLOW_21_in_start30); pushFollow(FOLLOW_symbol_in_start34); sym=symbol(); _fsp--; match(input,21,FOLLOW_21_in_start36); pushFollow(FOLLOW_code_in_start40); code1=code(); _fsp--; match(input,21,FOLLOW_21_in_start41); pushFollow(FOLLOW_name_in_start44); name1=name(); _fsp--; match(input,21,FOLLOW_21_in_start45); pushFollow(FOLLOW_code_in_start48); code2=code(); _fsp--; match(input,21,FOLLOW_21_in_start49); pushFollow(FOLLOW_name_in_start53); name2=name(); _fsp--; match(input,21,FOLLOW_21_in_start54); pushFollow(FOLLOW_validDates_in_start59); valDat=validDates(); _fsp--; match(input,21,FOLLOW_21_in_start60); pushFollow(FOLLOW_planeType_in_start64); plane=planeType(); _fsp--; match(input,21,FOLLOW_21_in_start65); pushFollow(FOLLOW_frequency_in_start68); freq=frequency(); _fsp--; rn.createEntry(input.toString(id.start,id.stop), input.toString(arTime.start,arTime.stop), input.toString(dTime.start,dTime.stop), input.toString(sym.start,sym.stop), input.toString(code1.start,code1.stop), input.toString(name1.start,name1.stop), input.toString(code2.start,code2.stop), input.toString(name2.start,name2.stop), input.toString(valDat.start,valDat.stop), input.toString(plane.start,plane.stop), input.toString(freq.start,freq.stop)); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return ; } // $ANTLR end start public static class flightID_return extends ParserRuleReturnScope { }; // $ANTLR start flightID // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:15:1: flightID : NUMBER ; public final flightID_return flightID() throws RecognitionException { flightID_return retval = new flightID_return(); retval.start = input.LT(1); try { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:15:9: ( NUMBER ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:15:11: NUMBER { match(input,NUMBER,FOLLOW_NUMBER_in_flightID80); } retval.stop = input.LT(-1); } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return retval; } // $ANTLR end flightID public static class depTime_return extends ParserRuleReturnScope { }; // $ANTLR start depTime // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:16:1: depTime : NUMBER ; public final depTime_return depTime() throws RecognitionException { depTime_return retval = new depTime_return(); retval.start = input.LT(1); try { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:16:9: ( NUMBER ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:16:11: NUMBER { match(input,NUMBER,FOLLOW_NUMBER_in_depTime87); } retval.stop = input.LT(-1); } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return retval; } // $ANTLR end depTime public static class arrTime_return extends ParserRuleReturnScope { }; // $ANTLR start arrTime // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:17:1: arrTime : ( . )+ ; public final arrTime_return arrTime() throws RecognitionException { arrTime_return retval = new arrTime_return(); retval.start = input.LT(1); try { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:17:9: ( ( . )+ ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:17:11: ( . )+ { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:17:11: ( . )+ int cnt1=0; loop1: do { int alt1=2; int LA1_0 = input.LA(1); if ( (LA1_0==21) ) { alt1=2; } else if ( ((LA1_0>=NUMBER && LA1_0<=LINE_COMMENT)) ) { alt1=1; } switch (alt1) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:17:12: . { matchAny(input); } break; default : if ( cnt1 >= 1 ) break loop1; EarlyExitException eee = new EarlyExitException(1, input); throw eee; } cnt1++; } while (true); } retval.stop = input.LT(-1); } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return retval; } // $ANTLR end arrTime public static class symbol_return extends ParserRuleReturnScope { }; // $ANTLR start symbol // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:18:1: symbol : IDENTIFIER ; public final symbol_return symbol() throws RecognitionException { symbol_return retval = new symbol_return(); retval.start = input.LT(1); try { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:18:9: ( IDENTIFIER ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:18:11: IDENTIFIER { match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_symbol105); } retval.stop = input.LT(-1); } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return retval; } // $ANTLR end symbol public static class code_return extends ParserRuleReturnScope { }; // $ANTLR start code // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:19:1: code : IDENTIFIER ; public final code_return code() throws RecognitionException { code_return retval = new code_return(); retval.start = input.LT(1); try { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:19:7: ( IDENTIFIER ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:19:9: IDENTIFIER { match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_code113); } retval.stop = input.LT(-1); } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return retval; } // $ANTLR end code public static class name_return extends ParserRuleReturnScope { }; // $ANTLR start name // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:20:1: name : ( ( . )+ | StringLiteral ) ; public final name_return name() throws RecognitionException { name_return retval = new name_return(); retval.start = input.LT(1); try { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:20:6: ( ( ( . )+ | StringLiteral ) ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:20:8: ( ( . )+ | StringLiteral ) { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:20:8: ( ( . )+ | StringLiteral ) int alt3=2; int LA3_0 = input.LA(1); if ( ((LA3_0>=NUMBER && LA3_0<=21)) ) { alt3=1; } else { NoViableAltException nvae = new NoViableAltException("20:8: ( ( . )+ | StringLiteral )", 3, 0, input); throw nvae; } switch (alt3) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:20:9: ( . )+ { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:20:9: ( . )+ int cnt2=0; loop2: do { int alt2=2; int LA2_0 = input.LA(1); if ( (LA2_0==21) ) { alt2=2; } else if ( ((LA2_0>=NUMBER && LA2_0<=LINE_COMMENT)) ) { alt2=1; } switch (alt2) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:20:10: . { matchAny(input); } break; default : if ( cnt2 >= 1 ) break loop2; EarlyExitException eee = new EarlyExitException(2, input); throw eee; } cnt2++; } while (true); } break; case 2 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:20:14: StringLiteral { match(input,StringLiteral,FOLLOW_StringLiteral_in_name126); } break; } } retval.stop = input.LT(-1); } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return retval; } // $ANTLR end name public static class validDates_return extends ParserRuleReturnScope { }; // $ANTLR start validDates // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:21:1: validDates : ( ( . )* | StringLiteral ) ; public final validDates_return validDates() throws RecognitionException { validDates_return retval = new validDates_return(); retval.start = input.LT(1); try { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:22:2: ( ( ( . )* | StringLiteral ) ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:22:4: ( ( . )* | StringLiteral ) { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:22:4: ( ( . )* | StringLiteral ) int alt5=2; int LA5_0 = input.LA(1); if ( (LA5_0==21) ) { alt5=1; } else if ( ((LA5_0>=NUMBER && LA5_0<=LINE_COMMENT)) ) { alt5=1; } else { NoViableAltException nvae = new NoViableAltException("22:4: ( ( . )* | StringLiteral )", 5, 0, input); throw nvae; } switch (alt5) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:22:5: ( . )* { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:22:5: ( . )* loop4: do { int alt4=2; int LA4_0 = input.LA(1); if ( (LA4_0==21) ) { alt4=2; } else if ( ((LA4_0>=NUMBER && LA4_0<=LINE_COMMENT)) ) { alt4=1; } switch (alt4) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:22:6: . { matchAny(input); } break; default : break loop4; } } while (true); } break; case 2 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:22:10: StringLiteral { match(input,StringLiteral,FOLLOW_StringLiteral_in_validDates141); } break; } } retval.stop = input.LT(-1); } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return retval; } // $ANTLR end validDates public static class planeType_return extends ParserRuleReturnScope { }; // $ANTLR start planeType // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:23:1: planeType : ( . )+ ; public final planeType_return planeType() throws RecognitionException { planeType_return retval = new planeType_return(); retval.start = input.LT(1); try { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:24:2: ( ( . )+ ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:24:4: ( . )+ { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:24:4: ( . )+ int cnt6=0; loop6: do { int alt6=2; int LA6_0 = input.LA(1); if ( (LA6_0==21) ) { alt6=2; } else if ( ((LA6_0>=NUMBER && LA6_0<=LINE_COMMENT)) ) { alt6=1; } switch (alt6) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:24:5: . { matchAny(input); } break; default : if ( cnt6 >= 1 ) break loop6; EarlyExitException eee = new EarlyExitException(6, input); throw eee; } cnt6++; } while (true); } retval.stop = input.LT(-1); } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return retval; } // $ANTLR end planeType public static class frequency_return extends ParserRuleReturnScope { }; // $ANTLR start frequency // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:25:1: frequency : ( . )+ ; public final frequency_return frequency() throws RecognitionException { frequency_return retval = new frequency_return(); retval.start = input.LT(1); try { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:26:2: ( ( . )+ ) // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:26:4: ( . )+ { // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:26:4: ( . )+ int cnt7=0; loop7: do { int alt7=2; int LA7_0 = input.LA(1); if ( (LA7_0==EOF) ) { alt7=2; } else if ( ((LA7_0>=NUMBER && LA7_0<=21)) ) { alt7=1; } switch (alt7) { case 1 : // C:\\temp\\CSVParsingProject\\src\\CSVParser.g:26:5: . { matchAny(input); } break; default : if ( cnt7 >= 1 ) break loop7; EarlyExitException eee = new EarlyExitException(7, input); throw eee; } cnt7++; } while (true); } retval.stop = input.LT(-1); } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return retval; } // $ANTLR end frequency public static final BitSet FOLLOW_flightID_in_start17 = new BitSet(new long[]{0x0000000000200000L}); public static final BitSet FOLLOW_21_in_start19 = new BitSet(new long[]{0x0000000000000010L}); public static final BitSet FOLLOW_depTime_in_start23 = new BitSet(new long[]{0x0000000000200000L}); public static final BitSet FOLLOW_21_in_start25 = new BitSet(new long[]{0x00000000003FFFF0L}); public static final BitSet FOLLOW_arrTime_in_start29 = new BitSet(new long[]{0x0000000000200000L}); public static final BitSet FOLLOW_21_in_start30 = new BitSet(new long[]{0x0000000000000020L}); public static final BitSet FOLLOW_symbol_in_start34 = new BitSet(new long[]{0x0000000000200000L}); public static final BitSet FOLLOW_21_in_start36 = new BitSet(new long[]{0x0000000000000020L}); public static final BitSet FOLLOW_code_in_start40 = new BitSet(new long[]{0x0000000000200000L}); public static final BitSet FOLLOW_21_in_start41 = new BitSet(new long[]{0x00000000003FFFF0L}); public static final BitSet FOLLOW_name_in_start44 = new BitSet(new long[]{0x0000000000200000L}); public static final BitSet FOLLOW_21_in_start45 = new BitSet(new long[]{0x0000000000000020L}); public static final BitSet FOLLOW_code_in_start48 = new BitSet(new long[]{0x0000000000200000L}); public static final BitSet FOLLOW_21_in_start49 = new BitSet(new long[]{0x00000000003FFFF0L}); public static final BitSet FOLLOW_name_in_start53 = new BitSet(new long[]{0x0000000000200000L}); public static final BitSet FOLLOW_21_in_start54 = new BitSet(new long[]{0x00000000003FFFF0L}); public static final BitSet FOLLOW_validDates_in_start59 = new BitSet(new long[]{0x0000000000200000L}); public static final BitSet FOLLOW_21_in_start60 = new BitSet(new long[]{0x00000000003FFFF0L}); public static final BitSet FOLLOW_planeType_in_start64 = new BitSet(new long[]{0x0000000000200000L}); public static final BitSet FOLLOW_21_in_start65 = new BitSet(new long[]{0x00000000003FFFF0L}); public static final BitSet FOLLOW_frequency_in_start68 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_NUMBER_in_flightID80 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_NUMBER_in_depTime87 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_IDENTIFIER_in_symbol105 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_IDENTIFIER_in_code113 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_StringLiteral_in_name126 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_StringLiteral_in_validDates141 = new BitSet(new long[]{0x0000000000000002L}); }