picceler
Loading...
Searching...
No Matches
picceler::Lexer Class Reference

Lexical analyzer for the picceler programming language. More...

#include <lexer.h>

Public Member Functions

 Lexer ()
 Constructs a Lexer.
void setSourceString (std::string_view source)
 Sets the source string for the lexer.
Result< void > setSource (const std::string &filepath)
 Sets the source file for the lexer.
Result< TokennextToken ()
 Returns the next token from the input.
Result< TokenpeekToken ()
 Returns the next token without advancing the input.
void skipWhitespaceAndComment ()
 Skips whitespace characters and comment lines in the input.
Result< std::vector< Token > > getTokens ()
 Tokenizes the entire input.

Detailed Description

Lexical analyzer for the picceler programming language.

Constructor & Destructor Documentation

◆ Lexer()

picceler::Lexer::Lexer ( )

Constructs a Lexer.

Member Function Documentation

◆ getTokens()

Result< std::vector< Token > > picceler::Lexer::getTokens ( )

Tokenizes the entire input.

Returns
A vector of all tokens.

◆ nextToken()

Result< Token > picceler::Lexer::nextToken ( )

Returns the next token from the input.

Returns
The next token.

◆ peekToken()

Result< Token > picceler::Lexer::peekToken ( )

Returns the next token without advancing the input.

Returns
The next token.

◆ setSource()

Result< void > picceler::Lexer::setSource ( const std::string & filepath)

Sets the source file for the lexer.

Parameters
filepathThe source file to read from.

◆ setSourceString()

void picceler::Lexer::setSourceString ( std::string_view source)

Sets the source string for the lexer.

Parameters
sourceThe source string to read from.

◆ skipWhitespaceAndComment()

void picceler::Lexer::skipWhitespaceAndComment ( )

Skips whitespace characters and comment lines in the input.


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