summaryrefslogtreecommitdiff
path: root/include/lexer.hpp
blob: 73c5717073cb982dbd02a8156955eca65ee6c457 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <string>

#ifndef LEXER_H
#define LEXER_H

const std::string EMPTY_STRING = ""; 

enum token_type{
  sum,
  substraction,
  division,
  multiplication,
  power,
  variable,
  number,
  sin,
  cos,
  tan,
  function,
  left_parens,
  right_parens
};

struct Token{
  token_type type;
  std::string value;
};

class Lexer{
private:
  std::string text;
  size_t txt_ptr;
  Token current_token;
  void setCurrentToken(Token val);
public:
  Lexer(std::string text);
  void nextToken();
  Token getCurrentToken();
};

#endif /* LEXER_H */