-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
57 lines (52 loc) · 1.26 KB
/
test.cpp
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <iostream>
#include <fstream>
#include "lexer.h"
std::string type_to_string(int code)
{
switch(code)
{
case naruto::TokenCodes::identifier:
return "Identifier";
case naruto::TokenCodes::int_val:
return "Int Val";
case naruto::TokenCodes::float_val:
return "Float Val";
case naruto::TokenCodes::no_jutsu:
return "No Jutsu";
case naruto::TokenCodes::sayonara:
return "Sayonara";
case naruto::TokenCodes::chan:
return "Chan";
case naruto::TokenCodes::nani:
return "Nani";
case naruto::TokenCodes::baka:
return "Baka";
case naruto::TokenCodes::suki:
return "Suki";
case naruto::TokenCodes::wa:
return "Wa";
case naruto::TokenCodes::desu:
return "Desu";
case naruto::TokenCodes::bin_op:
return "Binary Operator";
case naruto::TokenCodes::paren_open:
return "(";
case naruto::TokenCodes::paren_close:
return ")";
case naruto::TokenCodes::newline:
return "Newline";
}
}
int main(void)
{
auto out = naruto::naruto_lexize_file("fib.uwu");
for(auto item : out)
{
std::cout << "------------" << std::endl <<
"Obj type: " << type_to_string(item.code) << std::endl <<
"Obj info: '" << item.info << "'" << std::endl <<
"Int val: " << item.int_val << std::endl <<
"Flt val: " << item.float_val << std::endl;
}
return 0;
}