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 : char { UNDEFINED = 0, PUNCTUATION = char(128), WORD, VARIABLE, STRING, VERBATIMSTRING, LABEL, FLOAT_SCALAR, DOUBLE_SCALAR, LONG_DOUBLE_SCALAR, COMPOUND, ERROR } |
Enumeration defining the types of token. More... | |
enum | punctuationToken : char { 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 (const longDoubleScalar, label lineNumber=0) | |
Construct longDoubleScalar 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 | isLongDoubleScalar () const |
longDoubleScalar | longDoubleScalarToken () 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= (const longDoubleScalar) |
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 longDoubleScalar) 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 |
bool | operator!= (const longDoubleScalar) 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 : char |
enum punctuationToken : char |
Construct as copy.
Definition at line 69 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::LONG_DOUBLE_SCALAR, token::longDoubleScalarTokenPtr_, token::PUNCTUATION, token::punctuationToken_, token::STRING, token::stringTokenPtr_, token::UNDEFINED, token::VARIABLE, token::VERBATIMSTRING, token::WORD, and token::wordTokenPtr_.
|
inline |
|
inline |
|
inline |
|
inline |
Construct from Istream.
Definition at line 34 of file tokenIO.C.
References Istream::read().
|
inline |
Definition at line 187 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 197 of file tokenI.H.
References token::ERROR, and token::UNDEFINED.
Referenced by dimensionSet::dimensionSet(), Foam::operator>>(), and primitiveEntry::read().
|
inline |
Definition at line 202 of file tokenI.H.
References token::UNDEFINED.
|
inline |
Definition at line 207 of file tokenI.H.
References token::ERROR.
|
inline |
Definition at line 212 of file tokenI.H.
References token::PUNCTUATION.
Referenced by blockDescriptor::blockDescriptor(), dictionaryListEntry::dictionaryListEntry(), dimensionSet::dimensionSet(), FixedList< Type, 3 >::FixedList(), genericFvPatchField< Type >::genericFvPatchField(), List< Field< scalar > >::List(), LList< Foam::chemPointISAT< CompType, ThermoType > *>::LList(), blockVertex::New(), entry::New(), Foam::operator>>(), StaticHashTable< T, Key, Hash >::printInfo(), HashTable< Foam::phase *>::printInfo(), Foam::blockMeshTools::read(), PtrList< transferModel >::read(), PackedList< 2 >::read(), IOPosition< CloudType >::readData(), Reaction< ReactionThermo >::setLRhs(), and UList< Foam::wordRe >::writeEntry().
|
inline |
Definition at line 217 of file tokenI.H.
References token::NULL_TOKEN, token::PUNCTUATION, and token::punctuationToken_.
Referenced by blockDescriptor::blockDescriptor(), dictionaryListEntry::dictionaryListEntry(), dimensionSet::dimensionSet(), List< Field< scalar > >::List(), LList< Foam::chemPointISAT< CompType, ThermoType > *>::LList(), blockVertex::New(), entry::New(), Foam::operator<<(), Foam::operator>>(), StaticHashTable< T, Key, Hash >::printInfo(), HashTable< Foam::phase *>::printInfo(), Foam::blockMeshTools::read(), PtrList< transferModel >::read(), PackedList< 2 >::read(), Istream::readBeginList(), IOPosition< CloudType >::readData(), Istream::readEndList(), and UList< Foam::wordRe >::writeEntry().
|
inline |
Definition at line 230 of file tokenI.H.
References token::WORD.
Referenced by blockDescriptor::blockDescriptor(), dimensionSet::dimensionSet(), Field< Foam::Vector2D >::Field(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), blockVertex::New(), decomposedBlockData::numBlocks(), dimensioned< vector >::operator/=(), Foam::operator>>(), Foam::blockMeshTools::read(), dimensionSet::read(), IOobject::readHeader(), mappedPatchBase::readListOrField(), and Reaction< ReactionThermo >::specieCoeffs::specieCoeffs().
|
inline |
Definition at line 235 of file tokenI.H.
References word::null, word::typeName, token::WORD, and token::wordTokenPtr_.
Referenced by blockDescriptor::blockDescriptor(), dimensionSet::dimensionSet(), Field< Foam::Vector2D >::Field(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), blockVertex::New(), decomposedBlockData::numBlocks(), Foam::operator<<(), token::operator==(), Foam::operator>>(), Foam::blockMeshTools::read(), dimensionSet::read(), IOobject::readHeader(), mappedPatchBase::readListOrField(), and Reaction< ReactionThermo >::specieCoeffs::specieCoeffs().
|
inline |
Definition at line 248 of file tokenI.H.
References token::VARIABLE.
|
inline |
Definition at line 253 of file tokenI.H.
References token::STRING, token::VARIABLE, and token::VERBATIMSTRING.
Referenced by Foam::operator>>().
|
inline |
Definition at line 258 of file tokenI.H.
References string::null, token::STRING, token::stringTokenPtr_, string::typeName, token::VARIABLE, and token::VERBATIMSTRING.
Referenced by Foam::operator<<(), token::operator==(), Foam::operator>>(), prefixOSstream::write(), OSstream::write(), functionEntry::write(), and UOPstream::write().
|
inline |
Definition at line 271 of file tokenI.H.
References token::LABEL.
Referenced by dictionaryListEntry::dictionaryListEntry(), FixedList< Type, 3 >::FixedList(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), List< Field< scalar > >::List(), LList< Foam::chemPointISAT< CompType, ThermoType > *>::LList(), Matrix< RectangularMatrix< Type >, Type >::Matrix(), entry::New(), decomposedBlockData::numBlocks(), Foam::operator>>(), StaticHashTable< T, Key, Hash >::printInfo(), HashTable< Foam::phase *>::printInfo(), Foam::blockMeshTools::read(), PtrList< transferModel >::read(), PackedList< 2 >::read(), IOPosition< CloudType >::readData(), and UList< Foam::wordRe >::writeEntry().
|
inline |
Definition at line 276 of file tokenI.H.
References token::LABEL, and token::labelToken_.
Referenced by dictionaryListEntry::dictionaryListEntry(), FixedList< Type, 3 >::FixedList(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), List< Field< scalar > >::List(), LList< Foam::chemPointISAT< CompType, ThermoType > *>::LList(), Matrix< RectangularMatrix< Type >, Type >::Matrix(), Foam::operator<<(), Foam::operator>>(), StaticHashTable< T, Key, Hash >::printInfo(), HashTable< Foam::phase *>::printInfo(), Foam::blockMeshTools::read(), PtrList< transferModel >::read(), PackedList< 2 >::read(), IOPosition< CloudType >::readData(), and UList< Foam::wordRe >::writeEntry().
|
inline |
Definition at line 289 of file tokenI.H.
References token::FLOAT_SCALAR.
|
inline |
Definition at line 294 of file tokenI.H.
References token::FLOAT_SCALAR, and token::floatScalarToken_.
Referenced by Foam::operator<<().
|
inline |
Definition at line 308 of file tokenI.H.
References token::DOUBLE_SCALAR.
|
inline |
Definition at line 313 of file tokenI.H.
References token::DOUBLE_SCALAR, and token::doubleScalarToken_.
Referenced by Foam::operator<<().
|
inline |
Definition at line 327 of file tokenI.H.
References token::LONG_DOUBLE_SCALAR.
|
inline |
Definition at line 332 of file tokenI.H.
References token::LONG_DOUBLE_SCALAR, and token::longDoubleScalarTokenPtr_.
Referenced by Foam::operator<<().
|
inline |
Definition at line 346 of file tokenI.H.
References token::DOUBLE_SCALAR, token::FLOAT_SCALAR, and token::LONG_DOUBLE_SCALAR.
Referenced by token::isNumber(), and token::number().
|
inline |
Definition at line 356 of file tokenI.H.
References token::DOUBLE_SCALAR, token::doubleScalarToken_, token::FLOAT_SCALAR, token::floatScalarToken_, token::LONG_DOUBLE_SCALAR, and token::longDoubleScalarTokenPtr_.
Referenced by token::number().
|
inline |
Definition at line 377 of file tokenI.H.
References token::isScalar(), and token::LABEL.
Referenced by CrankNicolsonDdtScheme< Type >::CrankNicolsonDdtScheme(), Foam::operator>>(), dimensionSet::read(), and Reaction< ReactionThermo >::specieCoeffs::specieCoeffs().
|
inline |
Definition at line 382 of file tokenI.H.
References token::isScalar(), token::LABEL, token::labelToken_, and token::scalarToken().
Referenced by CrankNicolsonDdtScheme< Type >::CrankNicolsonDdtScheme(), genericFvPatchField< Type >::genericFvPatchField(), Foam::operator>>(), dimensionSet::read(), and Reaction< ReactionThermo >::specieCoeffs::specieCoeffs().
|
inline |
Definition at line 399 of file tokenI.H.
References token::COMPOUND.
Referenced by FixedList< Type, 3 >::FixedList(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), List< Field< scalar > >::List(), and UList< Foam::wordRe >::writeEntry().
|
inline |
Definition at line 404 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 FatalIOErrorInFunction.
Referenced by FixedList< Type, 3 >::FixedList(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), List< Field< scalar > >::List(), and UList< Foam::wordRe >::writeEntry().
|
inline |
Definition at line 418 of file tokenI.H.
Referenced by Foam::operator<<(), ISstream::read(), UIPstream::read(), and ITstream::read().
|
inline |
|
inline |
Set bad.
Definition at line 429 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 380 of file token.H.
Referenced by blockDescriptor::blockDescriptor(), dictionaryListEntry::dictionaryListEntry(), Field< Foam::Vector2D >::Field(), FixedList< Type, 3 >::FixedList(), List< Field< scalar > >::List(), LList< Foam::chemPointISAT< CompType, ThermoType > *>::LList(), Matrix< RectangularMatrix< Type >, Type >::Matrix(), blockVertex::New(), Foam::operator>>(), StaticHashTable< T, Key, Hash >::printInfo(), HashTable< Foam::phase *>::printInfo(), Foam::blockMeshTools::read(), PtrList< transferModel >::read(), PackedList< 2 >::read(), Istream::readBegin(), Istream::readBeginList(), IOPosition< CloudType >::readData(), Istream::readEnd(), Istream::readEndList(), Reaction< ReactionThermo >::specieCoeffs::specieCoeffs(), and UList< Foam::wordRe >::writeEntry().
|
inline |
Definition at line 438 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::LONG_DOUBLE_SCALAR, token::longDoubleScalarTokenPtr_, 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 491 of file tokenI.H.
References p, token::PUNCTUATION, and token::punctuationToken_.
|
inline |
Definition at line 498 of file tokenI.H.
References token::WORD, and token::wordTokenPtr_.
|
inline |
Definition at line 505 of file tokenI.H.
References token::operator=().
|
inline |
Definition at line 510 of file tokenI.H.
References token::STRING, and token::stringTokenPtr_.
|
inline |
Definition at line 517 of file tokenI.H.
References token::operator=().
|
inline |
Definition at line 522 of file tokenI.H.
References token::LABEL, and token::labelToken_.
|
inline |
Definition at line 529 of file tokenI.H.
References token::FLOAT_SCALAR, token::floatScalarToken_, and s().
|
inline |
Definition at line 536 of file tokenI.H.
References token::DOUBLE_SCALAR, token::doubleScalarToken_, and s().
|
inline |
Definition at line 543 of file tokenI.H.
References token::LONG_DOUBLE_SCALAR, and token::longDoubleScalarTokenPtr_.
|
inline |
Definition at line 550 of file tokenI.H.
References token::COMPOUND, and token::compoundTokenPtr_.
|
inline |
Definition at line 558 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::LONG_DOUBLE_SCALAR, token::longDoubleScalarTokenPtr_, 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 607 of file tokenI.H.
References token::PUNCTUATION, and token::punctuationToken_.
|
inline |
Definition at line 612 of file tokenI.H.
References token::WORD, and token::wordToken().
|
inline |
Definition at line 617 of file tokenI.H.
References token::STRING, token::stringToken(), token::VARIABLE, and token::VERBATIMSTRING.
|
inline |
Definition at line 626 of file tokenI.H.
References token::LABEL, and token::labelToken_.
|
inline |
Definition at line 631 of file tokenI.H.
References Foam::equal(), token::FLOAT_SCALAR, and token::floatScalarToken_.
|
inline |
Definition at line 636 of file tokenI.H.
References token::DOUBLE_SCALAR, token::doubleScalarToken_, and Foam::equal().
|
inline |
Definition at line 641 of file tokenI.H.
References Foam::equal(), token::LONG_DOUBLE_SCALAR, and token::longDoubleScalarTokenPtr_.
|
inline |
Definition at line 649 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 654 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 659 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 664 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 684 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 669 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 674 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 679 of file tokenI.H.
References token::operator==().
|
friend |
|
friend |
|
static |
Static undefined token.
Definition at line 242 of file token.H.
Referenced by Istream::peekBack(), and ITstream::read().
punctuationToken punctuationToken_ |
Definition at line 255 of file token.H.
Referenced by Foam::operator<<(), token::operator=(), token::operator==(), token::pToken(), and token::token().
word* wordTokenPtr_ |
Definition at line 256 of file token.H.
Referenced by Foam::operator<<(), token::operator=(), token::operator==(), token::token(), and token::wordToken().
string* stringTokenPtr_ |
Definition at line 257 of file token.H.
Referenced by Foam::operator<<(), token::operator=(), token::operator==(), token::stringToken(), and token::token().
label labelToken_ |
Definition at line 258 of file token.H.
Referenced by token::labelToken(), token::number(), Foam::operator<<(), token::operator=(), token::operator==(), and token::token().
floatScalar floatScalarToken_ |
Definition at line 259 of file token.H.
Referenced by token::floatScalarToken(), Foam::operator<<(), token::operator=(), token::operator==(), token::scalarToken(), and token::token().
doubleScalar doubleScalarToken_ |
Definition at line 260 of file token.H.
Referenced by token::doubleScalarToken(), Foam::operator<<(), token::operator=(), token::operator==(), token::scalarToken(), and token::token().
longDoubleScalar* longDoubleScalarTokenPtr_ |
Definition at line 261 of file token.H.
Referenced by token::longDoubleScalarToken(), Foam::operator<<(), token::operator=(), token::operator==(), token::scalarToken(), and token::token().
|
mutable |
Definition at line 262 of file token.H.
Referenced by token::compoundToken(), Foam::operator<<(), token::operator=(), token::operator==(), and token::token().