1#ifndef PRISM_INTERNAL_LINE_OFFSET_LIST_H
2#define PRISM_INTERNAL_LINE_OFFSET_LIST_H
6#include "prism/internal/assert.h"
23pm_line_offset_list_line_number(
size_t index, int32_t start_line) {
24 uint32_t line = (uint32_t) index + (uint32_t) start_line;
25 if (line <= INT32_MAX)
return (int32_t) line;
27 return INT32_MIN + (int32_t) (line - ((uint32_t) INT32_MAX + 1));
35 PRISM_ASSERT(list->
size == 0 || cursor > list->
offsets[list->
size - 1]);
40 pm_line_offset_list_append_slow(arena, list, cursor);
48int32_t pm_line_offset_list_line(
const pm_line_offset_list_t *list, uint32_t cursor, int32_t start_line);
A bump allocator for the prism parser.
#define PRISM_FORCE_INLINE
Force a function to be inlined at every call site.
A list of byte offsets of newlines in a string.
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.