Go to the documentation of this file.
48 !(level == 0 && nextTok == token::END_STATEMENT)
55 if( t == token::BEGIN_LIST ||
56 t == token::BEGIN_BLOCK ||
63 t == token::END_LIST ||
64 t == token::END_BLOCK ||
75 "number of opening and closing ( or, [ or { does not match, closing is greater than opening \n";
81 tokenStream_.appendToken(nextTok);
88 "imbalance number of ( or { or [ \n";
93 return nextTok.
good();
103 auto lastPuncBegin =
false;
104 auto lastPuncEnd =
false;
105 auto applySpace =
false;
107 const tokenList& tokens = tokenStream_.tokens();
110 for(
auto tok = tokens.cbegin(); tok != tokens.cend(); tok++)
129 lastPuncBegin =
true;
143 lastPuncBegin =
false;
148 if(!lastPuncBegin&&applySpace) os<<
spaceToken();
151 lastPuncBegin =
false;
167 tokenStream_(parDict_.globalName())
203 tokenStream_.rewind();
221 if( !readDataEntry(is) )
224 "error in reading data entry from file \n";
227 tokenStream_.rewind();
245 tokenStream_.appendToken(tok);
246 tokenStream_.rewind();
260 tokenStream_.rewind();
276 "Request for an entry that is not a dictionray. Entry name is " << globalName() <<
endl;
285 "Request for an entry that is not a dictionray. Entry name is " << globalName() <<
endl;
297 return tokenStream_.name();
310 "Request for an entry that is not a dictionray. Entry name is " << globalName() <<
endl;
319 "Request for an entry that is not a dictionray. Entry name is " << globalName() <<
endl;
327 return makeUnique<dataEntry>(*
this);
333 auto ptr = makeUnique<dataEntry>(*
this);
334 return ptr.release();
339 return makeUnique<dataEntry>(this->keyword(), parDict, *
this);
344 auto ptr = makeUnique<dataEntry>(this->keyword(), parDict, *
this);
345 return ptr.release();
352 if(!readKeyword(is, keyword_, tok))
355 "expected a valid keyword for dataEntry but found " << tok <<
endl;
359 if(!readDataEntry(is) )
362 "unsucceful in reading dataEntry from " << is.
name() <<
endl;
372 if( !writeDataEntry(os) )
const tokenList & tokens() const
const access to token list
bool readDataEntry(iIstream &is)
read dataEntry from stream
virtual iIstream & read(token &)=0
Return next token from stream.
#define fatalExit
Fatal exit.
Token class based on OpenFOAM stream, with some modifications/simplifications to be tailored to our n...
virtual iTstream & stream()
access to token stream
punctuationToken pToken() const
Return punctuation character.
token endStatementToken()
virtual const dictionary & parrentDict() const
const ref to parrent dictionary
virtual word globalName() const
global name of entry, separated with dots
bool isPunctuation() const
Token is PUNCTUATION.
bool writeDataEntry(iOstream &os) const
write dataEntry to stream
bool good() const
True if token is not UNDEFINED or ERROR.
virtual word globalName() const
global name of entry, separated with dots
iOstream & endl(iOstream &os)
Add newline and flush stream.
bool isEndToken(const token &tok)
dataEntry()
construct null dataEntry
Data entry to be used in dictionries.
Interface class for any input stream
bool bad() const
Return true if stream is corrupted.
iTstream tokenStream_
list the tokens as input token stream
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
virtual void rewind() override
Rewind the stream so that it may be read again.
bool fatalCheck(const char *operation) const
Check IOstream status for given operation.
virtual iOstream & endEntry()
Write end entry (';') followed by newline.
virtual dictionary * dictPtr()
not permited to be called
virtual const word & name() const
Return the name of the stream.
static dataEntry nullDataEntry
virtual bool isDictionary() const
should returen false;
virtual bool read(iIstream &is)
read from stream
virtual uniquePtr< iEntry > clone() const
word groupNames(const word &bw, const word &tw, char sep='.')
Group words and output bw.tw.
#define ioErrorInFile(fileName, lineNumber)
Report an error in file operation with supplied fileName and lineNumber.
Interface calss for data entry and dictionary
int32 lineNumber() const
Const access to the current stream line number.
virtual iEntry * clonePtr() const
clone the object
virtual dictionary & dict()
not permited to be called
virtual bool write(iOstream &os) const
write to stream
Interface class for any output stream.
bool isBeginToken(const token &tok)
Dictionary holds a set of data entries or sub-dictionaries that are enclosed in a curely braces or ar...