3run :: () -> bool {
4 using lexer_state: My_Lexer_State;
5 source = TEST;
7 while !is_at_end() {
8 char := advance();
10 if char == {
11 case "[";
12 state = .OPTION;
13 inner := consume_till("]");
14 if !inner continue;
16 advance_by(inner);
18 // Do stuff
20 current_char := u8_to_str(*peek());
21 ass(current_char, "]");
22 ass(inner, "Thing1:Something");
24 case "{";
25 state = .WEIRD;
26 inner := consume_till("}");
27 if !inner continue;
29 advance_by(inner);
31 // Do stuff
33 current_char := u8_to_str(*peek());
34 ass(current_char, "}");
35 ass(inner, " Something ");
37 case "(";
38 state = .VAL;
39 inner := consume_till("+");
41 if !inner then report_error(
42 lexer_state,
43 "lexer.jai",
44 "If you can see this, the test was %\n%",
45 "successful!",
46 1234567890
47 );
49 current_char := u8_to_str(*peek());
50 ass(current_char, "V");
51 }
52 }
54 return true;
55}
58#scope_file
61TOKEN_ERROR :: "ERROR";
63TEST :: #string STR_END
64[Thing1:Something]
65key1 = "123"
66key2 = "abc"
68AAAAAAAAAAAAAAAAAAAAAAAAA \ BBBBBBBBBBBBBBBBBBBBBBB
70{ Something }:{ Things
73&&
76 (Val: ERROR)
79STR_END;
82State :: enum {
83 ERROR;
84 NONE;
85 OPTION;
86 WEIRD;
87 VAL;
88 EOF;
89}
91My_Lexer_State :: struct {
92 index: int;
93 source: string;
94 state: State;
95}
98#import "Basic";
99#import "Print_Vars";
100#import "String";
101#import,file "../0x2_Lexer.jai";
103#load "assertion.jai";