CPTensorConfParser Class Reference

#include <CPTensorConfParser.hpp>

Inheritance diagram for CPTensorConfParser:

Inheritance graph
[legend]
Collaboration diagram for CPTensorConfParser:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void initializeASTFactory (antlr::ASTFactory &factory)
 CPTensorConfParser (antlr::TokenBuffer &tokenBuf)
 CPTensorConfParser (antlr::TokenStream &lexer)
 CPTensorConfParser (const antlr::ParserSharedInputState &state)
int getNumTokens () const
const char * getTokenName (int type) const
const char *const * getTokenNames () const
void configentry ()
double numvalue ()
bool boolvalue ()
void configfile ()
std::string stringvalue ()
antlr::RefAST getAST ()

Public Attributes

double scalefactor
bool normalize
bool writetensor
bool writeserialparallel
bool calcerr

Protected Member Functions

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

Protected Attributes

antlr::RefAST returnAST

Detailed Description

Definition at line 18 of file CPTensorConfParser.hpp.


Constructor & Destructor Documentation

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

Definition at line 8 of file CPTensorConfParser.cpp.

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

CPTensorConfParser::CPTensorConfParser ( antlr::TokenBuffer &  tokenBuf  ) 

Definition at line 13 of file CPTensorConfParser.cpp.

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

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

Definition at line 18 of file CPTensorConfParser.cpp.

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

CPTensorConfParser::CPTensorConfParser ( antlr::TokenStream &  lexer  ) 

Definition at line 23 of file CPTensorConfParser.cpp.

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

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

Definition at line 28 of file CPTensorConfParser.cpp.

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


Member Function Documentation

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

Definition at line 249 of file CPTensorConfParser.cpp.

00250 {
00251 }

int CPTensorConfParser::getNumTokens (  )  const [inline]

Definition at line 42 of file CPTensorConfParser.hpp.

00043         {
00044                 return CPTensorConfParser::NUM_TOKENS;
00045         }

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

Definition at line 46 of file CPTensorConfParser.hpp.

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

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

Definition at line 51 of file CPTensorConfParser.hpp.

00052         {
00053                 return CPTensorConfParser::tokenNames;
00054         }

void CPTensorConfParser::configentry (  ) 

Definition at line 33 of file CPTensorConfParser.cpp.

References boolvalue(), calcerr, CALCERRT, EQUAL, normalize, NORMALIZET, numvalue(), scalefactor, SCALEFACTORT, writeserialparallel, WRITESERIALPARALLELT, writetensor, and WRITETENSORT.

Referenced by configfile().

00033                                      {
00034         
00035         try {      // for error handling
00036                 {
00037                 switch ( LA(1)) {
00038                 case SCALEFACTORT:
00039                 {
00040                         match(SCALEFACTORT);
00041                         match(EQUAL);
00042                         scalefactor=numvalue();
00043                         break;
00044                 }
00045                 case NORMALIZET:
00046                 {
00047                         match(NORMALIZET);
00048                         match(EQUAL);
00049                         normalize=boolvalue();
00050                         break;
00051                 }
00052                 case WRITETENSORT:
00053                 {
00054                         match(WRITETENSORT);
00055                         match(EQUAL);
00056                         writetensor=boolvalue();
00057                         break;
00058                 }
00059                 case WRITESERIALPARALLELT:
00060                 {
00061                         match(WRITESERIALPARALLELT);
00062                         match(EQUAL);
00063                         writeserialparallel=boolvalue();
00064                         break;
00065                 }
00066                 case CALCERRT:
00067                 {
00068                         match(CALCERRT);
00069                         match(EQUAL);
00070                         calcerr=boolvalue();
00071                         break;
00072                 }
00073                 default:
00074                 {
00075                         throw antlr::NoViableAltException(LT(1), getFilename());
00076                 }
00077                 }
00078                 }
00079         }
00080         catch (antlr::RecognitionException& ex) {
00081                 if( inputState->guessing == 0 ) {
00082                         reportError(ex);
00083                         recover(ex,_tokenSet_0);
00084                 } else {
00085                         throw;
00086                 }
00087         }
00088 }

Here is the call graph for this function:

double CPTensorConfParser::numvalue (  ) 

Definition at line 90 of file CPTensorConfParser.cpp.

References NUMBER.

Referenced by configentry().

00090                                      {
00091 #line 48 "CPTensorConf.g"
00092         double r;
00093 #line 94 "CPTensorConfParser.cpp"
00094         antlr::RefToken  currvalue = antlr::nullToken;
00095         
00096         try {      // for error handling
00097                 currvalue = LT(1);
00098                 match(NUMBER);
00099                 if ( inputState->guessing==0 ) {
00100 #line 49 "CPTensorConf.g"
00101                         r = atof(currvalue->getText().c_str());
00102 #line 103 "CPTensorConfParser.cpp"
00103                 }
00104         }
00105         catch (antlr::RecognitionException& ex) {
00106                 if( inputState->guessing == 0 ) {
00107                         reportError(ex);
00108                         recover(ex,_tokenSet_0);
00109                 } else {
00110                         throw;
00111                 }
00112         }
00113         return r;
00114 }

bool CPTensorConfParser::boolvalue (  ) 

Definition at line 116 of file CPTensorConfParser.cpp.

References FALSE, and TRUE.

Referenced by configentry().

00116                                     {
00117 #line 52 "CPTensorConf.g"
00118         bool r;
00119 #line 120 "CPTensorConfParser.cpp"
00120         
00121         try {      // for error handling
00122                 {
00123                 switch ( LA(1)) {
00124                 case TRUE:
00125                 {
00126                         match(TRUE);
00127                         if ( inputState->guessing==0 ) {
00128 #line 53 "CPTensorConf.g"
00129                                 r = true;
00130 #line 131 "CPTensorConfParser.cpp"
00131                         }
00132                         break;
00133                 }
00134                 case FALSE:
00135                 {
00136                         match(FALSE);
00137                         if ( inputState->guessing==0 ) {
00138 #line 53 "CPTensorConf.g"
00139                                 r = false;
00140 #line 141 "CPTensorConfParser.cpp"
00141                         }
00142                         break;
00143                 }
00144                 default:
00145                 {
00146                         throw antlr::NoViableAltException(LT(1), getFilename());
00147                 }
00148                 }
00149                 }
00150         }
00151         catch (antlr::RecognitionException& ex) {
00152                 if( inputState->guessing == 0 ) {
00153                         reportError(ex);
00154                         recover(ex,_tokenSet_0);
00155                 } else {
00156                         throw;
00157                 }
00158         }
00159         return r;
00160 }

void CPTensorConfParser::configfile (  ) 

Definition at line 162 of file CPTensorConfParser.cpp.

References calcerr, COMMENT, configentry(), EQUAL, normalize, scalefactor, writeserialparallel, and writetensor.

Referenced by CPTensorConf::GetData().

00162                                     {
00163 #line 38 "CPTensorConf.g"
00164         
00165         scalefactor = 5;
00166         normalize = true;
00167         writetensor = false;
00168         writeserialparallel = false;
00169         calcerr = false;
00170         
00171 #line 172 "CPTensorConfParser.cpp"
00172         
00173         try {      // for error handling
00174                 { // ( ... )+
00175                 int _cnt18=0;
00176                 for (;;) {
00177                         if ((_tokenSet_1.member(LA(1)))) {
00178                                 configentry();
00179                                 {
00180                                 if ((LA(1) == COMMENT) && (_tokenSet_0.member(LA(2))) && (LA(3) == antlr::Token::EOF_TYPE || LA(3) == EQUAL || LA(3) == COMMENT) && (_tokenSet_2.member(LA(4))) && (_tokenSet_0.member(LA(5))) && (_tokenSet_3.member(LA(6))) && (_tokenSet_4.member(LA(7))) && (_tokenSet_5.member(LA(8))) && (_tokenSet_3.member(LA(9))) && (_tokenSet_6.member(LA(10)))) {
00181                                         match(COMMENT);
00182                                 }
00183                                 else if ((_tokenSet_0.member(LA(1))) && (LA(2) == antlr::Token::EOF_TYPE || LA(2) == EQUAL || LA(2) == COMMENT) && (_tokenSet_2.member(LA(3))) && (_tokenSet_0.member(LA(4))) && (_tokenSet_3.member(LA(5))) && (_tokenSet_4.member(LA(6))) && (_tokenSet_5.member(LA(7))) && (_tokenSet_3.member(LA(8))) && (_tokenSet_6.member(LA(9))) && (_tokenSet_6.member(LA(10)))) {
00184                                 }
00185                                 else {
00186                                         throw antlr::NoViableAltException(LT(1), getFilename());
00187                                 }
00188                                 
00189                                 }
00190                         }
00191                         else {
00192                                 if ( _cnt18>=1 ) { goto _loop18; } else {throw antlr::NoViableAltException(LT(1), getFilename());}
00193                         }
00194                         
00195                         _cnt18++;
00196                 }
00197                 _loop18:;
00198                 }  // ( ... )+
00199                 { // ( ... )*
00200                 for (;;) {
00201                         if ((LA(1) == COMMENT)) {
00202                                 match(COMMENT);
00203                         }
00204                         else {
00205                                 goto _loop20;
00206                         }
00207                         
00208                 }
00209                 _loop20:;
00210                 } // ( ... )*
00211                 match(antlr::Token::EOF_TYPE);
00212         }
00213         catch (antlr::RecognitionException& ex) {
00214                 if( inputState->guessing == 0 ) {
00215                         reportError(ex);
00216                         recover(ex,_tokenSet_7);
00217                 } else {
00218                         throw;
00219                 }
00220         }
00221 }

Here is the call graph for this function:

std::string CPTensorConfParser::stringvalue (  ) 

Definition at line 223 of file CPTensorConfParser.cpp.

References STRING.

00223                                            {
00224 #line 56 "CPTensorConf.g"
00225         std::string r;
00226 #line 227 "CPTensorConfParser.cpp"
00227         antlr::RefToken  currvalue = antlr::nullToken;
00228         
00229         try {      // for error handling
00230                 currvalue = LT(1);
00231                 match(STRING);
00232                 if ( inputState->guessing==0 ) {
00233 #line 57 "CPTensorConf.g"
00234                         r = currvalue->getText();
00235 #line 236 "CPTensorConfParser.cpp"
00236                 }
00237         }
00238         catch (antlr::RecognitionException& ex) {
00239                 if( inputState->guessing == 0 ) {
00240                         reportError(ex);
00241                         recover(ex,_tokenSet_7);
00242                 } else {
00243                         throw;
00244                 }
00245         }
00246         return r;
00247 }

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

Definition at line 61 of file CPTensorConfParser.hpp.

00062         {
00063                 return returnAST;
00064         }


Member Data Documentation

double CPTensorConfParser::scalefactor

Definition at line 25 of file CPTensorConfParser.hpp.

Referenced by configentry(), configfile(), and CPTensorConf::GetData().

bool CPTensorConfParser::normalize

Definition at line 26 of file CPTensorConfParser.hpp.

Referenced by configentry(), configfile(), and CPTensorConf::GetData().

bool CPTensorConfParser::writetensor

Definition at line 27 of file CPTensorConfParser.hpp.

Referenced by configentry(), configfile(), and CPTensorConf::GetData().

bool CPTensorConfParser::writeserialparallel

Definition at line 28 of file CPTensorConfParser.hpp.

Referenced by configentry(), configfile(), and CPTensorConf::GetData().

bool CPTensorConfParser::calcerr

Definition at line 29 of file CPTensorConfParser.hpp.

Referenced by configentry(), configfile(), and CPTensorConf::GetData().

antlr::RefAST CPTensorConfParser::returnAST [protected]

Definition at line 67 of file CPTensorConfParser.hpp.


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