39 namespace functionEntries
65 const token startArgs(is);
69 startArgs.isPunctuation()
73 args.append(startArgs);
79 <<
" to start the argument list but found " << startArgs
86 args.append(token(is));
87 args.append(token(is));
90 const token endArgs(is);
94 endArgs.isPunctuation()
104 <<
" to end the argument list but found " << endArgs
114 void Foam::functionEntries::ifeqEntry::readToken(token& t, Istream& is)
const
119 if( is.read(t).bad() || is.eof() || !t.good())
128 Foam::token Foam::functionEntries::ifeqEntry::expand
130 const dictionary&
dict,
138 word varName = var(1, var.size() - 1);
141 const entry* ePtr =
dict.lookupScopedEntryPtr
150 return token(ePtr->stream());
155 string expanded(var);
159 return token(expanded, t.lineNumber());
169 bool Foam::functionEntries::ifeqEntry::equalToken
175 const bool eqType = (t1.type() == t2.type());
183 return (eqType && t1.pToken() == t2.pToken());
189 if (t2.isAnyString())
191 return t1.anyStringToken() == t2.anyStringToken();
200 <<
"Attempt to compare an un-expanded variable"
201 << InfoProxy<token>(t1)
208 return t1.integer32Token() == t2.integer32Token();
210 else if (t2.isLabel())
212 return t1.labelToken() == t2.labelToken();
214 else if (t2.isScalar())
216 return t1.labelToken() == t2.scalarToken();
226 return t1.integer64Token() == t2.integer64Token();
228 else if (t2.isLabel())
230 return t1.labelToken() == t2.labelToken();
232 else if (t2.isScalar())
234 return t1.labelToken() == t2.scalarToken();
245 t1.unsignedInteger32Token() == t2.unsignedInteger32Token();
247 else if (t2.isLabel())
249 return t1.labelToken() == t2.labelToken();
251 else if (t2.isScalar())
253 return t1.labelToken() == t2.scalarToken();
264 t1.unsignedInteger64Token() == t2.unsignedInteger64Token();
266 else if (t2.isLabel())
268 return t1.labelToken() == t2.labelToken();
270 else if (t2.isScalar())
272 return t1.labelToken() == t2.scalarToken();
282 return equal(t1.floatScalarToken(), t2.floatScalarToken());
284 else if (t2.isScalar())
286 return t1.scalarToken() == t2.scalarToken();
296 return equal(t1.doubleScalarToken(), t2.doubleScalarToken());
298 else if (t2.isScalar())
300 return t1.scalarToken() == t2.scalarToken();
312 t1.longDoubleScalarToken(),
313 t2.longDoubleScalarToken()
316 else if (t2.isScalar())
318 return t1.scalarToken() == t2.scalarToken();
336 void Foam::functionEntries::ifeqEntry::skipUntil
338 DynamicList<filePos>& stack,
339 const dictionary& contextDict,
340 const functionName& endWord,
348 if (t.isFunctionName())
356 stack.append(filePos(is.name(), is.lineNumber()));
360 else if (t.functionNameToken() == endWord)
368 <<
"Did not find matching " << endWord
369 <<
" for " <<
typeName <<
" condition"
379 const label lineNumber,
385 functionEntry(functionType, lineNumber, parentDict, is, tokens)
391 const label lineNumber,
402 bool Foam::functionEntries::ifeqEntry::execute
409 return execute(stack, contextDict, contextDict, is);
413 bool Foam::functionEntries::ifeqEntry::execute
423 return ifeqe.execute(stack, contextDict, contextEntry, is);
Macros for easy insertion into member function selection tables.
Macros for easy insertion into run-time selection tables.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
label lineNumber() const
Return current stream line number.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Conditional parsing of and within dictionary entries.
ifeqEntry(const functionName &functionType, const label lineNumber, const dictionary &parentDict, const Istream &is, const tokenList &tokens)
Construct from function type, dictionary and tokenList.
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
A functionName is a word starting with '#'.
A keyword and a list of tokens is a 'primitiveEntry'. An primitiveEntry can be read,...
A token holds items read from Istream.
const variable & variableToken() const
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
defineFunctionTypeNameAndDebug(includeFvConstraintEntry, 0)
addToMemberFunctionSelectionTable(functionEntry, calcEntry, execute, primitiveEntryIstream)
addToRunTimeSelectionTable(functionEntry, includeFvConstraintEntry, dictionary)
string & inplaceExpandEntry(string &s, const dictionary &dict, const bool allowEnvVars, const bool allowEmpty, const char sigil='$')
Inplace expand occurrences of variables according to the dictionary.
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool equal(const T &s1, const T &s2)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
List< token > tokenList
List of tokens, used for a IOdictionary entry.
Foam::argList args(argc, argv)