22 int result = mpz_init_set_str(integer, text, base);
33 float result = strtof(text, NULL);
STA_DECL void * scan_get_context(const scan_t *scan)
get the context of a scanner
STA_DECL text_view_t scan_source(const scan_t *scan)
get a text span of the scanners contents
STA_DECL arena_t * scan_get_arena(const scan_t *scan)
get the arena of a scanner
CT_CONSTFN CT_BASE_API text_view_t text_view_make(STA_READS(length) const char *text, size_t length)
create a new non-owning text array text must be at least length bytes long
CT_EVENTS_API void evt_scan_error(logger_t *logger, const node_t *node, const char *msg)
signal that a scan error has occurred
CT_NODISCARD CT_SCAN_API node_t * node_new(const scan_t *scan, where_t where)
create a new node on the heap
CT_NODISCARD CT_SCAN_API node_t node_make(const scan_t *scan, where_t where)
create a new node on the stack
#define CT_UNUSED(x)
mark a variable as unused
CT_NOTIFY_API event_builder_t msg_notify(INOUT_NOTNULL logger_t *logs, const diagnostic_t *diagnostic, const node_t *node, STA_FORMAT_STRING const char *fmt,...)
notify the logger of a new message
CT_UTIL_API bool util_text_has_escapes(STA_READS(length) const char *text, size_t length)
CT_BEGIN_API CT_UTIL_API text_t util_text_escape(logger_t *reports, const node_t *node, STA_READS(length) const char *text, size_t length, arena_t *arena)
escape a string literal into a string
a position in a source file
size_t length
the number of characters in the text
a non-owning view of text
a location inside a scanner locations are inclusive and 0-based
void json_parse_string(text_view_t *string, scan_t *scan, json_where_t where, const char *text, size_t length)
void jsonerror(where_t *where, void *state, scan_t *scan, const char *msg)
json_scan_t * json_scan_context(scan_t *scan)
void json_parse_integer(mpz_t integer, scan_t *scan, where_t where, const char *text, int base)
void json_parse_float(float *real, scan_t *scan, where_t where, const char *text)