Ruby: prism/diagnostic.h Source File

Ruby 3.4.3p32 (2025-04-14 revision d0b7e5b6a04bde21ca483d20a1546b28b401c2d4)

diagnostic.h
Go to the documentation of this file.
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
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
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
359 typedef struct {
361 pm_list_node_t node;
362
364 pm_location_t location;
365
367 pm_diagnostic_id_t diag_id;
368
370 const char *message;
371
377 bool owned;
378
383 uint8_t level;
384} pm_diagnostic_t;
385
389 typedef enum {
391 PM_ERROR_LEVEL_SYNTAX = 0,
392
394 PM_ERROR_LEVEL_ARGUMENT = 1,
395
397 PM_ERROR_LEVEL_LOAD = 2
398} pm_error_level_t;
399
403 typedef enum {
405 PM_WARNING_LEVEL_DEFAULT = 0,
406
408 PM_WARNING_LEVEL_VERBOSE = 1
409} pm_warning_level_t;
410
417const char * pm_diagnostic_id_human(pm_diagnostic_id_t diag_id);
418
429bool pm_diagnostic_list_append(pm_list_t *list, const uint8_t *start, const uint8_t *end, pm_diagnostic_id_t diag_id);
430
442bool pm_diagnostic_list_append_format(pm_list_t *list, const uint8_t *start, const uint8_t *end, pm_diagnostic_id_t diag_id, ...);
443
449void pm_diagnostic_list_free(pm_list_t *list);
450
451#endif
assert.h
ast.h
The abstract syntax tree.
pm_diagnostic_list_free
void pm_diagnostic_list_free(pm_list_t *list)
Deallocate the internal state of the given diagnostic list.
Definition diagnostic.c:831
pm_diagnostic_list_append_format
bool pm_diagnostic_list_append_format(pm_list_t *list, const uint8_t *start, const uint8_t *end, pm_diagnostic_id_t diag_id,...)
Append a diagnostic to the given list of diagnostics that is using a format string for its message.
Definition diagnostic.c:787
pm_diagnostic_id_t
pm_diagnostic_id_t
The diagnostic IDs of all of the diagnostics, used to communicate the types of errors between the par...
Definition diagnostic.h:29
pm_diagnostic_list_append
bool pm_diagnostic_list_append(pm_list_t *list, const uint8_t *start, const uint8_t *end, pm_diagnostic_id_t diag_id)
Append a diagnostic to the given list of diagnostics that is using shared memory for its message.
Definition diagnostic.c:766
pm_diagnostic_id_human
const char * pm_diagnostic_id_human(pm_diagnostic_id_t diag_id)
Get the human-readable name of the given diagnostic ID.
Definition diagnostic.c:418
pm_warning_level_t
pm_warning_level_t
The levels of warnings generated during parsing.
Definition diagnostic.h:403
PM_WARNING_LEVEL_DEFAULT
@ PM_WARNING_LEVEL_DEFAULT
For warnings which should be emitted if $VERBOSE != nil.
Definition diagnostic.h:405
PM_WARNING_LEVEL_VERBOSE
@ PM_WARNING_LEVEL_VERBOSE
For warnings which should be emitted if $VERBOSE == true.
Definition diagnostic.h:408
pm_error_level_t
pm_error_level_t
The levels of errors generated during parsing.
Definition diagnostic.h:389
PM_ERROR_LEVEL_ARGUMENT
@ PM_ERROR_LEVEL_ARGUMENT
For errors that should raise an argument error.
Definition diagnostic.h:394
PM_ERROR_LEVEL_LOAD
@ PM_ERROR_LEVEL_LOAD
For errors that should raise a load error.
Definition diagnostic.h:397
PM_ERROR_LEVEL_SYNTAX
@ PM_ERROR_LEVEL_SYNTAX
For errors that should raise a syntax error.
Definition diagnostic.h:391
pm_list.h
An abstract linked list.
pm_list_node_t
struct pm_list_node pm_list_node_t
This struct represents an abstract linked list that provides common functionality.
defines.h
Macro definitions used throughout the prism library.
stdbool.h
C99 shim for <stdbool.h>
pm_diagnostic_t
This struct represents a diagnostic generated during parsing.
Definition diagnostic.h:359
pm_diagnostic_t::location
pm_location_t location
The location of the diagnostic in the source.
Definition diagnostic.h:364
pm_diagnostic_t::message
const char * message
The message associated with the diagnostic.
Definition diagnostic.h:370
pm_diagnostic_t::node
pm_list_node_t node
The embedded base node.
Definition diagnostic.h:361
pm_diagnostic_t::diag_id
pm_diagnostic_id_t diag_id
The ID of the diagnostic.
Definition diagnostic.h:367
pm_diagnostic_t::owned
bool owned
Whether or not the memory related to the message of this diagnostic is owned by this diagnostic.
Definition diagnostic.h:377
pm_diagnostic_t::level
uint8_t level
The level of the diagnostic, see pm_error_level_t and pm_warning_level_t for possible values.
Definition diagnostic.h:383
pm_list_t
This represents the overall linked list.
Definition pm_list.h:55
pm_location_t
This represents a range of bytes in the source string to which a node or token corresponds.
Definition ast.h:545