Ruby 4.1.0dev (2026-10-27 revision db563a357875d4efbadec58b0fd8695ac9a82f42)
comments.h
Go to the documentation of this file.
1
6#ifndef PRISM_COMMENTS_H
7#define PRISM_COMMENTS_H
8
12
13#include "prism/ast.h"
14
15#include <stddef.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
22typedef enum {
23 PM_COMMENT_INLINE,
24 PM_COMMENT_EMBDOC
26
29
34typedef struct {
36 uint32_t index;
37
39 uint32_t length;
41
49
58
67
68#ifdef __cplusplus
69}
70#endif
71
72#endif
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.
Definition parser.c:190
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.
Definition parser.c:198
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...
Definition parser.c:206
pm_comment_type_t
This is the type of a comment that we've found while parsing.
Definition comments.h:22
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
Definition exported.h:20
#define PRISM_NONNULL(...)
Mark the parameters of a function as non-null.
Definition nonnull.h:13
The comments owned by a node, as a slice of the comment attachments of the parser that produced it.
Definition comments.h:34
uint32_t index
The index of the first attachment owned by the node.
Definition comments.h:36
uint32_t length
The number of attachments owned by the node.
Definition comments.h:39
This struct represents a slice in the source code, defined by an offset and a length.
Definition ast.h:579