Skip to content

Commit 529652b

Browse files
committed
Add \memberof annotations
1 parent acc0b79 commit 529652b

File tree

9 files changed

+64
-3
lines changed

9 files changed

+64
-3
lines changed

include/prism.h

+20-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
* The prism version and the serialization format.
4444
*
4545
* @returns The prism version as a constant string.
46+
* \public \memberof pm_parser
4647
*/
4748
PRISM_EXPORTED_FUNCTION const char * pm_version(void);
4849

@@ -53,6 +54,7 @@ PRISM_EXPORTED_FUNCTION const char * pm_version(void);
5354
* @param source The source to parse.
5455
* @param size The size of the source.
5556
* @param options The optional options to use when parsing.
57+
* \public \memberof pm_parser
5658
*/
5759
PRISM_EXPORTED_FUNCTION void pm_parser_init(pm_parser_t *parser, const uint8_t *source, size_t size, const pm_options_t *options);
5860

@@ -62,13 +64,15 @@ PRISM_EXPORTED_FUNCTION void pm_parser_init(pm_parser_t *parser, const uint8_t *
6264
*
6365
* @param parser The parser to register the callback with.
6466
* @param callback The callback to register.
67+
* \public \memberof pm_parser
6568
*/
6669
PRISM_EXPORTED_FUNCTION void pm_parser_register_encoding_changed_callback(pm_parser_t *parser, pm_encoding_changed_callback_t callback);
6770

6871
/**
6972
* Free any memory associated with the given parser.
7073
*
7174
* @param parser The parser to free.
75+
* \public \memberof pm_parser
7276
*/
7377
PRISM_EXPORTED_FUNCTION void pm_parser_free(pm_parser_t *parser);
7478

@@ -77,13 +81,15 @@ PRISM_EXPORTED_FUNCTION void pm_parser_free(pm_parser_t *parser);
7781
*
7882
* @param parser The parser to use.
7983
* @return The AST representing the source.
84+
* \public \memberof pm_parser
8085
*/
8186
PRISM_EXPORTED_FUNCTION pm_node_t * pm_parse(pm_parser_t *parser);
8287

8388
/**
84-
* This function is used in pm_parse_stream to retrieve a line of input from a
89+
* This function is used in pm_parse_stream() to retrieve a line of input from a
8590
* stream. It closely mirrors that of fgets so that fgets can be used as the
8691
* default implementation.
92+
* \public \memberof pm_parser
8793
*/
8894
typedef char * (pm_parse_stream_fgets_t)(char *string, int size, void *stream);
8995

@@ -96,6 +102,7 @@ typedef char * (pm_parse_stream_fgets_t)(char *string, int size, void *stream);
96102
* @param fgets The function to use to read from the stream.
97103
* @param options The optional options to use when parsing.
98104
* @return The AST representing the source.
105+
* \public \memberof pm_parser
99106
*/
100107
PRISM_EXPORTED_FUNCTION pm_node_t * pm_parse_stream(pm_parser_t *parser, pm_buffer_t *buffer, void *stream, pm_parse_stream_fgets_t *fgets, const pm_options_t *options);
101108

@@ -112,6 +119,7 @@ PRISM_EXPORTED_FUNCTION pm_node_t * pm_parse_stream(pm_parser_t *parser, pm_buff
112119
* @param stream The stream to parse.
113120
* @param fgets The function to use to read from the stream.
114121
* @param data The optional data to pass to the parser.
122+
* \public \memberof pm_buffer_t
115123
*/
116124
PRISM_EXPORTED_FUNCTION void pm_serialize_parse_stream(pm_buffer_t *buffer, void *stream, pm_parse_stream_fgets_t *fgets, const char *data);
117125

@@ -121,6 +129,7 @@ PRISM_EXPORTED_FUNCTION void pm_serialize_parse_stream(pm_buffer_t *buffer, void
121129
* @param parser The parser to serialize.
122130
* @param list The list of comments to serialize.
123131
* @param buffer The buffer to serialize to.
132+
* \public \memberof pm_buffer_t
124133
*/
125134
void pm_serialize_comment_list(pm_parser_t *parser, pm_list_t *list, pm_buffer_t *buffer);
126135

@@ -129,6 +138,7 @@ void pm_serialize_comment_list(pm_parser_t *parser, pm_list_t *list, pm_buffer_t
129138
*
130139
* @param encoding The encoding to serialize.
131140
* @param buffer The buffer to serialize to.
141+
* \public \memberof pm_buffer_t
132142
*/
133143
void pm_serialize_encoding(const pm_encoding_t *encoding, pm_buffer_t *buffer);
134144

@@ -138,6 +148,7 @@ void pm_serialize_encoding(const pm_encoding_t *encoding, pm_buffer_t *buffer);
138148
* @param parser The parser to serialize.
139149
* @param node The node to serialize.
140150
* @param buffer The buffer to serialize to.
151+
* \public \memberof pm_buffer_t
141152
*/
142153
void pm_serialize_content(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer);
143154

@@ -147,6 +158,7 @@ void pm_serialize_content(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buf
147158
* @param parser The parser to serialize.
148159
* @param node The node to serialize.
149160
* @param buffer The buffer to serialize to.
161+
* \public \memberof pm_buffer_t
150162
*/
151163
PRISM_EXPORTED_FUNCTION void pm_serialize(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer);
152164

@@ -157,6 +169,7 @@ PRISM_EXPORTED_FUNCTION void pm_serialize(pm_parser_t *parser, pm_node_t *node,
157169
* @param source The source to parse.
158170
* @param size The size of the source.
159171
* @param data The optional data to pass to the parser.
172+
* \public \memberof pm_buffer_t
160173
*/
161174
PRISM_EXPORTED_FUNCTION void pm_serialize_parse(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data);
162175

@@ -167,6 +180,7 @@ PRISM_EXPORTED_FUNCTION void pm_serialize_parse(pm_buffer_t *buffer, const uint8
167180
* @param source The source to parse.
168181
* @param size The size of the source.
169182
* @param data The optional data to pass to the parser.
183+
* \public \memberof pm_buffer_t
170184
*/
171185
PRISM_EXPORTED_FUNCTION void pm_serialize_parse_comments(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data);
172186

@@ -177,6 +191,7 @@ PRISM_EXPORTED_FUNCTION void pm_serialize_parse_comments(pm_buffer_t *buffer, co
177191
* @param size The size of the source.
178192
* @param buffer The buffer to serialize to.
179193
* @param data The optional data to pass to the lexer.
194+
* \public \memberof pm_buffer_t
180195
*/
181196
PRISM_EXPORTED_FUNCTION void pm_serialize_lex(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data);
182197

@@ -188,6 +203,7 @@ PRISM_EXPORTED_FUNCTION void pm_serialize_lex(pm_buffer_t *buffer, const uint8_t
188203
* @param source The source to parse.
189204
* @param size The size of the source.
190205
* @param data The optional data to pass to the parser.
206+
* \public \memberof pm_buffer_t
191207
*/
192208
PRISM_EXPORTED_FUNCTION void pm_serialize_parse_lex(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data);
193209

@@ -200,6 +216,7 @@ PRISM_EXPORTED_FUNCTION void pm_serialize_parse_lex(pm_buffer_t *buffer, const u
200216
* @param size The size of the source.
201217
* @param data The optional data to pass to the parser.
202218
* @return True if the source parses without errors or warnings.
219+
* \public \static \memberof pm_parser
203220
*/
204221
PRISM_EXPORTED_FUNCTION bool pm_parse_success_p(const uint8_t *source, size_t size, const char *data);
205222

@@ -208,6 +225,7 @@ PRISM_EXPORTED_FUNCTION bool pm_parse_success_p(const uint8_t *source, size_t si
208225
*
209226
* @param token_type The token type to convert to a string.
210227
* @return A string representation of the given token type.
228+
* \public \memberof pm_parser
211229
*/
212230
PRISM_EXPORTED_FUNCTION const char * pm_token_type_name(pm_token_type_t token_type);
213231

@@ -229,6 +247,7 @@ const char * pm_token_type_human(pm_token_type_t token_type);
229247
* @param buffer The buffer to serialize to.
230248
* @param parser The parser that parsed the node.
231249
* @param node The node to serialize.
250+
* \public \memberof pm_buffer_t
232251
*/
233252
PRISM_EXPORTED_FUNCTION void pm_dump_json(pm_buffer_t *buffer, const pm_parser_t *parser, const pm_node_t *node);
234253

include/prism/node.h

+8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
*
2323
* @param list The list to append to.
2424
* @param node The node to append.
25+
* \private \memberof pm_node_list
2526
*/
2627
void pm_node_list_append(pm_node_list_t *list, pm_node_t *node);
2728

@@ -30,6 +31,7 @@ void pm_node_list_append(pm_node_list_t *list, pm_node_t *node);
3031
*
3132
* @param list The list to prepend to.
3233
* @param node The node to prepend.
34+
* \private \memberof pm_node_list
3335
*/
3436
void pm_node_list_prepend(pm_node_list_t *list, pm_node_t *node);
3537

@@ -38,13 +40,15 @@ void pm_node_list_prepend(pm_node_list_t *list, pm_node_t *node);
3840
*
3941
* @param list The list to concatenate onto.
4042
* @param other The list to concatenate.
43+
* \private \memberof pm_node_list
4144
*/
4245
void pm_node_list_concat(pm_node_list_t *list, pm_node_list_t *other);
4346

4447
/**
4548
* Free the internal memory associated with the given node list.
4649
*
4750
* @param list The list to free.
51+
* \private \memberof pm_node_list
4852
*/
4953
void pm_node_list_free(pm_node_list_t *list);
5054

@@ -53,6 +57,7 @@ void pm_node_list_free(pm_node_list_t *list);
5357
*
5458
* @param parser The parser that owns the node.
5559
* @param node The node to deallocate.
60+
* \public \memberof pm_node
5661
*/
5762
PRISM_EXPORTED_FUNCTION void pm_node_destroy(pm_parser_t *parser, struct pm_node *node);
5863

@@ -61,6 +66,7 @@ PRISM_EXPORTED_FUNCTION void pm_node_destroy(pm_parser_t *parser, struct pm_node
6166
*
6267
* @param node_type The node type to convert to a string.
6368
* @return A string representation of the given node type.
69+
* \public \memberof pm_node
6470
*/
6571
PRISM_EXPORTED_FUNCTION const char * pm_node_type_to_str(pm_node_type_t node_type);
6672

@@ -112,6 +118,7 @@ PRISM_EXPORTED_FUNCTION const char * pm_node_type_to_str(pm_node_type_t node_typ
112118
* @param node The root node to start visiting from.
113119
* @param visitor The callback to call for each node in the subtree.
114120
* @param data An opaque pointer that is passed to the visitor callback.
121+
* \public \memberof pm_node
115122
*/
116123
PRISM_EXPORTED_FUNCTION void pm_visit_node(const pm_node_t *node, bool (*visitor)(const pm_node_t *node, void *data), void *data);
117124

@@ -123,6 +130,7 @@ PRISM_EXPORTED_FUNCTION void pm_visit_node(const pm_node_t *node, bool (*visitor
123130
* @param node The node to visit the children of.
124131
* @param visitor The callback to call for each child node.
125132
* @param data An opaque pointer that is passed to the visitor callback.
133+
* \public \memberof pm_node
126134
*/
127135
PRISM_EXPORTED_FUNCTION void pm_visit_child_nodes(const pm_node_t *node, bool (*visitor)(const pm_node_t *node, void *data), void *data);
128136

include/prism/options.h

+13
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ static const uint8_t PM_OPTIONS_COMMAND_LINE_X = 0x20;
185185
* @param shebang_callback The shebang callback to set.
186186
* @param shebang_callback_data Any additional data that should be passed along
187187
* to the callback.
188+
* \public \memberof pm_options
188189
*/
189190
PRISM_EXPORTED_FUNCTION void pm_options_shebang_callback_set(pm_options_t *options, pm_options_shebang_callback_t shebang_callback, void *shebang_callback_data);
190191

@@ -193,6 +194,7 @@ PRISM_EXPORTED_FUNCTION void pm_options_shebang_callback_set(pm_options_t *optio
193194
*
194195
* @param options The options struct to set the filepath on.
195196
* @param filepath The filepath to set.
197+
* \public \memberof pm_options
196198
*/
197199
PRISM_EXPORTED_FUNCTION void pm_options_filepath_set(pm_options_t *options, const char *filepath);
198200

@@ -201,6 +203,7 @@ PRISM_EXPORTED_FUNCTION void pm_options_filepath_set(pm_options_t *options, cons
201203
*
202204
* @param options The options struct to set the line on.
203205
* @param line The line to set.
206+
* \public \memberof pm_options
204207
*/
205208
PRISM_EXPORTED_FUNCTION void pm_options_line_set(pm_options_t *options, int32_t line);
206209

@@ -209,6 +212,7 @@ PRISM_EXPORTED_FUNCTION void pm_options_line_set(pm_options_t *options, int32_t
209212
*
210213
* @param options The options struct to set the encoding on.
211214
* @param encoding The encoding to set.
215+
* \public \memberof pm_options
212216
*/
213217
PRISM_EXPORTED_FUNCTION void pm_options_encoding_set(pm_options_t *options, const char *encoding);
214218

@@ -217,6 +221,7 @@ PRISM_EXPORTED_FUNCTION void pm_options_encoding_set(pm_options_t *options, cons
217221
*
218222
* @param options The options struct to set the encoding_locked value on.
219223
* @param encoding_locked The encoding_locked value to set.
224+
* \public \memberof pm_options
220225
*/
221226
PRISM_EXPORTED_FUNCTION void pm_options_encoding_locked_set(pm_options_t *options, bool encoding_locked);
222227

@@ -225,6 +230,7 @@ PRISM_EXPORTED_FUNCTION void pm_options_encoding_locked_set(pm_options_t *option
225230
*
226231
* @param options The options struct to set the frozen string literal value on.
227232
* @param frozen_string_literal The frozen string literal value to set.
233+
* \public \memberof pm_options
228234
*/
229235
PRISM_EXPORTED_FUNCTION void pm_options_frozen_string_literal_set(pm_options_t *options, bool frozen_string_literal);
230236

@@ -233,6 +239,7 @@ PRISM_EXPORTED_FUNCTION void pm_options_frozen_string_literal_set(pm_options_t *
233239
*
234240
* @param options The options struct to set the command line option on.
235241
* @param command_line The command_line value to set.
242+
* \public \memberof pm_options
236243
*/
237244
PRISM_EXPORTED_FUNCTION void pm_options_command_line_set(pm_options_t *options, uint8_t command_line);
238245

@@ -245,6 +252,7 @@ PRISM_EXPORTED_FUNCTION void pm_options_command_line_set(pm_options_t *options,
245252
* @param version The version to set.
246253
* @param length The length of the version string.
247254
* @return Whether or not the version was parsed successfully.
255+
* \public \memberof pm_options
248256
*/
249257
PRISM_EXPORTED_FUNCTION bool pm_options_version_set(pm_options_t *options, const char *version, size_t length);
250258

@@ -254,6 +262,7 @@ PRISM_EXPORTED_FUNCTION bool pm_options_version_set(pm_options_t *options, const
254262
* @param options The options struct to initialize the scopes array on.
255263
* @param scopes_count The number of scopes to allocate.
256264
* @return Whether or not the scopes array was initialized successfully.
265+
* \public \memberof pm_options
257266
*/
258267
PRISM_EXPORTED_FUNCTION bool pm_options_scopes_init(pm_options_t *options, size_t scopes_count);
259268

@@ -263,6 +272,7 @@ PRISM_EXPORTED_FUNCTION bool pm_options_scopes_init(pm_options_t *options, size_
263272
* @param options The options struct to get the scope from.
264273
* @param index The index of the scope to get.
265274
* @return A pointer to the scope at the given index.
275+
* \public \memberof pm_options
266276
*/
267277
PRISM_EXPORTED_FUNCTION const pm_options_scope_t * pm_options_scope_get(const pm_options_t *options, size_t index);
268278

@@ -273,6 +283,7 @@ PRISM_EXPORTED_FUNCTION const pm_options_scope_t * pm_options_scope_get(const pm
273283
* @param scope The scope struct to initialize.
274284
* @param locals_count The number of locals to allocate.
275285
* @return Whether or not the scope was initialized successfully.
286+
* \public \memberof pm_options
276287
*/
277288
PRISM_EXPORTED_FUNCTION bool pm_options_scope_init(pm_options_scope_t *scope, size_t locals_count);
278289

@@ -282,13 +293,15 @@ PRISM_EXPORTED_FUNCTION bool pm_options_scope_init(pm_options_scope_t *scope, si
282293
* @param scope The scope struct to get the local from.
283294
* @param index The index of the local to get.
284295
* @return A pointer to the local at the given index.
296+
* \public \memberof pm_options
285297
*/
286298
PRISM_EXPORTED_FUNCTION const pm_string_t * pm_options_scope_local_get(const pm_options_scope_t *scope, size_t index);
287299

288300
/**
289301
* Free the internal memory associated with the options.
290302
*
291303
* @param options The options struct whose internal memory should be freed.
304+
* \public \memberof pm_options
292305
*/
293306
PRISM_EXPORTED_FUNCTION void pm_options_free(pm_options_t *options);
294307

include/prism/prettyprint.h

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void pm_prettyprint(void);
2626
* @param output_buffer The buffer to write the pretty-printed AST to.
2727
* @param parser The parser that parsed the AST.
2828
* @param node The root node of the AST to pretty-print.
29+
* \public \memberof pm_buffer_t
2930
*/
3031
PRISM_EXPORTED_FUNCTION void pm_prettyprint(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm_node_t *node);
3132

include/prism/regexp.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
#include <string.h>
1818

1919
/**
20-
* This callback is called when a named capture group is found.
20+
* This callback is called by pm_regexp_parse() when a named capture group is found.
21+
* \public \memberof pm_parser
2122
*/
2223
typedef void (*pm_regexp_name_callback_t)(const pm_string_t *name, void *data);
2324

2425
/**
25-
* This callback is called when a parse error is found.
26+
* This callback is called by pm_regexp_parse() when a parse error is found.
27+
* \public \memberof pm_parser
2628
*/
2729
typedef void (*pm_regexp_error_callback_t)(const uint8_t *start, const uint8_t *end, const char *message, void *data);
2830

@@ -37,6 +39,7 @@ typedef void (*pm_regexp_error_callback_t)(const uint8_t *start, const uint8_t *
3739
* @param name_data The optional data to pass to the name callback.
3840
* @param error_callback The callback to call when a parse error is found.
3941
* @param error_data The data to pass to the error callback.
42+
* \public \memberof pm_parser
4043
*/
4144
PRISM_EXPORTED_FUNCTION void pm_regexp_parse(pm_parser_t *parser, const uint8_t *source, size_t size, bool extended_mode, pm_regexp_name_callback_t name_callback, void *name_data, pm_regexp_error_callback_t error_callback, void *error_data);
4245

include/prism/util/pm_buffer.h

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ typedef struct {
3434
* Return the size of the pm_buffer_t struct.
3535
*
3636
* @returns The size of the pm_buffer_t struct.
37+
* \public \static \memberof pm_buffer_t
3738
*/
3839
PRISM_EXPORTED_FUNCTION size_t pm_buffer_sizeof(void);
3940

@@ -51,6 +52,7 @@ bool pm_buffer_init_capacity(pm_buffer_t *buffer, size_t capacity);
5152
*
5253
* @param buffer The buffer to initialize.
5354
* @returns True if the buffer was initialized successfully, false otherwise.
55+
* \public \memberof pm_buffer_t
5456
*/
5557
PRISM_EXPORTED_FUNCTION bool pm_buffer_init(pm_buffer_t *buffer);
5658

@@ -59,6 +61,7 @@ PRISM_EXPORTED_FUNCTION bool pm_buffer_init(pm_buffer_t *buffer);
5961
*
6062
* @param buffer The buffer to get the value of.
6163
* @returns The value of the buffer.
64+
* \public \memberof pm_buffer_t
6265
*/
6366
PRISM_EXPORTED_FUNCTION char * pm_buffer_value(const pm_buffer_t *buffer);
6467

@@ -67,6 +70,7 @@ PRISM_EXPORTED_FUNCTION char * pm_buffer_value(const pm_buffer_t *buffer);
6770
*
6871
* @param buffer The buffer to get the length of.
6972
* @returns The length of the buffer.
73+
* \public \memberof pm_buffer_t
7074
*/
7175
PRISM_EXPORTED_FUNCTION size_t pm_buffer_length(const pm_buffer_t *buffer);
7276

@@ -212,6 +216,7 @@ void pm_buffer_insert(pm_buffer_t *buffer, size_t index, const char *value, size
212216
* Free the memory associated with the buffer.
213217
*
214218
* @param buffer The buffer to free.
219+
* \public \memberof pm_buffer_t
215220
*/
216221
PRISM_EXPORTED_FUNCTION void pm_buffer_free(pm_buffer_t *buffer);
217222

0 commit comments

Comments
 (0)