Skip to content

Commit

Permalink
reader: rewrite to use new lone value functions
Browse files Browse the repository at this point in the history
This will make the code automatically adapt
to any changes in the lone value representation.
  • Loading branch information
matheusmoreira committed Dec 24, 2024
1 parent 5853a63 commit 526f50f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions source/lone/lisp/reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ static bool lone_lisp_reader_is_expected_character_symbol(struct lone_lisp_value
unsigned char character;

if (lone_lisp_is_symbol(value)) {
actual = value.as.heap_value;
actual = lone_lisp_value_to_heap_value(value);

if (actual->as.bytes.count != 1) {
return false;
Expand Down Expand Up @@ -581,7 +581,7 @@ static struct lone_lisp_value lone_lisp_parse(struct lone_lisp *lone,
if (reader->status.end_of_input) { return lone_lisp_nil(); }

/* lexer has already parsed atoms */
switch (token.type) {
switch (lone_lisp_value_to_type(token)) {
case LONE_LISP_TYPE_NIL:
case LONE_LISP_TYPE_INTEGER:
case LONE_LISP_TYPE_POINTER:
Expand All @@ -590,7 +590,7 @@ static struct lone_lisp_value lone_lisp_parse(struct lone_lisp *lone,
break;
}

actual = token.as.heap_value;
actual = lone_lisp_value_to_heap_value(token);

/* parser deals with nested structures */
switch (actual->type) {
Expand Down

0 comments on commit 526f50f

Please sign in to comment.