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() <<
'\'';
60 case token::tokenType::LABEL:
64 case token::tokenType::FLOAT:
68 case token::tokenType::DOUBLE:
72 case token::tokenType::WORD:
76 case token::tokenType::DIRECTIVE:
80 case token::tokenType::STRING:
84 case token::tokenType::EXPRESSION:
88 case token::tokenType::VARIABLE:
92 case token::tokenType::VERBATIM:
96 case token::tokenType::CHAR_DATA:
100 case token::tokenType::COMPOUND:
110 os <<
"compound of type " 115 case token::tokenType::ERROR:
120 os <<
"unknown token type '" << int(tok.
type()) <<
'\'';
145 case token::tokenType::UNDEFINED:
return "undefined";
146 case token::tokenType::BOOL:
return "bool";
147 case token::tokenType::FLAG:
return "flag";
148 case token::tokenType::PUNCTUATION:
return "punctuation";
149 case token::tokenType::LABEL:
return "label";
150 case token::tokenType::FLOAT:
return "float";
151 case token::tokenType::DOUBLE:
return "double";
152 case token::tokenType::WORD:
return "word";
153 case token::tokenType::DIRECTIVE:
return "directive";
154 case token::tokenType::STRING:
return "string";
155 case token::tokenType::EXPRESSION:
return "expression";
156 case token::tokenType::VARIABLE:
return "variable";
157 case token::tokenType::VERBATIM:
return "verbatim";
158 case token::tokenType::CHAR_DATA:
return "char_data";
159 case token::tokenType::COMPOUND:
return "compound";
160 case token::tokenType::ERROR:
return "error";
166 return "unknown(" + std::to_string(
int(tokType)) +
")";
183 case token::tokenType::UNDEFINED:
186 <<
"Undefined token" <<
endl;
189 case token::tokenType::FLAG:
193 case token::tokenType::PUNCTUATION:
194 os << tok.data_.punctuationVal;
197 case token::tokenType::BOOL:
198 case token::tokenType::LABEL:
199 os << tok.data_.labelVal;
202 case token::tokenType::FLOAT:
203 os << tok.data_.floatVal;
206 case token::tokenType::DOUBLE:
207 os << tok.data_.doubleVal;
212 case token::tokenType::DIRECTIVE:
213 case token::tokenType::EXPRESSION:
214 case token::tokenType::VARIABLE:
215 case token::tokenType::VERBATIM:
216 case token::tokenType::CHAR_DATA:
220 case token::tokenType::WORD:
221 os << *tok.data_.wordPtr;
224 case token::tokenType::STRING:
225 os << *tok.data_.stringPtr;
228 case token::tokenType::COMPOUND:
229 os << *tok.data_.compoundPtr;
232 case token::tokenType::ERROR:
235 <<
"Error token" <<
endl;
241 <<
"Unknown token" <<
endl;
251 return os << char(pt);
257 return os << char(pt);
277 ostream& Foam::operator<<
280 const InfoProxy<token>& iproxy
291 const InfoProxy<token>& iproxy
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.
#define WarningInFunction
Report a warning using Foam::Warning.
label labelToken() const
Return label value.
bool pending() const noexcept
Get compound pending-read status.