Cloudy
Spectral Synthesis Code for Astrophysics
Loading...
Searching...
No Matches
Parser Class Reference

#include <parser.h>

Collaboration diagram for Parser:

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, t_wavl &val1, t_wavl &val2)
 
bool nMatchErase (const char *chKey)
 
bool nMatchSkip (const string &chKey, size_t nmin=4)
 
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
 
t_wavl getWave ()
 
t_wavl 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
 

Detailed Description

Parser class holds pointer to string currently being analysed

Constructor & Destructor Documentation

◆ Parser() [1/2]

Parser::Parser ( void )
inlineexplicit

References init(), m_Commands, and NULL.

Here is the call graph for this function:

◆ Parser() [2/2]

Parser::Parser ( const CloudyCommand * commands)
inlineexplicit

References init(), and m_Commands.

Here is the call graph for this function:

Member Function Documentation

◆ at_end()

bool Parser::at_end ( ) const
private

◆ ClosestMatch()

string Parser::ClosestMatch ( const string & token) const

References dist(), LevenshteinDistance(), m_Commands, and NULL.

Referenced by CommandError().

Here is the call graph for this function:

◆ Command()

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

References hasCommand().

Referenced by ParseCommands().

Here is the call graph for this function:

◆ CommandError()

NORETURN void Parser::CommandError ( void ) const

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

Referenced by ParseCommands().

Here is the call graph for this function:

◆ current()

char Parser::current ( void ) const
inlineprivate

◆ current_raw()

char Parser::current_raw ( ) const
private

References m_card_raw, and m_off.

Referenced by getSymbol().

◆ doSetVar()

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().

Here is the call graph for this function:

◆ echo()

void Parser::echo ( void ) const

References called, fprintf(), ioQQQ, m_card, m_card_comment, and nMatch().

Referenced by ParseCommands(), and ParseInterp().

Here is the call graph for this function:

◆ Error()

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

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

Referenced by StringError().

Here is the call graph for this function:

◆ FFmtRead()

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(), getNumberCheck(), getNumberDefault(), getNumberDefaultAlwaysLog(), getNumberDefaultNegImplLog(), getNumberPlain(), GetOptColDen(), GetOptLineInt(), GetOptTemp(), getPairs(), GetParam(), 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(), ParseIllumination(), 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().

Here is the call graph for this function:

◆ GetElem()

long int Parser::GetElem ( void ) const

◆ getElement()

int Parser::getElement ( )

References at_end(), caps(), cdEXIT, current(), DEBUG_ENTRY, elementnames, EXIT_FAILURE, fprintf(), ioQQQ, ipHYDROGEN, LIMELM, m_card, m_off, PrintLine(), and skip_whitespace().

Referenced by GetOptColDen(), and GetOptTemp().

Here is the call graph for this function:

◆ getFirstChunk()

string Parser::getFirstChunk ( long i)

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

Here is the call graph for this function:

◆ getFirstChunkRaw()

string Parser::getFirstChunkRaw ( long i)

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

Here is the call graph for this function:

◆ getline()

◆ getLineID()

LineID Parser::getLineID ( bool lgAtStart = true)

◆ getNumberCheck()

double Parser::getNumberCheck ( const char * chDesc)

◆ getNumberCheckAlwaysLog()

double Parser::getNumberCheckAlwaysLog ( const char * chDesc)

References exp10(), and getNumberCheck().

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

Here is the call graph for this function:

◆ getNumberCheckAlwaysLogLim()

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

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

Referenced by ParseDynaTime().

Here is the call graph for this function:

◆ getNumberCheckLogLinNegImplLog()

double Parser::getNumberCheckLogLinNegImplLog ( const char * chDesc)

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

Referenced by abund_starburst().

Here is the call graph for this function:

◆ getNumberDefault()

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

References FFmtRead(), and lgEOL().

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

Here is the call graph for this function:

◆ getNumberDefaultAlwaysLog()

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

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

Referenced by ParseDarkMatter(), and ParseDynaTime().

Here is the call graph for this function:

◆ getNumberDefaultNegImplLog()

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

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

Referenced by diatomics::H2_ParseSave().

Here is the call graph for this function:

◆ getNumberPlain()

double Parser::getNumberPlain ( const char * chDesc)

References FFmtRead().

Referenced by ParseDynaWind().

Here is the call graph for this function:

◆ getPairs()

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.

Here is the call graph for this function:

◆ GetParam()

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

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

Referenced by ParseMonitorResults().

Here is the call graph for this function:

◆ GetQuote()

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(), GetMetalsDeplete(), GetOptColDen(), ParseAbundances(), ParseCompile(), ParseDatabase(), ParseGrain(), ParseGrid(), ParseInit(), ParseMonitorResults(), ParseOptimize(), ParsePrint(), ParseSave(), ParseSet(), ParseSpecies(), ParseStop(), ParseTable(), ParseTitle(), and readList().

Here is the call graph for this function:

◆ GetRange()

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

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

Referenced by ParseMonitorResults(), and ParsePrint().

Here is the call graph for this function:

◆ getRawTail()

string Parser::getRawTail ( )
inline

References m_card_raw, and m_off.

Referenced by ParseBackgrd(), ParseStop(), and ParseTitle().

◆ getSymbol()

◆ getVarName()

std::string Parser::getVarName ( void )

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

Referenced by doSetVar(), and FFmtRead().

Here is the call graph for this function:

◆ getWave()

t_wavl Parser::getWave ( )

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

Referenced by ParseSet().

Here is the call graph for this function:

◆ getWaveOpt()

t_wavl Parser::getWaveOpt ( )

References current(), FFmtRead(), m_off, nMatchSkip(), WL_AIR, WL_NATIVE, and WL_VACUUM.

Referenced by GetRange(), and getWave().

Here is the call graph for this function:

◆ hasCommand()

◆ help()

void Parser::help ( FILE * fp) const

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

Referenced by ParseHelp().

Here is the call graph for this function:

◆ init()

void Parser::init ( )
inlineprivate

References findUniqueLen(), insertToken(), m_Commands, m_lgDSet, m_lgEOF, m_nqh, m_uniqueLen, min(), NULL, and setline().

Referenced by Parser(), and Parser().

Here is the call graph for this function:

◆ isComment()

bool Parser::isComment ( void ) const

References lgInputComment(), and m_card_comment.

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

Here is the call graph for this function:

◆ isVar()

bool Parser::isVar ( void ) const

References current().

Referenced by ParseCommands().

Here is the call graph for this function:

◆ last()

bool Parser::last ( void ) const

References lgInputEOF(), m_card_comment, and m_lgEOF.

Referenced by ParseCommands(), and ParseInterp().

Here is the call graph for this function:

◆ lgEOL()

◆ lgReachedEnd()

bool Parser::lgReachedEnd ( )

References at_end(), and skip_whitespace().

Referenced by GetOptLineInt(), and ParseLineList().

Here is the call graph for this function:

◆ m_getCommandToken()

string Parser::m_getCommandToken ( ) const
private

References DEBUG_ENTRY, getCommandToken(), and m_card.

Referenced by CommandError(), and hasCommand().

Here is the call graph for this function:

◆ m_getUniqueLen()

size_t Parser::m_getUniqueLen ( const string & s2) const
inlineprivate

References m_uniqueLen.

Referenced by hasCommand(), and peekNextCommand().

◆ newlineProcess()

void Parser::newlineProcess ( void )
private

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

Referenced by getline(), and setline().

Here is the call graph for this function:

◆ nMatch()

◆ nMatch1()

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

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

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

Here is the call graph for this function:

◆ nMatchErase()

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

References m_card, and nMatch1().

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

Here is the call graph for this function:

◆ nMatchSkip()

bool Parser::nMatchSkip ( const string & chKey,
size_t nmin = 4 )

References at_end(), current(), isSeparatorChar(), m_card, m_off, and matchKey().

Referenced by getWaveOpt().

Here is the call graph for this function:

◆ NoNumb()

◆ nWord()

const char * Parser::nWord ( const char * chKey) const

References m_card.

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

◆ peekNextCommand()

bool Parser::peekNextCommand ( const string & s2)

References caps(), DEBUG_ENTRY, getCommandToken(), input, m_getUniqueLen(), and max().

Referenced by ParseAbundances().

Here is the call graph for this function:

◆ PrintLine()

◆ readLaw()

◆ readList()

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.

Referenced by ParseSave().

Here is the call graph for this function:

◆ set_point()

void Parser::set_point ( long int ipnt)
inline

◆ setEOL()

void Parser::setEOL ( bool val)
inline

References m_lgEOL.

Referenced by ParseSet().

◆ setline()

void Parser::setline ( const string & card)

◆ showLocation()

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

References fprintf(), m_card_comment, and m_off.

Referenced by GetOptLineInt(), ParseAbundances(), and ParseLineList().

Here is the call graph for this function:

◆ skip_whitespace()

void Parser::skip_whitespace ( )
private

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

Referenced by getElement(), hasCommand(), and lgReachedEnd().

Here is the call graph for this function:

◆ StandardEnergyUnit()

const char * Parser::StandardEnergyUnit ( void ) const

References m_card.

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

◆ StandardFluxUnit()

string Parser::StandardFluxUnit ( void ) const

References m_card.

Referenced by ParseOptimize(), and ParseStop().

◆ StringError()

NORETURN void Parser::StringError ( ) const

References Error(), and NORETURN.

Referenced by GetJenkins09(), GetMetalsDeplete(), ParseCompile(), ParseGrain(), ParseGrid(), ParseInit(), ParseMonitorResults(), ParseOptimize(), and ParseSave().

Here is the call graph for this function:

Member Data Documentation

◆ m_card

◆ m_card_comment

string Parser::m_card_comment
private

◆ m_card_raw

◆ m_Commands

const CloudyCommand* const Parser::m_Commands
private

Referenced by ClosestMatch(), help(), init(), Parser(), and Parser().

◆ m_len

long int Parser::m_len
private

◆ m_lgDSet

bool Parser::m_lgDSet

◆ m_lgEOF

◆ m_lgEOL

bool Parser::m_lgEOL
private

◆ m_nqh

◆ m_off

◆ m_symtab

std::map<string,double> Parser::m_symtab
private

Referenced by doSetVar(), and FFmtRead().

◆ m_uniqueLen

std::map<string,size_t> Parser::m_uniqueLen
private

Referenced by init(), and m_getUniqueLen().


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