feat(lexer): restructure lexer for hopefully better results
This commit is contained in:
parent
8c0105639f
commit
f5b3235455
5 changed files with 187 additions and 205 deletions
|
|
@ -14,7 +14,7 @@ void test_lexer_header() {
|
|||
|
||||
mrk_token t;
|
||||
TEST_CHECK(mrk_lexer_next(&t, lxr) == mrk_lexer_err_ok);
|
||||
TEST_CHECK(t.type == mrk_token_type_pounds);
|
||||
TEST_CHECK(t.type == mrk_token_type_header_start);
|
||||
TEST_CHECK_(t.start == 0, "t.start == %lu", t.start);
|
||||
TEST_CHECK(t.end == 4);
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ void test_lexer_line_break() {
|
|||
mrk_lexer_open(lxr, buf2, 0);
|
||||
|
||||
TEST_CHECK(mrk_lexer_next(&t, lxr) == mrk_lexer_err_ok);
|
||||
TEST_CHECK(t.type == mrk_token_type_spaces);
|
||||
TEST_CHECK(t.type == mrk_token_type_text);
|
||||
|
||||
TEST_CHECK(mrk_lexer_done(lxr));
|
||||
|
||||
|
|
@ -52,17 +52,15 @@ void test_lexer_simple1() {
|
|||
|
||||
mrk_token t;
|
||||
TEST_CHECK(mrk_lexer_next(&t, lxr) == mrk_lexer_err_ok);
|
||||
TEST_CHECK(t.type == mrk_token_type_pounds);
|
||||
TEST_CHECK(t.type == mrk_token_type_header_start);
|
||||
TEST_CHECK(mrk_lexer_next(&t, lxr) == mrk_lexer_err_ok);
|
||||
TEST_CHECK(t.type == mrk_token_type_spaces);
|
||||
TEST_CHECK(t.type == mrk_token_type_text);
|
||||
TEST_CHECK(mrk_lexer_next(&t, lxr) == mrk_lexer_err_ok);
|
||||
TEST_CHECK(t.type == mrk_token_type_word);
|
||||
TEST_CHECK(t.type == mrk_token_type_newline);
|
||||
TEST_CHECK(mrk_lexer_next(&t, lxr) == mrk_lexer_err_ok);
|
||||
TEST_CHECK(t.type == mrk_token_type_spaces);
|
||||
TEST_CHECK(t.type == mrk_token_type_newline);
|
||||
TEST_CHECK(mrk_lexer_next(&t, lxr) == mrk_lexer_err_ok);
|
||||
TEST_CHECK(t.type == mrk_token_type_word);
|
||||
TEST_CHECK(mrk_lexer_next(&t, lxr) == mrk_lexer_err_ok);
|
||||
TEST_CHECK(t.type == mrk_token_type_blank_line);
|
||||
TEST_CHECK(t.type == mrk_token_type_text);
|
||||
}
|
||||
|
||||
TEST_LIST = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue