aboutsummaryrefslogtreecommitdiff
path: root/src/utils.h
blob: 0145065068f8f5c050e652f983d31640ea59589c (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
#ifndef PARSER_SRC_UTILS_H_
#define PARSER_SRC_UTILS_H_

#include <string>
#include <vector>

#include "nodes.h"

namespace SimpleParser {

enum class PrecedenceLevel : uint8_t {
	FIRST  = 1,
	SECOND = 2,
	THIRD  = 3,
	FOURTH = 4,
	FIFTH  = 5,
};

enum class TokenType {
	OPERATOR_PLUS,
	OPERATOR_MINUS,
	OPERATOR_DIVIDE,
	OPERATOR_MULTIPLY,
	OPERATOR_POWER,
	PARENTHESES_OPEN,
	PARENTHESES_CLOSE,
	VALUE_NUMBER,
	VALUE_IDENTIFIER,
};

TokenType getTokenType(char);
PrecedenceLevel getPrecedence(TokenType);
std::vector<std::string> lexer(std::string);

}

#endif  // PARSER_SRC_UTILS_H_