Go to the documentation of this file.
38 namespace functionEntries
78 const string& keyword,
82 if (keyword[0] ==
'$')
84 const word varName(keyword.substr(1));
90 return token(ePtr->stream());
95 string expanded(keyword);
141 const bool eqType = (t1.
type() == t2.
type());
175 return w1.match(
w2) ||
w2.match(
w1);
260 skipUntil(stack, parentDict,
"#endif", is);
270 <<
"Did not find matching " << endWord <<
nl
291 execute(stack, parentDict, is);
296 ifEntry::execute(stack, parentDict, is);
306 skipUntil(stack, parentDict,
"#endif", is);
339 evaluate(
true, stack, parentDict, is);
356 skipUntil(stack, parentDict,
"#endif", is);
374 if (ifEntry::isTrue(
e.stream()))
391 evaluate(
false, stack, parentDict, is);
396 evaluate(
true, stack, parentDict, is);
410 const label nNested = stack.size();
416 cond1 =
expand(parentDict, cond1);
420 cond2 =
expand(parentDict, cond2);
422 const bool equal = equalToken(cond1, cond2);
431 if (stack.size() != nNested)
434 <<
"Did not find matching #endif for condition starting"
435 <<
" at line " << stack.last().second()
452 return execute(stack, parentDict, is);
A keyword and a list of tokens is an 'entry'.
label labelToken() const
Return label value.
static bool execute(const bool equal, DynamicList< filePos > &stack, dictionary &parentDict, Istream &is)
static bool New(dictionary &parentDict, Istream &is, const inputMode inpMode=inputMode::GLOBAL, const int endChar=0)
Construct from an Istream and insert into the dictionary.
bool isScalar() const
Token is FLOAT or DOUBLE.
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read,...
A class for handling words, derived from Foam::string.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
const string & stringToken() const
Return const reference to the string contents.
bool eof() const
Return true if end of input seen.
defineTypeNameAndDebug(codeStream, 0)
bool isString() const
Token is STRING, VARIABLE or VERBATIM string.
Detect if the string contains meta-characters.
Generic input stream using a standard (STL) stream.
bool boolToken() const
Return boolean token value.
bool isDirective() const
Token is DIRECTIVE (word variant)
A dictionary #directive (word variant)
static void readToken(token &t, Istream &is)
Read tokens. Skip dummy tokens.
single character punctuation
A token holds an item read from Istream.
A token error encountered.
bool good() const
True if token is not UNDEFINED or ERROR.
static token expand(const dictionary &dict, const string &keyword, const token &t)
Expand a variable (string/word/var starting with '$')
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
punctuationToken pToken() const
Return punctuation character.
string expand(const std::string &s, const HashTable< string, word, string::hash > &mapping, const char sigil='$')
static bool evaluate(const bool doIf, DynamicList< filePos > &stack, dictionary &parentDict, Istream &is)
static void skipUntil(DynamicList< filePos > &stack, const dictionary &parentDict, const word &endWord, Istream &is)
Consume tokens until reached a specific word.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A dictionary $variable (string variant)
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
bool isVariable() const
Token is VARIABLE (string variant)
void inplaceExpand(std::string &s, const HashTable< string, word, string::hash > &mapping, const char sigil='$')
Macros for easy insertion into member function selection tables.
virtual const fileName & name() const
Return the name of the stream.
Compound type such as List<label> etc.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool isWord() const
Token is WORD or DIRECTIVE word.
bool bad() const
Return true if stream is corrupted.
addNamedToMemberFunctionSelectionTable(functionEntry, calcEntry, execute, dictionaryIstream, calc)
Input from string buffer, using a ISstream.
floatScalar floatToken() const
Return float value.
doubleScalar doubleToken() const
Return double value.
const word & wordToken() const
Return const reference to the word contents.
errorManipArg< error, int > exit(error &err, const int errNo=1)
stream flag (1-byte bitmask)
float (single-precision) type
tokenType type() const
Return the token type.
scalar scalarToken() const
Return float or double value.
void putBack(const token &tok)
Put back token.
const dimensionedScalar e
Elementary charge.
T remove()
Remove and return the last element. Fatal on an empty list.
label lineNumber() const
Const access to the current stream line number.
static bool equalToken(const token &t1, const token &t2)
int flagToken() const
Return flag bitmask value.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
label lineNumber() const
The line number for the token.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
bool equal(const T &s1, const T &s2)
Compare two values for equality.
double (double-precision) type
bool isStringType() const
Token is WORD, DIRECTIVE, STRING, VARIABLE or VERBATIM.
string evaluate(const std::string &s, size_t pos=0, size_t len=std::string::npos)
virtual Istream & read(token &)=0
Return next token from stream.