summaryrefslogtreecommitdiff
path: root/src/lex.h
diff options
context:
space:
mode:
authorLizzy Fleckenstein <lizzy@vlhl.dev>2026-04-12 20:57:06 +0200
committerLizzy Fleckenstein <lizzy@vlhl.dev>2026-04-12 20:59:39 +0200
commite5af28536bfb0f4c9131df56d2009ba5196f5e3a (patch)
tree3ab928f961a1ccd8440b070d7b57f79146457e8c /src/lex.h
downloadanimtool-e5af28536bfb0f4c9131df56d2009ba5196f5e3a.tar.xz
init
Diffstat (limited to 'src/lex.h')
-rw-r--r--src/lex.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/lex.h b/src/lex.h
new file mode 100644
index 0000000..9e600d7
--- /dev/null
+++ b/src/lex.h
@@ -0,0 +1,40 @@
+#ifndef ANIMTOOL_LEX_H_
+#define ANIMTOOL_LEX_H_
+
+#include "util/container.h"
+#include "util/str.h"
+#include "source.h"
+#include "op.h"
+
+enum token_type
+{
+ TOKEN_NUMBER,
+ TOKEN_STRING,
+ TOKEN_VAR,
+ TOKEN_IDENT,
+ TOKEN_OP,
+};
+
+struct token
+{
+ struct range loc;
+ enum token_type type;
+ union
+ {
+ double number;
+ str string;
+ str var;
+ str ident;
+ struct
+ {
+ enum op_type type;
+ struct range name_loc;
+ array(struct token) children;
+ } op;
+ };
+};
+
+bool lex_token(struct source *source, struct token *tok);
+void free_token(struct token *tok);
+
+#endif