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
 
bool lgReachedEnd ()
 
void showLocation (FILE *io=ioQQQ) 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 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
 
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
 
void skip_whitespace ()
 
int nMatch1 (const char *chKey) const
 

Private Attributes

char m_card [INPUT_LINE_LENGTH]
 
char m_card_raw [INPUT_LINE_LENGTH]
 
char m_card_comment [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 43 of file parser.h.

Constructor & Destructor Documentation

Parser::Parser ( void  )
inlineexplicit

Definition at line 57 of file parser.h.

References init().

Here is the call graph for this function:

Parser::Parser ( const CloudyCommand commands)
inlineexplicit

Definition at line 61 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(), hasCommand(), lgReachedEnd(), and skip_whitespace().

Here is the call graph for this function:

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

Definition at line 193 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 260 of file parser.cpp.

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

Referenced by ParseCommands().

Here is the call graph for this function:

char Parser::current ( void  ) const
inlineprivate

Definition at line 74 of file parser.h.

References m_card, and m_off.

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

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 161 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 189 of file parser.cpp.

References called, fprintf(), ioQQQ, t_called::lgTalk, m_card, m_card_comment, 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 249 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 472 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 554 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 ( )
double Parser::getNumberCheck ( const char *  chDesc)

Definition at line 392 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 427 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 433 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 410 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 401 of file parser.cpp.

References FFmtRead(), and lgEOL().

Referenced by cdRead(), 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 446 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 455 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 388 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 768 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 154 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 213 of file parser.cpp.

References DEBUG_ENTRY, GetString(), m_card, and m_card_raw.

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 163 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 217 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 148 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 379 of file parser.cpp.

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

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

Here is the call graph for this function:

double Parser::getWaveOpt ( )

Definition at line 356 of file parser.cpp.

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

Referenced by 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 294 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 66 of file parser.h.

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

Referenced by Parser().

Here is the call graph for this function:

bool Parser::isComment ( void  ) const

Definition at line 140 of file parser.cpp.

References lgInputComment(), and m_card_comment.

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

Here is the call graph for this function:

bool Parser::isVar ( void  ) const

Definition at line 144 of file parser.cpp.

References current().

Referenced by ParseCommands().

Here is the call graph for this function:

bool Parser::last ( void  ) const

Definition at line 196 of file parser.cpp.

References lgInputEOF(), m_card_comment, and m_lgEOF.

Referenced by ParseCommands(), and ParseInterp().

Here is the call graph for this function:

bool Parser::lgEOL ( void  ) const
inline
bool Parser::lgReachedEnd ( )

Definition at line 109 of file parser.cpp.

References at_end(), and skip_whitespace().

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

Here is the call graph for this function:

void Parser::newlineProcess ( void  )
private

Definition at line 50 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

Definition at line 150 of file parser.h.

References nMatch1().

Referenced by abund_starburst(), cdRead(), ChkUnits(), echo(), GetElem(), getline(), getNumberCheckLogLinNegImplLog(), GetOptColDen(), GetOptLineInt(), GetOptTemp(), diatomics::H2_ParseSave(), parse_save_average(), Parse_Save_Line_RT(), ParseAbsMag(), ParseAbundances(), ParseAgn(), ParseAperture(), ParseBackgrd(), ParseBlackbody(), ParseBremsstrahlung(), ParseCaseB(), ParseCMBOuter(), ParseCommands(), ParseCompile(), ParseConstant(), ParseCoronal(), ParseCosmicRays(), ParseCosmology(), ParseCrashDo(), ParseDarkMatter(), ParseDatabase(), ParseDatabaseH2(), ParseDatabaseISO(), ParseDiffuse(), ParseDistance(), ParseDLaw(), ParseDont(), ParseDrive(), ParseDynaTime(), ParseDynaWind(), ParseElement(), ParseEnergy(), ParseExtinguish(), ParseF_nu(), ParseFail(), ParseFill(), ParseFluc(), ParseForceTemperature(), ParseGrain(), ParseGravity(), ParseGrid(), ParseHDEN(), ParseHExtra(), ParseIlluminate(), ParseInit(), ParseIntensity(), ParseIonPar(), ParseIterations(), ParseLuminosity(), ParseMagnet(), ParseMap(), ParseMetal(), ParseMonitorResults(), ParseNorm(), ParseOptimize(), ParsePhi(), ParsePlot(), ParsePlotRangeContin(), ParsePlotRangeOption(), ParsePowerlawContinuum(), ParsePrint(), ParseQH(), ParseRadius(), ParseRangeOption(), ParseRatio(), ParseSave(), ParseSet(), ParseSphere(), ParseState(), ParseStop(), ParseTable(), ParseTest(), ParseTLaw(), ParseTrace(), ParseTurbulence(), and readLaw().

Here is the call graph for this function:

int Parser::nMatch1 ( const char *  chKey) const
inlineprivate

Definition at line 123 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 173 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 949 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 95 of file parser.h.

References m_off.

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

void Parser::setEOL ( bool  val)
inline

Definition at line 117 of file parser.h.

References m_lgEOL.

Referenced by ParseSet().

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

Definition at line 82 of file parser.h.

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

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

Here is the call graph for this function:

void Parser::showLocation ( FILE *  io = ioQQQ) const

Definition at line 115 of file parser.cpp.

References fprintf(), m_card_comment, and m_off.

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

Here is the call graph for this function:

void Parser::skip_whitespace ( )
private

Definition at line 45 of file parser.cpp.

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

Referenced by hasCommand(), and lgReachedEnd().

Here is the call graph for this function:

const char * Parser::StandardEnergyUnit ( void  ) const

Definition at line 286 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 290 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 203 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_comment[INPUT_LINE_LENGTH]
private

Definition at line 47 of file parser.h.

Referenced by echo(), getline(), isComment(), last(), setline(), and showLocation().

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

Definition at line 51 of file parser.h.

Referenced by help().

long int Parser::m_len
private

Definition at line 48 of file parser.h.

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

bool Parser::m_lgDSet

Definition at line 55 of file parser.h.

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

bool Parser::m_lgEOF
bool Parser::m_lgEOL
private

Definition at line 50 of file parser.h.

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

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

Definition at line 52 of file parser.h.

Referenced by doSetVar(), and FFmtRead().


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