Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Token Struct Reference

Structure representing a lexical token. More...

#include <parse_utils.H>

Collaboration diagram for Aleph::Token:
[legend]

Public Member Functions

 Token ()=default
 Default constructor.
 
 Token (TokenType t, std::string v, SourceLocation loc)
 Construct with all fields.
 
bool is_eof () const
 Check if this is an end-of-file token.
 
std::string to_string () const
 String representation for debugging.
 

Public Attributes

TokenType type = TokenType::UNKNOWN
 Type of the token.
 
std::string value
 String value/content.
 
SourceLocation location
 Where token appeared.
 

Detailed Description

Structure representing a lexical token.

Definition at line 1506 of file parse_utils.H.

Constructor & Destructor Documentation

◆ Token() [1/2]

Aleph::Token::Token ( )
default

Default constructor.

◆ Token() [2/2]

Aleph::Token::Token ( TokenType  t,
std::string  v,
SourceLocation  loc 
)
inline

Construct with all fields.

Definition at line 1516 of file parse_utils.H.

Member Function Documentation

◆ is_eof()

bool Aleph::Token::is_eof ( ) const
inline

Check if this is an end-of-file token.

Definition at line 1520 of file parse_utils.H.

References Aleph::END_OF_FILE, and type.

◆ to_string()

std::string Aleph::Token::to_string ( ) const
inline

String representation for debugging.

Definition at line 1523 of file parse_utils.H.

References location, Aleph::SourceLocation::to_string(), Aleph::token_type_to_string(), type, and value.

Member Data Documentation

◆ location

SourceLocation Aleph::Token::location

Where token appeared.

Definition at line 1510 of file parse_utils.H.

Referenced by to_string().

◆ type

TokenType Aleph::Token::type = TokenType::UNKNOWN

Type of the token.

Definition at line 1508 of file parse_utils.H.

Referenced by is_eof(), and to_string().

◆ value

std::string Aleph::Token::value

String value/content.

Definition at line 1509 of file parse_utils.H.

Referenced by to_string().


The documentation for this struct was generated from the following file: