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());
174 return w1.match(
w2,
false) ||
w2.match(
w1,
false);
256 skipUntil(stack, parentDict,
"#endif", is);
267 <<
"Did not find matching " << endWord <<
nl
288 execute(stack, parentDict, is);
293 ifEntry::execute(stack, parentDict, is);
303 skipUntil(stack, parentDict,
"#endif", is);
336 evaluate(
true, stack, parentDict, is);
352 skipUntil(stack, parentDict,
"#endif", is);
370 if (ifEntry::isTrue(
e.stream()))
387 evaluate(
false, stack, parentDict, is);
392 evaluate(
true, stack, parentDict, is);
406 const label nNested = stack.size();
412 cond1 =
expand(parentDict, cond1);
416 cond2 =
expand(parentDict, cond2);
418 const bool equal = equalToken(cond1, cond2);
427 if (stack.size() != nNested)
430 <<
"Did not find matching #endif for condition starting"
431 <<
" at line " << stack.last().second()
448 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_SCALAR or DOUBLE_SCALAR.
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 standard (STL) streams.
bool boolToken() const
Return boolean token value.
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.
floatScalar floatScalarToken() const
Return float value.
static bool evaluate(const bool doIf, DynamicList< filePos > &stack, dictionary &parentDict, Istream &is)
float (single-precision) type
static void skipUntil(DynamicList< filePos > &stack, const dictionary &parentDict, const word &endWord, Istream &is)
Consume tokens until reached a specific word.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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.
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.
bool bad() const
Return true if stream is corrupted.
addNamedToMemberFunctionSelectionTable(functionEntry, calcEntry, execute, dictionaryIstream, calc)
Input from string buffer, using a ISstream.
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)
tokenType type() const
Return the token type.
scalar scalarToken() const
Return float or double value.
void putBack(const token &tok)
Put back token.
string expand(const std::string &str, const HashTable< string, word, string::hash > &mapping, const char sigil='$')
const dimensionedScalar e
Elementary charge.
T remove()
Remove and return the last element. Fatal on an empty list.
double (double-precision) type
doubleScalar doubleScalarToken() const
Return double value.
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.
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.