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()) <<
'\'';
153 case token::tokenType::UNDEFINED:
return "undefined";
154 case token::tokenType::BOOL:
return "bool";
155 case token::tokenType::FLAG:
return "flag";
156 case token::tokenType::PUNCTUATION:
return "punctuation";
160 case token::tokenType::LABEL:
return "label";
161 case token::tokenType::FLOAT:
return "float";
162 case token::tokenType::DOUBLE:
return "double";
163 case token::tokenType::WORD:
return "word";
164 case token::tokenType::DIRECTIVE:
return "directive";
165 case token::tokenType::STRING:
return "string";
166 case token::tokenType::EXPRESSION:
return "expression";
167 case token::tokenType::VARIABLE:
return "variable";
168 case token::tokenType::VERBATIM:
return "verbatim";
169 case token::tokenType::CHAR_DATA:
return "char_data";
170 case token::tokenType::COMPOUND:
return "compound";
171 case token::tokenType::ERROR:
return "error";
177 return "unknown(" + std::to_string(
int(tokType)) +
")";
194 case token::tokenType::UNDEFINED:
197 <<
"Undefined token" <<
endl;
200 case token::tokenType::FLAG:
204 case token::tokenType::PUNCTUATION:
205 os << tok.data_.punctuationVal;
208 case token::tokenType::BOOL:
209 case token::tokenType::LABEL:
210 os << tok.data_.labelVal;
213 case token::tokenType::FLOAT:
214 os << tok.data_.floatVal;
217 case token::tokenType::DOUBLE:
218 os << tok.data_.doubleVal;
223 case token::tokenType::DIRECTIVE:
224 case token::tokenType::EXPRESSION:
225 case token::tokenType::VARIABLE:
226 case token::tokenType::VERBATIM:
227 case token::tokenType::CHAR_DATA:
231 case token::tokenType::WORD:
232 os << *tok.data_.wordPtr;
235 case token::tokenType::STRING:
236 os << *tok.data_.stringPtr;
239 case token::tokenType::COMPOUND:
240 os << *tok.data_.compoundPtr;
243 case token::tokenType::ERROR:
246 <<
"Error token" <<
endl;
252 <<
"Unknown token" <<
endl;
262 return os << char(pt);
268 return os << char(pt);
288 ostream& Foam::operator<<
291 const InfoProxy<token>& iproxy
302 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.