A token holds items read from Istream. More...
Classes | |
class | compound |
Abstract base class for complex tokens. More... | |
class | Compound |
A templated class for holding compound tokens. More... | |
Public Types | |
enum | tokenType { UNDEFINED, PUNCTUATION, WORD, VARIABLE, STRING, VERBATIMSTRING, LABEL, FLOAT_SCALAR, DOUBLE_SCALAR, COMPOUND, ERROR } |
Enumeration defining the types of token. More... | |
enum | punctuationToken { NULL_TOKEN = '\0', SPACE = ' ', TAB = '\t', NL = '\n', END_STATEMENT = ';', BEGIN_LIST = '(', END_LIST = ')', BEGIN_SQR = '[', END_SQR = ']', BEGIN_BLOCK = '{', END_BLOCK = '}', COLON = ':', COMMA = ',', HASH = '#', BEGIN_STRING = '"', END_STRING = BEGIN_STRING, ASSIGN = '=', ADD = '+', SUBTRACT = '-', MULTIPLY = '*', DIVIDE = '/' } |
Standard punctuation tokens. More... | |
Public Member Functions | |
token () | |
Construct null. More... | |
token (const token &) | |
Construct as copy. More... | |
token (punctuationToken, label lineNumber=0) | |
Construct punctuation character token. More... | |
token (const word &, label lineNumber=0) | |
Construct word token. More... | |
token (const string &, label lineNumber=0) | |
Construct string token. More... | |
token (const label, label lineNumber=0) | |
Construct label token. More... | |
token (const floatScalar, label lineNumber=0) | |
Construct floatScalar token. More... | |
token (const doubleScalar, label lineNumber=0) | |
Construct doubleScalar token. More... | |
token (Istream &) | |
Construct from Istream. More... | |
~token () | |
Destructor. More... | |
tokenType | type () const |
tokenType & | type () |
bool | good () const |
bool | undefined () const |
bool | error () const |
bool | isPunctuation () const |
punctuationToken | pToken () const |
bool | isWord () const |
const word & | wordToken () const |
bool | isVariable () const |
bool | isString () const |
const string & | stringToken () const |
bool | isLabel () const |
label | labelToken () const |
bool | isFloatScalar () const |
floatScalar | floatScalarToken () const |
bool | isDoubleScalar () const |
doubleScalar | doubleScalarToken () const |
bool | isScalar () const |
scalar | scalarToken () const |
bool | isNumber () const |
scalar | number () const |
bool | isCompound () const |
const compound & | compoundToken () const |
compound & | transferCompoundToken (const Istream &is) |
label | lineNumber () const |
label & | lineNumber () |
void | setBad () |
Set bad. More... | |
InfoProxy< token > | info () const |
Return info proxy. More... | |
void | operator= (const token &) |
void | operator= (const punctuationToken) |
void | operator= (word *) |
void | operator= (const word &) |
void | operator= (string *) |
void | operator= (const string &) |
void | operator= (const label) |
void | operator= (const floatScalar) |
void | operator= (const doubleScalar) |
void | operator= (compound *) |
bool | operator== (const token &) const |
bool | operator== (const punctuationToken) const |
bool | operator== (const word &) const |
bool | operator== (const string &) const |
bool | operator== (const label) const |
bool | operator== (const floatScalar) const |
bool | operator== (const doubleScalar) const |
bool | operator!= (const token &) const |
bool | operator!= (const punctuationToken) const |
bool | operator!= (const word &) const |
bool | operator!= (const string &) const |
bool | operator!= (const label) const |
bool | operator!= (const floatScalar) const |
bool | operator!= (const doubleScalar) const |
Static Public Attributes | |
static token | undefinedToken |
Static undefined token. More... | |
static const char *const | typeName = "token" |
Friends | |
Istream & | operator>> (Istream &, token &) |
Ostream & | operator<< (Ostream &, const token &) |
Ostream & | operator<< (Ostream &, const punctuationToken &) |
ostream & | operator<< (ostream &, const punctuationToken &) |
ostream & | operator<< (ostream &, const InfoProxy< token > &) |
A token holds items read from Istream.
enum tokenType |
enum punctuationToken |
Construct as copy.
Definition at line 72 of file tokenI.H.
References token::COMPOUND, token::compoundTokenPtr_, token::DOUBLE_SCALAR, token::doubleScalarToken_, token::ERROR, token::FLOAT_SCALAR, token::floatScalarToken_, token::LABEL, token::labelToken_, token::PUNCTUATION, token::punctuationToken_, token::STRING, token::stringTokenPtr_, token::UNDEFINED, token::VARIABLE, token::VERBATIMSTRING, token::WORD, and token::wordTokenPtr_.
|
inline |
|
inline |
|
inline |
Construct from Istream.
Definition at line 34 of file tokenIO.C.
References Istream::read().
|
inline |
Definition at line 178 of file tokenI.H.
Referenced by token::compound::compound(), Foam::operator<<(), ISstream::read(), UIPstream::read(), prefixOSstream::write(), OSstream::write(), UOPstream::write(), and primitiveEntry::write().
|
inline |
|
inline |
Definition at line 188 of file tokenI.H.
References token::ERROR, and token::UNDEFINED.
Referenced by dimensionSet::dimensionSet(), keyType::match(), Foam::operator>>(), and primitiveEntry::read().
|
inline |
Definition at line 193 of file tokenI.H.
References token::UNDEFINED.
|
inline |
Definition at line 198 of file tokenI.H.
References token::ERROR.
|
inline |
Definition at line 203 of file tokenI.H.
References token::PUNCTUATION.
Referenced by blockDescriptor::blockDescriptor(), dimensionSet::dimensionSet(), FixedList< T, Size >::FixedList(), genericFvPatchField< Type >::genericFvPatchField(), List< T >::List(), LList< LListBase, T >::LList(), Foam::operator>>(), StaticHashTable< T, Key, Hash >::printInfo(), HashTable< T, Key, Hash >::printInfo(), PtrList< T >::read(), PackedList< nBits >::read(), IOPosition< CloudType >::readData(), Reaction< ReactionThermo >::setLRhs(), thirdBodyEfficiencies::thirdBodyEfficiencies(), and UList< T >::writeEntry().
|
inline |
Definition at line 208 of file tokenI.H.
References token::NULL_TOKEN, token::PUNCTUATION, and token::punctuationToken_.
Referenced by blockDescriptor::blockDescriptor(), dimensionSet::dimensionSet(), List< T >::List(), LList< LListBase, T >::LList(), Foam::operator<<(), Foam::operator>>(), StaticHashTable< T, Key, Hash >::printInfo(), HashTable< T, Key, Hash >::printInfo(), PtrList< T >::read(), PackedList< nBits >::read(), Istream::readBeginList(), IOPosition< CloudType >::readData(), Istream::readEndList(), thirdBodyEfficiencies::thirdBodyEfficiencies(), and UList< T >::writeEntry().
|
inline |
Definition at line 221 of file tokenI.H.
References token::WORD.
Referenced by blockDescriptor::blockDescriptor(), Constant< Type >::Constant(), dimensionSet::dimensionSet(), Field< Type >::Field(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), keyType::match(), dimensioned< Type >::operator/=(), Foam::operator>>(), dimensionSet::read(), IOobject::readHeader(), mappedPatchBase::readListOrField(), Reaction< ReactionThermo >::specieCoeffs::specieCoeffs(), and thirdBodyEfficiencies::thirdBodyEfficiencies().
|
inline |
Definition at line 226 of file tokenI.H.
References word::null, token::WORD, and token::wordTokenPtr_.
Referenced by blockDescriptor::blockDescriptor(), dimensionSet::dimensionSet(), Field< Type >::Field(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), keyType::match(), Foam::operator<<(), token::operator==(), Foam::operator>>(), dimensionSet::read(), IOobject::readHeader(), mappedPatchBase::readListOrField(), Reaction< ReactionThermo >::specieCoeffs::specieCoeffs(), and thirdBodyEfficiencies::thirdBodyEfficiencies().
|
inline |
Definition at line 239 of file tokenI.H.
References token::VARIABLE.
|
inline |
Definition at line 244 of file tokenI.H.
References token::STRING, token::VARIABLE, and token::VERBATIMSTRING.
Referenced by keyType::match(), and Foam::operator>>().
|
inline |
Definition at line 249 of file tokenI.H.
References string::null, token::STRING, token::stringTokenPtr_, token::VARIABLE, and token::VERBATIMSTRING.
Referenced by keyType::match(), Foam::operator<<(), token::operator==(), Foam::operator>>(), prefixOSstream::write(), OSstream::write(), and UOPstream::write().
|
inline |
Definition at line 262 of file tokenI.H.
References token::LABEL.
Referenced by FixedList< T, Size >::FixedList(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), List< T >::List(), LList< LListBase, T >::LList(), Matrix< Form, Type >::Matrix(), Foam::operator>>(), StaticHashTable< T, Key, Hash >::printInfo(), HashTable< T, Key, Hash >::printInfo(), PtrList< T >::read(), PackedList< nBits >::read(), IOPosition< CloudType >::readData(), and UList< T >::writeEntry().
|
inline |
Definition at line 267 of file tokenI.H.
References token::LABEL, and token::labelToken_.
Referenced by FixedList< T, Size >::FixedList(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), List< T >::List(), LList< LListBase, T >::LList(), Matrix< Form, Type >::Matrix(), Foam::operator<<(), Foam::operator>>(), StaticHashTable< T, Key, Hash >::printInfo(), HashTable< T, Key, Hash >::printInfo(), PtrList< T >::read(), PackedList< nBits >::read(), IOPosition< CloudType >::readData(), and UList< T >::writeEntry().
|
inline |
Definition at line 280 of file tokenI.H.
References token::FLOAT_SCALAR.
|
inline |
Definition at line 285 of file tokenI.H.
References token::FLOAT_SCALAR, and token::floatScalarToken_.
Referenced by Foam::operator<<().
|
inline |
Definition at line 299 of file tokenI.H.
References token::DOUBLE_SCALAR.
|
inline |
Definition at line 304 of file tokenI.H.
References token::DOUBLE_SCALAR, and token::doubleScalarToken_.
Referenced by Foam::operator<<().
|
inline |
Definition at line 318 of file tokenI.H.
References token::DOUBLE_SCALAR, and token::FLOAT_SCALAR.
Referenced by token::isNumber(), and token::number().
|
inline |
Definition at line 323 of file tokenI.H.
References token::DOUBLE_SCALAR, token::doubleScalarToken_, token::FLOAT_SCALAR, and token::floatScalarToken_.
Referenced by token::number().
|
inline |
Definition at line 340 of file tokenI.H.
References token::isScalar(), and token::LABEL.
Referenced by Time::findTimes(), Foam::operator>>(), dimensionSet::read(), and Reaction< ReactionThermo >::specieCoeffs::specieCoeffs().
|
inline |
Definition at line 345 of file tokenI.H.
References token::isScalar(), token::LABEL, token::labelToken_, and token::scalarToken().
Referenced by Time::findTimes(), genericFvPatchField< Type >::genericFvPatchField(), Foam::operator>>(), dimensionSet::read(), and Reaction< ReactionThermo >::specieCoeffs::specieCoeffs().
|
inline |
Definition at line 362 of file tokenI.H.
References token::COMPOUND.
Referenced by FixedList< T, Size >::FixedList(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), List< T >::List(), and UList< T >::writeEntry().
|
inline |
Definition at line 367 of file tokenI.H.
References token::COMPOUND, and token::compoundTokenPtr_.
Referenced by genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), and Foam::operator<<().
Foam::token::compound & transferCompoundToken | ( | const Istream & | is | ) |
Definition at line 93 of file token.C.
References Foam::abort(), Foam::FatalIOError, and FatalIOErrorIn.
Referenced by FixedList< T, Size >::FixedList(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), List< T >::List(), and UList< T >::writeEntry().
|
inline |
Definition at line 381 of file tokenI.H.
Referenced by Foam::operator<<(), ISstream::read(), UIPstream::read(), and ITstream::read().
|
inline |
Set bad.
Definition at line 392 of file tokenI.H.
References token::ERROR.
Referenced by ISstream::read(), and UIPstream::read().
Return info proxy.
Used to print token information to a stream
Definition at line 372 of file token.H.
Referenced by blockDescriptor::blockDescriptor(), Field< Type >::Field(), FixedList< T, Size >::FixedList(), List< T >::List(), LList< LListBase, T >::LList(), keyType::match(), Matrix< Form, Type >::Matrix(), Foam::operator>>(), StaticHashTable< T, Key, Hash >::printInfo(), HashTable< T, Key, Hash >::printInfo(), PtrList< T >::read(), PackedList< nBits >::read(), Istream::readBegin(), Istream::readBeginList(), IOPosition< CloudType >::readData(), Istream::readEnd(), Istream::readEndList(), Reaction< ReactionThermo >::specieCoeffs::specieCoeffs(), thirdBodyEfficiencies::thirdBodyEfficiencies(), and UList< T >::writeEntry().
|
inline |
Definition at line 401 of file tokenI.H.
References token::COMPOUND, token::compoundTokenPtr_, token::DOUBLE_SCALAR, token::doubleScalarToken_, token::ERROR, token::FLOAT_SCALAR, token::floatScalarToken_, token::LABEL, token::labelToken_, token::PUNCTUATION, token::punctuationToken_, token::STRING, token::stringTokenPtr_, token::UNDEFINED, token::VARIABLE, token::VERBATIMSTRING, token::WORD, and token::wordTokenPtr_.
Referenced by token::operator=().
|
inline |
Definition at line 449 of file tokenI.H.
References p, token::PUNCTUATION, and token::punctuationToken_.
|
inline |
Definition at line 456 of file tokenI.H.
References token::WORD, and token::wordTokenPtr_.
|
inline |
Definition at line 463 of file tokenI.H.
References token::operator=().
|
inline |
Definition at line 468 of file tokenI.H.
References token::STRING, and token::stringTokenPtr_.
|
inline |
Definition at line 475 of file tokenI.H.
References token::operator=().
|
inline |
Definition at line 480 of file tokenI.H.
References token::LABEL, and token::labelToken_.
|
inline |
Definition at line 487 of file tokenI.H.
References token::FLOAT_SCALAR, token::floatScalarToken_, and s().
|
inline |
Definition at line 494 of file tokenI.H.
References token::DOUBLE_SCALAR, token::doubleScalarToken_, and s().
|
inline |
Definition at line 501 of file tokenI.H.
References token::COMPOUND, and token::compoundTokenPtr_.
|
inline |
Definition at line 509 of file tokenI.H.
References token::COMPOUND, token::compoundTokenPtr_, token::DOUBLE_SCALAR, token::doubleScalarToken_, Foam::equal(), token::ERROR, token::FLOAT_SCALAR, token::floatScalarToken_, token::LABEL, token::labelToken_, token::PUNCTUATION, token::punctuationToken_, token::STRING, token::stringTokenPtr_, token::UNDEFINED, token::VARIABLE, token::VERBATIMSTRING, token::WORD, and token::wordTokenPtr_.
Referenced by token::operator!=().
|
inline |
Definition at line 551 of file tokenI.H.
References token::PUNCTUATION, and token::punctuationToken_.
|
inline |
Definition at line 556 of file tokenI.H.
References token::WORD, and token::wordToken().
|
inline |
Definition at line 561 of file tokenI.H.
References token::STRING, token::stringToken(), token::VARIABLE, and token::VERBATIMSTRING.
|
inline |
Definition at line 570 of file tokenI.H.
References token::LABEL, and token::labelToken_.
|
inline |
Definition at line 575 of file tokenI.H.
References Foam::equal(), token::FLOAT_SCALAR, and token::floatScalarToken_.
|
inline |
Definition at line 580 of file tokenI.H.
References token::DOUBLE_SCALAR, token::doubleScalarToken_, and Foam::equal().
|
inline |
Definition at line 585 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 590 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 595 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 600 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 615 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 605 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 610 of file tokenI.H.
References token::operator==().
|
friend |
|
friend |
|
static |
Static undefined token.
Definition at line 241 of file token.H.
Referenced by Istream::peekBack(), and ITstream::read().
punctuationToken punctuationToken_ |
Definition at line 254 of file token.H.
Referenced by Foam::operator<<(), token::operator=(), token::operator==(), token::pToken(), and token::token().
word* wordTokenPtr_ |
Definition at line 255 of file token.H.
Referenced by Foam::operator<<(), token::operator=(), token::operator==(), token::token(), and token::wordToken().
string* stringTokenPtr_ |
Definition at line 256 of file token.H.
Referenced by Foam::operator<<(), token::operator=(), token::operator==(), token::stringToken(), and token::token().
label labelToken_ |
Definition at line 257 of file token.H.
Referenced by token::labelToken(), token::number(), Foam::operator<<(), token::operator=(), token::operator==(), and token::token().
floatScalar floatScalarToken_ |
Definition at line 258 of file token.H.
Referenced by token::floatScalarToken(), Foam::operator<<(), token::operator=(), token::operator==(), token::scalarToken(), and token::token().
doubleScalar doubleScalarToken_ |
Definition at line 259 of file token.H.
Referenced by token::doubleScalarToken(), Foam::operator<<(), token::operator=(), token::operator==(), token::scalarToken(), and token::token().
|
mutable |
Definition at line 260 of file token.H.
Referenced by token::compoundToken(), Foam::operator<<(), token::operator=(), token::operator==(), and token::token().