|
Prism Ruby parser
|
A data structure that stores a set of strings. More...
#include "prism/compiler/exported.h"#include "prism/compiler/nodiscard.h"#include "prism/compiler/nonnull.h"#include "prism/arena.h"#include <stddef.h>#include <stdint.h>

Go to the source code of this file.
Data Structures | |
| struct | pm_constant_id_list_t |
| A list of constant IDs. More... | |
Typedefs | |
| typedef uint32_t | pm_constant_id_t |
| A constant id is a unique identifier for a constant in the constant pool. | |
| typedef struct pm_constant_t | pm_constant_t |
| A constant in the pool which effectively stores a string. | |
| typedef struct pm_constant_pool_t | pm_constant_pool_t |
| The overall constant pool, which stores constants found while parsing. | |
Functions | |
| PRISM_EXPORTED_FUNCTION const uint8_t * | pm_constant_start (const pm_constant_t *constant) PRISM_NONNULL(1) |
| Return a raw pointer to the start of a constant. | |
| PRISM_EXPORTED_FUNCTION size_t | pm_constant_length (const pm_constant_t *constant) PRISM_NONNULL(1) |
| Return the length of a constant. | |
| PRISM_EXPORTED_FUNCTION void | pm_constant_id_list_init (pm_constant_id_list_t *list) PRISM_NONNULL(1) |
| Initialize a list of constant ids. | |
| PRISM_EXPORTED_FUNCTION void | pm_constant_id_list_append (pm_arena_t *arena, pm_constant_id_list_t *list, pm_constant_id_t id) PRISM_NONNULL(1 |
| Append a constant id to a list of constant ids. | |
A data structure that stores a set of strings.
Each string is assigned a unique id, which can be used to compare strings for equality. This comparison ends up being much faster than strcmp, since it only requires a single integer comparison.
| PRISM_EXPORTED_FUNCTION const uint8_t * pm_constant_start | ( | const pm_constant_t * | constant | ) |
Return a raw pointer to the start of a constant.
| constant | The constant to get the start of. |
| PRISM_EXPORTED_FUNCTION size_t pm_constant_length | ( | const pm_constant_t * | constant | ) |
Return the length of a constant.
| constant | The constant to get the length of. |
| PRISM_EXPORTED_FUNCTION void pm_constant_id_list_init | ( | pm_constant_id_list_t * | list | ) |
Initialize a list of constant ids.
| list | The list to initialize. |
| PRISM_EXPORTED_FUNCTION void pm_constant_id_list_append | ( | pm_arena_t * | arena, |
| pm_constant_id_list_t * | list, | ||
| pm_constant_id_t | id | ||
| ) |
Append a constant id to a list of constant ids.
| arena | The arena to use for allocations. |
| list | The list to append to. |
| id | The constant id to append. |