EMath++
Classes for mathematical concepts
Loading...
Searching...
No Matches
emthp::Lexer Class Reference

Class that works as a token supplier for the Parser class. More...

#include <eparser.h>

Public Member Functions

 Lexer (const std::string &input) noexcept
 Standalone constructor for the Lexer class.
 
Lexeroperator= (const Lexer &ogn) noexcept
 Assigment operator for when called with an lvalue.
 
Token next () noexcept
 Function that returns the next Token in the input provided in the constructor.
 
void back () noexcept
 Backtrack function that moves the cursor's position one position backwards.
 

Detailed Description

Class that works as a token supplier for the Parser class.

The class consists of two public functions, one for getting the next Token and the other for going back one position.

Definition at line 70 of file eparser.h.

Constructor & Destructor Documentation

◆ Lexer()

emthp::Lexer::Lexer ( const std::string &  input)
noexcept

Standalone constructor for the Lexer class.

Parameters
inputA const reference to the std::string to tokenize.

Definition at line 14 of file eparser.cpp.

Member Function Documentation

◆ back()

void emthp::Lexer::back ( )
noexcept

Backtrack function that moves the cursor's position one position backwards.

Definition at line 52 of file eparser.cpp.

◆ next()

emthp::Token emthp::Lexer::next ( )
noexcept

Function that returns the next Token in the input provided in the constructor.

Returns
(Token) The next Token in the input

Definition at line 29 of file eparser.cpp.

References next(), emthp::T_EOF, emthp::T_EXPONENT, emthp::T_MINUS, emthp::T_NUMBER, emthp::T_PLUS, and emthp::T_VARIABLE.

◆ operator=()

emthp::Lexer & emthp::Lexer::operator= ( const Lexer ogn)
noexcept

Assigment operator for when called with an lvalue.

Parameters
ognThe lvalue Lexer object.
Returns
(Lexer&) A reference to the lvalue of the operation

Definition at line 20 of file eparser.cpp.


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