datadog-ruby_core_source 3.4.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.datadog.md +4 -0
  3. data/README.md +8 -5
  4. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ccan/build_assert/build_assert.h +40 -0
  5. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ccan/check_type/check_type.h +63 -0
  6. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ccan/container_of/container_of.h +142 -0
  7. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ccan/list/list.h +791 -0
  8. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ccan/str/str.h +17 -0
  9. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/id.h +352 -0
  10. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/id_table.h +39 -0
  11. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/array.h +152 -0
  12. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/basic_operators.h +65 -0
  13. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/bignum.h +244 -0
  14. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/bits.h +650 -0
  15. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/class.h +283 -0
  16. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/cmdlineopt.h +61 -0
  17. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/compar.h +29 -0
  18. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/compile.h +34 -0
  19. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/compilers.h +107 -0
  20. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/complex.h +29 -0
  21. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/cont.h +35 -0
  22. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/dir.h +16 -0
  23. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/enc.h +19 -0
  24. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/encoding.h +38 -0
  25. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/enum.h +18 -0
  26. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/enumerator.h +21 -0
  27. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/error.h +244 -0
  28. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/eval.h +33 -0
  29. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/file.h +38 -0
  30. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/fixnum.h +185 -0
  31. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/gc.h +333 -0
  32. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/hash.h +193 -0
  33. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/imemo.h +257 -0
  34. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/inits.h +47 -0
  35. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/io.h +143 -0
  36. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/load.h +18 -0
  37. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/loadpath.h +16 -0
  38. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/math.h +23 -0
  39. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/missing.h +19 -0
  40. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/numeric.h +274 -0
  41. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/object.h +63 -0
  42. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/parse.h +131 -0
  43. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/proc.h +30 -0
  44. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/process.h +124 -0
  45. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/ractor.h +10 -0
  46. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/random.h +17 -0
  47. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/range.h +40 -0
  48. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/rational.h +71 -0
  49. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/re.h +28 -0
  50. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/ruby_parser.h +102 -0
  51. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/sanitizers.h +330 -0
  52. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/serial.h +23 -0
  53. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/signal.h +24 -0
  54. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/st.h +11 -0
  55. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/static_assert.h +16 -0
  56. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/string.h +199 -0
  57. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/struct.h +119 -0
  58. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/symbol.h +47 -0
  59. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/thread.h +108 -0
  60. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/time.h +37 -0
  61. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/transcode.h +23 -0
  62. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/util.h +27 -0
  63. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/variable.h +70 -0
  64. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/vm.h +137 -0
  65. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/warnings.h +16 -0
  66. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal.h +108 -0
  67. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/iseq.h +351 -0
  68. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/method.h +258 -0
  69. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/node.h +122 -0
  70. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/parser_st.h +162 -0
  71. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/parser_value.h +106 -0
  72. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/ast.h +7964 -0
  73. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/defines.h +260 -0
  74. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/diagnostic.h +451 -0
  75. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/encoding.h +283 -0
  76. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/extension.h +19 -0
  77. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/node.h +129 -0
  78. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/options.h +442 -0
  79. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/pack.h +163 -0
  80. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/parser.h +933 -0
  81. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/prettyprint.h +34 -0
  82. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/prism.h +383 -0
  83. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/regexp.h +43 -0
  84. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/static_literals.h +121 -0
  85. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_buffer.h +228 -0
  86. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_char.h +204 -0
  87. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_constant_pool.h +218 -0
  88. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_integer.h +126 -0
  89. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_list.h +97 -0
  90. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_memchr.h +29 -0
  91. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_newline_list.h +113 -0
  92. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_string.h +190 -0
  93. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_strncasecmp.h +32 -0
  94. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_strpbrk.h +46 -0
  95. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/version.h +29 -0
  96. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism_compile.h +105 -0
  97. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ractor_core.h +382 -0
  98. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ruby_assert.h +14 -0
  99. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ruby_atomic.h +23 -0
  100. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/rubyparser.h +1380 -0
  101. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/shape.h +234 -0
  102. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/thread_none.h +21 -0
  103. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/thread_pthread.h +167 -0
  104. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/vm_core.h +2235 -0
  105. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/vm_debug.h +124 -0
  106. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/vm_opts.h +67 -0
  107. data/lib/datadog/ruby_core_source/version.rb +1 -1
  108. metadata +105 -2
@@ -0,0 +1,260 @@
1
+ /**
2
+ * @file defines.h
3
+ *
4
+ * Macro definitions used throughout the prism library.
5
+ *
6
+ * This file should be included first by any *.h or *.c in prism for consistency
7
+ * and to ensure that the macros are defined before they are used.
8
+ */
9
+ #ifndef PRISM_DEFINES_H
10
+ #define PRISM_DEFINES_H
11
+
12
+ #include <ctype.h>
13
+ #include <limits.h>
14
+ #include <math.h>
15
+ #include <stdarg.h>
16
+ #include <stddef.h>
17
+ #include <stdint.h>
18
+ #include <stdio.h>
19
+ #include <string.h>
20
+
21
+ /**
22
+ * We want to be able to use the PRI* macros for printing out integers, but on
23
+ * some platforms they aren't included unless this is already defined.
24
+ */
25
+ #define __STDC_FORMAT_MACROS
26
+ // Include sys/types.h before inttypes.h to work around issue with
27
+ // certain versions of GCC and newlib which causes omission of PRIx64
28
+ #include <sys/types.h>
29
+ #include <inttypes.h>
30
+
31
+ /**
32
+ * When we are parsing using recursive descent, we want to protect against
33
+ * malicious payloads that could attempt to crash our parser. We do this by
34
+ * specifying a maximum depth to which we are allowed to recurse.
35
+ */
36
+ #ifndef PRISM_DEPTH_MAXIMUM
37
+ #define PRISM_DEPTH_MAXIMUM 10000
38
+ #endif
39
+
40
+ /**
41
+ * By default, we compile with -fvisibility=hidden. When this is enabled, we
42
+ * need to mark certain functions as being publically-visible. This macro does
43
+ * that in a compiler-agnostic way.
44
+ */
45
+ #ifndef PRISM_EXPORTED_FUNCTION
46
+ # ifdef PRISM_EXPORT_SYMBOLS
47
+ # ifdef _WIN32
48
+ # define PRISM_EXPORTED_FUNCTION __declspec(dllexport) extern
49
+ # else
50
+ # define PRISM_EXPORTED_FUNCTION __attribute__((__visibility__("default"))) extern
51
+ # endif
52
+ # else
53
+ # define PRISM_EXPORTED_FUNCTION
54
+ # endif
55
+ #endif
56
+
57
+ /**
58
+ * Certain compilers support specifying that a function accepts variadic
59
+ * parameters that look like printf format strings to provide a better developer
60
+ * experience when someone is using the function. This macro does that in a
61
+ * compiler-agnostic way.
62
+ */
63
+ #if defined(__GNUC__)
64
+ # if defined(__MINGW_PRINTF_FORMAT)
65
+ # define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((format(__MINGW_PRINTF_FORMAT, string_index, argument_index)))
66
+ # else
67
+ # define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((format(printf, string_index, argument_index)))
68
+ # endif
69
+ #elif defined(__clang__)
70
+ # define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((__format__(__printf__, string_index, argument_index)))
71
+ #else
72
+ # define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index)
73
+ #endif
74
+
75
+ /**
76
+ * GCC will warn if you specify a function or parameter that is unused at
77
+ * runtime. This macro allows you to mark a function or parameter as unused in a
78
+ * compiler-agnostic way.
79
+ */
80
+ #if defined(__GNUC__)
81
+ # define PRISM_ATTRIBUTE_UNUSED __attribute__((unused))
82
+ #else
83
+ # define PRISM_ATTRIBUTE_UNUSED
84
+ #endif
85
+
86
+ /**
87
+ * Old Visual Studio versions do not support the inline keyword, so we need to
88
+ * define it to be __inline.
89
+ */
90
+ #if defined(_MSC_VER) && !defined(inline)
91
+ # define inline __inline
92
+ #endif
93
+
94
+ /**
95
+ * Old Visual Studio versions before 2015 do not implement sprintf, but instead
96
+ * implement _snprintf. We standard that here.
97
+ */
98
+ #if !defined(snprintf) && defined(_MSC_VER) && (_MSC_VER < 1900)
99
+ # define snprintf _snprintf
100
+ #endif
101
+
102
+ /**
103
+ * A simple utility macro to concatenate two tokens together, necessary when one
104
+ * of the tokens is itself a macro.
105
+ */
106
+ #define PM_CONCATENATE(left, right) left ## right
107
+
108
+ /**
109
+ * We want to be able to use static assertions, but they weren't standardized
110
+ * until C11. As such, we polyfill it here by making a hacky typedef that will
111
+ * fail to compile due to a negative array size if the condition is false.
112
+ */
113
+ #if defined(_Static_assert)
114
+ # define PM_STATIC_ASSERT(line, condition, message) _Static_assert(condition, message)
115
+ #else
116
+ # define PM_STATIC_ASSERT(line, condition, message) typedef char PM_CONCATENATE(static_assert_, line)[(condition) ? 1 : -1]
117
+ #endif
118
+
119
+ /**
120
+ * In general, libc for embedded systems does not support memory-mapped files.
121
+ * If the target platform is POSIX or Windows, we can map a file in memory and
122
+ * read it in a more efficient manner.
123
+ */
124
+ #ifdef _WIN32
125
+ # define PRISM_HAS_MMAP
126
+ #else
127
+ # include <unistd.h>
128
+ # ifdef _POSIX_MAPPED_FILES
129
+ # define PRISM_HAS_MMAP
130
+ # endif
131
+ #endif
132
+
133
+ /**
134
+ * If PRISM_HAS_NO_FILESYSTEM is defined, then we want to exclude all filesystem
135
+ * related code from the library. All filesystem related code should be guarded
136
+ * by PRISM_HAS_FILESYSTEM.
137
+ */
138
+ #ifndef PRISM_HAS_NO_FILESYSTEM
139
+ # define PRISM_HAS_FILESYSTEM
140
+ #endif
141
+
142
+ /**
143
+ * isinf on POSIX systems it accepts a float, a double, or a long double.
144
+ * But mingw didn't provide an isinf macro, only an isinf function that only
145
+ * accepts floats, so we need to use _finite instead.
146
+ */
147
+ #ifdef __MINGW64__
148
+ #include <float.h>
149
+ #define PRISM_ISINF(x) (!_finite(x))
150
+ #else
151
+ #define PRISM_ISINF(x) isinf(x)
152
+ #endif
153
+
154
+ /**
155
+ * If you build prism with a custom allocator, configure it with
156
+ * "-D PRISM_XALLOCATOR" to use your own allocator that defines xmalloc,
157
+ * xrealloc, xcalloc, and xfree.
158
+ *
159
+ * For example, your `prism_xallocator.h` file could look like this:
160
+ *
161
+ * ```
162
+ * #ifndef PRISM_XALLOCATOR_H
163
+ * #define PRISM_XALLOCATOR_H
164
+ * #define xmalloc my_malloc
165
+ * #define xrealloc my_realloc
166
+ * #define xcalloc my_calloc
167
+ * #define xfree my_free
168
+ * #endif
169
+ * ```
170
+ */
171
+ #ifdef PRISM_XALLOCATOR
172
+ #include "prism_xallocator.h"
173
+ #else
174
+ #ifndef xmalloc
175
+ /**
176
+ * The malloc function that should be used. This can be overridden with
177
+ * the PRISM_XALLOCATOR define.
178
+ */
179
+ #define xmalloc malloc
180
+ #endif
181
+
182
+ #ifndef xrealloc
183
+ /**
184
+ * The realloc function that should be used. This can be overridden with
185
+ * the PRISM_XALLOCATOR define.
186
+ */
187
+ #define xrealloc realloc
188
+ #endif
189
+
190
+ #ifndef xcalloc
191
+ /**
192
+ * The calloc function that should be used. This can be overridden with
193
+ * the PRISM_XALLOCATOR define.
194
+ */
195
+ #define xcalloc calloc
196
+ #endif
197
+
198
+ #ifndef xfree
199
+ /**
200
+ * The free function that should be used. This can be overridden with the
201
+ * PRISM_XALLOCATOR define.
202
+ */
203
+ #define xfree free
204
+ #endif
205
+ #endif
206
+
207
+ /**
208
+ * If PRISM_BUILD_MINIMAL is defined, then we're going to define every possible
209
+ * switch that will turn off certain features of prism.
210
+ */
211
+ #ifdef PRISM_BUILD_MINIMAL
212
+ /** Exclude the serialization API. */
213
+ #define PRISM_EXCLUDE_SERIALIZATION
214
+
215
+ /** Exclude the JSON serialization API. */
216
+ #define PRISM_EXCLUDE_JSON
217
+
218
+ /** Exclude the Array#pack parser API. */
219
+ #define PRISM_EXCLUDE_PACK
220
+
221
+ /** Exclude the prettyprint API. */
222
+ #define PRISM_EXCLUDE_PRETTYPRINT
223
+
224
+ /** Exclude the full set of encodings, using the minimal only. */
225
+ #define PRISM_ENCODING_EXCLUDE_FULL
226
+ #endif
227
+
228
+ /**
229
+ * Support PRISM_LIKELY and PRISM_UNLIKELY to help the compiler optimize its
230
+ * branch predication.
231
+ */
232
+ #if defined(__GNUC__) || defined(__clang__)
233
+ /** The compiler should predicate that this branch will be taken. */
234
+ #define PRISM_LIKELY(x) __builtin_expect(!!(x), 1)
235
+
236
+ /** The compiler should predicate that this branch will not be taken. */
237
+ #define PRISM_UNLIKELY(x) __builtin_expect(!!(x), 0)
238
+ #else
239
+ /** Void because this platform does not support branch prediction hints. */
240
+ #define PRISM_LIKELY(x) (x)
241
+
242
+ /** Void because this platform does not support branch prediction hints. */
243
+ #define PRISM_UNLIKELY(x) (x)
244
+ #endif
245
+
246
+ /**
247
+ * We use -Wimplicit-fallthrough to guard potentially unintended fall-through between cases of a switch.
248
+ * Use PRISM_FALLTHROUGH to explicitly annotate cases where the fallthrough is intentional.
249
+ */
250
+ #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L // C23 or later
251
+ #define PRISM_FALLTHROUGH [[fallthrough]];
252
+ #elif defined(__GNUC__) || defined(__clang__)
253
+ #define PRISM_FALLTHROUGH __attribute__((fallthrough));
254
+ #elif defined(_MSC_VER)
255
+ #define PRISM_FALLTHROUGH __fallthrough;
256
+ #else
257
+ #define PRISM_FALLTHROUGH
258
+ #endif
259
+
260
+ #endif
@@ -0,0 +1,451 @@
1
+ /*----------------------------------------------------------------------------*/
2
+ /* This file is generated by the templates/template.rb script and should not */
3
+ /* be modified manually. See */
4
+ /* templates/include/prism/diagnostic.h.erb */
5
+ /* if you are looking to modify the */
6
+ /* template */
7
+ /*----------------------------------------------------------------------------*/
8
+
9
+ /**
10
+ * @file diagnostic.h
11
+ *
12
+ * A list of diagnostics generated during parsing.
13
+ */
14
+ #ifndef PRISM_DIAGNOSTIC_H
15
+ #define PRISM_DIAGNOSTIC_H
16
+
17
+ #include "prism/ast.h"
18
+ #include "prism/defines.h"
19
+ #include "prism/util/pm_list.h"
20
+
21
+ #include <stdbool.h>
22
+ #include <stdlib.h>
23
+ #include <assert.h>
24
+
25
+ /**
26
+ * The diagnostic IDs of all of the diagnostics, used to communicate the types
27
+ * of errors between the parser and the user.
28
+ */
29
+ typedef enum {
30
+ // These are the error diagnostics.
31
+ PM_ERR_ALIAS_ARGUMENT,
32
+ PM_ERR_ALIAS_ARGUMENT_NUMBERED_REFERENCE,
33
+ PM_ERR_AMPAMPEQ_MULTI_ASSIGN,
34
+ PM_ERR_ARGUMENT_AFTER_BLOCK,
35
+ PM_ERR_ARGUMENT_AFTER_FORWARDING_ELLIPSES,
36
+ PM_ERR_ARGUMENT_BARE_HASH,
37
+ PM_ERR_ARGUMENT_BLOCK_FORWARDING,
38
+ PM_ERR_ARGUMENT_BLOCK_MULTI,
39
+ PM_ERR_ARGUMENT_CONFLICT_AMPERSAND,
40
+ PM_ERR_ARGUMENT_CONFLICT_STAR,
41
+ PM_ERR_ARGUMENT_CONFLICT_STAR_STAR,
42
+ PM_ERR_ARGUMENT_FORMAL_CLASS,
43
+ PM_ERR_ARGUMENT_FORMAL_CONSTANT,
44
+ PM_ERR_ARGUMENT_FORMAL_GLOBAL,
45
+ PM_ERR_ARGUMENT_FORMAL_IVAR,
46
+ PM_ERR_ARGUMENT_FORWARDING_UNBOUND,
47
+ PM_ERR_ARGUMENT_NO_FORWARDING_AMPERSAND,
48
+ PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES,
49
+ PM_ERR_ARGUMENT_NO_FORWARDING_STAR,
50
+ PM_ERR_ARGUMENT_NO_FORWARDING_STAR_STAR,
51
+ PM_ERR_ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT,
52
+ PM_ERR_ARGUMENT_SPLAT_AFTER_SPLAT,
53
+ PM_ERR_ARGUMENT_TERM_PAREN,
54
+ PM_ERR_ARGUMENT_UNEXPECTED_BLOCK,
55
+ PM_ERR_ARRAY_ELEMENT,
56
+ PM_ERR_ARRAY_EXPRESSION,
57
+ PM_ERR_ARRAY_EXPRESSION_AFTER_STAR,
58
+ PM_ERR_ARRAY_SEPARATOR,
59
+ PM_ERR_ARRAY_TERM,
60
+ PM_ERR_BEGIN_LONELY_ELSE,
61
+ PM_ERR_BEGIN_TERM,
62
+ PM_ERR_BEGIN_UPCASE_BRACE,
63
+ PM_ERR_BEGIN_UPCASE_TERM,
64
+ PM_ERR_BEGIN_UPCASE_TOPLEVEL,
65
+ PM_ERR_BLOCK_PARAM_LOCAL_VARIABLE,
66
+ PM_ERR_BLOCK_PARAM_PIPE_TERM,
67
+ PM_ERR_BLOCK_TERM_BRACE,
68
+ PM_ERR_BLOCK_TERM_END,
69
+ PM_ERR_CANNOT_PARSE_EXPRESSION,
70
+ PM_ERR_CANNOT_PARSE_STRING_PART,
71
+ PM_ERR_CASE_EXPRESSION_AFTER_CASE,
72
+ PM_ERR_CASE_EXPRESSION_AFTER_WHEN,
73
+ PM_ERR_CASE_MATCH_MISSING_PREDICATE,
74
+ PM_ERR_CASE_MISSING_CONDITIONS,
75
+ PM_ERR_CASE_TERM,
76
+ PM_ERR_CLASS_IN_METHOD,
77
+ PM_ERR_CLASS_NAME,
78
+ PM_ERR_CLASS_SUPERCLASS,
79
+ PM_ERR_CLASS_TERM,
80
+ PM_ERR_CLASS_UNEXPECTED_END,
81
+ PM_ERR_CLASS_VARIABLE_BARE,
82
+ PM_ERR_CONDITIONAL_ELSIF_PREDICATE,
83
+ PM_ERR_CONDITIONAL_IF_PREDICATE,
84
+ PM_ERR_CONDITIONAL_PREDICATE_TERM,
85
+ PM_ERR_CONDITIONAL_TERM,
86
+ PM_ERR_CONDITIONAL_TERM_ELSE,
87
+ PM_ERR_CONDITIONAL_UNLESS_PREDICATE,
88
+ PM_ERR_CONDITIONAL_UNTIL_PREDICATE,
89
+ PM_ERR_CONDITIONAL_WHILE_PREDICATE,
90
+ PM_ERR_CONSTANT_PATH_COLON_COLON_CONSTANT,
91
+ PM_ERR_DEF_ENDLESS,
92
+ PM_ERR_DEF_ENDLESS_SETTER,
93
+ PM_ERR_DEF_NAME,
94
+ PM_ERR_DEF_PARAMS_TERM,
95
+ PM_ERR_DEF_PARAMS_TERM_PAREN,
96
+ PM_ERR_DEF_RECEIVER,
97
+ PM_ERR_DEF_RECEIVER_TERM,
98
+ PM_ERR_DEF_TERM,
99
+ PM_ERR_DEFINED_EXPRESSION,
100
+ PM_ERR_EMBDOC_TERM,
101
+ PM_ERR_EMBEXPR_END,
102
+ PM_ERR_EMBVAR_INVALID,
103
+ PM_ERR_END_UPCASE_BRACE,
104
+ PM_ERR_END_UPCASE_TERM,
105
+ PM_ERR_ESCAPE_INVALID_CONTROL,
106
+ PM_ERR_ESCAPE_INVALID_CONTROL_REPEAT,
107
+ PM_ERR_ESCAPE_INVALID_HEXADECIMAL,
108
+ PM_ERR_ESCAPE_INVALID_META,
109
+ PM_ERR_ESCAPE_INVALID_META_REPEAT,
110
+ PM_ERR_ESCAPE_INVALID_UNICODE,
111
+ PM_ERR_ESCAPE_INVALID_UNICODE_CM_FLAGS,
112
+ PM_ERR_ESCAPE_INVALID_UNICODE_LIST,
113
+ PM_ERR_ESCAPE_INVALID_UNICODE_LITERAL,
114
+ PM_ERR_ESCAPE_INVALID_UNICODE_LONG,
115
+ PM_ERR_ESCAPE_INVALID_UNICODE_SHORT,
116
+ PM_ERR_ESCAPE_INVALID_UNICODE_TERM,
117
+ PM_ERR_EXPECT_ARGUMENT,
118
+ PM_ERR_EXPECT_EOL_AFTER_STATEMENT,
119
+ PM_ERR_EXPECT_EXPRESSION_AFTER_AMPAMPEQ,
120
+ PM_ERR_EXPECT_EXPRESSION_AFTER_COMMA,
121
+ PM_ERR_EXPECT_EXPRESSION_AFTER_EQUAL,
122
+ PM_ERR_EXPECT_EXPRESSION_AFTER_LESS_LESS,
123
+ PM_ERR_EXPECT_EXPRESSION_AFTER_LPAREN,
124
+ PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR,
125
+ PM_ERR_EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ,
126
+ PM_ERR_EXPECT_EXPRESSION_AFTER_QUESTION,
127
+ PM_ERR_EXPECT_EXPRESSION_AFTER_SPLAT,
128
+ PM_ERR_EXPECT_EXPRESSION_AFTER_SPLAT_HASH,
129
+ PM_ERR_EXPECT_EXPRESSION_AFTER_STAR,
130
+ PM_ERR_EXPECT_FOR_DELIMITER,
131
+ PM_ERR_EXPECT_IDENT_REQ_PARAMETER,
132
+ PM_ERR_EXPECT_IN_DELIMITER,
133
+ PM_ERR_EXPECT_LPAREN_REQ_PARAMETER,
134
+ PM_ERR_EXPECT_MESSAGE,
135
+ PM_ERR_EXPECT_RBRACKET,
136
+ PM_ERR_EXPECT_RPAREN,
137
+ PM_ERR_EXPECT_RPAREN_AFTER_MULTI,
138
+ PM_ERR_EXPECT_RPAREN_REQ_PARAMETER,
139
+ PM_ERR_EXPECT_SINGLETON_CLASS_DELIMITER,
140
+ PM_ERR_EXPECT_STRING_CONTENT,
141
+ PM_ERR_EXPECT_WHEN_DELIMITER,
142
+ PM_ERR_EXPRESSION_BARE_HASH,
143
+ PM_ERR_EXPRESSION_NOT_WRITABLE,
144
+ PM_ERR_EXPRESSION_NOT_WRITABLE_ENCODING,
145
+ PM_ERR_EXPRESSION_NOT_WRITABLE_FALSE,
146
+ PM_ERR_EXPRESSION_NOT_WRITABLE_FILE,
147
+ PM_ERR_EXPRESSION_NOT_WRITABLE_LINE,
148
+ PM_ERR_EXPRESSION_NOT_WRITABLE_NIL,
149
+ PM_ERR_EXPRESSION_NOT_WRITABLE_NUMBERED,
150
+ PM_ERR_EXPRESSION_NOT_WRITABLE_SELF,
151
+ PM_ERR_EXPRESSION_NOT_WRITABLE_TRUE,
152
+ PM_ERR_FLOAT_PARSE,
153
+ PM_ERR_FOR_COLLECTION,
154
+ PM_ERR_FOR_IN,
155
+ PM_ERR_FOR_INDEX,
156
+ PM_ERR_FOR_TERM,
157
+ PM_ERR_GLOBAL_VARIABLE_BARE,
158
+ PM_ERR_HASH_EXPRESSION_AFTER_LABEL,
159
+ PM_ERR_HASH_KEY,
160
+ PM_ERR_HASH_ROCKET,
161
+ PM_ERR_HASH_TERM,
162
+ PM_ERR_HASH_VALUE,
163
+ PM_ERR_HEREDOC_IDENTIFIER,
164
+ PM_ERR_HEREDOC_TERM,
165
+ PM_ERR_INCOMPLETE_QUESTION_MARK,
166
+ PM_ERR_INCOMPLETE_VARIABLE_CLASS,
167
+ PM_ERR_INCOMPLETE_VARIABLE_CLASS_3_3,
168
+ PM_ERR_INCOMPLETE_VARIABLE_INSTANCE,
169
+ PM_ERR_INCOMPLETE_VARIABLE_INSTANCE_3_3,
170
+ PM_ERR_INSTANCE_VARIABLE_BARE,
171
+ PM_ERR_INVALID_BLOCK_EXIT,
172
+ PM_ERR_INVALID_CHARACTER,
173
+ PM_ERR_INVALID_COMMA,
174
+ PM_ERR_INVALID_ENCODING_MAGIC_COMMENT,
175
+ PM_ERR_INVALID_ESCAPE_CHARACTER,
176
+ PM_ERR_INVALID_FLOAT_EXPONENT,
177
+ PM_ERR_INVALID_LOCAL_VARIABLE_READ,
178
+ PM_ERR_INVALID_LOCAL_VARIABLE_WRITE,
179
+ PM_ERR_INVALID_MULTIBYTE_CHAR,
180
+ PM_ERR_INVALID_MULTIBYTE_CHARACTER,
181
+ PM_ERR_INVALID_MULTIBYTE_ESCAPE,
182
+ PM_ERR_INVALID_NUMBER_BINARY,
183
+ PM_ERR_INVALID_NUMBER_DECIMAL,
184
+ PM_ERR_INVALID_NUMBER_FRACTION,
185
+ PM_ERR_INVALID_NUMBER_HEXADECIMAL,
186
+ PM_ERR_INVALID_NUMBER_OCTAL,
187
+ PM_ERR_INVALID_NUMBER_UNDERSCORE_INNER,
188
+ PM_ERR_INVALID_NUMBER_UNDERSCORE_TRAILING,
189
+ PM_ERR_INVALID_PERCENT,
190
+ PM_ERR_INVALID_PERCENT_EOF,
191
+ PM_ERR_INVALID_PRINTABLE_CHARACTER,
192
+ PM_ERR_INVALID_RETRY_AFTER_ELSE,
193
+ PM_ERR_INVALID_RETRY_AFTER_ENSURE,
194
+ PM_ERR_INVALID_RETRY_WITHOUT_RESCUE,
195
+ PM_ERR_INVALID_SYMBOL,
196
+ PM_ERR_INVALID_VARIABLE_GLOBAL,
197
+ PM_ERR_INVALID_VARIABLE_GLOBAL_3_3,
198
+ PM_ERR_INVALID_YIELD,
199
+ PM_ERR_IT_NOT_ALLOWED_NUMBERED,
200
+ PM_ERR_IT_NOT_ALLOWED_ORDINARY,
201
+ PM_ERR_LAMBDA_OPEN,
202
+ PM_ERR_LAMBDA_TERM_BRACE,
203
+ PM_ERR_LAMBDA_TERM_END,
204
+ PM_ERR_LIST_I_LOWER_ELEMENT,
205
+ PM_ERR_LIST_I_LOWER_TERM,
206
+ PM_ERR_LIST_I_UPPER_ELEMENT,
207
+ PM_ERR_LIST_I_UPPER_TERM,
208
+ PM_ERR_LIST_W_LOWER_ELEMENT,
209
+ PM_ERR_LIST_W_LOWER_TERM,
210
+ PM_ERR_LIST_W_UPPER_ELEMENT,
211
+ PM_ERR_LIST_W_UPPER_TERM,
212
+ PM_ERR_MALLOC_FAILED,
213
+ PM_ERR_MIXED_ENCODING,
214
+ PM_ERR_MODULE_IN_METHOD,
215
+ PM_ERR_MODULE_NAME,
216
+ PM_ERR_MODULE_TERM,
217
+ PM_ERR_MULTI_ASSIGN_MULTI_SPLATS,
218
+ PM_ERR_MULTI_ASSIGN_UNEXPECTED_REST,
219
+ PM_ERR_NESTING_TOO_DEEP,
220
+ PM_ERR_NO_LOCAL_VARIABLE,
221
+ PM_ERR_NON_ASSOCIATIVE_OPERATOR,
222
+ PM_ERR_NOT_EXPRESSION,
223
+ PM_ERR_NUMBER_LITERAL_UNDERSCORE,
224
+ PM_ERR_NUMBERED_PARAMETER_INNER_BLOCK,
225
+ PM_ERR_NUMBERED_PARAMETER_IT,
226
+ PM_ERR_NUMBERED_PARAMETER_ORDINARY,
227
+ PM_ERR_NUMBERED_PARAMETER_OUTER_BLOCK,
228
+ PM_ERR_OPERATOR_MULTI_ASSIGN,
229
+ PM_ERR_OPERATOR_WRITE_ARGUMENTS,
230
+ PM_ERR_OPERATOR_WRITE_BLOCK,
231
+ PM_ERR_PARAMETER_ASSOC_SPLAT_MULTI,
232
+ PM_ERR_PARAMETER_BLOCK_MULTI,
233
+ PM_ERR_PARAMETER_CIRCULAR,
234
+ PM_ERR_PARAMETER_FORWARDING_AFTER_REST,
235
+ PM_ERR_PARAMETER_METHOD_NAME,
236
+ PM_ERR_PARAMETER_NAME_DUPLICATED,
237
+ PM_ERR_PARAMETER_NO_DEFAULT,
238
+ PM_ERR_PARAMETER_NO_DEFAULT_KW,
239
+ PM_ERR_PARAMETER_NUMBERED_RESERVED,
240
+ PM_ERR_PARAMETER_ORDER,
241
+ PM_ERR_PARAMETER_SPLAT_MULTI,
242
+ PM_ERR_PARAMETER_STAR,
243
+ PM_ERR_PARAMETER_UNEXPECTED_FWD,
244
+ PM_ERR_PARAMETER_UNEXPECTED_NO_KW,
245
+ PM_ERR_PARAMETER_WILD_LOOSE_COMMA,
246
+ PM_ERR_PATTERN_ARRAY_MULTIPLE_RESTS,
247
+ PM_ERR_PATTERN_CAPTURE_DUPLICATE,
248
+ PM_ERR_PATTERN_EXPRESSION_AFTER_BRACKET,
249
+ PM_ERR_PATTERN_EXPRESSION_AFTER_COMMA,
250
+ PM_ERR_PATTERN_EXPRESSION_AFTER_HROCKET,
251
+ PM_ERR_PATTERN_EXPRESSION_AFTER_IN,
252
+ PM_ERR_PATTERN_EXPRESSION_AFTER_KEY,
253
+ PM_ERR_PATTERN_EXPRESSION_AFTER_PAREN,
254
+ PM_ERR_PATTERN_EXPRESSION_AFTER_PIN,
255
+ PM_ERR_PATTERN_EXPRESSION_AFTER_PIPE,
256
+ PM_ERR_PATTERN_EXPRESSION_AFTER_RANGE,
257
+ PM_ERR_PATTERN_EXPRESSION_AFTER_REST,
258
+ PM_ERR_PATTERN_FIND_MISSING_INNER,
259
+ PM_ERR_PATTERN_HASH_IMPLICIT,
260
+ PM_ERR_PATTERN_HASH_KEY,
261
+ PM_ERR_PATTERN_HASH_KEY_DUPLICATE,
262
+ PM_ERR_PATTERN_HASH_KEY_INTERPOLATED,
263
+ PM_ERR_PATTERN_HASH_KEY_LABEL,
264
+ PM_ERR_PATTERN_HASH_KEY_LOCALS,
265
+ PM_ERR_PATTERN_IDENT_AFTER_HROCKET,
266
+ PM_ERR_PATTERN_LABEL_AFTER_COMMA,
267
+ PM_ERR_PATTERN_REST,
268
+ PM_ERR_PATTERN_TERM_BRACE,
269
+ PM_ERR_PATTERN_TERM_BRACKET,
270
+ PM_ERR_PATTERN_TERM_PAREN,
271
+ PM_ERR_PIPEPIPEEQ_MULTI_ASSIGN,
272
+ PM_ERR_REGEXP_ENCODING_OPTION_MISMATCH,
273
+ PM_ERR_REGEXP_INCOMPAT_CHAR_ENCODING,
274
+ PM_ERR_REGEXP_INVALID_UNICODE_RANGE,
275
+ PM_ERR_REGEXP_NON_ESCAPED_MBC,
276
+ PM_ERR_REGEXP_PARSE_ERROR,
277
+ PM_ERR_REGEXP_TERM,
278
+ PM_ERR_REGEXP_UNKNOWN_OPTIONS,
279
+ PM_ERR_REGEXP_UTF8_CHAR_NON_UTF8_REGEXP,
280
+ PM_ERR_RESCUE_EXPRESSION,
281
+ PM_ERR_RESCUE_MODIFIER_VALUE,
282
+ PM_ERR_RESCUE_TERM,
283
+ PM_ERR_RESCUE_VARIABLE,
284
+ PM_ERR_RETURN_INVALID,
285
+ PM_ERR_SCRIPT_NOT_FOUND,
286
+ PM_ERR_SINGLETON_FOR_LITERALS,
287
+ PM_ERR_STATEMENT_ALIAS,
288
+ PM_ERR_STATEMENT_POSTEXE_END,
289
+ PM_ERR_STATEMENT_PREEXE_BEGIN,
290
+ PM_ERR_STATEMENT_UNDEF,
291
+ PM_ERR_STRING_CONCATENATION,
292
+ PM_ERR_STRING_INTERPOLATED_TERM,
293
+ PM_ERR_STRING_LITERAL_EOF,
294
+ PM_ERR_STRING_LITERAL_TERM,
295
+ PM_ERR_SYMBOL_INVALID,
296
+ PM_ERR_SYMBOL_TERM_DYNAMIC,
297
+ PM_ERR_SYMBOL_TERM_INTERPOLATED,
298
+ PM_ERR_TERNARY_COLON,
299
+ PM_ERR_TERNARY_EXPRESSION_FALSE,
300
+ PM_ERR_TERNARY_EXPRESSION_TRUE,
301
+ PM_ERR_UNARY_DISALLOWED,
302
+ PM_ERR_UNARY_RECEIVER,
303
+ PM_ERR_UNDEF_ARGUMENT,
304
+ PM_ERR_UNEXPECTED_BLOCK_ARGUMENT,
305
+ PM_ERR_UNEXPECTED_INDEX_BLOCK,
306
+ PM_ERR_UNEXPECTED_INDEX_KEYWORDS,
307
+ PM_ERR_UNEXPECTED_LABEL,
308
+ PM_ERR_UNEXPECTED_MULTI_WRITE,
309
+ PM_ERR_UNEXPECTED_RANGE_OPERATOR,
310
+ PM_ERR_UNEXPECTED_SAFE_NAVIGATION,
311
+ PM_ERR_UNEXPECTED_TOKEN_CLOSE_CONTEXT,
312
+ PM_ERR_UNEXPECTED_TOKEN_IGNORE,
313
+ PM_ERR_UNTIL_TERM,
314
+ PM_ERR_VOID_EXPRESSION,
315
+ PM_ERR_WHILE_TERM,
316
+ PM_ERR_WRITE_TARGET_IN_METHOD,
317
+ PM_ERR_WRITE_TARGET_READONLY,
318
+ PM_ERR_WRITE_TARGET_UNEXPECTED,
319
+ PM_ERR_XSTRING_TERM,
320
+
321
+ // These are the warning diagnostics.
322
+ PM_WARN_AMBIGUOUS_BINARY_OPERATOR,
323
+ PM_WARN_AMBIGUOUS_FIRST_ARGUMENT_MINUS,
324
+ PM_WARN_AMBIGUOUS_FIRST_ARGUMENT_PLUS,
325
+ PM_WARN_AMBIGUOUS_PREFIX_AMPERSAND,
326
+ PM_WARN_AMBIGUOUS_PREFIX_STAR,
327
+ PM_WARN_AMBIGUOUS_PREFIX_STAR_STAR,
328
+ PM_WARN_AMBIGUOUS_SLASH,
329
+ PM_WARN_COMPARISON_AFTER_COMPARISON,
330
+ PM_WARN_DOT_DOT_DOT_EOL,
331
+ PM_WARN_EQUAL_IN_CONDITIONAL,
332
+ PM_WARN_EQUAL_IN_CONDITIONAL_3_3,
333
+ PM_WARN_END_IN_METHOD,
334
+ PM_WARN_DUPLICATED_HASH_KEY,
335
+ PM_WARN_DUPLICATED_WHEN_CLAUSE,
336
+ PM_WARN_FLOAT_OUT_OF_RANGE,
337
+ PM_WARN_IGNORED_FROZEN_STRING_LITERAL,
338
+ PM_WARN_INDENTATION_MISMATCH,
339
+ PM_WARN_INTEGER_IN_FLIP_FLOP,
340
+ PM_WARN_INVALID_CHARACTER,
341
+ PM_WARN_INVALID_MAGIC_COMMENT_VALUE,
342
+ PM_WARN_INVALID_NUMBERED_REFERENCE,
343
+ PM_WARN_KEYWORD_EOL,
344
+ PM_WARN_LITERAL_IN_CONDITION_DEFAULT,
345
+ PM_WARN_LITERAL_IN_CONDITION_VERBOSE,
346
+ PM_WARN_SHAREABLE_CONSTANT_VALUE_LINE,
347
+ PM_WARN_SHEBANG_CARRIAGE_RETURN,
348
+ PM_WARN_UNEXPECTED_CARRIAGE_RETURN,
349
+ PM_WARN_UNREACHABLE_STATEMENT,
350
+ PM_WARN_UNUSED_LOCAL_VARIABLE,
351
+ PM_WARN_VOID_STATEMENT,
352
+ } pm_diagnostic_id_t;
353
+
354
+ /**
355
+ * This struct represents a diagnostic generated during parsing.
356
+ *
357
+ * @extends pm_list_node_t
358
+ */
359
+ typedef struct {
360
+ /** The embedded base node. */
361
+ pm_list_node_t node;
362
+
363
+ /** The location of the diagnostic in the source. */
364
+ pm_location_t location;
365
+
366
+ /** The ID of the diagnostic. */
367
+ pm_diagnostic_id_t diag_id;
368
+
369
+ /** The message associated with the diagnostic. */
370
+ const char *message;
371
+
372
+ /**
373
+ * Whether or not the memory related to the message of this diagnostic is
374
+ * owned by this diagnostic. If it is, it needs to be freed when the
375
+ * diagnostic is freed.
376
+ */
377
+ bool owned;
378
+
379
+ /**
380
+ * The level of the diagnostic, see `pm_error_level_t` and
381
+ * `pm_warning_level_t` for possible values.
382
+ */
383
+ uint8_t level;
384
+ } pm_diagnostic_t;
385
+
386
+ /**
387
+ * The levels of errors generated during parsing.
388
+ */
389
+ typedef enum {
390
+ /** For errors that should raise a syntax error. */
391
+ PM_ERROR_LEVEL_SYNTAX = 0,
392
+
393
+ /** For errors that should raise an argument error. */
394
+ PM_ERROR_LEVEL_ARGUMENT = 1,
395
+
396
+ /** For errors that should raise a load error. */
397
+ PM_ERROR_LEVEL_LOAD = 2
398
+ } pm_error_level_t;
399
+
400
+ /**
401
+ * The levels of warnings generated during parsing.
402
+ */
403
+ typedef enum {
404
+ /** For warnings which should be emitted if $VERBOSE != nil. */
405
+ PM_WARNING_LEVEL_DEFAULT = 0,
406
+
407
+ /** For warnings which should be emitted if $VERBOSE == true. */
408
+ PM_WARNING_LEVEL_VERBOSE = 1
409
+ } pm_warning_level_t;
410
+
411
+ /**
412
+ * Get the human-readable name of the given diagnostic ID.
413
+ *
414
+ * @param diag_id The diagnostic ID.
415
+ * @return The human-readable name of the diagnostic ID.
416
+ */
417
+ const char * pm_diagnostic_id_human(pm_diagnostic_id_t diag_id);
418
+
419
+ /**
420
+ * Append a diagnostic to the given list of diagnostics that is using shared
421
+ * memory for its message.
422
+ *
423
+ * @param list The list to append to.
424
+ * @param start The start of the diagnostic.
425
+ * @param end The end of the diagnostic.
426
+ * @param diag_id The diagnostic ID.
427
+ * @return Whether the diagnostic was successfully appended.
428
+ */
429
+ bool pm_diagnostic_list_append(pm_list_t *list, const uint8_t *start, const uint8_t *end, pm_diagnostic_id_t diag_id);
430
+
431
+ /**
432
+ * Append a diagnostic to the given list of diagnostics that is using a format
433
+ * string for its message.
434
+ *
435
+ * @param list The list to append to.
436
+ * @param start The start of the diagnostic.
437
+ * @param end The end of the diagnostic.
438
+ * @param diag_id The diagnostic ID.
439
+ * @param ... The arguments to the format string for the message.
440
+ * @return Whether the diagnostic was successfully appended.
441
+ */
442
+ bool pm_diagnostic_list_append_format(pm_list_t *list, const uint8_t *start, const uint8_t *end, pm_diagnostic_id_t diag_id, ...);
443
+
444
+ /**
445
+ * Deallocate the internal state of the given diagnostic list.
446
+ *
447
+ * @param list The list to deallocate.
448
+ */
449
+ void pm_diagnostic_list_free(pm_list_t *list);
450
+
451
+ #endif