rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
esc_json_int.h
Go to the documentation of this file.
1
10
11#ifndef ESC_JSON_INT_H
12#define ESC_JSON_INT_H
13
14#include <stdbool.h>
15#include <stddef.h>
16#include <stdint.h>
17
19typedef enum { T_OBJ, T_ARR, T_STR, T_NUM, T_TRUE, T_FALSE, T_NULL } ttype_t;
20
22typedef struct {
24 uint32_t start;
25 uint32_t end;
26 uint32_t size;
27 uint32_t next;
28} tok_t;
29
33typedef enum {
34 LEX_SYNTAX = 0,
40} lex_why_t;
41
43typedef struct {
44 const char *s;
45 uint32_t len;
46 uint32_t pos;
48 uint32_t n;
49 uint32_t cap;
51} lex_t;
52
63bool esc_json_lex_all(lex_t *l);
64
71const char *esc_json_lex_why_text(lex_why_t why);
72
84unsigned esc_json_decode_unit(const char *s, uint32_t *i, uint8_t out[4]);
85
94bool esc_json_text_is(const char *s, const tok_t *a, const char *lit);
95
96#endif /* ESC_JSON_INT_H */
unsigned esc_json_decode_unit(const char *s, uint32_t *i, uint8_t out[4])
The UTF-8 bytes of the character at s[*i], into out; *i moves past it.
Definition esc_json_lex.c:272
ttype_t
Type of one JSON token.
Definition esc_json_int.h:19
bool esc_json_text_is(const char *s, const tok_t *a, const char *lit)
Whether a string token's text decodes to the plain lit.
Definition esc_json_lex.c:361
bool esc_json_lex_all(lex_t *l)
Cut lexer l's text into tokens.
Definition esc_json_lex.c:584
const char * esc_json_lex_why_text(lex_why_t why)
Why the lexer refused, as the text after "%s near byte".
Definition esc_json_lex.c:595
lex_why_t
Why the text was refused, beyond its not being JSON.
Definition esc_json_int.h:33
@ LEX_SURROGATE
Definition esc_json_int.h:37
@ LEX_UTF8
Definition esc_json_int.h:38
@ LEX_MEMBERS
Definition esc_json_int.h:39
@ LEX_DUP
Definition esc_json_int.h:35
@ LEX_NUL
Definition esc_json_int.h:36
#define s
Short name for esc_stick_s inside the five stick-class files.
Definition esc_stick_panel_int.h:295
State of one lexer run over a JSON text.
Definition esc_json_int.h:43
uint32_t cap
Definition esc_json_int.h:49
uint32_t pos
Definition esc_json_int.h:46
lex_why_t why
Definition esc_json_int.h:50
tok_t * tok
Definition esc_json_int.h:47
const char * s
Definition esc_json_int.h:44
uint32_t n
Definition esc_json_int.h:48
uint32_t len
Definition esc_json_int.h:45
One JSON token, with its byte range and its links.
Definition esc_json_int.h:22
ttype_t type
Definition esc_json_int.h:23
uint32_t size
Definition esc_json_int.h:26
uint32_t start
Definition esc_json_int.h:24
uint32_t end
Definition esc_json_int.h:25
uint32_t next
Definition esc_json_int.h:27