cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Data Fields | Private Member Functions | Private Attributes
Parser Class Reference

#include <parser.h>

Collaboration diagram for Parser:
Collaboration graph
[legend]

Public Member Functions

 Parser (void)
 
 Parser (const CloudyCommand *commands)
 
bool getline ()
 
void setline (const char *const card)
 
void set_point (long int ipnt)
 
const char * nWord (const char *chKey) const
 
long int GetElem (void) const
 
double FFmtRead (void)
 
double getNumberPlain (const char *chDesc)
 
double getNumberCheck (const char *chDesc)
 
double getNumberDefault (const char *chDesc, double fdef)
 
double getNumberCheckLogLinNegImplLog (const char *chDesc)
 
double getNumberCheckAlwaysLog (const char *chDesc)
 
double getNumberCheckAlwaysLogLim (const char *chDesc, double flim)
 
double getNumberDefaultAlwaysLog (const char *chDesc, double fdef)
 
double getNumberDefaultNegImplLog (const char *chDesc, double fdef)
 
bool lgEOL (void) const
 
void setEOL (bool val)
 
NORETURN void NoNumb (const char *chDesc) const
 
bool nMatch (const char *chKey) const
 
bool GetParam (const char *chKey, double *val)
 
bool GetRange (const char *chKey, double *val1, double *val2)
 
bool nMatchErase (const char *chKey)
 
bool hasCommand (const char *s2)
 
bool Command (const char *name, OptionParser doOpts)
 
bool isComment (void) const
 
bool isCommandComment (void) const
 
bool isVar (void) const
 
std::string getVarName (void)
 
void doSetVar (void)
 
void echo (void) const
 
bool last (void) const
 
int PrintLine (FILE *fp) const
 
NORETURN void CommandError (void) const
 
NORETURN void Error (const char *msg) const
 
NORETURN void StringError () const
 
int GetQuote (string &chLabel)
 
const char * StandardEnergyUnit (void) const
 
string StandardFluxUnit (void) const
 
string getFirstChunk (long i)
 
string getRawTail ()
 
void help (FILE *fp) const
 
double getWave ()
 
double getWaveOpt ()
 
LineID getLineID ()
 
Symbol getSymbol ()
 
void getPairs (vector< double > &a, vector< double > &b)
 
void readList (vector< string > &list, const char *chName)
 
void readLaw (DepthTable &table)
 

Data Fields

long int m_nqh
 
long int m_nInitFile
 
bool m_lgDSet
 
bool m_lgEOF
 

Private Member Functions

void init ()
 
void newlineProcess ()
 
bool at_end () const
 
char current (void) const
 
char current_raw () const
 
int nMatch1 (const char *chKey) const
 

Private Attributes

char m_card [INPUT_LINE_LENGTH]
 
char m_card_raw [INPUT_LINE_LENGTH]
 
long int m_len
 
long int m_off
 
bool m_lgEOL
 
const CloudyCommand *const m_Commands
 
std::map< string, double > m_symtab
 

Detailed Description

Parser class holds pointer to string currently being analysed

Definition at line 42 of file parser.h.

Constructor & Destructor Documentation

Parser::Parser ( void  )
inlineexplicit

Definition at line 55 of file parser.h.

References init().

Here is the call graph for this function:

Parser::Parser ( const CloudyCommand commands)
inlineexplicit

Definition at line 59 of file parser.h.

References init().

Here is the call graph for this function:

Member Function Documentation

bool Parser::at_end ( ) const
private

Definition at line 37 of file parser.cpp.

References current().

Referenced by doSetVar(), getSymbol(), getVarName(), and hasCommand().

Here is the call graph for this function:

bool Parser::Command ( const char *  name,
OptionParser  doOpts 
)
inline

Definition at line 183 of file parser.h.

References hasCommand().

Referenced by ParseCommands().

Here is the call graph for this function:

NORETURN void Parser::CommandError ( void  ) const

Definition at line 239 of file parser.cpp.

References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, fprintf(), ioQQQ, m_card, and PrintLine().

Referenced by ParseCommands().

Here is the call graph for this function:

char Parser::current ( void  ) const
inlineprivate

Definition at line 72 of file parser.h.

References m_card, and m_off.

Referenced by at_end(), doSetVar(), FFmtRead(), getSymbol(), getVarName(), getWaveOpt(), hasCommand(), and isVar().

char Parser::current_raw ( ) const
private

Definition at line 41 of file parser.cpp.

References m_card_raw, and m_off.

Referenced by getSymbol().

void Parser::doSetVar ( void  )

Definition at line 139 of file parser.cpp.

References at_end(), cdEXIT, current(), DEBUG_ENTRY, EXIT_FAILURE, FFmtRead(), fprintf(), getVarName(), ioQQQ, m_off, and m_symtab.

Referenced by ParseCommands().

Here is the call graph for this function:

void Parser::echo ( void  ) const

Definition at line 167 of file parser.cpp.

References called, fprintf(), ioQQQ, t_called::lgTalk, m_card, m_card_raw, and nMatch().

Referenced by ParseAbundances(), ParseCommands(), and ParseInterp().

Here is the call graph for this function:

NORETURN void Parser::Error ( const char *  msg) const

Definition at line 228 of file parser.cpp.

References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, fprintf(), ioQQQ, and PrintLine().

Referenced by StringError().

Here is the call graph for this function:

double Parser::FFmtRead ( void  )

Definition at line 438 of file parser.cpp.

References ASSERT, current(), DEBUG_ENTRY, fprintf(), getVarName(), ioQQQ, m_card, m_len, m_lgEOL, m_off, m_symtab, and ParseExpr().

Referenced by doSetVar(), getNumberCheck(), getNumberDefault(), getNumberDefaultAlwaysLog(), getNumberDefaultNegImplLog(), getNumberPlain(), GetOptColDen(), GetOptLineInt(), GetOptTemp(), getPairs(), GetParam(), GetRange(), getWaveOpt(), parse_save_average(), Parse_Save_Line_RT(), ParseAbsMag(), ParseAbundances(), ParseAge(), ParseAgn(), ParseAperture(), ParseBackgrd(), ParseBlackbody(), ParseBremsstrahlung(), ParseCaseB(), ParseCExtra(), ParseCMBOuter(), ParseCompile(), ParseConstant(), ParseCoronal(), ParseCosmicRays(), ParseCosmology(), ParseCovering(), ParseCrashDo(), ParseCylinder(), ParseDatabase(), ParseDatabaseH2(), ParseDatabaseISO(), ParseDiffuse(), ParseDistance(), ParseDLaw(), ParseDrive(), ParseEden(), ParseElement(), ParseEnergy(), ParseExtinguish(), ParseF_nu(), ParseFail(), ParseFill(), ParseFluc(), ParseForceTemperature(), ParseFudge(), ParseGlobule(), ParseGrain(), ParseGravity(), ParseGrid(), ParseHDEN(), ParseHExtra(), ParseIlluminate(), ParseIntensity(), ParseInterp(), ParseIonPar(), ParseIterations(), ParseLaser(), ParseLuminosity(), ParseMap(), ParseMetal(), ParseMonitorResults(), ParseNeutrons(), ParseNorm(), ParseOptimize(), ParsePhi(), ParsePlotRangeContin(), ParsePlotRangeOption(), ParsePowerlawContinuum(), ParsePrint(), ParseQH(), ParseRadius(), ParseRangeOption(), ParseRatio(), ParseSave(), ParseSet(), ParseSphere(), ParseStop(), ParseTable(), ParseTauMin(), ParseTLaw(), ParseTrace(), ParseTurbulence(), ParseVLaw(), and readLaw().

Here is the call graph for this function:

long int Parser::GetElem ( void  ) const
string Parser::getFirstChunk ( long  i)

Definition at line 520 of file parser.cpp.

References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, fprintf(), ioQQQ, m_card, m_len, and m_off.

Referenced by getLineID(), GetOptColDen(), and GetOptTemp().

Here is the call graph for this function:

bool Parser::getline ( void  )
LineID Parser::getLineID ( )

Definition at line 535 of file parser.cpp.

References LineID::chLabel, DEBUG_ENTRY, fprintf(), getFirstChunk(), GetQuote(), getWaveOpt(), ioQQQ, trimTrailingWhiteSpace(), and LineID::wave.

Referenced by GetOptLineInt(), parse_save_line(), and ParsePrtLineSum().

Here is the call graph for this function:

double Parser::getNumberCheck ( const char *  chDesc)

Definition at line 358 of file parser.cpp.

References FFmtRead(), lgEOL(), and NoNumb().

Referenced by getNumberCheckAlwaysLog(), getNumberCheckAlwaysLogLim(), getNumberCheckLogLinNegImplLog(), ParseDynaWind(), and ParseMagnet().

Here is the call graph for this function:

double Parser::getNumberCheckAlwaysLog ( const char *  chDesc)

Definition at line 393 of file parser.cpp.

References exp10(), and getNumberCheck().

Referenced by ParseDarkMatter(), ParseDynaTime(), and ParseMagnet().

Here is the call graph for this function:

double Parser::getNumberCheckAlwaysLogLim ( const char *  chDesc,
double  flim 
)

Definition at line 399 of file parser.cpp.

References exp10(), fprintf(), getNumberCheck(), and ioQQQ.

Referenced by ParseDynaTime().

Here is the call graph for this function:

double Parser::getNumberCheckLogLinNegImplLog ( const char *  chDesc)

Definition at line 376 of file parser.cpp.

References exp10(), getNumberCheck(), and nMatch().

Referenced by abund_starburst().

Here is the call graph for this function:

double Parser::getNumberDefault ( const char *  chDesc,
double  fdef 
)

Definition at line 367 of file parser.cpp.

References FFmtRead(), and lgEOL().

Referenced by diatomics::H2_ParseSave(), ParseDynaWind(), and ParseMagnet().

Here is the call graph for this function:

double Parser::getNumberDefaultAlwaysLog ( const char *  chDesc,
double  fdef 
)

Definition at line 412 of file parser.cpp.

References exp10(), FFmtRead(), and lgEOL().

Referenced by ParseDarkMatter(), and ParseDynaTime().

Here is the call graph for this function:

double Parser::getNumberDefaultNegImplLog ( const char *  chDesc,
double  fdef 
)

Definition at line 421 of file parser.cpp.

References exp10(), FFmtRead(), and lgEOL().

Referenced by diatomics::H2_ParseSave().

Here is the call graph for this function:

double Parser::getNumberPlain ( const char *  chDesc)

Definition at line 354 of file parser.cpp.

References FFmtRead().

Referenced by ParseDynaWind().

Here is the call graph for this function:

void Parser::getPairs ( vector< double > &  a,
vector< double > &  b 
)

Definition at line 728 of file parser.cpp.

References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, FFmtRead(), fprintf(), getline(), hasCommand(), ioQQQ, isComment(), lgEOL(), and m_lgEOF.

Here is the call graph for this function:

bool Parser::GetParam ( const char *  chKey,
double *  val 
)
inline

Definition at line 144 of file parser.h.

References FFmtRead(), m_off, and nMatch1().

Referenced by ParseMonitorResults().

Here is the call graph for this function:

int Parser::GetQuote ( string &  chLabel)

find string between pair of double quotes. Returns 0 for success, 1 for failure typical use is to follow failure by p.StringError();

Definition at line 184 of file parser.cpp.

References DEBUG_ENTRY, m_card, m_card_raw, strchr_s(), and TotalInsanity().

Referenced by getLineID(), ParseAbundances(), ParseCompile(), ParseDatabase(), ParseDrive(), ParseGrain(), ParseGrid(), ParseInit(), ParseMonitorResults(), ParseNorm(), ParseOptimize(), ParsePrint(), ParseSave(), ParseSet(), ParseSpecies(), ParseState(), ParseStop(), ParseTable(), ParseTitle(), and readList().

Here is the call graph for this function:

bool Parser::GetRange ( const char *  chKey,
double *  val1,
double *  val2 
)
inline

Definition at line 153 of file parser.h.

References FFmtRead(), m_off, and nMatch1().

Referenced by ParseMonitorResults().

Here is the call graph for this function:

string Parser::getRawTail ( )
inline

Definition at line 211 of file parser.h.

References m_card_raw, and m_off.

Referenced by ParseBackgrd(), and ParseTitle().

Symbol Parser::getSymbol ( )
std::string Parser::getVarName ( void  )

Definition at line 126 of file parser.cpp.

References at_end(), current(), and m_off.

Referenced by doSetVar(), and FFmtRead().

Here is the call graph for this function:

double Parser::getWave ( )

Definition at line 345 of file parser.cpp.

References getWaveOpt(), lgEOL(), and NoNumb().

Referenced by ParseMonitorResults(), ParseNorm(), ParsePrint(), and ParseStop().

Here is the call graph for this function:

double Parser::getWaveOpt ( )

Definition at line 329 of file parser.cpp.

References current(), and FFmtRead().

Referenced by getLineID(), getWave(), and ParseStop().

Here is the call graph for this function:

bool Parser::hasCommand ( const char *  s2)
void Parser::help ( FILE *  fp) const

Definition at line 267 of file parser.cpp.

References cdEXIT, DEBUG_ENTRY, EXIT_SUCCESS, fprintf(), and m_Commands.

Referenced by ParseHelp().

Here is the call graph for this function:

void Parser::init ( void  )
inlineprivate

Definition at line 64 of file parser.h.

References m_lgDSet, m_lgEOF, m_nInitFile, m_nqh, and setline().

Referenced by Parser().

Here is the call graph for this function:

bool Parser::isCommandComment ( void  ) const

Definition at line 117 of file parser.cpp.

References isComment(), and m_card.

Referenced by ParseCommands().

Here is the call graph for this function:

bool Parser::isComment ( void  ) const

Definition at line 113 of file parser.cpp.

References lgInputComment(), and m_card.

Referenced by getPairs(), isCommandComment(), ParseAbundances(), ParseInterp(), and readList().

Here is the call graph for this function:

bool Parser::isVar ( void  ) const

Definition at line 122 of file parser.cpp.

References current().

Referenced by ParseCommands().

Here is the call graph for this function:

bool Parser::last ( void  ) const
inline

Definition at line 196 of file parser.h.

References m_card, and m_lgEOF.

Referenced by ParseCommands(), and ParseInterp().

bool Parser::lgEOL ( void  ) const
inline
void Parser::newlineProcess ( void  )
private

Definition at line 45 of file parser.cpp.

References caps(), INPUT_LINE_LENGTH, m_card, m_card_raw, m_len, m_lgEOL, and m_off.

Referenced by getline(), and setline().

Here is the call graph for this function:

bool Parser::nMatch ( const char *  chKey) const
inline
int Parser::nMatch1 ( const char *  chKey) const
inlineprivate

Definition at line 113 of file parser.h.

References ASSERT, isBoundaryChar(), m_card, nMatch(), and nWord().

Referenced by GetParam(), GetRange(), nMatch(), and nMatchErase().

Here is the call graph for this function:

bool Parser::nMatchErase ( const char *  chKey)
inline

Definition at line 163 of file parser.h.

References m_card, and nMatch1().

Referenced by ParseCompile(), ParseGrain(), ParseMonitorResults(), ParseSave(), and ParseTable().

Here is the call graph for this function:

NORETURN void Parser::NoNumb ( const char *  chDesc) const
const char * Parser::nWord ( const char *  chKey) const

Definition at line 32 of file parser.cpp.

References m_card, and nWord().

Referenced by nMatch1(), ParseAge(), and parserProcess().

Here is the call graph for this function:

int Parser::PrintLine ( FILE *  fp) const
inline
void Parser::readLaw ( DepthTable table)
void Parser::readList ( vector< string > &  list,
const char *  chName 
)

Definition at line 909 of file parser.cpp.

References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, fprintf(), getline(), GetQuote(), hasCommand(), ioQQQ, isComment(), m_card_raw, and m_lgEOF.

Here is the call graph for this function:

void Parser::set_point ( long int  ipnt)
inline

Definition at line 87 of file parser.h.

References m_off.

Referenced by ParseBackgrd(), ParseCMBOuter(), ParseRangeOption(), and ParseTest().

void Parser::setEOL ( bool  val)
inline

Definition at line 107 of file parser.h.

References m_lgEOL.

Referenced by ParseSet().

void Parser::setline ( const char *const  card)
inline

Definition at line 79 of file parser.h.

References ASSERT, INPUT_LINE_LENGTH, m_card_raw, and newlineProcess().

Referenced by cdGetLineList(), init(), ParseAbundances(), ParseBackgrd(), ParseCMBOuter(), ParseCommands(), ParseDrive(), and ParseTest().

Here is the call graph for this function:

const char * Parser::StandardEnergyUnit ( void  ) const

Definition at line 259 of file parser.cpp.

References m_card, and StandardEnergyUnit().

Referenced by ChkUnits(), ParseOptimize(), ParseSave(), ParseSet(), and ParseStop().

Here is the call graph for this function:

string Parser::StandardFluxUnit ( void  ) const

Definition at line 263 of file parser.cpp.

References m_card, and StandardFluxUnit().

Referenced by ParseOptimize(), and ParseStop().

Here is the call graph for this function:

NORETURN void Parser::StringError ( ) const

Definition at line 174 of file parser.cpp.

References Error().

Referenced by ParseCompile(), ParseGrain(), ParseGrid(), ParseInit(), ParseMonitorResults(), ParseNorm(), ParseOptimize(), ParseSave(), ParseState(), and ParseStop().

Here is the call graph for this function:

Field Documentation

char Parser::m_card[INPUT_LINE_LENGTH]
private
char Parser::m_card_raw[INPUT_LINE_LENGTH]
private
const CloudyCommand* const Parser::m_Commands
private

Definition at line 49 of file parser.h.

Referenced by help().

long int Parser::m_len
private

Definition at line 46 of file parser.h.

Referenced by FFmtRead(), getFirstChunk(), and newlineProcess().

bool Parser::m_lgDSet

Definition at line 53 of file parser.h.

Referenced by init(), ParseAbundances(), ParseCommands(), and ParseGrain().

bool Parser::m_lgEOF
bool Parser::m_lgEOL
private

Definition at line 48 of file parser.h.

Referenced by FFmtRead(), lgEOL(), newlineProcess(), and setEOL().

long int Parser::m_nInitFile

Definition at line 52 of file parser.h.

Referenced by init(), ParseCommands(), and ParseInitCount().

long int Parser::m_nqh
long int Parser::m_off
private
std::map<string,double> Parser::m_symtab
private

Definition at line 50 of file parser.h.

Referenced by doSetVar(), and FFmtRead().


The documentation for this class was generated from the following files: