Skip to content

TokenGroup

class TokenGroup

A group of tokens specified by specific tokens or token types.

DEFINITION
class TokenGroup;

constructor TokenGroup

Create a token group that contains no or all tokens.

DEFINITION
TokenGroup ( bool  contains_all = false );
PARAMETERDESCRIPTION
contains_all

If true, the group contains all tokens, otherwise it contains no tokens.

constructor TokenGroup

Create a token group that contains all tokens of the given type.

DEFINITION
TokenGroup ( Token::Type  type );
PARAMETERDESCRIPTION
type

The type of tokens to include in the group.

constructor TokenGroup

Create a token group that contains the given tokens.

DEFINITION
TokenGroup ( std::unordered_set< Token::Type >  types,
std::unordered_set< Token >  tokens,
std::string  name );
PARAMETERDESCRIPTION
types
tokens

The tokens to include in the group.

name

The name of the token group.

method containsconst

Check if the group contains a given token.

DEFINITION
bool  contains ( const Token & token ) const;
PARAMETERDESCRIPTION
token

The token to check.

RETURNSDESCRIPTION
bool

true if the group contains the token, false otherwise.

member allstatic

A token group that contains all tokens.

DEFINITION
static const TokenGroup  all;

member contains_all

Whether the group contains all tokens.

DEFINITION
bool  contains_all;

member name

The name of the token group.

DEFINITION
std::string  name;

member newlinestatic

A token group that contains the newline token.

DEFINITION
static const TokenGroup  newline;

member tokens

The specific tokens contained in the group.

DEFINITION
std::unordered_set< Token >  tokens;

member types

The token types contained in the group.

DEFINITION
std::unordered_set< Token::Type >  types;