feat(lexer): parse equal signs
parent
f6e034097d
commit
dc3cfc5fbe
|
@ -19,6 +19,7 @@ typedef enum mrk_token_type {
|
|||
mrk_token_type_dashes,
|
||||
mrk_token_type_underscores,
|
||||
mrk_token_type_stars,
|
||||
mrk_token_type_equals,
|
||||
mrk_token_type_blank_line,
|
||||
mrk_token_type_space,
|
||||
mrk_token_type_line_break,
|
||||
|
|
|
@ -124,7 +124,8 @@ mrk_lexer_err mrk_lexer_next(mrk_token *out, mrk_lexer *lexer) {
|
|||
char c = mrk_lexer_advance(lexer);
|
||||
switch (c) {
|
||||
// All these characters have multiple meanings depending on their location
|
||||
// in the file and how many there are
|
||||
// in the file and how many there are, so the lexer can only match them as
|
||||
// one or more grouped characters
|
||||
case '#':
|
||||
mrk_lexer_advance_eq(lexer, c);
|
||||
mrk_lexer_emit(out, lexer, mrk_token_type_pounds);
|
||||
|
@ -145,6 +146,10 @@ mrk_lexer_err mrk_lexer_next(mrk_token *out, mrk_lexer *lexer) {
|
|||
mrk_lexer_advance_eq(lexer, c);
|
||||
mrk_lexer_emit(out, lexer, mrk_token_type_stars);
|
||||
break;
|
||||
case '=':
|
||||
mrk_lexer_advance_eq(lexer, c);
|
||||
mrk_lexer_emit(out, lexer, mrk_token_type_equals);
|
||||
break;
|
||||
// Two consecutive newlines constitute a blank line, otherwise they're
|
||||
// ignored as whitespace
|
||||
case '\n':
|
||||
|
|
Loading…
Reference in New Issue