run :: () -> bool { using lexer_state: My_Lexer_State; source = TEST; while !is_at_end() { char := advance(); if char == { case "["; state = .OPTION; inner := consume_till("]"); if !inner continue; advance_by(inner); // Do stuff current_char := u8_to_str(*peek()); ass(current_char, "]"); ass(inner, "Thing1:Something"); case "{"; state = .WEIRD; inner := consume_till("}"); if !inner continue; advance_by(inner); // Do stuff current_char := u8_to_str(*peek()); ass(current_char, "}"); ass(inner, " Something "); case "("; state = .VAL; inner := consume_till("+"); if !inner then report_error( lexer_state, "lexer.jai", "If you can see this, the test was %\n%", "successful!", 1234567890 ); current_char := u8_to_str(*peek()); ass(current_char, "V"); } } return true; } #scope_file TOKEN_ERROR :: "ERROR"; TEST :: #string STR_END [Thing1:Something] key1 = "123" key2 = "abc" AAAAAAAAAAAAAAAAAAAAAAAAA \ BBBBBBBBBBBBBBBBBBBBBBB { Something }:{ Things && (Val: ERROR) STR_END; State :: enum { ERROR; NONE; OPTION; WEIRD; VAL; EOF; } My_Lexer_State :: struct { index: int; source: string; state: State; } #import "Basic"; #import "Print_Vars"; #import "String"; #import,file "../0x2_Lexer.jai"; #load "assertion.jai";