summaryrefslogtreecommitdiff
path: root/prism/util/pm_buffer.h
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2024-03-11 12:13:12 -0400
committergit <[email protected]>2024-03-12 03:30:50 +0000
commit21ea290b34e310371b5a8c2569c161a67467981c (patch)
treea894282d4dbc201f6c61ce16ddfe42a076e08709 /prism/util/pm_buffer.h
parentcb4bc4d03ca41bf367d1fe1ae47865a8b80092ed (diff)
[ruby/prism] Static literals inspect
https://github.com/ruby/prism/commit/4913d112da
Diffstat (limited to 'prism/util/pm_buffer.h')
-rw-r--r--prism/util/pm_buffer.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/prism/util/pm_buffer.h b/prism/util/pm_buffer.h
index d8ec8180e7..f80b0e7b82 100644
--- a/prism/util/pm_buffer.h
+++ b/prism/util/pm_buffer.h
@@ -189,6 +189,26 @@ void pm_buffer_clear(pm_buffer_t *buffer);
void pm_buffer_rstrip(pm_buffer_t *buffer);
/**
+ * Checks if the buffer includes the given value.
+ *
+ * @param buffer The buffer to check.
+ * @param value The value to check for.
+ * @returns The index of the first occurrence of the value in the buffer, or -1
+ * if the value is not found.
+ */
+ssize_t pm_buffer_index(const pm_buffer_t *buffer, char value);
+
+/**
+ * Insert the given string into the buffer at the given index.
+ *
+ * @param buffer The buffer to insert into.
+ * @param index The index to insert at.
+ * @param value The string to insert.
+ * @param length The length of the string to insert.
+ */
+void pm_buffer_insert(pm_buffer_t *buffer, size_t index, const char *value, size_t length);
+
+/**
* Free the memory associated with the buffer.
*
* @param buffer The buffer to free.