Ruby  3.4.0dev (2024-12-06 revision 892c46283a5ea4179500d951c9d4866c0051f27b)
Data Structures | Functions
static_literals.h File Reference

(892c46283a5ea4179500d951c9d4866c0051f27b)

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>
Include dependency graph for static_literals.h:
This graph shows which files directly or indirectly include this file:

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_tpm_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. More...
 
void pm_static_literals_free (pm_static_literals_t *literals)
 Free the internal memory associated with the given static literals set. More...
 
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. More...
 

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
bufferThe buffer to write the string to.
newline_listThe list of newline offsets to use to calculate lines.
start_lineThe line number that the parser starts on.
encoding_nameThe name of the encoding of the source being parsed.
nodeThe node to create a string representation of.

Definition at line 613 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_listThe list of newline offsets to use to calculate lines.
start_lineThe line number that the parser starts on.
literalsThe set of static literals to add the node to.
nodeThe node to add to the set.
replaceWhether 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
literalsThe set of static literals to free.

Definition at line 462 of file static_literals.c.