Ruby 4.1.0dev (2026-10-27 revision db563a357875d4efbadec58b0fd8695ac9a82f42)
Data Structures | Typedefs | Enumerations | Functions
comments.h File Reference

(db563a357875d4efbadec58b0fd8695ac9a82f42)

Types and functions related to comments found during parsing. More...

#include "prism/compiler/exported.h"
#include "prism/compiler/nodiscard.h"
#include "prism/compiler/nonnull.h"
#include "prism/ast.h"
#include <stddef.h>
Include dependency graph for comments.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pm_comment_range_t
 The comments owned by a node, as a slice of the comment attachments of the parser that produced it. More...
 

Typedefs

typedef struct pm_comment_t pm_comment_t
 An opaque pointer to a comment found while parsing.
 

Enumerations

enum  pm_comment_type_t { PM_COMMENT_INLINE , PM_COMMENT_EMBDOC }
 This is the type of a comment that we've found while parsing. More...
 

Functions

PRISM_EXPORTED_FUNCTION pm_location_t pm_comment_location (const pm_comment_t *comment) PRISM_NONNULL(1)
 Returns the location associated with the given comment.
 
PRISM_EXPORTED_FUNCTION pm_comment_type_t pm_comment_type (const pm_comment_t *comment) PRISM_NONNULL(1)
 Returns the type associated with the given comment.
 
PRISM_EXPORTED_FUNCTION const pm_comment_t * pm_comment_next (const pm_comment_t *comment) PRISM_NONNULL(1)
 Returns the comment that follows the given comment among the comments associated with the parser that found it.
 

Detailed Description

Types and functions related to comments found during parsing.

Definition in file comments.h.

Typedef Documentation

◆ pm_comment_t

typedef struct pm_comment_t pm_comment_t

An opaque pointer to a comment found while parsing.

Definition at line 28 of file comments.h.

Enumeration Type Documentation

◆ pm_comment_type_t

This is the type of a comment that we've found while parsing.

Definition at line 22 of file comments.h.

Function Documentation

◆ pm_comment_location()

PRISM_EXPORTED_FUNCTION pm_location_t pm_comment_location ( const pm_comment_t *  comment)

Returns the location associated with the given comment.

Parameters
commentthe comment whose location we want to get
Returns
the location associated with the given comment

Definition at line 190 of file parser.c.

Referenced by pm_comment_location().

◆ pm_comment_next()

PRISM_EXPORTED_FUNCTION const pm_comment_t * pm_comment_next ( const pm_comment_t *  comment)

Returns the comment that follows the given comment among the comments associated with the parser that found it.

Parameters
commentthe comment whose successor we want to get
Returns
the next comment, or NULL if the given comment is the last one

Returns the comment that follows the given comment among the comments associated with the parser that found it.

Definition at line 206 of file parser.c.

Referenced by pm_comment_next().

◆ pm_comment_type()

PRISM_EXPORTED_FUNCTION pm_comment_type_t pm_comment_type ( const pm_comment_t *  comment)

Returns the type associated with the given comment.

Parameters
commentthe comment whose type we want to get
Returns
the type associated with the given comment. This can either be PM_COMMENT_INLINE or PM_COMMENT_EMBDOC.

Definition at line 198 of file parser.c.

Referenced by pm_comment_type().