summaryrefslogtreecommitdiff
path: root/token.h
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-08-06 01:40:02 +1200
committerDavid Phillips <david@sighup.nz>2018-08-06 01:40:02 +1200
commit5dbadfa0448e3324479ece98045c0a427856f382 (patch)
tree338998ddbfc0eed315845199f18d7bd4050d9a60 /token.h
parent0bff14977a2e4196bf4cd06481b8d0a93a563816 (diff)
downloadhence-5dbadfa0448e3324479ece98045c0a427856f382.tar.xz
Add TOK_BEGIN
This lets us indicate that the lexer succeeded, even on an empty program. Previous behaviour was to return NULL on failure and on lex success of an empty progam. Enforcing the presence of a head for the linked token list ensures that we can reliably detect error as a caller of the lexer. Fixes test just added in previous commit too.
Diffstat (limited to 'token.h')
-rw-r--r--token.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/token.h b/token.h
index c00c870..453b554 100644
--- a/token.h
+++ b/token.h
@@ -4,6 +4,9 @@
#define MAX_IDENT_LENGTH 128
enum TOKEN_TYPE {
+ /* Nop token to indicate lexer success */
+ TOK_BEGIN,
+
/* Keywords */
TOK_MODULE,
TOK_INPUT,