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