linc 0.7
Linc is a general-purpose programming language inspired by C
Loading...
Searching...
No Matches
linc::Lexer Class Referencefinal

Lexer class, the purpose of which is to take raw source code as its input and produce a list of Tokens that correspond to it as its output. More...

#include <Lexer.hpp>

Public Member Functions

 Lexer (const Code::Source &source_code, bool initialize_source)
 Initialize a lexer object.
 
std::vector< Tokenoperator() () const
 Process the source code given to the lexer and output its tokenized form.
 
void appendIncludeDirectories (const std::vector< std::string > &new_directories) const
 Append a list of custom directories to the include paths list.
 

Static Public Member Functions

static bool isDigit (char c, Token::NumberBase base)
 Determine whether a character is a digit for a given number system base.
 

Detailed Description

Lexer class, the purpose of which is to take raw source code as its input and produce a list of Tokens that correspond to it as its output.

Constructor & Destructor Documentation

◆ Lexer()

linc::Lexer::Lexer ( const Code::Source & source_code,
bool initialize_source )
explicit

Initialize a lexer object.

Parameters
source_codeThe actual source code to be tokenized.
initialize_sourceWhether to initialize the source code representation used for reporting errors. To be used for files that directly go through language analysis, i.e. not via include directives.

Member Function Documentation

◆ appendIncludeDirectories()

void linc::Lexer::appendIncludeDirectories ( const std::vector< std::string > & new_directories) const
inline

Append a list of custom directories to the include paths list.

Parameters
new_directoriesThe new paths to be appended.

◆ isDigit()

static bool linc::Lexer::isDigit ( char c,
Token::NumberBase base )
inlinestatic

Determine whether a character is a digit for a given number system base.

Returns
Boolean corresponding to the result of the test.

◆ operator()()

auto linc::Lexer::operator() ( ) const

Process the source code given to the lexer and output its tokenized form.

Returns
The list of tokens that correspond to the original source code.

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