Cloudy
Spectral Synthesis Code for Astrophysics
|
#include <parser.h>
Public Member Functions | |
Parser (void) | |
Parser (const CloudyCommand *commands) | |
bool | getline () |
void | setline (const string &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 string &s2) |
bool | peekNextCommand (const string &s2) |
bool | Command (const char *name, OptionParser doOpts) |
string | ClosestMatch (const string &token) const |
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 | getFirstChunkRaw (long i) |
string | getRawTail () |
void | help (FILE *fp) const |
double | getWave () |
double | getWaveOpt () |
LineID | getLineID (bool lgAtStart=true) |
Symbol | getSymbol () |
int | getElement () |
void | getPairs (vector< double > &a, vector< double > &b) |
void | readList (vector< string > &list, const char *chName) |
void | readLaw (DepthTable &table) |
Public Attributes | |
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 () |
string | m_getCommandToken () const |
size_t | m_getUniqueLen (const string &s2) const |
int | nMatch1 (const char *chKey) const |
Private Attributes | |
string | m_card |
string | m_card_raw |
string | m_card_comment |
long int | m_len |
long int | m_off |
bool | m_lgEOL |
const CloudyCommand *const | m_Commands |
std::map< string, double > | m_symtab |
std::map< string, size_t > | m_uniqueLen |
Parser class holds pointer to string currently being analysed
|
inlineexplicit |
|
inlineexplicit |
|
private |
Referenced by doSetVar(), getElement(), getSymbol(), getVarName(), lgReachedEnd(), and skip_whitespace().
string Parser::ClosestMatch | ( | const string & | token | ) | const |
References dist(), LevenshteinDistance(), m_Commands, CloudyCommand::name, and NULL.
Referenced by CommandError().
|
inline |
NORETURN void Parser::CommandError | ( | void | ) | const |
References cdEXIT, ClosestMatch(), DEBUG_ENTRY, EXIT_FAILURE, fprintf(), ioQQQ, lgIsExpungedCommentSeq(), m_card, m_getCommandToken(), and PrintLine().
Referenced by ParseCommands().
|
inlineprivate |
Referenced by doSetVar(), FFmtRead(), getElement(), getSymbol(), getVarName(), getWaveOpt(), isVar(), and skip_whitespace().
|
private |
References m_card_raw, and m_off.
Referenced by getSymbol().
void Parser::doSetVar | ( | void | ) |
References at_end(), cdEXIT, current(), DEBUG_ENTRY, EXIT_FAILURE, FFmtRead(), fprintf(), getVarName(), ioQQQ, m_off, and m_symtab.
Referenced by ParseCommands().
void Parser::echo | ( | void | ) | const |
References called, fprintf(), ioQQQ, t_called::lgTalk, m_card, m_card_comment, and nMatch().
Referenced by ParseCommands(), and ParseInterp().
NORETURN void Parser::Error | ( | const char * | msg | ) | const |
References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, fprintf(), ioQQQ, and PrintLine().
Referenced by StringError().
double Parser::FFmtRead | ( | void | ) |
References ASSERT, current(), DEBUG_ENTRY, fprintf(), getVarName(), ioQQQ, m_card, m_len, m_lgEOL, m_off, m_symtab, and ParseExpr().
Referenced by doSetVar(), getLineID(), 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(), 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(), ParsePowerlawContinuum(), ParsePrint(), ParseQH(), ParseRadius(), ParseRangeOption(), ParseRatio(), ParseSave(), ParseSet(), ParseSphere(), ParseStop(), ParseTable(), ParseTauMin(), ParseTLaw(), ParseTrace(), ParseTurbulence(), ParseVLaw(), and readLaw().
long int Parser::GetElem | ( | void | ) | const |
References t_elementnames::chElementNameShort, DEBUG_ENTRY, elementnames, LIMELM, and nMatch().
Referenced by parse_save_average(), ParseDatabaseISO(), ParseElement(), ParseMonitorResults(), ParsePrint(), ParseSave(), ParseSet(), and ParseTrace().
int Parser::getElement | ( | ) |
References at_end(), caps(), cdEXIT, t_elementnames::chElementName, current(), DEBUG_ENTRY, elementnames, EXIT_FAILURE, fprintf(), ioQQQ, ipHYDROGEN, LIMELM, m_card, m_off, PrintLine(), and skip_whitespace().
Referenced by GetOptColDen(), and GetOptTemp().
string Parser::getFirstChunk | ( | long | i | ) |
References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, fprintf(), ioQQQ, m_card, m_len, and m_off.
string Parser::getFirstChunkRaw | ( | long | i | ) |
References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, fprintf(), ioQQQ, m_card_raw, m_len, and m_off.
Referenced by getLineID().
bool Parser::getline | ( | void | ) |
References t_input::crd, input, t_input::lgVisibilityStatus, m_card_raw, m_lgEOF, newlineProcess(), nMatch(), t_input::nRead, and t_input::readarray().
Referenced by GetOptColDen(), GetOptLineInt(), GetOptTemp(), getPairs(), parse_save_average(), Parse_Save_Line_RT(), ParseAbundances(), ParseCommands(), ParseDynaTime(), ParseElement(), ParseInterp(), ParseLineList(), readLaw(), and readList().
LineID Parser::getLineID | ( | bool | lgAtStart = true | ) |
References cdEXIT, LineID::chLabel, DEBUG_ENTRY, LineID::ELo, EXIT_FAILURE, FFmtRead(), fprintf(), getFirstChunkRaw(), GetQuote(), getWave(), LineID::indHi, LineID::indLo, ioQQQ, lgEOL(), m_card, m_card_raw, nMatch(), NoNumb(), showLocation(), trimTrailingWhiteSpace(), and LineID::wave.
Referenced by GetOptLineInt(), ParseLineList(), and ParseMonitorResults().
double Parser::getNumberCheck | ( | const char * | chDesc | ) |
References FFmtRead(), lgEOL(), and NoNumb().
Referenced by getNumberCheckAlwaysLog(), getNumberCheckAlwaysLogLim(), getNumberCheckLogLinNegImplLog(), ParseDynaWind(), ParseMagnet(), and ParseSave().
double Parser::getNumberCheckAlwaysLog | ( | const char * | chDesc | ) |
References exp10(), and getNumberCheck().
Referenced by ParseDarkMatter(), ParseDynaTime(), and ParseMagnet().
double Parser::getNumberCheckAlwaysLogLim | ( | const char * | chDesc, |
double | flim | ||
) |
References exp10(), fprintf(), getNumberCheck(), and ioQQQ.
Referenced by ParseDynaTime().
double Parser::getNumberCheckLogLinNegImplLog | ( | const char * | chDesc | ) |
References exp10(), getNumberCheck(), and nMatch().
Referenced by abund_starburst().
double Parser::getNumberDefault | ( | const char * | chDesc, |
double | fdef | ||
) |
References FFmtRead(), and lgEOL().
Referenced by cdRead(), diatomics::H2_ParseSave(), ParseDynaWind(), and ParseMagnet().
double Parser::getNumberDefaultAlwaysLog | ( | const char * | chDesc, |
double | fdef | ||
) |
References exp10(), FFmtRead(), and lgEOL().
Referenced by ParseDarkMatter(), and ParseDynaTime().
double Parser::getNumberDefaultNegImplLog | ( | const char * | chDesc, |
double | fdef | ||
) |
References exp10(), FFmtRead(), and lgEOL().
Referenced by diatomics::H2_ParseSave().
double Parser::getNumberPlain | ( | const char * | chDesc | ) |
void Parser::getPairs | ( | vector< double > & | a, |
vector< double > & | b | ||
) |
References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, FFmtRead(), fprintf(), getline(), hasCommand(), ioQQQ, isComment(), lgEOL(), and m_lgEOF.
|
inline |
References FFmtRead(), m_off, and nMatch1().
Referenced by ParseMonitorResults().
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();
References DEBUG_ENTRY, GetString(), m_card, and m_card_raw.
Referenced by GetJenkins09(), getLineID(), GetMetalsDeplete(), GetOptColDen(), ParseAbundances(), ParseCompile(), ParseDatabase(), ParseGrain(), ParseGrid(), ParseInit(), ParseMonitorResults(), ParseNorm(), ParseOptimize(), ParsePrint(), ParseSave(), ParseSet(), ParseSpecies(), ParseStop(), ParseTable(), ParseTitle(), and readList().
|
inline |
References FFmtRead(), m_off, and nMatch1().
Referenced by ParseMonitorResults().
|
inline |
References m_card_raw, and m_off.
Referenced by ParseBackgrd(), and ParseTitle().
Symbol Parser::getSymbol | ( | ) |
References at_end(), current(), current_raw(), DEBUG_ENTRY, Symbol::EOSTAT, Symbol::ERROR, fprintf(), ioQQQ, m_off, maybeNumber(), Symbol::NAME, Symbol::NUMBER, Symbol::OPERATOR, Symbol::STRING, and Symbol::value.
Referenced by ParseAbundances(), ParseChemistry(), and ParseSpecies().
std::string Parser::getVarName | ( | void | ) |
References at_end(), current(), and m_off.
Referenced by doSetVar(), and FFmtRead().
double Parser::getWave | ( | ) |
References getWaveOpt(), lgEOL(), and NoNumb().
Referenced by getLineID(), ParseNorm(), ParsePrint(), and ParseStop().
double Parser::getWaveOpt | ( | ) |
References current(), FFmtRead(), and m_off.
Referenced by getWave(), and ParseStop().
bool Parser::hasCommand | ( | const string & | s2 | ) |
References DEBUG_ENTRY, m_card, m_getCommandToken(), m_getUniqueLen(), m_off, max(), and skip_whitespace().
Referenced by cdRead(), Command(), GetOptColDen(), GetOptLineInt(), GetOptTemp(), getPairs(), parse_save_average(), ParseAbundances(), ParseDynaTime(), ParseElement(), ParseInterp(), ParseLineList(), readLaw(), and readList().
void Parser::help | ( | FILE * | fp | ) | const |
References cdEXIT, DEBUG_ENTRY, EXIT_SUCCESS, fprintf(), m_Commands, and NULL.
Referenced by ParseHelp().
|
inlineprivate |
References findUniqueLen(), insertToken(), m_Commands, m_lgDSet, m_lgEOF, m_nqh, m_uniqueLen, min(), CloudyCommand::name, NULL, and setline().
Referenced by Parser().
bool Parser::isComment | ( | void | ) | const |
References lgInputComment(), and m_card_comment.
Referenced by getPairs(), ParseCommands(), ParseInterp(), and readList().
bool Parser::isVar | ( | void | ) | const |
bool Parser::last | ( | void | ) | const |
References lgInputEOF(), m_card_comment, and m_lgEOF.
Referenced by ParseCommands(), and ParseInterp().
|
inline |
References m_lgEOL.
Referenced by diatomics::GetIndices(), getLineID(), getNumberCheck(), getNumberDefault(), getNumberDefaultAlwaysLog(), getNumberDefaultNegImplLog(), GetOptColDen(), GetOptLineInt(), GetOptTemp(), getPairs(), getWave(), diatomics::H2_ReadTransprob(), parse_save_average(), Parse_Save_Line_RT(), ParseAbsMag(), ParseAbundances(), ParseAge(), ParseAgn(), ParseAperture(), ParseBackgrd(), ParseBlackbody(), ParseBremsstrahlung(), ParseCaseB(), ParseCExtra(), ParseCMBOuter(), ParseCompile(), ParseConstant(), ParseCoronal(), ParseCosmicRays(), ParseCovering(), ParseCrashDo(), ParseCylinder(), ParseDatabase(), ParseDatabaseH2(), ParseDatabaseISO(), ParseDiffuse(), ParseDistance(), ParseDLaw(), ParseEden(), ParseElement(), ParseEnergy(), ParseExtinguish(), ParseF_nu(), ParseFail(), ParseFill(), ParseFluc(), ParseForceTemperature(), ParseFudge(), ParseGlobule(), ParseGravity(), ParseGrid(), ParseHDEN(), ParseHExtra(), ParseIlluminate(), ParseIntensity(), ParseInterp(), ParseIonPar(), ParseIterations(), ParseLaser(), ParseLuminosity(), ParseMap(), ParseMetal(), ParseMonitorResults(), ParseNeutrons(), ParseNorm(), ParseOptimize(), ParsePhi(), ParsePowerlawContinuum(), ParsePrint(), ParseQH(), ParseRadius(), ParseRangeOption(), ParseRatio(), ParseSave(), ParseSet(), ParseSphere(), ParseStop(), ParseTable(), ParseTauMin(), ParseTrace(), ParseTurbulence(), and readLaw().
bool Parser::lgReachedEnd | ( | ) |
References at_end(), and skip_whitespace().
Referenced by GetOptLineInt(), and ParseLineList().
|
private |
References DEBUG_ENTRY, getCommandToken(), and m_card.
Referenced by CommandError(), and hasCommand().
|
inlineprivate |
References m_uniqueLen.
Referenced by hasCommand(), and peekNextCommand().
|
private |
References caps(), m_card, m_card_comment, m_card_raw, m_len, m_lgEOL, m_off, and StripComment().
Referenced by getline(), and setline().
|
inline |
References nMatch1().
Referenced by abund_starburst(), cdRead(), ChkUnits(), echo(), GetElem(), GetJenkins09(), getline(), getLineID(), GetMetalsDeplete(), 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(), 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(), ParsePowerlawContinuum(), ParsePrint(), ParseQH(), ParseRadius(), ParseRangeOption(), ParseRatio(), ParseSave(), ParseSet(), ParseSphere(), ParseStop(), ParseTable(), ParseTest(), ParseTLaw(), ParseTrace(), ParseTurbulence(), and readLaw().
|
inlineprivate |
References ASSERT, isBoundaryChar(), m_card, nMatch(), NULL, and nWord().
Referenced by GetParam(), GetRange(), nMatch(), and nMatchErase().
|
inline |
References m_card, and nMatch1().
Referenced by ParseCompile(), ParseGrain(), ParseMonitorResults(), ParseSave(), and ParseTable().
NORETURN void Parser::NoNumb | ( | const char * | chDesc | ) | const |
References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, fprintf(), ioQQQ, and m_card_raw.
Referenced by getLineID(), getNumberCheck(), getWave(), parse_save_average(), ParseAbundances(), ParseAperture(), ParseBlackbody(), ParseBremsstrahlung(), ParseCExtra(), ParseConstant(), ParseCosmicRays(), ParseCovering(), ParseCylinder(), ParseDatabase(), ParseDatabaseH2(), ParseDatabaseISO(), ParseDistance(), ParseDLaw(), ParseEden(), ParseElement(), ParseEnergy(), ParseExtinguish(), ParseF_nu(), ParseFail(), ParseFill(), ParseForceTemperature(), ParseFudge(), ParseHExtra(), ParseIlluminate(), ParseIntensity(), ParseIonPar(), ParseLaser(), ParseLuminosity(), ParseMetal(), ParseMonitorResults(), ParseNeutrons(), ParseOptimize(), ParsePhi(), ParsePrint(), ParseQH(), ParseRadius(), ParseRatio(), ParseSet(), ParseStop(), ParseTable(), ParseTauMin(), ParseTurbulence(), and readLaw().
const char * Parser::nWord | ( | const char * | chKey | ) | const |
References m_card, and nWord().
Referenced by nMatch1(), ParseAge(), and parserProcess().
bool Parser::peekNextCommand | ( | const string & | s2 | ) |
References caps(), DEBUG_ENTRY, getCommandToken(), input, m_getUniqueLen(), max(), and t_input::peekarray().
Referenced by ParseAbundances().
|
inline |
References fprintf(), and m_card_comment.
Referenced by CommandError(), Error(), getElement(), GetOptColDen(), GetOptLineInt(), GetOptTemp(), parse_save_average(), Parse_Save_Line_RT(), ParseDont(), ParseElement(), ParseMonitorResults(), ParseOptimize(), ParseSet(), ParseStop(), and ParseTurbulence().
void Parser::readLaw | ( | DepthTable & | table | ) |
References cdEXIT, DepthTable::clear(), DEBUG_ENTRY, dist(), DepthTable::dist, EXIT_FAILURE, FFmtRead(), fprintf(), getline(), hasCommand(), ioQQQ, DepthTable::lgDepth, lgEOL(), m_lgEOF, nMatch(), NoNumb(), DepthTable::nvals, and DepthTable::val.
Referenced by ParseDLaw(), and ParseTLaw().
void Parser::readList | ( | vector< string > & | list, |
const char * | chName | ||
) |
References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, fprintf(), getline(), GetQuote(), hasCommand(), ioQQQ, isComment(), m_card_raw, and m_lgEOF.
|
inline |
References m_off.
Referenced by ParseBackgrd(), ParseCMBOuter(), ParseRangeOption(), and StuffCommand().
|
inline |
References m_lgEOL.
Referenced by ParseSet().
void Parser::setline | ( | const string & | card | ) |
References m_card_raw, newlineProcess(), StripComment(), and trimTrailingWhiteSpace().
Referenced by cdRead(), init(), ParseAbundances(), ParseBackgrd(), ParseCMBOuter(), ParseCommands(), and StuffCommand().
void Parser::showLocation | ( | FILE * | io = ioQQQ | ) | const |
References fprintf(), m_card_comment, and m_off.
Referenced by getLineID(), GetOptLineInt(), ParseAbundances(), and ParseLineList().
|
private |
References at_end(), current(), and m_off.
Referenced by getElement(), hasCommand(), and lgReachedEnd().
const char * Parser::StandardEnergyUnit | ( | void | ) | const |
References m_card, and StandardEnergyUnit().
Referenced by ChkUnits(), ParseOptimize(), ParseSave(), ParseSet(), and ParseStop().
string Parser::StandardFluxUnit | ( | void | ) | const |
References m_card, and StandardFluxUnit().
Referenced by ParseOptimize(), and ParseStop().
NORETURN void Parser::StringError | ( | ) | const |
References Error().
Referenced by GetJenkins09(), GetMetalsDeplete(), ParseCompile(), ParseGrain(), ParseGrid(), ParseInit(), ParseMonitorResults(), ParseNorm(), ParseOptimize(), ParseSave(), and ParseStop().
|
private |
|
private |
Referenced by echo(), isComment(), last(), newlineProcess(), PrintLine(), and showLocation().
|
private |
Referenced by current_raw(), getFirstChunkRaw(), getline(), getLineID(), GetQuote(), getRawTail(), newlineProcess(), NoNumb(), readList(), and setline().
|
private |
Referenced by ClosestMatch(), help(), and init().
|
private |
Referenced by at_end(), FFmtRead(), getFirstChunk(), getFirstChunkRaw(), and newlineProcess().
bool Parser::m_lgDSet |
Referenced by init(), ParseAbundances(), ParseCommands(), and ParseGrain().
bool Parser::m_lgEOF |
|
private |
Referenced by FFmtRead(), lgEOL(), newlineProcess(), and setEOL().
long int Parser::m_nqh |
|
private |
|
private |
Referenced by doSetVar(), and FFmtRead().
|
private |
Referenced by init(), and m_getUniqueLen().