gfy-cpp
Loading...
Searching...
No Matches
Token Class Reference

#include <token.hpp>

Public Member Functions

 Token (Type type, const string &text, const string &file, tuple< int, int > position)
 Construct a new Token object.
 
Type get_type ()
 Type getter.
 
string get_text ()
 Text getter.
 
string get_file ()
 File getter.
 
tuple< int, int > get_position ()
 Position getter.
 
int get_line ()
 Get token line number.
 
int get_column ()
 Get token column number.
 
string to_string () const
 Stringify the token.
 

Private Attributes

Type type
 
string text
 
string file
 
tuple< int, int > position
 

Constructor & Destructor Documentation

◆ Token()

Token::Token ( Type type,
const string & text,
const string & file,
tuple< int, int > position )
inline

Construct a new Token object.

Parameters
typeThe type of the token
textThe text of the token
fileThe file of the token
positionThe position of the token

Member Function Documentation

◆ get_column()

int Token::get_column ( )

Get token column number.

Returns
The column number of the token

◆ get_file()

string Token::get_file ( )

File getter.

Returns
The file name where the token was found

◆ get_line()

int Token::get_line ( )

Get token line number.

Returns
The line number of the token

◆ get_position()

tuple< int, int > Token::get_position ( )

Position getter.

Returns
The position of the token

◆ get_text()

string Token::get_text ( )

Text getter.

Returns
The text of the token

◆ get_type()

Type Token::get_type ( )

Type getter.

Returns
The type of the token

◆ to_string()

string Token::to_string ( ) const

Stringify the token.

Returns
The stringified token

Field Documentation

◆ file

string Token::file
private

◆ position

tuple<int, int> Token::position
private

◆ text

string Token::text
private

◆ type

Type Token::type
private

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