|
x-engine-c v0.2.13
The C engine for x-lang
|
S-expression analyser, reader, writer, and display for list literals. More...
#include "x-type/list.h"#include "x-type/buffer.h"#include "x-type/symbol.h"#include "x-eval.h"#include "x-heap.h"#include "x-token.h"#include "x-token/sexp/list.h"#include "x-token/sexp/whitespace.h"Functions | |
| x_obj_t * | x_sexp_list_analyse (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_sexp_list_delimit (x_obj_t *p_base, x_obj_t *p_args) |
| static x_obj_t * | x_sexp_list_read_next (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_sexp_list_read (x_obj_t *p_base, x_obj_t *p_args) |
Variables | |
| x_satom_t | x_sexp_list_analyse_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { .fn = x_sexp_list_analyse }) |
| x_satom_t | x_sexp_list_delimit_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { .fn = x_sexp_list_delimit }) |
| x_satom_t | x_sexp_list_read_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { .fn = x_sexp_list_read }) |
S-expression analyser, reader, writer, and display for list literals.
Analyse: score on any list delimiter character.
Matches ( and ) only. Scores the buffer length immediately, which is sound because the brackets really are always single-character tokens.
The dot is NOT matched, and that sentence used to be false of it: a dot scored here on sight, so a token merely BEGINNING with one was taken whole as the pair separator. It is an ordinary character now – the symbol analyser accumulates it, and the list reader recognises the symbol "." when it builds a pair.
| p_base | Base (execution context). |
| p_args | Read-args containing the token buffer and score. |
Delimiter callback for list characters.
Backs up the read pointer when a list delimiter is encountered so the current token is terminated before the delimiter.
| p_base | Base (execution context). |
| p_args | Read-args containing the token buffer. |
Read a list (or dotted pair) from the token stream.
Two cases, on the bracket character:
) – returns the read_prim sentinel (end of list).( – recursively reads elements via x_token_read until the close-paren sentinel, treating the one-character symbol . as the pair separator when it meets one.The separator has no sentinel of its own. It used to: the dot was a single-character token and this returned delimit_prim for it, which meant every token beginning with a dot became the separator and ... reached the caller as that raw satom, inside a list, as a value.
| p_base | Base (execution context). |
| p_args | Read-args containing the token buffer. |
x_token_read, but end-of-input inside an OPEN list is truncation: raise instead of returning the EOF sentinel. Control never returns, so a partial list can never reach evaluation, and the callers that used to spin appending the ambiguous NULL (#156) terminate loudly. No root-pop before the raise: guard restores the root chain (x-syntax/control.c) and the no-handler path exits – the same protocol as every mid-eval raise.
| p_base | Base (execution context). |
| p_args | Read-args containing the token buffer. |
| x_satom_t x_sexp_list_analyse_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { .fn = x_sexp_list_analyse }) |
Analyser / delimiter / reader primitive satoms for the list type.
| x_satom_t x_sexp_list_delimit_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { .fn = x_sexp_list_delimit }) |
| x_satom_t x_sexp_list_read_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { .fn = x_sexp_list_read }) |