44 case token::tokenType::UNDEFINED:
45 os <<
"undefined token";
48 case token::tokenType::BOOL:
49 os <<
"bool '" << (tok.
boolToken() ?
"true" :
"false") <<
'\'';
52 case token::tokenType::FLAG:
56 case token::tokenType::PUNCTUATION:
57 os <<
"punctuation '" << tok.
pToken() <<
'\'';
68 case token::tokenType::LABEL:
72 case token::tokenType::FLOAT:
76 case token::tokenType::DOUBLE:
80 case token::tokenType::WORD:
84 case token::tokenType::DIRECTIVE:
88 case token::tokenType::STRING:
92 case token::tokenType::EXPRESSION:
96 case token::tokenType::VARIABLE:
100 case token::tokenType::VERBATIM:
104 case token::tokenType::CHAR_DATA:
108 case token::tokenType::COMPOUND:
118 os <<
"compound of type " 123 case token::tokenType::ERROR:
128 os <<
"unknown token type '" << int(tok.
type()) <<
'\'';
166 case token::tokenType::UNDEFINED:
return "undefined";
167 case token::tokenType::BOOL:
return "bool";
168 case token::tokenType::FLAG:
return "flag";
169 case token::tokenType::PUNCTUATION:
return "punctuation";
173 case token::tokenType::LABEL:
return "label";
174 case token::tokenType::FLOAT:
return "float";
175 case token::tokenType::DOUBLE:
return "double";
176 case token::tokenType::WORD:
return "word";
177 case token::tokenType::DIRECTIVE:
return "directive";
178 case token::tokenType::STRING:
return "string";
179 case token::tokenType::EXPRESSION:
return "expression";
180 case token::tokenType::VARIABLE:
return "variable";
181 case token::tokenType::VERBATIM:
return "verbatim";
182 case token::tokenType::CHAR_DATA:
return "char_data";
183 case token::tokenType::COMPOUND:
return "compound";
184 case token::tokenType::ERROR:
return "error";
190 return "unknown(" + std::to_string(
int(tokType)) +
")";
207 case token::tokenType::UNDEFINED:
210 <<
"Undefined token" <<
endl;
213 case token::tokenType::FLAG:
217 case token::tokenType::PUNCTUATION:
218 os << tok.data_.punctuationVal;
221 case token::tokenType::BOOL:
222 case token::tokenType::LABEL:
223 os << tok.data_.labelVal;
226 case token::tokenType::FLOAT:
227 os << tok.data_.floatVal;
230 case token::tokenType::DOUBLE:
231 os << tok.data_.doubleVal;
236 case token::tokenType::DIRECTIVE:
237 case token::tokenType::EXPRESSION:
238 case token::tokenType::VARIABLE:
239 case token::tokenType::VERBATIM:
240 case token::tokenType::CHAR_DATA:
244 case token::tokenType::WORD:
245 os << *tok.data_.wordPtr;
248 case token::tokenType::STRING:
249 os << *tok.data_.stringPtr;
252 case token::tokenType::COMPOUND:
253 os << *tok.data_.compoundPtr;
256 case token::tokenType::ERROR:
259 <<
"Error token" <<
endl;
265 <<
"Unknown token" <<
endl;
275 return os << char(pt);
281 return os << char(pt);
301 ostream& Foam::operator<<
304 const InfoProxy<token>& iproxy
315 const InfoProxy<token>& iproxy
bool good() const noexcept
True if token is not UNDEFINED or ERROR.
punctuationToken pToken() const
Return punctuation character.
constexpr token() noexcept
Default construct, initialized to an UNDEFINED token.
virtual Ostream & write(const char c) override
Write character.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
const word & wordToken() const
Return const reference to the word contents.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
A token holds an item read from Istream.
tokenType
Enumeration defining the types of token.
bool moved() const noexcept
Get compound transferred status.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tokenType type() const noexcept
Return the token type.
static OS & printTokenInfo(OS &os, const token &tok)
float floatToken() const
Return float value.
bool boolToken() const
Return boolean token value.
word name() const
Return the name of the current token type.
#define SeriousErrorInFunction
Report an error message using Foam::SeriousError.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
int flagToken() const
Return flag bitmask value.
label lineNumber() const noexcept
The line number for the token.
virtual Istream & read(token &)=0
Return next token from stream.
double doubleToken() const
Return double value.
A class for handling words, derived from Foam::string.
Istream & operator>>(Istream &, directionInfo &)
punctuationToken
Standard punctuation tokens (a character)
const compound & compoundToken() const
Const reference to compound token. Fatal if the wrong type.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
const string & stringToken() const
Return const reference to the string contents.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
void reset()
Reset token to UNDEFINED and clear any allocated storage.
bool read(Istream &is)
Read a token from Istream, calls reset() first.
#define WarningInFunction
Report a warning using Foam::Warning.
bool good() const noexcept
True if next operation might succeed.
label labelToken() const
Return label value.
bool pending() const noexcept
Get compound pending-read status.