5 #include <ctu_scan_api.h>
typedefCT_BEGIN_API struct node_t node_t
#define CT_PUREFN
mark a function as pure, always returns the same value for the same arguments
#define CT_NODISCARD
mark a function as returning a value that must be used
#define IN_NOTNULL
annotate a parameter as not being null
#define IN_STRING
annotate a parameter as being a null terminated string
CT_NODISCARD CT_SCAN_API node_t * node_builtin(const char *name, arena_t *arena)
get the builtin node node used for drivers that declare builtin symbols
CT_NODISCARD CT_PUREFN CT_SCAN_API const scan_t * node_get_scan(const node_t *node)
get the associated source file of a node
CT_NODISCARD CT_PUREFN CT_SCAN_API bool node_is_builtin(const node_t *node)
check if a node is the builtin node
CT_NODISCARD CT_PUREFN CT_SCAN_API where_t node_get_location(const node_t *node)
get the location of a node inside its source file
CT_SCAN_API void node_init(OUT_NOTNULL node_t *node, const scan_t *scan, where_t where)
initialize a source node
CT_SCAN_API const where_t kNowhere
nowhere in a source file
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
a position in a source file
const scan_t * scan
the scanner that this node is in
where_t where
the location of this node
a location inside a scanner locations are inclusive and 0-based