A token holds an item read from Istream. More...
Classes | |
class | Compound |
class | compound |
Public Types | |
enum | tokenType : char { UNDEFINED = '\0', ERROR = '\x80', FLAG, PUNCTUATION, BOOL, LABEL, FLOAT, DOUBLE, WORD, STRING, COMPOUND, DIRECTIVE, EXPRESSION, VARIABLE, VERBATIM, FLOAT_SCALAR = FLOAT, DOUBLE_SCALAR = DOUBLE, VERBATIMSTRING = VERBATIM } |
enum | flagType { NO_FLAG = 0, ASCII = 1, BINARY = 2 } |
enum | punctuationToken : char { NULL_TOKEN = '\0', TAB = '\t', NL = '\n', SPACE = ' ', COLON = ':', SEMICOLON = ';', COMMA = ',', HASH = '#', DOLLAR = '$', QUESTION = '?', ATSYM = '@', SQUOTE = '\'', DQUOTE = '"', ASSIGN = '=', PLUS = '+', MINUS = '-', MULTIPLY = '*', DIVIDE = '/', LPAREN = '(', RPAREN = ')', LSQUARE = '[', RSQUARE = ']', LBRACE = '{', RBRACE = '}', ADD = PLUS, SUBTRACT = MINUS, END_STATEMENT = SEMICOLON, BEGIN_LIST = LPAREN, END_LIST = RPAREN, BEGIN_SQR = LSQUARE, END_SQR = RSQUARE, BEGIN_BLOCK = LBRACE, END_BLOCK = RBRACE, BEGIN_STRING = DQUOTE, END_STRING = DQUOTE } |
Public Member Functions | |
constexpr | token () noexcept |
token (const token &t) | |
token (token &&t) noexcept | |
token (punctuationToken p, label lineNum=0) noexcept | |
token (const label val, label lineNum=0) noexcept | |
token (const floatScalar val, label lineNum=0) noexcept | |
token (const doubleScalar val, label lineNum=0) noexcept | |
token (const word &w, label lineNum=0) | |
token (const string &str, label lineNum=0) | |
token (word &&w, label lineNum=0) | |
token (string &&str, label lineNum=0) | |
token (token::compound *ptr, label lineNum=0) | |
token (Istream &is) | |
~token () | |
word | name () const |
tokenType | type () const noexcept |
bool | setType (const tokenType tokType) noexcept |
label | lineNumber () const noexcept |
label | lineNumber (const label lineNum) noexcept |
bool | good () const noexcept |
bool | undefined () const noexcept |
bool | error () const noexcept |
bool | isBool () const noexcept |
bool | isFlag () const noexcept |
bool | isPunctuation () const noexcept |
bool | isPunctuation (const punctuationToken p) const noexcept |
bool | isSeparator () const noexcept |
bool | isLabel () const noexcept |
bool | isLabel (const label val) const noexcept |
bool | isFloat () const noexcept |
bool | isDouble () const noexcept |
bool | isScalar () const noexcept |
bool | isNumber () const noexcept |
bool | isWord () const noexcept |
bool | isWord (const std::string &s) const |
bool | isDirective () const noexcept |
bool | isQuotedString () const noexcept |
bool | isString () const noexcept |
bool | isExpression () const noexcept |
bool | isVariable () const noexcept |
bool | isVerbatim () const noexcept |
bool | isStringType () const noexcept |
bool | isCompound () const noexcept |
bool | boolToken () const |
int | flagToken () const |
punctuationToken | pToken () const |
label | labelToken () const |
floatScalar | floatToken () const |
doubleScalar | doubleToken () const |
scalar | scalarToken () const |
scalar | number () const |
const word & | wordToken () const |
const string & | stringToken () const |
const compound & | compoundToken () const |
compound & | transferCompoundToken () |
compound & | transferCompoundToken (const Istream &is) |
void | reset () |
void | setBad () |
void | swap (token &tok) |
InfoProxy< token > | info () const |
void | operator= (const token &tok) |
void | operator= (token &&tok) |
void | operator= (const punctuationToken p) |
void | operator= (const label val) |
void | operator= (const floatScalar val) |
void | operator= (const doubleScalar val) |
void | operator= (const word &w) |
void | operator= (const string &str) |
void | operator= (word &&w) |
void | operator= (string &&str) |
void | operator= (token::compound *ptr) |
void | operator= (autoPtr< token::compound > &&ptr) |
bool | operator== (const token &tok) const |
bool | operator== (const punctuationToken p) const noexcept |
bool | operator== (const label val) const noexcept |
bool | operator== (const floatScalar val) const noexcept |
bool | operator== (const doubleScalar val) const noexcept |
bool | operator== (const std::string &s) const |
bool | operator!= (const token &tok) const |
bool | operator!= (const punctuationToken p) const noexcept |
bool | operator!= (const label val) const noexcept |
bool | operator!= (const floatScalar val) const noexcept |
bool | operator!= (const doubleScalar val) const noexcept |
bool | operator!= (const std::string &s) const |
label & | lineNumber () noexcept |
bool | isFloatScalar () const |
bool | isDoubleScalar () const |
floatScalar | floatScalarToken () const |
doubleScalar | doubleScalarToken () const |
void | operator= (word *)=delete |
void | operator= (string *)=delete |
Static Public Member Functions | |
static token | boolean (bool on) noexcept |
static token | flag (int bitmask) noexcept |
static bool | isseparator (int c) noexcept |
Static Public Attributes | |
static const token | undefinedToken |
static constexpr const char *const | typeName = "token" |
Friends | |
Ostream & | operator<< (Ostream &os, const token &tok) |
Ostream & | operator<< (Ostream &os, const punctuationToken &pt) |
ostream & | operator<< (ostream &os, const punctuationToken &pt) |
ostream & | operator<< (ostream &os, const InfoProxy< token > &ct) |
A token holds an item read from Istream.
enum tokenType : char |
Enumerator | |
---|---|
UNDEFINED | An undefined token-type. |
ERROR | Token error encountered. |
FLAG | stream flag (1-byte bitmask) |
PUNCTUATION | single character punctuation |
BOOL | boolean type |
LABEL | label (integer) type |
FLOAT | float (single-precision) type |
DOUBLE | double (double-precision) type |
WORD | |
STRING | Foam::string (usually double-quoted) |
COMPOUND | |
DIRECTIVE | Word-variant: dictionary |
EXPRESSION | String-variant: math expression for evaluation stored with delimiters |
VARIABLE | String-variant: dictionary |
VERBATIM | String-variant: verbatim string content stored without delimiters |
FLOAT_SCALAR | |
DOUBLE_SCALAR | |
VERBATIMSTRING |
enum flagType |
enum punctuationToken : char |
Enumerator | |
---|---|
NULL_TOKEN | Nul character. |
TAB | Tab [isspace]. |
NL | Newline [isspace]. |
SPACE | Space [isspace]. |
COLON | Colon [isseparator]. |
SEMICOLON | Semicolon [isseparator]. |
COMMA | Comma [isseparator]. |
HASH | Hash - directive or start verbatim string. |
DOLLAR | Dollar - start variable or expression. |
QUESTION | Question mark (eg, ternary) |
ATSYM | The 'at' symbol. |
SQUOTE | Single quote. |
DQUOTE | Double quote. |
ASSIGN | Assignment/equals [isseparator]. |
PLUS | Addition [isseparator]. |
MINUS | Subtract or start of negative number. |
MULTIPLY | Multiply [isseparator]. |
DIVIDE | Divide [isseparator]. |
LPAREN | Left parenthesis [isseparator]. |
RPAREN | Right parenthesis [isseparator]. |
LSQUARE | Left square bracket [isseparator]. |
RSQUARE | Right square bracket [isseparator]. |
LBRACE | Left brace [isseparator]. |
RBRACE | Right brace [isseparator]. |
ADD | Addition [isseparator]. |
SUBTRACT | Subtract or start of negative number. |
END_STATEMENT | End entry [isseparator]. |
BEGIN_LIST | Begin list [isseparator]. |
END_LIST | End list [isseparator]. |
BEGIN_SQR | Begin dimensions [isseparator]. |
END_SQR | End dimensions [isseparator]. |
BEGIN_BLOCK | Begin block [isseparator]. |
END_BLOCK | End block [isseparator]. |
BEGIN_STRING | Begin string with double quote. |
END_STRING | End string with double quote. |
|
inlineexplicitnoexcept |
|
inlineexplicitnoexcept |
|
inlineexplicitnoexcept |
|
inlineexplicitnoexcept |
|
inlineexplicit |
Definition at line 117 of file tokenIO.C.
References Istream::read().
|
inline |
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
Definition at line 46 of file tokenI.H.
References Foam::constant::universal::c.
Foam::word name | ( | ) | const |
|
inlinenoexcept |
Definition at line 304 of file tokenI.H.
Referenced by Foam::printTokenInfo(), OSstream::write(), and UOPstream::write().
Definition at line 310 of file tokenI.H.
Referenced by UIPstream::read(), ISstream::read(), and exprString::writeEntry().
|
inlinenoexcept |
Definition at line 384 of file tokenI.H.
Referenced by Foam::printTokenInfo(), UIPstream::read(), ISstream::read(), and ITstream::read().
|
inlinenoexcept |
|
inlinenoexcept |
Definition at line 398 of file tokenI.H.
Referenced by wordDirective::execute(), Foam::getToken(), Foam::operator>>(), Foam::parseStream(), Foam::printTokenError(), primitiveEntry::read(), decomposedBlockData::readBlockEntry(), Switch::Switch(), and OTstream::write().
|
inlinenoexcept |
Definition at line 416 of file tokenI.H.
Referenced by Switch::Switch().
|
inlinenoexcept |
Definition at line 434 of file tokenI.H.
Referenced by UIPstream::read().
|
inlinenoexcept |
Definition at line 452 of file tokenI.H.
Referenced by blockDescriptor::blockDescriptor(), dictionaryListEntry::dictionaryListEntry(), Foam::exprTools::getList(), Foam::getValueToken(), seriesWriter::load(), blockVertex::New(), entry::New(), Foam::operator>>(), Foam::blockMeshTools::read(), primitiveEntry::read(), IOPosition::readData(), PtrList< transferModel >::readIstream(), LList< Foam::chemPointISAT< CompType, ThermoType > * >::readList(), List< vectorField >::readList(), PackedList< 2 >::readList(), FixedList< Type, 3 >::readList(), UList< Foam::wordRe >::readList(), and Reaction::setLRhs().
|
inlinenoexcept |
|
inlinenoexcept |
Definition at line 490 of file tokenI.H.
Referenced by dictionaryListEntry::dictionaryListEntry(), Foam::exprTools::getList(), entry::New(), Foam::operator>>(), Foam::blockMeshTools::read(), STARCDsurfaceFormat< Face >::read(), STARCDedgeFormat::read(), STARCDMeshReader::readBoundary(), STARCDMeshReader::readCells(), IOPosition::readData(), PtrList< transferModel >::readIstream(), LList< Foam::chemPointISAT< CompType, ThermoType > * >::readList(), List< vectorField >::readList(), PackedList< 2 >::readList(), FixedList< Type, 3 >::readList(), UList< Foam::wordRe >::readList(), Matrix< RectangularMatrix< Type >, Type >::readMatrix(), STARCDMeshReader::readPoints(), STARCDCore::readPoints(), and Switch::Switch().
|
inlinenoexcept |
Definition at line 518 of file tokenI.H.
Referenced by token::isFloatScalar().
|
inlinenoexcept |
Definition at line 536 of file tokenI.H.
Referenced by token::isDoubleScalar().
|
inlinenoexcept |
Definition at line 554 of file tokenI.H.
Referenced by Foam::operator>>().
|
inlinenoexcept |
Definition at line 580 of file tokenI.H.
Referenced by CrankNicolsonDdtScheme< Type >::CrankNicolsonDdtScheme(), Foam::getLazyPair(), Foam::getRadius(), seriesWriter::load(), Foam::operator>>(), dimensionSet::read(), Foam::readScaling(), Reaction::specieCoeffs::specieCoeffs(), and IOstreamOption::versionNumber::versionNumber().
|
inlinenoexcept |
Definition at line 602 of file tokenI.H.
Referenced by arcEdge::arcEdge(), fileName::assign(), keyType::assign(), wordRe::assign(), blockDescriptor::blockDescriptor(), Constant< Type >::Constant(), Field< Foam::Vector2D >::Field(), blockVertex::New(), Foam::operator>>(), Polynomial< Type >::Polynomial(), Foam::printTokenError(), genericPatchFieldBase::processEntry(), rawIOField< Type >::rawIOField(), Foam::blockMeshTools::read(), dimensionSet::read(), decomposedBlockData::readBlockEntry(), IOobject::readHeader(), Reaction::specieCoeffs::specieCoeffs(), Switch::Switch(), and Table< Type >::Table().
|
inline |
|
inlinenoexcept |
Definition at line 618 of file tokenI.H.
Referenced by ifeqEntry::evaluate(), and ifeqEntry::execute().
|
inlinenoexcept |
Definition at line 640 of file tokenI.H.
Referenced by fileName::assign(), keyType::assign(), wordRe::assign(), and Foam::operator>>().
|
inlinenoexcept |
Definition at line 646 of file tokenI.H.
Referenced by Foam::exprTools::getList(), seriesWriter::load(), and Foam::operator>>().
|
inlinenoexcept |
Definition at line 664 of file tokenI.H.
Referenced by Foam::operator>>().
|
inlinenoexcept |
Definition at line 676 of file tokenI.H.
Referenced by functionEntry::readStringList(), and IOstreamOption::versionNumber::versionNumber().
|
inlinenoexcept |
Definition at line 709 of file tokenI.H.
Referenced by mappedPatchBase::constructIOField(), decomposedBlockData::readBlockEntry(), List< vectorField >::readList(), FixedList< Type, 3 >::readList(), and UList< Foam::wordRe >::readList().
|
inline |
Definition at line 422 of file tokenI.H.
Referenced by Foam::printTokenInfo(), and Switch::Switch().
|
inline |
Definition at line 440 of file tokenI.H.
Referenced by Foam::printTokenInfo(), UIPstream::read(), and UOPstream::write().
|
inline |
Definition at line 478 of file tokenI.H.
Referenced by blockDescriptor::blockDescriptor(), seriesWriter::load(), Foam::operator>>(), Foam::printTokenInfo(), primitiveEntry::read(), Istream::readBeginList(), and Istream::readEndList().
|
inline |
Definition at line 506 of file tokenI.H.
Referenced by dictionaryListEntry::dictionaryListEntry(), Foam::operator>>(), Foam::printTokenInfo(), Foam::blockMeshTools::read(), STARCDsurfaceFormat< Face >::read(), STARCDMeshReader::readCells(), IOPosition::readData(), PtrList< transferModel >::readIstream(), LList< Foam::chemPointISAT< CompType, ThermoType > * >::readList(), List< vectorField >::readList(), PackedList< 2 >::readList(), FixedList< Type, 3 >::readList(), UList< Foam::wordRe >::readList(), Matrix< RectangularMatrix< Type >, Type >::readMatrix(), STARCDMeshReader::readPoints(), STARCDCore::readPoints(), and Switch::Switch().
|
inline |
Definition at line 524 of file tokenI.H.
Referenced by token::floatScalarToken(), and Foam::printTokenInfo().
|
inline |
Definition at line 542 of file tokenI.H.
Referenced by token::doubleScalarToken(), and Foam::printTokenInfo().
|
inline |
Definition at line 564 of file tokenI.H.
Referenced by Foam::operator>>().
|
inline |
Definition at line 586 of file tokenI.H.
Referenced by arcEdge::arcEdge(), CrankNicolsonDdtScheme< Type >::CrankNicolsonDdtScheme(), seriesWriter::load(), Foam::operator>>(), dimensionSet::read(), Reaction::specieCoeffs::specieCoeffs(), and IOstreamOption::versionNumber::versionNumber().
|
inline |
Definition at line 624 of file tokenI.H.
References word::null.
Referenced by fileName::assign(), keyType::assign(), wordRe::assign(), blockDescriptor::blockDescriptor(), ifeqEntry::evaluate(), ifeqEntry::execute(), blockVertex::New(), Foam::operator>>(), Foam::printTokenError(), Foam::printTokenInfo(), Foam::blockMeshTools::read(), dimensionSet::read(), Reaction::specieCoeffs::specieCoeffs(), Switch::Switch(), OSstream::write(), and UOPstream::write().
|
inline |
Definition at line 682 of file tokenI.H.
References string::null.
Referenced by fileName::assign(), keyType::assign(), wordRe::assign(), Foam::exprTools::getList(), seriesWriter::load(), Foam::operator>>(), Foam::printTokenInfo(), IOstreamOption::versionNumber::versionNumber(), OSstream::write(), functionEntry::write(), and UOPstream::write().
|
inline |
Definition at line 715 of file tokenI.H.
Referenced by mappedPatchBase::constructIOField(), and Foam::printTokenInfo().
Foam::token::compound & transferCompoundToken | ( | ) |
Definition at line 83 of file token.C.
References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.
Referenced by mappedPatchBase::constructIOField(), List< vectorField >::readList(), FixedList< Type, 3 >::readList(), and UList< Foam::wordRe >::readList().
Foam::token::compound & transferCompoundToken | ( | const Istream & | is | ) |
Definition at line 105 of file token.C.
References Foam::abort(), Foam::FatalIOError, and FatalIOErrorInFunction.
|
inline |
Definition at line 250 of file tokenI.H.
Referenced by Foam::operator>>(), Istream::peekBack(), and ITstream::read().
|
inline |
Definition at line 727 of file tokenI.H.
References reset().
Referenced by UIPstream::read(), and ISstream::read().
Definition at line 582 of file token.H.
Referenced by blockDescriptor::blockDescriptor(), dictionaryListEntry::dictionaryListEntry(), Field< Foam::Vector2D >::Field(), blockVertex::New(), entry::New(), Foam::operator>>(), Foam::printTokenError(), Foam::blockMeshTools::read(), Istream::readBegin(), Istream::readBeginList(), IOPosition::readData(), Istream::readEnd(), Istream::readEndList(), PtrList< transferModel >::readIstream(), LList< Foam::chemPointISAT< CompType, ThermoType > * >::readList(), List< vectorField >::readList(), PackedList< 2 >::readList(), FixedList< Type, 3 >::readList(), UList< Foam::wordRe >::readList(), Matrix< RectangularMatrix< Type >, Type >::readMatrix(), Reaction::specieCoeffs::specieCoeffs(), and IOstreamOption::versionNumber::versionNumber().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 877 of file tokenI.H.
References Foam::equal().
|
inlinenoexcept |
|
inlinenoexcept |
Definition at line 951 of file tokenI.H.
References Foam::equal().
|
inlinenoexcept |
Definition at line 961 of file tokenI.H.
References Foam::equal().
|
inline |
Definition at line 971 of file tokenI.H.
References Foam::operator==().
|
inlinenoexcept |
|
inlinenoexcept |
Definition at line 983 of file tokenI.H.
References Foam::operator==().
|
inlinenoexcept |
Definition at line 989 of file tokenI.H.
References Foam::operator==().
|
inlinenoexcept |
Definition at line 995 of file tokenI.H.
References Foam::operator==().
|
inline |
Definition at line 1001 of file tokenI.H.
References Foam::operator==(), and s.
|
inline |
Definition at line 667 of file token.H.
References token::isFloat().
|
inline |
Definition at line 671 of file token.H.
References token::isDouble().
|
inline |
Definition at line 675 of file token.H.
References token::floatToken().
|
inline |
Definition at line 679 of file token.H.
References token::doubleToken().
|
delete |
|
delete |
|
friend |
|
friend |
|
static |
Definition at line 290 of file token.H.
Referenced by Istream::peekBack(), and Foam::peekTokenAt().
|
staticconstexpr |
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.