token Class Reference
Collaboration diagram for token:

Classes

union  content
 

Public Types

enum  tokenType {
  UNDEFINED = 0, FLAG, PUNCTUATION, BOOL,
  INT64, FLOAT, DOUBLE, WORD,
  STRING, DIRECTIVE, VARIABLE, ERROR
}
 
enum  flagType { NO_FLAG = 0, ASCII = 1, BINARY = 2 }
 
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 = ',', DOLLAR = '$', SQUOTE = '\'', DQUOTE = '"',
  SUBTRACT = '-', DIVIDE = '/', BEGIN_STRING = DQUOTE, END_STRING = DQUOTE
}
 

Public Member Functions

constexpr token () noexcept
 
 token (const token &t)
 
 token (token &&t)
 
 token (punctuationToken p, int32 lineNumber=0)
 
 token (const label val, int32 lineNumber=0)
 
 token (const uint32 val, int32 lineNumber=0)
 
 token (const int64 val, int32 lineNumber=0)
 
 token (const int32 val, int32 lineNumber=0)
 
 token (const float val, int32 lineNumber=0)
 
 token (const double val, int32 lineNumber=0)
 
 token (const word &w, int32 lineNumber=0, bool isString=false)
 
 token (word &&w, int32 lineNumber=0, bool isString=false)
 
 token (iIstream &is)
 
 ~token ()
 
word name () const
 
tokenType type () const
 
bool setType (const tokenType tokType)
 
int32 lineNumber () const
 
int32lineNumber ()
 
bool good () const
 
bool undefined () const
 
bool error () const
 
bool isBool () const
 
bool isFlag () const
 
bool isPunctuation () const
 
bool isSeparator () const
 
bool isEndStatement () const
 
bool isEndBlock () const
 
bool isInt64 () const
 
bool isInt32 () const
 
bool isFloat () const
 
bool isDouble () const
 
bool isReal () const
 
bool isNumber () const
 
bool isWord () const
 
bool isDirective () const
 
bool isString () const
 
bool isVariable () const
 
bool isStringType () const
 
bool boolToken () const
 
int flagToken () const
 
punctuationToken pToken () const
 
int64 int64Token () const
 
int32 int32Token () const
 
float floatToken () const
 
double doubleToken () const
 
real realToken () const
 
real number () const
 
const wordwordToken () const
 
const wordstringToken () const
 
void reset ()
 
void setBad ()
 
void swap (token &tok)
 
void operator= (const token &tok)
 
void operator= (token &&tok)
 
void operator= (const punctuationToken p)
 
void operator= (const int64 val)
 
void operator= (const int32 val)
 
void operator= (const float val)
 
void operator= (const double val)
 
void operator= (const word &w)
 
void operator= (word &&w)
 
bool operator== (const token &tok) const
 
bool operator== (const punctuationToken p) const
 
bool operator== (const int64 val) const
 
bool operator== (const int32 val) const
 
bool operator== (const float val) const
 
bool operator== (const double val) const
 
bool operator== (const word &w) const
 
bool operator!= (const token &tok) const
 
bool operator!= (const punctuationToken p) const
 
bool operator!= (const int64 val) const
 
bool operator!= (const int32 val) const
 
bool operator!= (const float val) const
 
bool operator!= (const double val) const
 
bool operator!= (const word &w) const
 
iOstreamprintInfo (iOstream &os) const
 
std::ostream & printInfo (std::ostream &os) const
 
void operator= (word *)=delete
 

Static Public Member Functions

static const token undefinedToken ()
 
static token endList ()
 
static token beginList ()
 
static token endStatement ()
 
static token beginBlock ()
 
static token endBlocK ()
 
static token beginSquare ()
 
static token endSquare ()
 
static token space ()
 
static token newLine ()
 
static token boolean (bool on)
 
static token flag (int bitmask)
 
static bool isseparator (int c)
 

Private Member Functions

void setUndefined ()
 
void parseError (const char *expected) const
 

Private Attributes

content data_
 
tokenType type_
 
int32 lineNumber_
 

Friends

iOstreamoperator<< (iOstream &os, const token &tok)
 
iOstreamoperator<< (iOstream &os, const punctuationToken &pt)
 
std::ostream & operator<< (std::ostream &os, const token &tok)
 
std::ostream & operator<< (std::ostream &os, const punctuationToken &pt)
 

Detailed Description

Definition at line 42 of file token.hpp.

Member Enumeration Documentation

◆ tokenType

enum tokenType
Enumerator
UNDEFINED 

An undefined token-type.

FLAG 

stream flag (1-byte bitmask)

PUNCTUATION 

single character punctuation

BOOL 

boolean type

INT64 

int64 (integer) type

FLOAT 

float (single-precision) type

DOUBLE 

double (double-precision) type

WORD 

A pFlow::word.

STRING 

A string whth double quuote.

DIRECTIVE 

A dictionary #directive (word variant)

VARIABLE 

A dictionary $variable (string variant)

ERROR 

A token error encountered.

Definition at line 49 of file token.hpp.

◆ flagType

enum flagType
Enumerator
NO_FLAG 

No flags.

ASCII 

ASCII-mode stream.

BINARY 

BINARY-mode stream.

Definition at line 72 of file token.hpp.

◆ punctuationToken

enum punctuationToken : char
Enumerator
NULL_TOKEN 

Nul character.

SPACE 

Space [isspace].

TAB 

Tab [isspace].

NL 

Newline [isspace].

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].

COLON 

Colon [isseparator].

COMMA 

Comma [isseparator].

DOLLAR 

Dollar - start variable.

SQUOTE 

Single quote.

DQUOTE 

Double quote.

SUBTRACT 

Subtract or start of negative number.

DIVIDE 

Divide [isseparator].

BEGIN_STRING 

Begin string with double quote.

END_STRING 

End string with double quote.

Definition at line 81 of file token.hpp.

Constructor & Destructor Documentation

◆ token() [1/13]

constexpr token ( )
inlineconstexprnoexcept

◆ token() [2/13]

token ( const token t)
inline

◆ token() [3/13]

token ( token &&  t)
inline

Definition at line 127 of file tokenI.hpp.

◆ token() [4/13]

token ( punctuationToken  p,
int32  lineNumber = 0 
)
inlineexplicit

Definition at line 138 of file tokenI.hpp.

References token::data_, and token::content::punctuationVal.

◆ token() [5/13]

token ( const label  val,
int32  lineNumber = 0 
)
inlineexplicit

Definition at line 147 of file tokenI.hpp.

References token::data_, and token::content::int64Val.

◆ token() [6/13]

token ( const uint32  val,
int32  lineNumber = 0 
)
inlineexplicit

Definition at line 156 of file tokenI.hpp.

References token::data_, and token::content::int64Val.

◆ token() [7/13]

token ( const int64  val,
int32  lineNumber = 0 
)
inlineexplicit

Definition at line 165 of file tokenI.hpp.

References token::data_, and token::content::int64Val.

◆ token() [8/13]

token ( const int32  val,
int32  lineNumber = 0 
)
inlineexplicit

Definition at line 174 of file tokenI.hpp.

References token::data_, and token::content::int64Val.

◆ token() [9/13]

token ( const float  val,
int32  lineNumber = 0 
)
inlineexplicit

Definition at line 183 of file tokenI.hpp.

References token::data_, and token::content::floatVal.

◆ token() [10/13]

token ( const double  val,
int32  lineNumber = 0 
)
inlineexplicit

Definition at line 193 of file tokenI.hpp.

References token::data_, and token::content::doubleVal.

◆ token() [11/13]

token ( const word w,
int32  lineNumber = 0,
bool  isString = false 
)
inlineexplicit

Definition at line 203 of file tokenI.hpp.

References token::data_, token::isString(), token::content::stringPtr, token::type_, and token::content::wordPtr.

Here is the call graph for this function:

◆ token() [12/13]

token ( word &&  w,
int32  lineNumber = 0,
bool  isString = false 
)
inlineexplicit

Definition at line 220 of file tokenI.hpp.

References token::data_, token::isString(), token::content::stringPtr, token::type_, and token::content::wordPtr.

Here is the call graph for this function:

◆ token() [13/13]

token ( iIstream is)
explicit

Definition at line 100 of file tokenIO.cpp.

References iIstream::read().

Here is the call graph for this function:

◆ ~token()

~token ( )
inline

Definition at line 237 of file tokenI.hpp.

Member Function Documentation

◆ undefinedToken()

static const token undefinedToken ( )
inlinestatic

◆ endList()

static token endList ( )
inlinestatic

Definition at line 111 of file token.hpp.

References token::token().

Referenced by pFlow::endListToken().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ beginList()

static token beginList ( )
inlinestatic

Definition at line 116 of file token.hpp.

References token::token().

Referenced by pFlow::beginListToken().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ endStatement()

static token endStatement ( )
inlinestatic

Definition at line 121 of file token.hpp.

References token::token().

Referenced by pFlow::endStatementToken().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ beginBlock()

static token beginBlock ( )
inlinestatic

Definition at line 126 of file token.hpp.

References token::token().

Referenced by pFlow::beginBlockToken().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ endBlocK()

static token endBlocK ( )
inlinestatic

Definition at line 131 of file token.hpp.

References token::token().

Referenced by pFlow::endBlocKToken().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ beginSquare()

static token beginSquare ( )
inlinestatic

Definition at line 136 of file token.hpp.

References token::token().

Here is the call graph for this function:

◆ endSquare()

static token endSquare ( )
inlinestatic

Definition at line 141 of file token.hpp.

References token::token().

Here is the call graph for this function:

◆ space()

static token space ( )
inlinestatic

Definition at line 146 of file token.hpp.

References token::token().

Referenced by pFlow::spaceToken().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ newLine()

static token newLine ( )
inlinestatic

Definition at line 151 of file token.hpp.

References token::token().

Referenced by pFlow::newLineToken().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setUndefined()

void setUndefined ( )
inlineprivate

Definition at line 79 of file tokenI.hpp.

◆ parseError()

void parseError ( const char *  expected) const
private

Definition at line 30 of file token.cpp.

References pFlow::endl(), and fatalError.

Here is the call graph for this function:

◆ boolean()

pFlow::token boolean ( bool  on)
inlinestatic

Definition at line 28 of file tokenI.hpp.

References token::data_, token::content::int64Val, and token::type_.

◆ flag()

pFlow::token flag ( int  bitmask)
inlinestatic

Definition at line 38 of file tokenI.hpp.

References token::data_, token::content::flagVal, and token::type_.

◆ isseparator()

◆ name()

pFlow::word name ( ) const

Definition at line 110 of file tokenIO.cpp.

◆ type()

pFlow::token::tokenType type ( ) const
inline

Definition at line 284 of file tokenI.hpp.

Referenced by pFlow::printTokenInfo(), and Ostream::write().

Here is the caller graph for this function:

◆ setType()

bool setType ( const tokenType  tokType)
inline

Definition at line 290 of file tokenI.hpp.

Referenced by Istream::read().

Here is the caller graph for this function:

◆ lineNumber() [1/2]

pFlow::int32 & lineNumber ( ) const
inline

Definition at line 360 of file tokenI.hpp.

Referenced by pFlow::printTokenInfo(), iTstream::read(), and Istream::read().

Here is the caller graph for this function:

◆ lineNumber() [2/2]

int32& lineNumber ( )
inline

◆ good()

◆ undefined()

bool undefined ( ) const
inline

Definition at line 378 of file tokenI.hpp.

◆ error()

bool error ( ) const
inline

Definition at line 384 of file tokenI.hpp.

Referenced by iIstream::findToken(), iIstream::findTokenAndNext(), iIstream::findTokenAndNextSilent(), iIstream::findTokenSilent(), and iIstream::nextData().

Here is the caller graph for this function:

◆ isBool()

bool isBool ( ) const
inline

Definition at line 390 of file tokenI.hpp.

◆ isFlag()

bool isFlag ( ) const
inline

Definition at line 408 of file tokenI.hpp.

◆ isPunctuation()

bool isPunctuation ( ) const
inline

Definition at line 426 of file tokenI.hpp.

Referenced by dataEntry::readDataEntry(), List< word >::readList(), and Vector< word, vecAllocator< word > >::readVector().

Here is the caller graph for this function:

◆ isSeparator()

bool isSeparator ( ) const
inline

Definition at line 464 of file tokenI.hpp.

◆ isEndStatement()

bool isEndStatement ( ) const
inline

◆ isEndBlock()

bool isEndBlock ( ) const
inline

Definition at line 442 of file tokenI.hpp.

Referenced by iIstream::findToken(), and iIstream::findTokenSilent().

Here is the caller graph for this function:

◆ isInt64()

bool isInt64 ( ) const
inline

Definition at line 474 of file tokenI.hpp.

◆ isInt32()

bool isInt32 ( ) const
inline

Definition at line 479 of file tokenI.hpp.

◆ isFloat()

bool isFloat ( ) const
inline

Definition at line 500 of file tokenI.hpp.

◆ isDouble()

bool isDouble ( ) const
inline

Definition at line 518 of file tokenI.hpp.

◆ isReal()

bool isReal ( ) const
inline

Definition at line 536 of file tokenI.hpp.

◆ isNumber()

bool isNumber ( ) const
inline

Definition at line 562 of file tokenI.hpp.

Referenced by pFlow::checkNumberToken(), and pFlow::operator>>().

Here is the caller graph for this function:

◆ isWord()

◆ isDirective()

bool isDirective ( ) const
inline

Definition at line 594 of file tokenI.hpp.

◆ isString()

bool isString ( ) const
inline

Definition at line 615 of file tokenI.hpp.

Referenced by pFlow::operator>>(), Logical::read(), and token::token().

Here is the caller graph for this function:

◆ isVariable()

bool isVariable ( ) const
inline

Definition at line 648 of file tokenI.hpp.

◆ isStringType()

bool isStringType ( ) const
inline

Definition at line 653 of file tokenI.hpp.

◆ boolToken()

bool boolToken ( ) const
inline

Definition at line 396 of file tokenI.hpp.

◆ flagToken()

int flagToken ( ) const
inline

Definition at line 414 of file tokenI.hpp.

◆ pToken()

pFlow::token::punctuationToken pToken ( ) const
inline

Definition at line 452 of file tokenI.hpp.

Referenced by pFlow::operator<<(), pFlow::printTokenInfo(), iIstream::readBeginList(), dataEntry::readDataEntry(), iIstream::readEndList(), and iIstream::readEndStatement().

Here is the caller graph for this function:

◆ int64Token()

pFlow::int64 int64Token ( ) const
inline

Definition at line 484 of file tokenI.hpp.

Referenced by pFlow::operator<<(), and pFlow::printTokenInfo().

Here is the caller graph for this function:

◆ int32Token()

pFlow::int32 int32Token ( ) const
inline

Definition at line 495 of file tokenI.hpp.

◆ floatToken()

float floatToken ( ) const
inline

Definition at line 506 of file tokenI.hpp.

Referenced by pFlow::operator<<(), and pFlow::printTokenInfo().

Here is the caller graph for this function:

◆ doubleToken()

double doubleToken ( ) const
inline

Definition at line 524 of file tokenI.hpp.

Referenced by pFlow::operator<<(), and pFlow::printTokenInfo().

Here is the caller graph for this function:

◆ realToken()

pFlow::real realToken ( ) const
inline

Definition at line 546 of file tokenI.hpp.

◆ number()

pFlow::real number ( ) const
inline

Definition at line 568 of file tokenI.hpp.

Referenced by pFlow::checkNumberToken(), and pFlow::operator>>().

Here is the caller graph for this function:

◆ wordToken()

◆ stringToken()

const pFlow::word & stringToken ( ) const
inline

Definition at line 624 of file tokenI.hpp.

References pFlow::nullWord.

Referenced by pFlow::operator<<(), pFlow::operator>>(), pFlow::printTokenInfo(), and Logical::read().

Here is the caller graph for this function:

◆ reset()

void reset ( )
inline

Definition at line 245 of file tokenI.hpp.

Referenced by pFlow::operator>>(), iIstream::peekBack(), iTstream::read(), and iIstream::resetPutBack().

Here is the caller graph for this function:

◆ setBad()

void setBad ( )
inline

Definition at line 658 of file tokenI.hpp.

Referenced by Istream::read(), and Istream::readWordToken().

Here is the caller graph for this function:

◆ swap()

void swap ( token tok)
inline

Definition at line 271 of file tokenI.hpp.

References token::data_, token::lineNumber_, and token::type_.

◆ operator=() [1/10]

void operator= ( const token tok)
inline

◆ operator=() [2/10]

void operator= ( token &&  tok)
inline

Definition at line 705 of file tokenI.hpp.

◆ operator=() [3/10]

void operator= ( const punctuationToken  p)
inline

Definition at line 718 of file tokenI.hpp.

◆ operator=() [4/10]

void operator= ( const int64  val)
inline

Definition at line 726 of file tokenI.hpp.

◆ operator=() [5/10]

void operator= ( const int32  val)
inline

Definition at line 733 of file tokenI.hpp.

◆ operator=() [6/10]

void operator= ( const float  val)
inline

Definition at line 741 of file tokenI.hpp.

◆ operator=() [7/10]

void operator= ( const double  val)
inline

Definition at line 749 of file tokenI.hpp.

◆ operator=() [8/10]

void operator= ( const word w)
inline

Definition at line 757 of file tokenI.hpp.

◆ operator=() [9/10]

void operator= ( word &&  w)
inline

Definition at line 765 of file tokenI.hpp.

◆ operator==() [1/7]

bool operator== ( const token tok) const
inline

◆ operator==() [2/7]

bool operator== ( const punctuationToken  p) const
inline

Definition at line 819 of file tokenI.hpp.

◆ operator==() [3/7]

bool operator== ( const int64  val) const
inline

Definition at line 825 of file tokenI.hpp.

◆ operator==() [4/7]

bool operator== ( const int32  val) const
inline

Definition at line 834 of file tokenI.hpp.

◆ operator==() [5/7]

bool operator== ( const float  val) const
inline

Definition at line 844 of file tokenI.hpp.

References pFlow::equal().

Here is the call graph for this function:

◆ operator==() [6/7]

bool operator== ( const double  val) const
inline

Definition at line 854 of file tokenI.hpp.

References pFlow::equal().

Here is the call graph for this function:

◆ operator==() [7/7]

bool operator== ( const word w) const
inline

Definition at line 863 of file tokenI.hpp.

◆ operator!=() [1/7]

bool operator!= ( const token tok) const
inline

Definition at line 872 of file tokenI.hpp.

References operator==().

Here is the call graph for this function:

◆ operator!=() [2/7]

bool operator!= ( const punctuationToken  p) const
inline

Definition at line 878 of file tokenI.hpp.

References operator==().

Here is the call graph for this function:

◆ operator!=() [3/7]

bool operator!= ( const int64  val) const
inline

Definition at line 884 of file tokenI.hpp.

References operator==().

Here is the call graph for this function:

◆ operator!=() [4/7]

bool operator!= ( const int32  val) const
inline

Definition at line 889 of file tokenI.hpp.

References operator==().

Here is the call graph for this function:

◆ operator!=() [5/7]

bool operator!= ( const float  val) const
inline

Definition at line 895 of file tokenI.hpp.

References operator==().

Here is the call graph for this function:

◆ operator!=() [6/7]

bool operator!= ( const double  val) const
inline

Definition at line 901 of file tokenI.hpp.

References operator==().

Here is the call graph for this function:

◆ operator!=() [7/7]

bool operator!= ( const word w) const
inline

Definition at line 907 of file tokenI.hpp.

References operator==().

Here is the call graph for this function:

◆ printInfo() [1/2]

pFlow::iOstream & printInfo ( iOstream os) const

Definition at line 224 of file tokenIO.cpp.

References pFlow::printTokenInfo().

Here is the call graph for this function:

◆ printInfo() [2/2]

std::ostream & printInfo ( std::ostream &  os) const

Definition at line 229 of file tokenIO.cpp.

References pFlow::printTokenInfo().

Here is the call graph for this function:

◆ operator=() [10/10]

void operator= ( word )
delete

Friends And Related Function Documentation

◆ operator<< [1/4]

iOstream& operator<< ( iOstream os,
const token tok 
)
friend

◆ operator<< [2/4]

iOstream& operator<< ( iOstream os,
const punctuationToken pt 
)
friend

◆ operator<< [3/4]

std::ostream& operator<< ( std::ostream &  os,
const token tok 
)
friend

◆ operator<< [4/4]

std::ostream& operator<< ( std::ostream &  os,
const punctuationToken pt 
)
friend

Member Data Documentation

◆ data_

content data_
private

◆ type_

◆ lineNumber_

int32 lineNumber_
private

Definition at line 185 of file token.hpp.

Referenced by token::operator=(), and token::swap().


The documentation for this class was generated from the following files: