14#ifndef PRISM_LINE_OFFSET_LIST_H
15#define PRISM_LINE_OFFSET_LIST_H
A bump allocator for the prism parser.
static PRISM_FORCE_INLINE void pm_line_offset_list_append(pm_arena_t *arena, pm_line_offset_list_t *list, uint32_t cursor)
Append a new offset to the list.
void pm_line_offset_list_clear(pm_line_offset_list_t *list)
Clear out the offsets that have been appended to the list.
int32_t pm_line_offset_list_line(const pm_line_offset_list_t *list, uint32_t cursor, int32_t start_line)
Returns the line of the given offset.
void pm_line_offset_list_init(pm_arena_t *arena, pm_line_offset_list_t *list, size_t capacity)
Initialize a new line offset list with the given capacity.
PRISM_EXPORTED_FUNCTION pm_line_column_t pm_line_offset_list_line_column(const pm_line_offset_list_t *list, uint32_t cursor, int32_t start_line)
Returns the line and column of the given offset.
void pm_line_offset_list_append_slow(pm_arena_t *arena, pm_line_offset_list_t *list, uint32_t cursor)
Append a new offset to the list (slow path with resize).
Macro definitions used throughout the prism library.
#define PRISM_FORCE_INLINE
Force a function to be inlined at every call site.
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
A line and column in a string.
uint32_t column
The column in bytes.
int32_t line
The line number.
A list of offsets of the start of lines in a string.
uint32_t * offsets
The list of offsets.
size_t size
The number of offsets in the list.
size_t capacity
The capacity of the list that has been allocated.