StationParser Class Reference

#include <StationParser.hpp>

Inheritance diagram for StationParser:

Inheritance graph
[legend]
Collaboration diagram for StationParser:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void initializeASTFactory (antlr::ASTFactory &factory)
 StationParser (antlr::TokenBuffer &tokenBuf)
 StationParser (antlr::TokenStream &lexer)
 StationParser (const antlr::ParserSharedInputState &state)
int getNumTokens () const
const char * getTokenName (int type) const
const char *const * getTokenNames () const
void stationfile ()
void stationline ()
std::string stringvalue ()
double datavalue ()
antlr::RefAST getAST ()

Public Attributes

std::vector< double > Latitudes
std::vector< double > Longitudes
std::vector< bool > HasLatLong
std::vector< std::string > Stationnames

Protected Member Functions

 StationParser (antlr::TokenBuffer &tokenBuf, int k)
 StationParser (antlr::TokenStream &lexer, int k)

Protected Attributes

antlr::RefAST returnAST

Detailed Description

Definition at line 19 of file StationParser.hpp.


Constructor & Destructor Documentation

StationParser::StationParser ( antlr::TokenBuffer &  tokenBuf,
int  k 
) [protected]

Definition at line 8 of file StationParser.cpp.

00009 : antlr::LLkParser(tokenBuf,k)
00010 {
00011 }

StationParser::StationParser ( antlr::TokenBuffer &  tokenBuf  ) 

Definition at line 13 of file StationParser.cpp.

00014 : antlr::LLkParser(tokenBuf,10)
00015 {
00016 }

StationParser::StationParser ( antlr::TokenStream &  lexer,
int  k 
) [protected]

Definition at line 18 of file StationParser.cpp.

00019 : antlr::LLkParser(lexer,k)
00020 {
00021 }

StationParser::StationParser ( antlr::TokenStream &  lexer  ) 

Definition at line 23 of file StationParser.cpp.

00024 : antlr::LLkParser(lexer,10)
00025 {
00026 }

StationParser::StationParser ( const antlr::ParserSharedInputState &  state  ) 

Definition at line 28 of file StationParser.cpp.

00029 : antlr::LLkParser(state,10)
00030 {
00031 }


Member Function Documentation

void StationParser::initializeASTFactory ( antlr::ASTFactory &  factory  ) 

Definition at line 142 of file StationParser.cpp.

00143 {
00144 }

int StationParser::getNumTokens (  )  const [inline]

Definition at line 42 of file StationParser.hpp.

00043         {
00044                 return StationParser::NUM_TOKENS;
00045         }

const char* StationParser::getTokenName ( int  type  )  const [inline]

Definition at line 46 of file StationParser.hpp.

00047         {
00048                 if( type > getNumTokens() ) return 0;
00049                 return StationParser::tokenNames[type];
00050         }

const char* const* StationParser::getTokenNames (  )  const [inline]

Definition at line 51 of file StationParser.hpp.

00052         {
00053                 return StationParser::tokenNames;
00054         }

void StationParser::stationfile (  ) 

Definition at line 33 of file StationParser.cpp.

References ENTRY, and stationline().

Referenced by SeismicStationList::GetData(), and CMTStationList::GetData().

00033                                 {
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 }

Here is the call graph for this function:

void StationParser::stationline (  ) 

Definition at line 58 of file StationParser.cpp.

References datavalue(), ENTRY, HasLatLong, Latitudes, Longitudes, NEWLINE, Stationnames, and stringvalue().

Referenced by stationfile().

00058                                 {
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 }

Here is the call graph for this function:

std::string StationParser::stringvalue (  ) 

Definition at line 102 of file StationParser.cpp.

References ENTRY.

Referenced by stationline().

00102                                       {
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 }

double StationParser::datavalue (  ) 

Definition at line 122 of file StationParser.cpp.

References ENTRY.

Referenced by stationline().

00122                                  {
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 }

antlr::RefAST StationParser::getAST (  )  [inline]

Definition at line 60 of file StationParser.hpp.

00061         {
00062                 return returnAST;
00063         }


Member Data Documentation

std::vector<double> StationParser::Latitudes

Definition at line 26 of file StationParser.hpp.

Referenced by SeismicStationList::GetData(), CMTStationList::GetData(), and stationline().

std::vector<double> StationParser::Longitudes

Definition at line 27 of file StationParser.hpp.

Referenced by SeismicStationList::GetData(), CMTStationList::GetData(), and stationline().

std::vector<bool> StationParser::HasLatLong

Definition at line 28 of file StationParser.hpp.

Referenced by SeismicStationList::GetData(), CMTStationList::GetData(), and stationline().

std::vector<std::string> StationParser::Stationnames

Definition at line 29 of file StationParser.hpp.

Referenced by SeismicStationList::GetData(), CMTStationList::GetData(), and stationline().

antlr::RefAST StationParser::returnAST [protected]

Definition at line 66 of file StationParser.hpp.


The documentation for this class was generated from the following files:
Generated on Thu Nov 22 14:10:41 2007 for GPLIB++ by  doxygen 1.5.1