diff options
author | Freya Murphy <freya@freyacat.org> | 2024-09-13 11:11:18 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-09-13 11:11:18 -0400 |
commit | df4a225ccf79dd9f5fa3faef4fd68ae87471f0ca (patch) | |
tree | 44629775a57e229024f56d087ab5d1aebed978d3 /masm/lex.h | |
parent | dont upload those :p (diff) | |
download | mips-df4a225ccf79dd9f5fa3faef4fd68ae87471f0ca.tar.gz mips-df4a225ccf79dd9f5fa3faef4fd68ae87471f0ca.tar.bz2 mips-df4a225ccf79dd9f5fa3faef4fd68ae87471f0ca.zip |
better
Diffstat (limited to '')
-rw-r--r-- | masm/lex.h | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -14,6 +14,13 @@ struct lexer { int y; }; +struct lexer_state { + long offset; + int peek; + int x; + int y; +}; + enum token_type { TOK_IDENT, TOK_REG, @@ -52,4 +59,10 @@ int lexer_next(struct lexer *lexer, struct token *token); /* token type to string */ char *token_str(enum token_type); +/* save the state of a lexer */ +void lexer_save(struct lexer *lexer, struct lexer_state *state); + +/* load a different state into a lexer */ +void lexer_load(struct lexer *lexer, const struct lexer_state *state); + #endif /* __LEX_H__ */ |