19 #include "query_bison.h"
20 #include "query_flex.h"
39 if (object->
kind != eJsonObject)
50 if (object->
kind != eJsonArray)
68 if (object->
kind != eJsonObject)
105 return eval_query(json, result.
tree, arena);
111 return query_internal(json, query, logger, NULL, arena);
121 json_t *result = query_internal(json, query, logger, &scan, arena);
125 if (result->
kind == kind)
CT_NODISCARD CT_SCAN_API scan_t * scan_io(const char *language, io_t *io, arena_t *arena)
create a scanner from an io source
CT_SCAN_API void scan_set_context(scan_t *scan, void *value)
get the context of a scanner
#define STA_DECL
sal2 annotation on function implementations to copy annotations from the declaration
STA_RET_STRING colour_t idx
CT_INTEROP_API parse_result_t scan_buffer(scan_t *scan, const scan_callbacks_t *callbacks)
parse the contents of a scanner into a language specific ast
@ eParseOk
parse was successful
CT_NODISCARD CT_IO_API io_t * io_string(const char *name, const char *string, arena_t *arena)
create an IO view of a string create a readonly IO view of a string
CT_JSON_API const char * json_kind_name(json_kind_t kind)
get the name of a json kind
json_kind_t
the kind of json value
CT_JSON_API json_t * json_map_get(const json_t *json, const char *key)
get a json value from an object by key
CT_NODISCARD CT_SCAN_API node_t node_make(const scan_t *scan, where_t where)
create a new node on the stack
CT_NODISCARD CT_ARENA_API char * arena_strndup(STA_READS(len) const char *str, size_t len, arena_t *arena)
allocate a copy of a string with a maximum length from a custom allocator
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
#define CT_ASSERT_RANGE(value, min, max)
assert that a value is in a range inclusive bounds check
#define CT_NEVER(...)
assert that a code path is never reached
#define CTASSERT(expr)
assert a condition, prints the condition as a message
CT_NODISCARD CT_PUREFN CT_STD_API size_t typevec_len(const typevec_t *vec)
get the length of a vector
CT_NODISCARD CT_PUREFN CT_STD_API void * typevec_offset(const typevec_t *vec, size_t index)
get a pointer to the value at the given index
typevec_t array
the array value of this node
where_t where
the source location of the json value
json_kind_t kind
the kind of json value
a position in a source file
size_t length
the number of characters in the text
STA_DECL json_t * json_query_type(json_t *json, const char *query, json_kind_t kind, logger_t *logger, arena_t *arena)
query a json object and ensure it is of a specific type
CT_CALLBACKS(kQueryCallbacks, query)
STA_DECL json_t * json_query(json_t *json, const char *query, logger_t *logger, arena_t *arena)
query a json object