Skip to content

Commit

Permalink
Add links to code refs in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
amomchilov committed Aug 30, 2024
1 parent acc0b79 commit 0f10178
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions include/prism.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,11 @@ PRISM_EXPORTED_FUNCTION void pm_dump_json(pm_buffer_t *buffer, const pm_parser_t
* In order to parse Ruby code, the structures and functions that you're going
* to want to use and be aware of are:
*
* * `pm_parser_t` - the main parser structure
* * `pm_parser_init` - initialize a parser
* * `pm_parse` - parse and return the root node
* * `pm_node_destroy` - deallocate the root node returned by `pm_parse`
* * `pm_parser_free` - free the internal memory of the parser
* * <code>#pm_parser_t</code> - the main parser structure
* * `pm_parser_init()` - initialize a parser
* * `pm_parse()` - parse and return the root node
* * `pm_node_destroy()` - deallocate the root node returned by `pm_parse()`
* * `pm_parser_free()` - free the internal memory of the parser
*
* Putting all of this together would look something like:
*
Expand All @@ -280,9 +280,9 @@ PRISM_EXPORTED_FUNCTION void pm_dump_json(pm_buffer_t *buffer, const pm_parser_t
* }
* ```
*
* All of the nodes "inherit" from `pm_node_t` by embedding those structures as
* All of the nodes "inherit" from <code>#pm_parser_t</code> by embedding those structures as
* their first member. This means you can downcast and upcast any node in the
* tree to a `pm_node_t`.
* tree to a \ref pm_parser_t "<code>pm_parser_t *</code>".
*
* @section serializing Serializing
*
Expand All @@ -292,10 +292,10 @@ PRISM_EXPORTED_FUNCTION void pm_dump_json(pm_buffer_t *buffer, const pm_parser_t
* parse Ruby code. The structures and functions that you're going to want to
* use and be aware of are:
*
* * `pm_buffer_t` - a small buffer object that will hold the serialized AST
* * `pm_buffer_free` - free the memory associated with the buffer
* * `pm_serialize` - serialize the AST into a buffer
* * `pm_serialize_parse` - parse and serialize the AST into a buffer
* * #pm_buffer_t - a small buffer object that will hold the serialized AST
* * #pm_buffer_free() - free the memory associated with the buffer
* * #pm_serialize() - serialize the AST into a buffer
* * #pm_serialize_parse() - parse and serialize the AST into a buffer
*
* Putting all of this together would look something like:
*
Expand All @@ -313,7 +313,7 @@ PRISM_EXPORTED_FUNCTION void pm_dump_json(pm_buffer_t *buffer, const pm_parser_t
* @section inspecting Inspecting
*
* Prism provides the ability to inspect the AST by pretty-printing nodes. You
* can do this with the `pm_prettyprint` function, which you would use like:
* can do this with the pm_prettyprint() function, which you would use like:
*
* ```c
* void prettyprint(const uint8_t *source, size_t length) {
Expand Down
8 changes: 4 additions & 4 deletions include/prism/util/pm_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ typedef struct {
/** The length of the string in bytes of memory. */
size_t length;

/** The type of the string. This field determines how the string should be freed. */
enum {
/** The type of the string, which determines how the string should be freed. */
enum pm_string_type {
/** This string is a constant string, and should not be freed. */
PM_STRING_CONSTANT,

/** This is a slice of another string, and should not be freed. */
PM_STRING_SHARED,

/** This string owns its memory, and should be freed using `pm_string_free`. */
/** This string owns its memory, and should be freed using \ref pm_string_free "<code>pm_string_free()</code>". */
PM_STRING_OWNED,

#ifdef PRISM_HAS_MMAP
/** This string is a memory-mapped file, and should be freed using `pm_string_free`. */
/** This string is a memory-mapped file, and should be freed using \ref pm_string_free "<code>pm_string_free()</code>". */
PM_STRING_MAPPED
#endif
} type;
Expand Down

0 comments on commit 0f10178

Please sign in to comment.