|
x-engine-c v0.2.13
The C engine for x-lang
|
S-expression analyser and reader for list literals. More...
#include "x-obj.h"Go to the source code of this file.
Macros | |
| #define | X_SEXP_LIST_PRE_STR "(" |
| #define | X_SEXP_LIST_DOT_STR "." |
| #define | X_SEXP_LIST_POST_STR ")" |
| #define | X_SEXP_LIST_CHARS_STR X_SEXP_LIST_PRE_STR X_SEXP_LIST_POST_STR |
Functions | |
| x_obj_t * | x_sexp_list_analyse (x_obj_t *p_base, x_obj_t *args) |
| x_obj_t * | x_sexp_list_delimit (x_obj_t *p_base, x_obj_t *args) |
| x_obj_t * | x_sexp_list_read (x_obj_t *p_base, x_obj_t *args) |
Variables | |
Analyser / reader primitives (satom). | |
| x_satom_t | x_sexp_list_analyse_prim |
| x_satom_t | x_sexp_list_delimit_prim |
| x_satom_t | x_sexp_list_read_prim |
S-expression analyser and reader for list literals.
| #define X_SEXP_LIST_CHARS_STR X_SEXP_LIST_PRE_STR X_SEXP_LIST_POST_STR |
< The characters the list type CLAIMS: the brackets, and nothing else.
The dot is deliberately absent. It used to be here, which made it a single-character token scored on sight – so every token BEGINNING with a dot became the pair separator, and ... reached the caller as the raw separator satom sitting in a list as a VALUE. Touching it segfaulted.
A dot is now an ordinary character: nothing claims it, the symbol analyser accumulates it like any other, and the list READER recognises the one-character symbol "." as the separator when it builds a pair. That is where the structural decision already lived.
| #define X_SEXP_LIST_DOT_STR "." |
Dotted-pair separator.
| #define X_SEXP_LIST_POST_STR ")" |
List close delimiter.
| #define X_SEXP_LIST_PRE_STR "(" |
List open delimiter.
Analyse: score on any list delimiter character.
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: back up read pointer on list characters.
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.
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. |
|
extern |
Analyser / delimiter / reader primitive satoms for the list type.
| x_satom_t x_sexp_list_delimit_prim |
| x_satom_t x_sexp_list_read_prim |