Cloudy
Spectral Synthesis Code for Astrophysics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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, 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
 

Detailed Description

Parser class holds pointer to string currently being analysed

Constructor & Destructor Documentation

Parser::Parser ( void  )
inlineexplicit

References init().

Here is the call graph for this function:

Parser::Parser ( const CloudyCommand commands)
inlineexplicit

References init().

Here is the call graph for this function:

Member Function Documentation

bool Parser::at_end ( ) const
private
string Parser::ClosestMatch ( const string &  token) const

References dist(), LevenshteinDistance(), m_Commands, CloudyCommand::name, and NULL.

Referenced by CommandError().

Here is the call graph for this function:

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

References hasCommand().

Referenced by ParseCommands().

Here is the call graph for this function:

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

Here is the call graph for this function:

char Parser::current ( void  ) const
inlineprivate
char Parser::current_raw ( ) const
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().

Here is the call graph for this function:

void Parser::echo ( void  ) const

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

Referenced by ParseCommands(), and ParseInterp().

Here is the call graph for this function:

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

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  )

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

Here is the call graph for this function:

long int Parser::GetElem ( void  ) const
int Parser::getElement ( )
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:

string Parser::getFirstChunkRaw ( long  i)

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

Referenced by getLineID().

Here is the call graph for this function:

double Parser::getNumberCheck ( const char *  chDesc)
double Parser::getNumberCheckAlwaysLog ( const char *  chDesc)

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 
)

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

Referenced by ParseDynaTime().

Here is the call graph for this function:

double Parser::getNumberCheckLogLinNegImplLog ( const char *  chDesc)

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 
)

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 
)

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 
)

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

Referenced by diatomics::H2_ParseSave().

Here is the call graph for this function:

double Parser::getNumberPlain ( const char *  chDesc)

References FFmtRead().

Referenced by ParseDynaWind().

Here is the call graph for this function:

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:

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:

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

Here is the call graph for this function:

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

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

Referenced by ParseMonitorResults().

Here is the call graph for this function:

string Parser::getRawTail ( )
inline

References m_card_raw, and m_off.

Referenced by ParseBackgrd(), and ParseTitle().

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:

double Parser::getWave ( )

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

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

Here is the call graph for this function:

double Parser::getWaveOpt ( )

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

Referenced by getWave(), and ParseStop().

Here is the call graph for this function:

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:

void Parser::init ( void  )
inlineprivate

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

Referenced by Parser().

Here is the call graph for this function:

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:

bool Parser::isVar ( void  ) const

References current().

Referenced by ParseCommands().

Here is the call graph for this function:

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:

bool Parser::lgReachedEnd ( )

References at_end(), and skip_whitespace().

Referenced by GetOptLineInt(), and ParseLineList().

Here is the call graph for this function:

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:

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

References m_uniqueLen.

Referenced by hasCommand(), and peekNextCommand().

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:

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

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

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

Here is the call graph for this function:

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:

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

References m_card, and nWord().

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

Here is the call graph for this function:

bool Parser::peekNextCommand ( const string &  s2)

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

Referenced by ParseAbundances().

Here is the call graph for this function:

int Parser::PrintLine ( FILE *  fp) const
inline
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.

Here is the call graph for this function:

void Parser::set_point ( long int  ipnt)
inline
void Parser::setEOL ( bool  val)
inline

References m_lgEOL.

Referenced by ParseSet().

void Parser::setline ( const string &  card)
void Parser::showLocation ( FILE *  io = ioQQQ) const

References fprintf(), m_card_comment, and m_off.

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

Here is the call graph for this function:

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:

const char * Parser::StandardEnergyUnit ( void  ) const

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

References m_card, and StandardFluxUnit().

Referenced by ParseOptimize(), and ParseStop().

Here is the call graph for this function:

NORETURN void Parser::StringError ( ) const

Member Data Documentation

string Parser::m_card_comment
private
const CloudyCommand* const Parser::m_Commands
private

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

long int Parser::m_len
private
bool Parser::m_lgDSet
bool Parser::m_lgEOL
private
std::map<string,double> Parser::m_symtab
private

Referenced by doSetVar(), and FFmtRead().

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: