summaryrefslogtreecommitdiff
path: root/masm/lex.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--masm/lex.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/masm/lex.h b/masm/lex.h
index f1c482a..e08d0a3 100644
--- a/masm/lex.h
+++ b/masm/lex.h
@@ -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__ */