Ruby: prism/static_literals.h File Reference

Ruby 3.4.3p32 (2025-04-14 revision d0b7e5b6a04bde21ca483d20a1546b28b401c2d4)

Data Structures | Functions
static_literals.h File Reference

A set of static literal nodes that can be checked for duplicates. More...

`#include "prism/defines.h"`
`#include "prism/ast.h"`
`#include "prism/util/pm_newline_list.h"`
`#include <assert.h>`
`#include <stdbool.h>`

Go to the source code of this file.

## Data Structures
struct | pm_node_hash_t
| An internal hash table for a set of nodes. More...
struct | pm_static_literals_t
| Certain sets of nodes (hash keys and when clauses) check for duplicate nodes to alert the user of potential issues. More...

## Functions
pm_node_t * | pm_static_literals_add (const pm_newline_list_t *newline_list, int32_t start_line, pm_static_literals_t *literals, pm_node_t *node, bool replace)
| Add a node to the set of static literals.
void | pm_static_literals_free (pm_static_literals_t *literals)
| Free the internal memory associated with the given static literals set.
void | pm_static_literal_inspect (pm_buffer_t *buffer, const pm_newline_list_t *newline_list, int32_t start_line, const char *encoding_name, const pm_node_t *node)
| Create a string-based representation of the given static literal.

## Detailed Description

A set of static literal nodes that can be checked for duplicates.

Definition in file static_literals.h.

## Function Documentation

## ◆ pm_static_literal_inspect()

void pm_static_literal_inspect | ( | pm_buffer_t * | buffer,
|  | const pm_newline_list_t * | newline_list,
|  | int32_t | start_line,
|  | const char * | encoding_name,
|  | const pm_node_t * | node )

Create a string-based representation of the given static literal.

Parameters

  buffer | The buffer to write the string to.
  newline_list | The list of newline offsets to use to calculate lines.
  start_line | The line number that the parser starts on.
  encoding_name | The name of the encoding of the source being parsed.
  node | The node to create a string representation of.

Definition at line 607 of file static_literals.c.

## ◆ pm_static_literals_add()

pm_node_t * pm_static_literals_add | ( | const pm_newline_list_t * | newline_list,
|  | int32_t | start_line,
|  | pm_static_literals_t * | literals,
|  | pm_node_t * | node,
|  | bool | replace )

Add a node to the set of static literals.

Parameters

  newline_list | The list of newline offsets to use to calculate lines.
  start_line | The line number that the parser starts on.
  literals | The set of static literals to add the node to.
  node | The node to add to the set.
  replace | Whether to replace the previous node if one already exists.

Returns
  A pointer to the node that is being overwritten, if there is one.

Definition at line 356 of file static_literals.c.

## ◆ pm_static_literals_free()

void pm_static_literals_free | ( | pm_static_literals_t * | literals | ) |

Free the internal memory associated with the given static literals set.

Parameters

  literals | The set of static literals to free.

Definition at line 462 of file static_literals.c.