S-expression analyser, reader, writer, and display for string literals.
More...
|
| x_spair_t | x_sexp_str_analyse1_prim = x_obj_set(NULL, X_OBJ_FLAG_NONE, { .fn = x_sexp_str_analyse1 }, { NULL }) |
| |
| x_spair_t | x_sexp_str_analyse2_prim = x_obj_set(NULL, X_OBJ_FLAG_NONE, { .fn = x_sexp_str_analyse2 }, { NULL }) |
| |
| x_spair_t | x_sexp_str_analyse3_prim = x_obj_set(NULL, X_OBJ_FLAG_NONE, { .fn = x_sexp_str_analyse3 }, { NULL }) |
| |
| x_satom_t | x_sexp_str_read_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { .fn = x_sexp_str_read }) |
| |
S-expression analyser, reader, writer, and display for string literals.
- Author
- Jon Ruttan (jonru.nosp@m.ttan.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)
- Copyright
- 2021 Jon Ruttan @license MIT No Attribution (MIT-0)
◆ x_next_state
| #define x_next_state |
( |
|
self, |
|
|
|
dflt |
|
) |
| |
Value:
int x_obj_isnil(x_obj_t *p_base, x_obj_t *p_obj)
Definition x-obj.c:54
#define x_callable_state(X)
Definition prim.h:40
Read next-state from callable state slot, with default fallback.
◆ hex_digit()
◆ x_sexp_str_analyse1()
Analyse state 1: match the opening double-quote.
- Parameters
-
| p_base | Base (execution context). |
| p_args | Pair of (self, read-args). |
- Returns
- Next analyser state on match, or NULL.
◆ x_sexp_str_analyse2()
Analyse state 2: consume string body characters.
Detects backslash (transitions to escape state) and closing quote (scores the full token length). All other characters loop.
- Parameters
-
| p_base | Base (execution context). |
| p_args | Pair of (self, read-args). |
- Returns
- Self, score, or next state.
◆ x_sexp_str_analyse3()
Analyse state 3: escape state.
Unconditionally consumes one character after a backslash and returns to the normal body-reading state (analyse2).
- Parameters
-
| p_base | Base (execution context). |
| p_args | Pair of (self, read-args). |
- Returns
- The analyse2 state primitive.
◆ x_sexp_str_read()
Read a string literal from the token buffer.
Strips the surrounding quotes and processes escape sequences in-place. Supported escapes: \", \\, \n, \t, \r, \0, and \xHH (two hex digits). Unknown escapes are preserved literally.
- Parameters
-
| p_base | Base (execution context). |
| p_args | Read-args containing the token buffer. |
- Returns
- A newly created owned-string object.
◆ x_sexp_str_analyse1_prim
◆ x_sexp_str_analyse2_prim
◆ x_sexp_str_analyse3_prim
◆ x_sexp_str_read_prim