A token holds items read from Istream. More...
Data Structures | |
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" |
Private Member Functions | |
void | clear () |
Clear any allocated storage (word or string) More... | |
void | parseError (const char *expected) const |
Private Attributes | |
tokenType | type_ |
The token type. More... | |
union { | |
punctuationToken punctuationToken_ | |
word * wordTokenPtr_ | |
string * stringTokenPtr_ | |
label labelToken_ | |
floatScalar floatScalarToken_ | |
doubleScalar doubleScalarToken_ | |
compound * compoundTokenPtr_ | |
}; | |
Anonymous Union of token types. More... | |
label | lineNumber_ |
Line number in the file this token was read from. More... | |
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::type_, 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 |
Destructor.
Definition at line 170 of file tokenI.H.
References token::clear().
|
inlineprivate |
Clear any allocated storage (word or string)
Definition at line 36 of file tokenI.H.
References token::COMPOUND, token::compoundTokenPtr_, refCount::okToDelete(), token::STRING, token::stringTokenPtr_, token::type_, token::UNDEFINED, token::VARIABLE, token::VERBATIMSTRING, token::WORD, and token::wordTokenPtr_.
Referenced by token::operator=(), Foam::operator>>(), token::setBad(), and token::~token().
|
private |
Definition at line 43 of file token.C.
References Foam::endl(), Foam::FatalIOError, and token::info().
Referenced by token::compoundToken(), token::doubleScalarToken(), token::floatScalarToken(), token::labelToken(), token::number(), token::pToken(), token::scalarToken(), token::stringToken(), and token::wordToken().
|
inline |
Definition at line 178 of file tokenI.H.
References token::type_.
Referenced by 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, token::type_, and token::UNDEFINED.
Referenced by entry::getKeyword(), Foam::operator>>(), and primitiveEntry::read().
|
inline |
Definition at line 193 of file tokenI.H.
References token::type_, and token::UNDEFINED.
|
inline |
Definition at line 198 of file tokenI.H.
References token::ERROR, and token::type_.
Referenced by dimensionSet::parse().
|
inline |
Definition at line 203 of file tokenI.H.
References token::PUNCTUATION, and token::type_.
Referenced by blockDescriptor::blockDescriptor(), blockMesh::createTopology(), genericFvPatchField< Type >::genericFvPatchField(), Foam::operator>>(), dimensionSet::parse(), dimensionSet::tokeniser::priority(), ILList< DLListBase, entry >::read(), HashPtrTable< ThermoType >::read(), LPtrList< SLListBase, Reaction< Foam::sutherlandTransport > >::read(), PtrList< injectionModel >::read(), PackedList< 2 >::read(), IOPosition::readData(), blockMesh::readPatches(), Reaction::setLRhs(), and thirdBodyEfficiencies::thirdBodyEfficiencies().
|
inline |
Definition at line 208 of file tokenI.H.
References token::NULL_TOKEN, token::parseError(), token::PUNCTUATION, token::punctuationToken_, and token::type_.
Referenced by blockDescriptor::blockDescriptor(), blockMesh::createTopology(), Foam::operator<<(), Foam::operator>>(), dimensionSet::parse(), dimensionSet::tokeniser::priority(), HashPtrTable< ThermoType >::read(), ILList< DLListBase, entry >::read(), LPtrList< SLListBase, Reaction< Foam::sutherlandTransport > >::read(), PtrList< injectionModel >::read(), PackedList< 2 >::read(), Istream::readBeginList(), IOPosition::readData(), Istream::readEndList(), blockMesh::readPatches(), and thirdBodyEfficiencies::thirdBodyEfficiencies().
|
inline |
Definition at line 221 of file tokenI.H.
References token::type_, and token::WORD.
Referenced by primitiveEntry::append(), blockDescriptor::blockDescriptor(), CompatibilityConstant::CompatibilityConstant(), Constant::Constant(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), entry::getKeyword(), dimensioned< Type >::initialize(), DataEntry::New(), dimensionSet::tokeniser::nextToken(), Foam::operator>>(), dimensionSet::parse(), dimensionSet::read(), IOobject::readHeader(), mappedPatchBase::readListOrField(), triSurface::readSTL(), Reaction::specieCoeffs::specieCoeffs(), and thirdBodyEfficiencies::thirdBodyEfficiencies().
|
inline |
Definition at line 226 of file tokenI.H.
References word::null, token::parseError(), token::type_, word::typeName, token::WORD, and token::wordTokenPtr_.
Referenced by primitiveEntry::append(), blockDescriptor::blockDescriptor(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), entry::getKeyword(), DataEntry::New(), dimensionSet::tokeniser::nextToken(), Foam::operator<<(), token::operator==(), Foam::operator>>(), dimensionSet::parse(), dimensionSet::read(), IOobject::readHeader(), mappedPatchBase::readListOrField(), triSurface::readSTL(), Reaction::specieCoeffs::specieCoeffs(), and thirdBodyEfficiencies::thirdBodyEfficiencies().
|
inline |
Definition at line 239 of file tokenI.H.
References token::type_, and token::VARIABLE.
Referenced by primitiveEntry::append().
|
inline |
Definition at line 244 of file tokenI.H.
References token::STRING, token::type_, token::VARIABLE, and token::VERBATIMSTRING.
Referenced by entry::getKeyword(), and Foam::operator>>().
|
inline |
Definition at line 249 of file tokenI.H.
References string::null, token::parseError(), token::STRING, token::stringTokenPtr_, token::type_, string::typeName, token::VARIABLE, and token::VERBATIMSTRING.
Referenced by primitiveEntry::append(), entry::getKeyword(), 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, and token::type_.
Referenced by LongList< Foam::meshOctreeCube >::appendFromStream(), blockMesh::createTopology(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), Foam::operator>>(), ILList< DLListBase, entry >::read(), HashPtrTable< ThermoType >::read(), LPtrList< SLListBase, Reaction< Foam::sutherlandTransport > >::read(), PtrList< injectionModel >::read(), PackedList< 2 >::read(), IOPosition::readData(), and blockMesh::readPatches().
|
inline |
Definition at line 267 of file tokenI.H.
References token::LABEL, token::labelToken_, token::parseError(), and token::type_.
Referenced by LongList< Foam::meshOctreeCube >::appendFromStream(), blockMesh::createTopology(), genericFvPatchField< Type >::genericFvPatchField(), genericPointPatchField< Type >::genericPointPatchField(), Foam::operator<<(), Foam::operator>>(), HashPtrTable< ThermoType >::read(), ILList< DLListBase, entry >::read(), LPtrList< SLListBase, Reaction< Foam::sutherlandTransport > >::read(), PtrList< injectionModel >::read(), PackedList< 2 >::read(), IOPosition::readData(), and blockMesh::readPatches().
|
inline |
Definition at line 280 of file tokenI.H.
References token::FLOAT_SCALAR, and token::type_.
|
inline |
Definition at line 285 of file tokenI.H.
References token::FLOAT_SCALAR, token::floatScalarToken_, token::parseError(), and token::type_.
Referenced by Foam::operator<<().
|
inline |
Definition at line 299 of file tokenI.H.
References token::DOUBLE_SCALAR, and token::type_.
|
inline |
Definition at line 304 of file tokenI.H.
References token::DOUBLE_SCALAR, token::doubleScalarToken_, token::parseError(), and token::type_.
Referenced by Foam::operator<<().
|
inline |
Definition at line 318 of file tokenI.H.
References token::DOUBLE_SCALAR, token::FLOAT_SCALAR, and token::type_.
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, token::floatScalarToken_, token::parseError(), and token::type_.
Referenced by token::number().
|
inline |
Definition at line 340 of file tokenI.H.
References token::isScalar(), token::LABEL, and token::type_.
Referenced by Time::findTimes(), Foam::operator>>(), dimensionSet::parse(), dimensionSet::read(), and Reaction::specieCoeffs::specieCoeffs().
|
inline |
Definition at line 345 of file tokenI.H.
References token::isScalar(), token::LABEL, token::labelToken_, token::parseError(), token::scalarToken(), and token::type_.
Referenced by Time::findTimes(), genericFvPatchField< Type >::genericFvPatchField(), Foam::operator>>(), dimensionSet::parse(), dimensionSet::read(), and Reaction::specieCoeffs::specieCoeffs().
|
inline |
Definition at line 362 of file tokenI.H.
References token::COMPOUND, and token::type_.
Referenced by genericFvPatchField< Type >::genericFvPatchField(), and genericPointPatchField< Type >::genericPointPatchField().
|
inline |
Definition at line 367 of file tokenI.H.
References token::COMPOUND, token::compoundTokenPtr_, token::parseError(), and token::type_.
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 genericFvPatchField< Type >::genericFvPatchField(), and genericPointPatchField< Type >::genericPointPatchField().
|
inline |
Definition at line 381 of file tokenI.H.
References token::lineNumber_.
Referenced by Foam::operator<<(), ISstream::read(), UIPstream::read(), and ITstream::read().
|
inline |
|
inline |
Set bad.
Definition at line 392 of file tokenI.H.
References token::clear(), token::ERROR, and token::type_.
Referenced by ISstream::read(), UIPstream::read(), and ISstream::readWordToken().
Return info proxy.
Used to print token information to a stream
Definition at line 372 of file token.H.
Referenced by LongList< Foam::meshOctreeCube >::appendFromStream(), blockDescriptor::blockDescriptor(), main(), Foam::operator>>(), token::parseError(), HashPtrTable< ThermoType >::read(), ILList< DLListBase, entry >::read(), LPtrList< SLListBase, Reaction< Foam::sutherlandTransport > >::read(), PtrList< injectionModel >::read(), PackedList< 2 >::read(), Istream::readBegin(), Istream::readBeginList(), IOPosition::readData(), Istream::readEnd(), Istream::readEndList(), Reaction::specieCoeffs::specieCoeffs(), and thirdBodyEfficiencies::thirdBodyEfficiencies().
|
inline |
Definition at line 401 of file tokenI.H.
References token::clear(), token::COMPOUND, token::compoundTokenPtr_, token::DOUBLE_SCALAR, token::doubleScalarToken_, token::ERROR, token::FLOAT_SCALAR, token::floatScalarToken_, token::LABEL, token::labelToken_, token::lineNumber_, token::PUNCTUATION, token::punctuationToken_, token::STRING, token::stringTokenPtr_, token::type_, 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 token::clear(), p, token::PUNCTUATION, token::punctuationToken_, and token::type_.
|
inline |
Definition at line 456 of file tokenI.H.
References token::clear(), token::type_, token::WORD, and token::wordTokenPtr_.
|
inline |
Definition at line 463 of file tokenI.H.
References token::operator=(), and w().
|
inline |
Definition at line 468 of file tokenI.H.
References token::clear(), token::STRING, token::stringTokenPtr_, and token::type_.
|
inline |
Definition at line 475 of file tokenI.H.
References token::operator=(), and s().
|
inline |
Definition at line 480 of file tokenI.H.
References token::clear(), token::LABEL, token::labelToken_, and token::type_.
|
inline |
Definition at line 487 of file tokenI.H.
References token::clear(), token::FLOAT_SCALAR, token::floatScalarToken_, s(), and token::type_.
|
inline |
Definition at line 494 of file tokenI.H.
References token::clear(), token::DOUBLE_SCALAR, token::doubleScalarToken_, s(), and token::type_.
|
inline |
Definition at line 501 of file tokenI.H.
References token::clear(), token::COMPOUND, token::compoundTokenPtr_, and token::type_.
|
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::type_, 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 p, token::PUNCTUATION, token::punctuationToken_, and token::type_.
|
inline |
Definition at line 556 of file tokenI.H.
References token::type_, w(), token::WORD, and token::wordToken().
|
inline |
Definition at line 561 of file tokenI.H.
References s(), token::STRING, token::stringToken(), token::type_, token::VARIABLE, and token::VERBATIMSTRING.
|
inline |
Definition at line 570 of file tokenI.H.
References token::LABEL, token::labelToken_, and token::type_.
|
inline |
Definition at line 575 of file tokenI.H.
References Foam::equal(), token::FLOAT_SCALAR, token::floatScalarToken_, s(), and token::type_.
|
inline |
Definition at line 580 of file tokenI.H.
References token::DOUBLE_SCALAR, token::doubleScalarToken_, Foam::equal(), s(), and token::type_.
|
inline |
Definition at line 585 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 590 of file tokenI.H.
References token::operator==(), and p.
|
inline |
Definition at line 595 of file tokenI.H.
References token::operator==(), and w().
|
inline |
Definition at line 600 of file tokenI.H.
References token::operator==(), and s().
|
inline |
Definition at line 615 of file tokenI.H.
References token::operator==().
|
inline |
Definition at line 605 of file tokenI.H.
References token::operator==(), and s().
|
inline |
Definition at line 610 of file tokenI.H.
References token::operator==(), and s().
|
friend |
|
friend |
|
static |
Static undefined token.
Definition at line 241 of file token.H.
Referenced by Istream::peekBack(), and ITstream::read().
|
private |
The token type.
Definition at line 249 of file token.H.
Referenced by token::clear(), token::compoundToken(), token::doubleScalarToken(), token::error(), token::floatScalarToken(), token::good(), token::isCompound(), token::isDoubleScalar(), token::isFloatScalar(), token::isLabel(), token::isNumber(), token::isPunctuation(), token::isScalar(), token::isString(), token::isVariable(), token::isWord(), token::labelToken(), token::number(), Foam::operator<<(), token::operator=(), token::operator==(), token::pToken(), token::scalarToken(), token::setBad(), token::stringToken(), token::token(), token::type(), token::undefined(), and token::wordToken().
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 token::clear(), Foam::operator<<(), token::operator=(), token::operator==(), token::token(), and token::wordToken().
string* stringTokenPtr_ |
Definition at line 256 of file token.H.
Referenced by token::clear(), 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::clear(), token::compoundToken(), Foam::operator<<(), token::operator=(), token::operator==(), and token::token().
union { ... } |
Anonymous Union of token types.
|
private |
Line number in the file this token was read from.
Definition at line 264 of file token.H.
Referenced by token::lineNumber(), and token::operator=().
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.