Prism Ruby parser
Loading...
Searching...
No Matches
line_offset_list.h
Go to the documentation of this file.
1
14#ifndef PRISM_LINE_OFFSET_LIST_H
15#define PRISM_LINE_OFFSET_LIST_H
16
17#include "prism/compiler/exported.h"
18#include "prism/compiler/nonnull.h"
19
20#include <stddef.h>
21#include <stdint.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
31typedef struct {
33 size_t size;
34
36 size_t capacity;
37
39 uint32_t *offsets;
41
45typedef struct {
47 int32_t line;
48
50 uint32_t column;
52
63PRISM_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) PRISM_NONNULL(1);
64
65#ifdef __cplusplus
66}
67#endif
68
69#endif
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) PRISM_NONNULL(1)
Returns the line and column of the given offset.
A line and column in a string.
Definition line_offset_list.h:45
uint32_t column
The column in bytes.
Definition line_offset_list.h:50
int32_t line
The line number.
Definition line_offset_list.h:47
A list of offsets of the start of lines in a string.
Definition line_offset_list.h:31
uint32_t * offsets
The list of offsets.
Definition line_offset_list.h:39
size_t size
The number of offsets in the list.
Definition line_offset_list.h:33
size_t capacity
The capacity of the list that has been allocated.
Definition line_offset_list.h:36