update lexer to just return the number and then do the other logic somewhere else
This commit is contained in:
@@ -11,7 +11,21 @@ void lexer(LexerState state) {
|
||||
void* buffer = yy_scan_string(state.content, scanner);
|
||||
yy_switch_to_buffer(buffer, scanner);
|
||||
|
||||
yylex(scanner);
|
||||
int token;
|
||||
while ((token = yylex(scanner)) != 0) {
|
||||
Token * token_struct = create_token(
|
||||
token,
|
||||
yyget_lineno(scanner),
|
||||
state.current_column,
|
||||
yyget_text(scanner)
|
||||
);
|
||||
append(state.tokens, token_struct);
|
||||
if (token == TOKEN_NEW_LINE) {
|
||||
state.current_column = 0;
|
||||
} else {
|
||||
state.current_column += yyget_leng(scanner);
|
||||
}
|
||||
}
|
||||
|
||||
yy_delete_buffer(buffer, scanner);
|
||||
yylex_destroy(scanner);
|
||||
|
||||
Reference in New Issue
Block a user