StationParser.cpp

Go to the documentation of this file.
00001 /* $ANTLR 2.7.6 (20070220): "StationParser.g" -> "StationParser.cpp"$ */
00002 #include "StationParser.hpp"
00003 #include <antlr/NoViableAltException.hpp>
00004 #include <antlr/SemanticException.hpp>
00005 #include <antlr/ASTFactory.hpp>
00006 #line 1 "StationParser.g"
00007 #line 8 "StationParser.cpp"
00008 StationParser::StationParser(antlr::TokenBuffer& tokenBuf, int k)
00009 : antlr::LLkParser(tokenBuf,k)
00010 {
00011 }
00012 
00013 StationParser::StationParser(antlr::TokenBuffer& tokenBuf)
00014 : antlr::LLkParser(tokenBuf,10)
00015 {
00016 }
00017 
00018 StationParser::StationParser(antlr::TokenStream& lexer, int k)
00019 : antlr::LLkParser(lexer,k)
00020 {
00021 }
00022 
00023 StationParser::StationParser(antlr::TokenStream& lexer)
00024 : antlr::LLkParser(lexer,10)
00025 {
00026 }
00027 
00028 StationParser::StationParser(const antlr::ParserSharedInputState& state)
00029 : antlr::LLkParser(state,10)
00030 {
00031 }
00032 
00033 void StationParser::stationfile() {
00034         
00035         try {      // for error handling
00036                 { // ( ... )+
00037                 int _cnt3=0;
00038                 for (;;) {
00039                         if ((LA(1) == ENTRY)) {
00040                                 stationline();
00041                         }
00042                         else {
00043                                 if ( _cnt3>=1 ) { goto _loop3; } else {throw antlr::NoViableAltException(LT(1), getFilename());}
00044                         }
00045                         
00046                         _cnt3++;
00047                 }
00048                 _loop3:;
00049                 }  // ( ... )+
00050                 match(antlr::Token::EOF_TYPE);
00051         }
00052         catch (antlr::RecognitionException& ex) {
00053                 reportError(ex);
00054                 recover(ex,_tokenSet_0);
00055         }
00056 }
00057 
00058 void StationParser::stationline() {
00059 #line 34 "StationParser.g"
00060         double latde,longde; std::string name;
00061 #line 62 "StationParser.cpp"
00062         
00063         try {      // for error handling
00064                 name=stringvalue();
00065 #line 36 "StationParser.g"
00066                 Stationnames.push_back(name);
00067 #line 68 "StationParser.cpp"
00068                 {
00069                 switch ( LA(1)) {
00070                 case ENTRY:
00071                 {
00072                         {
00073                         longde=datavalue();
00074                         latde=datavalue();
00075                         }
00076 #line 37 "StationParser.g"
00077                         Latitudes.push_back(latde); Longitudes.push_back(longde); HasLatLong.push_back(true);
00078 #line 79 "StationParser.cpp"
00079                         break;
00080                 }
00081                 case NEWLINE:
00082                 {
00083 #line 38 "StationParser.g"
00084                         Latitudes.push_back(0); Longitudes.push_back(0); HasLatLong.push_back(false);
00085 #line 86 "StationParser.cpp"
00086                         break;
00087                 }
00088                 default:
00089                 {
00090                         throw antlr::NoViableAltException(LT(1), getFilename());
00091                 }
00092                 }
00093                 }
00094                 match(NEWLINE);
00095         }
00096         catch (antlr::RecognitionException& ex) {
00097                 reportError(ex);
00098                 recover(ex,_tokenSet_1);
00099         }
00100 }
00101 
00102 std::string  StationParser::stringvalue() {
00103 #line 47 "StationParser.g"
00104         std::string r;
00105 #line 106 "StationParser.cpp"
00106         antlr::RefToken  currvalue = antlr::nullToken;
00107         
00108         try {      // for error handling
00109                 currvalue = LT(1);
00110                 match(ENTRY);
00111 #line 48 "StationParser.g"
00112                 r = currvalue->getText();
00113 #line 114 "StationParser.cpp"
00114         }
00115         catch (antlr::RecognitionException& ex) {
00116                 reportError(ex);
00117                 recover(ex,_tokenSet_2);
00118         }
00119         return r;
00120 }
00121 
00122 double  StationParser::datavalue() {
00123 #line 42 "StationParser.g"
00124         double r;
00125 #line 126 "StationParser.cpp"
00126         antlr::RefToken  currvalue = antlr::nullToken;
00127         
00128         try {      // for error handling
00129                 currvalue = LT(1);
00130                 match(ENTRY);
00131 #line 44 "StationParser.g"
00132                 r = atof(currvalue->getText().c_str());
00133 #line 134 "StationParser.cpp"
00134         }
00135         catch (antlr::RecognitionException& ex) {
00136                 reportError(ex);
00137                 recover(ex,_tokenSet_2);
00138         }
00139         return r;
00140 }
00141 
00142 void StationParser::initializeASTFactory( antlr::ASTFactory& )
00143 {
00144 }
00145 const char* StationParser::tokenNames[] = {
00146         "<0>",
00147         "EOF",
00148         "<2>",
00149         "NULL_TREE_LOOKAHEAD",
00150         "NEWLINE",
00151         "ENTRY",
00152         "WS",
00153         "COMMENT",
00154         "PLUS",
00155         "MINUS",
00156         "DIGIT",
00157         "CHAR",
00158         "OTHER",
00159         0
00160 };
00161 
00162 const unsigned long StationParser::_tokenSet_0_data_[] = { 2UL, 0UL, 0UL, 0UL };
00163 // EOF 
00164 const antlr::BitSet StationParser::_tokenSet_0(_tokenSet_0_data_,4);
00165 const unsigned long StationParser::_tokenSet_1_data_[] = { 34UL, 0UL, 0UL, 0UL };
00166 // EOF ENTRY 
00167 const antlr::BitSet StationParser::_tokenSet_1(_tokenSet_1_data_,4);
00168 const unsigned long StationParser::_tokenSet_2_data_[] = { 48UL, 0UL, 0UL, 0UL };
00169 // NEWLINE ENTRY 
00170 const antlr::BitSet StationParser::_tokenSet_2(_tokenSet_2_data_,4);
00171 
00172 

Generated on Thu Nov 22 13:58:27 2007 for GPLIB++ by  doxygen 1.5.1