summaryrefslogtreecommitdiff
path: root/include/lexer.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/lexer.hpp')
-rw-r--r--include/lexer.hpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/include/lexer.hpp b/include/lexer.hpp
new file mode 100644
index 0000000..73c5717
--- /dev/null
+++ b/include/lexer.hpp
@@ -0,0 +1,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 */