44static constexpr label maxRecursionDepth_ = 100;
59 for (
const string& input : inputs)
64 for (
const auto& subMatch : varExpressions)
76 if (varExpr[0] ==
'#')
94 result.reserve(result.size() + expansions.size());
97 result.append(std::move(str));
138 const entry* eptr =
dict.findEntry(keyword, keyType::LITERAL_RECURSIVE);
145 <<
"Missing mandatory entry: " << keyword << nl << nl
146 << exit(FatalIOError);
152 if (++recursionDepth > maxRecursionDepth_)
155 <<
"Exceeded recursion depth (" << maxRecursionDepth_
156 <<
") while reading list " << keyword <<
nl
157 <<
"Likely caused by circular referencing" <<
nl
158 <<
exit(FatalIOError);
162 ITstream& is = eptr->stream();
167 if (tok.isLabel() || tok.isPunctuation(token::BEGIN_LIST))
173 else if (tok.isString())
177 list[0] = tok.stringToken();
182 <<
" Entry '"<< keyword
183 <<
"' not a string or list of strings" <<
nl
184 <<
exit(FatalIOError);
190 dict.checkITstream(is, keyword);
193 return expandExprStrings(list,
dict, mandatory, recursionDepth);
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeMin > & shrink()
Calls shrink_to_fit() and returns a reference to the DynamicList.
An input stream of tokens.
virtual void rewind() override
Rewind the stream so that it may be read again. Same as seek(0).
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void resize(const label len)
Adjust allocated size of list.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A keyword and a list of tokens is an 'entry'.
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
A variant of Foam::string with expansion of dictionary variables into a comma-separated form.
static exprString toExpr(const std::string &str)
Copy convert string to exprString.
A token holds an item read from Istream.
bool isPunctuation() const noexcept
Token is PUNCTUATION.
@ BEGIN_LIST
Begin list [isseparator].
bool isLabel() const noexcept
Integral token is convertible to Foam::label.
const string & stringToken() const
Return const reference to the string contents.
bool isString() const noexcept
Token is string-variant (STRING, EXPRESSION, VARIABLE, VERBATIM, CHAR_DATA).
A class for handling words, derived from Foam::string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
string trim(const std::string &s)
Return string trimmed of leading and trailing whitespace.
Foam::SubStrings split(const std::string &str, const char delim, std::string::size_type pos=0, const bool keepEmpty=false)
Split string into sub-strings at the delimiter character.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).