Skip to content

Commit c6ddd5d

Browse files
authored
Merge pull request #3641 from ruby/memberof
Add `\memberof` annotations
2 parents acdfd41 + d1d2161 commit c6ddd5d

File tree

7 files changed

+75
-3
lines changed

7 files changed

+75
-3
lines changed

include/prism.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ PRISM_EXPORTED_FUNCTION const char * pm_version(void);
5656
* @param size The size of the source.
5757
* @param options The optional options to use when parsing. These options must
5858
* live for the whole lifetime of this parser.
59+
*
60+
* \public \memberof pm_parser
5961
*/
6062
PRISM_EXPORTED_FUNCTION void pm_parser_init(pm_parser_t *parser, const uint8_t *source, size_t size, const pm_options_t *options);
6163

@@ -65,6 +67,8 @@ PRISM_EXPORTED_FUNCTION void pm_parser_init(pm_parser_t *parser, const uint8_t *
6567
*
6668
* @param parser The parser to register the callback with.
6769
* @param callback The callback to register.
70+
*
71+
* \public \memberof pm_parser
6872
*/
6973
PRISM_EXPORTED_FUNCTION void pm_parser_register_encoding_changed_callback(pm_parser_t *parser, pm_encoding_changed_callback_t callback);
7074

@@ -75,6 +79,8 @@ PRISM_EXPORTED_FUNCTION void pm_parser_register_encoding_changed_callback(pm_par
7579
* parser.
7680
*
7781
* @param parser The parser to free.
82+
*
83+
* \public \memberof pm_parser
7884
*/
7985
PRISM_EXPORTED_FUNCTION void pm_parser_free(pm_parser_t *parser);
8086

@@ -83,11 +89,13 @@ PRISM_EXPORTED_FUNCTION void pm_parser_free(pm_parser_t *parser);
8389
*
8490
* @param parser The parser to use.
8591
* @return The AST representing the source.
92+
*
93+
* \public \memberof pm_parser
8694
*/
8795
PRISM_EXPORTED_FUNCTION pm_node_t * pm_parse(pm_parser_t *parser);
8896

8997
/**
90-
* This function is used in pm_parse_stream to retrieve a line of input from a
98+
* This function is used in pm_parse_stream() to retrieve a line of input from a
9199
* stream. It closely mirrors that of fgets so that fgets can be used as the
92100
* default implementation.
93101
*/
@@ -110,6 +118,8 @@ typedef int (pm_parse_stream_feof_t)(void *stream);
110118
* @param stream_feof The function to use to determine if the stream has hit eof.
111119
* @param options The optional options to use when parsing.
112120
* @return The AST representing the source.
121+
*
122+
* \public \memberof pm_parser
113123
*/
114124
PRISM_EXPORTED_FUNCTION pm_node_t * pm_parse_stream(pm_parser_t *parser, pm_buffer_t *buffer, void *stream, pm_parse_stream_fgets_t *stream_fgets, pm_parse_stream_feof_t *stream_feof, const pm_options_t *options);
115125

include/prism/options.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ static const uint8_t PM_OPTIONS_COMMAND_LINE_X = 0x20;
237237
* @param shebang_callback The shebang callback to set.
238238
* @param shebang_callback_data Any additional data that should be passed along
239239
* to the callback.
240+
*
241+
* \public \memberof pm_options
240242
*/
241243
PRISM_EXPORTED_FUNCTION void pm_options_shebang_callback_set(pm_options_t *options, pm_options_shebang_callback_t shebang_callback, void *shebang_callback_data);
242244

@@ -245,6 +247,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_shebang_callback_set(pm_options_t *optio
245247
*
246248
* @param options The options struct to set the filepath on.
247249
* @param filepath The filepath to set.
250+
*
251+
* \public \memberof pm_options
248252
*/
249253
PRISM_EXPORTED_FUNCTION void pm_options_filepath_set(pm_options_t *options, const char *filepath);
250254

@@ -253,6 +257,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_filepath_set(pm_options_t *options, cons
253257
*
254258
* @param options The options struct to set the line on.
255259
* @param line The line to set.
260+
*
261+
* \public \memberof pm_options
256262
*/
257263
PRISM_EXPORTED_FUNCTION void pm_options_line_set(pm_options_t *options, int32_t line);
258264

@@ -261,6 +267,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_line_set(pm_options_t *options, int32_t
261267
*
262268
* @param options The options struct to set the encoding on.
263269
* @param encoding The encoding to set.
270+
*
271+
* \public \memberof pm_options
264272
*/
265273
PRISM_EXPORTED_FUNCTION void pm_options_encoding_set(pm_options_t *options, const char *encoding);
266274

@@ -269,6 +277,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_encoding_set(pm_options_t *options, cons
269277
*
270278
* @param options The options struct to set the encoding_locked value on.
271279
* @param encoding_locked The encoding_locked value to set.
280+
*
281+
* \public \memberof pm_options
272282
*/
273283
PRISM_EXPORTED_FUNCTION void pm_options_encoding_locked_set(pm_options_t *options, bool encoding_locked);
274284

@@ -277,6 +287,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_encoding_locked_set(pm_options_t *option
277287
*
278288
* @param options The options struct to set the frozen string literal value on.
279289
* @param frozen_string_literal The frozen string literal value to set.
290+
*
291+
* \public \memberof pm_options
280292
*/
281293
PRISM_EXPORTED_FUNCTION void pm_options_frozen_string_literal_set(pm_options_t *options, bool frozen_string_literal);
282294

@@ -285,6 +297,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_frozen_string_literal_set(pm_options_t *
285297
*
286298
* @param options The options struct to set the command line option on.
287299
* @param command_line The command_line value to set.
300+
*
301+
* \public \memberof pm_options
288302
*/
289303
PRISM_EXPORTED_FUNCTION void pm_options_command_line_set(pm_options_t *options, uint8_t command_line);
290304

@@ -297,6 +311,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_command_line_set(pm_options_t *options,
297311
* @param version The version to set.
298312
* @param length The length of the version string.
299313
* @return Whether or not the version was parsed successfully.
314+
*
315+
* \public \memberof pm_options
300316
*/
301317
PRISM_EXPORTED_FUNCTION bool pm_options_version_set(pm_options_t *options, const char *version, size_t length);
302318

@@ -305,6 +321,8 @@ PRISM_EXPORTED_FUNCTION bool pm_options_version_set(pm_options_t *options, const
305321
*
306322
* @param options The options struct to set the main script value on.
307323
* @param main_script The main script value to set.
324+
*
325+
* \public \memberof pm_options
308326
*/
309327
PRISM_EXPORTED_FUNCTION void pm_options_main_script_set(pm_options_t *options, bool main_script);
310328

@@ -313,6 +331,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_main_script_set(pm_options_t *options, b
313331
*
314332
* @param options The options struct to set the partial script value on.
315333
* @param partial_script The partial script value to set.
334+
*
335+
* \public \memberof pm_options
316336
*/
317337
PRISM_EXPORTED_FUNCTION void pm_options_partial_script_set(pm_options_t *options, bool partial_script);
318338

@@ -321,6 +341,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_partial_script_set(pm_options_t *options
321341
*
322342
* @param options The options struct to set the freeze value on.
323343
* @param freeze The freeze value to set.
344+
*
345+
* \public \memberof pm_options
324346
*/
325347
PRISM_EXPORTED_FUNCTION void pm_options_freeze_set(pm_options_t *options, bool freeze);
326348

@@ -330,6 +352,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_freeze_set(pm_options_t *options, bool f
330352
* @param options The options struct to initialize the scopes array on.
331353
* @param scopes_count The number of scopes to allocate.
332354
* @return Whether or not the scopes array was initialized successfully.
355+
*
356+
* \public \memberof pm_options
333357
*/
334358
PRISM_EXPORTED_FUNCTION bool pm_options_scopes_init(pm_options_t *options, size_t scopes_count);
335359

@@ -339,6 +363,8 @@ PRISM_EXPORTED_FUNCTION bool pm_options_scopes_init(pm_options_t *options, size_
339363
* @param options The options struct to get the scope from.
340364
* @param index The index of the scope to get.
341365
* @return A pointer to the scope at the given index.
366+
*
367+
* \public \memberof pm_options
342368
*/
343369
PRISM_EXPORTED_FUNCTION const pm_options_scope_t * pm_options_scope_get(const pm_options_t *options, size_t index);
344370

@@ -349,6 +375,8 @@ PRISM_EXPORTED_FUNCTION const pm_options_scope_t * pm_options_scope_get(const pm
349375
* @param scope The scope struct to initialize.
350376
* @param locals_count The number of locals to allocate.
351377
* @return Whether or not the scope was initialized successfully.
378+
*
379+
* \public \memberof pm_options
352380
*/
353381
PRISM_EXPORTED_FUNCTION bool pm_options_scope_init(pm_options_scope_t *scope, size_t locals_count);
354382

@@ -358,6 +386,8 @@ PRISM_EXPORTED_FUNCTION bool pm_options_scope_init(pm_options_scope_t *scope, si
358386
* @param scope The scope struct to get the local from.
359387
* @param index The index of the local to get.
360388
* @return A pointer to the local at the given index.
389+
*
390+
* \public \memberof pm_options
361391
*/
362392
PRISM_EXPORTED_FUNCTION const pm_string_t * pm_options_scope_local_get(const pm_options_scope_t *scope, size_t index);
363393

@@ -366,13 +396,17 @@ PRISM_EXPORTED_FUNCTION const pm_string_t * pm_options_scope_local_get(const pm_
366396
*
367397
* @param scope The scope struct to set the forwarding on.
368398
* @param forwarding The forwarding value to set.
399+
*
400+
* \public \memberof pm_options
369401
*/
370402
PRISM_EXPORTED_FUNCTION void pm_options_scope_forwarding_set(pm_options_scope_t *scope, uint8_t forwarding);
371403

372404
/**
373405
* Free the internal memory associated with the options.
374406
*
375407
* @param options The options struct whose internal memory should be freed.
408+
*
409+
* \public \memberof pm_options
376410
*/
377411
PRISM_EXPORTED_FUNCTION void pm_options_free(pm_options_t *options);
378412

include/prism/regexp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
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.
2121
*/
2222
typedef void (*pm_regexp_name_callback_t)(const pm_string_t *name, void *data);
2323

2424
/**
25-
* This callback is called when a parse error is found.
25+
* This callback is called by pm_regexp_parse() when a parse error is found.
2626
*/
2727
typedef void (*pm_regexp_error_callback_t)(const uint8_t *start, const uint8_t *end, const char *message, void *data);
2828

include/prism/util/pm_buffer.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ bool pm_buffer_init_capacity(pm_buffer_t *buffer, size_t capacity);
5151
*
5252
* @param buffer The buffer to initialize.
5353
* @returns True if the buffer was initialized successfully, false otherwise.
54+
*
55+
* \public \memberof pm_buffer_t
5456
*/
5557
PRISM_EXPORTED_FUNCTION bool pm_buffer_init(pm_buffer_t *buffer);
5658

@@ -59,6 +61,8 @@ 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+
*
65+
* \public \memberof pm_buffer_t
6266
*/
6367
PRISM_EXPORTED_FUNCTION char * pm_buffer_value(const pm_buffer_t *buffer);
6468

@@ -67,6 +71,8 @@ PRISM_EXPORTED_FUNCTION char * pm_buffer_value(const pm_buffer_t *buffer);
6771
*
6872
* @param buffer The buffer to get the length of.
6973
* @returns The length of the buffer.
74+
*
75+
* \public \memberof pm_buffer_t
7076
*/
7177
PRISM_EXPORTED_FUNCTION size_t pm_buffer_length(const pm_buffer_t *buffer);
7278

@@ -222,6 +228,8 @@ void pm_buffer_insert(pm_buffer_t *buffer, size_t index, const char *value, size
222228
* Free the memory associated with the buffer.
223229
*
224230
* @param buffer The buffer to free.
231+
*
232+
* \public \memberof pm_buffer_t
225233
*/
226234
PRISM_EXPORTED_FUNCTION void pm_buffer_free(pm_buffer_t *buffer);
227235

include/prism/util/pm_integer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ void pm_integers_reduce(pm_integer_t *numerator, pm_integer_t *denominator);
112112
*
113113
* @param buffer The buffer to append the string to.
114114
* @param integer The integer to convert to a string.
115+
*
116+
* \public \memberof pm_integer_t
115117
*/
116118
PRISM_EXPORTED_FUNCTION void pm_integer_string(pm_buffer_t *buffer, const pm_integer_t *integer);
117119

@@ -120,6 +122,8 @@ PRISM_EXPORTED_FUNCTION void pm_integer_string(pm_buffer_t *buffer, const pm_int
120122
* the integer exceeds the size of a single node in the linked list.
121123
*
122124
* @param integer The integer to free.
125+
*
126+
* \public \memberof pm_integer_t
123127
*/
124128
PRISM_EXPORTED_FUNCTION void pm_integer_free(pm_integer_t *integer);
125129

include/prism/util/pm_list.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ typedef struct {
6868
*
6969
* @param list The list to check.
7070
* @return True if the given list is empty, otherwise false.
71+
*
72+
* \public \memberof pm_list_t
7173
*/
7274
PRISM_EXPORTED_FUNCTION bool pm_list_empty_p(pm_list_t *list);
7375

@@ -76,6 +78,8 @@ PRISM_EXPORTED_FUNCTION bool pm_list_empty_p(pm_list_t *list);
7678
*
7779
* @param list The list to check.
7880
* @return The size of the list.
81+
*
82+
* \public \memberof pm_list_t
7983
*/
8084
PRISM_EXPORTED_FUNCTION size_t pm_list_size(pm_list_t *list);
8185

@@ -91,6 +95,8 @@ void pm_list_append(pm_list_t *list, pm_list_node_t *node);
9195
* Deallocate the internal state of the given list.
9296
*
9397
* @param list The list to free.
98+
*
99+
* \public \memberof pm_list_t
94100
*/
95101
PRISM_EXPORTED_FUNCTION void pm_list_free(pm_list_t *list);
96102

include/prism/util/pm_string.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ typedef enum {
130130
* @param string The string to initialize.
131131
* @param filepath The filepath to read.
132132
* @return The success of the read, indicated by the value of the enum.
133+
*
134+
* \public \memberof pm_string_t
133135
*/
134136
PRISM_EXPORTED_FUNCTION pm_string_init_result_t pm_string_mapped_init(pm_string_t *string, const char *filepath);
135137

@@ -141,6 +143,8 @@ PRISM_EXPORTED_FUNCTION pm_string_init_result_t pm_string_mapped_init(pm_string_
141143
* @param string The string to initialize.
142144
* @param filepath The filepath to read.
143145
* @return The success of the read, indicated by the value of the enum.
146+
*
147+
* \public \memberof pm_string_t
144148
*/
145149
PRISM_EXPORTED_FUNCTION pm_string_init_result_t pm_string_file_init(pm_string_t *string, const char *filepath);
146150

@@ -169,6 +173,8 @@ int pm_string_compare(const pm_string_t *left, const pm_string_t *right);
169173
*
170174
* @param string The string to get the length of.
171175
* @return The length of the string.
176+
*
177+
* \public \memberof pm_string_t
172178
*/
173179
PRISM_EXPORTED_FUNCTION size_t pm_string_length(const pm_string_t *string);
174180

@@ -177,13 +183,17 @@ PRISM_EXPORTED_FUNCTION size_t pm_string_length(const pm_string_t *string);
177183
*
178184
* @param string The string to get the start pointer of.
179185
* @return The start pointer of the string.
186+
*
187+
* \public \memberof pm_string_t
180188
*/
181189
PRISM_EXPORTED_FUNCTION const uint8_t * pm_string_source(const pm_string_t *string);
182190

183191
/**
184192
* Free the associated memory of the given string.
185193
*
186194
* @param string The string to free.
195+
*
196+
* \public \memberof pm_string_t
187197
*/
188198
PRISM_EXPORTED_FUNCTION void pm_string_free(pm_string_t *string);
189199

0 commit comments

Comments
 (0)