feat(lexer): header, line breaks, paragraph breaks
This commit is contained in:
parent
a6c17eff5f
commit
f003e3555b
5 changed files with 1974 additions and 13 deletions
|
|
@ -14,7 +14,11 @@ typedef enum mrk_lexer_err {
|
|||
} mrk_lexer_err;
|
||||
|
||||
typedef enum mrk_token_type {
|
||||
mrk_token_type_pound = 0,
|
||||
mrk_token_type_header = 0,
|
||||
mrk_token_type_blank_line,
|
||||
mrk_token_type_star_star,
|
||||
mrk_token_type_space_space,
|
||||
mrk_token_type_line_break,
|
||||
} mrk_token_type;
|
||||
|
||||
typedef struct mrk_token {
|
||||
|
|
@ -28,6 +32,11 @@ typedef struct mrk_token {
|
|||
*/
|
||||
mrk_err mrk_lexer_init(mrk_lexer **out);
|
||||
|
||||
/**
|
||||
* Deallocate the lexer object.
|
||||
*/
|
||||
void mrk_lexer_free(mrk_lexer *lexer);
|
||||
|
||||
/**
|
||||
* Open the buffer with the given lexer struct. `buf` is expected to live for
|
||||
* the duration of the lexing.
|
||||
|
|
@ -41,7 +50,7 @@ void mrk_lexer_open(mrk_lexer *lexer, const char *buf, size_t len);
|
|||
/**
|
||||
* Returns whether the lexer is done.
|
||||
*/
|
||||
bool mrk_lexer_at_end(const mrk_lexer *lexer);
|
||||
bool mrk_lexer_done(const mrk_lexer *lexer);
|
||||
|
||||
/**
|
||||
* Output the next lexed token for the given input.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue