god::token#

Note

Declared in <god/token.hpp>

class token#

A lexical token derived from raw input.

Members

tokentype type#

The tokentype enum member related to the token content.

std::string lexeme#

The captured text (lexical content) of the token.

coordinates location#

Indexes for the beginning and end line and columns.

Constructors

inline token(tokentype ptype, std::string plexeme, std::uint32_t lb, std::uint32_t le, std::uint32_t cb, std::uint32_t ce)#

Main constructor for the token class. Recieves type and lexeme arguments along with four indexes to create a coordinates object.

inline token(tokentype ptype, std::string plexeme, coordinates plocation)#

Alternative constructor for the token class Recieves the type and lexeme identically to the main constructor, but recieves a coordinates object directly for location.

Methods

bool operator==(const token &other) const = default#

boolean comparison operator

Parameters:

other – Another token to compare against

Returns:

True if the tokens are identical, false otherwise

std::string type_string() const noexcept#

Get the token type as a string.

Returns:

A string representing the token type