commit 837516fd18a14210ffb6cb46311ddd7fe9979c70
parent 613e94fd674226346973b98cac8cde97e5b9bff2
Author: thing1 <thing1@seacrossedlovers.xyz>
Date: Thu, 9 Oct 2025 12:18:43 +0100
allowed for pointer deref
Diffstat:
5 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/.lex.h.swp b/.lex.h.swp
Binary files differ.
diff --git a/lex.c b/lex.c
@@ -117,8 +117,16 @@ lex_sym() {
/* TODO: make this execpt pointer derefs at the start of a name */
lex_val *
lex_name(void) {
+
static char name[32] = { 0 };
char c, len = 0;
+
+ if (peekc(input) == '*') {
+ getchr(input);
+ lv.type = DEREF;
+ return &lv;
+ }
+
if (!isalpha((c = getchr(input)))) return &lex_error;
do {
memcpy(strnul(name), &c, 1);
diff --git a/lex.h b/lex.h
@@ -7,6 +7,7 @@ enum lex_type {
NUM,
SEMI,
PTR,
+ DEREF,
UNARRAY,
QUOTE,
OBRACE,
diff --git a/main.c b/main.c
@@ -9,7 +9,8 @@ main() {
init_lexer(f);
while (val = get_next())
- continue;
+ if (val->type == UNKNOWN)
+ break;
fclose(f);
}
diff --git a/test.hlc b/test.hlc
@@ -1 +1 @@
-byte *name;
+byte *name = *first;