Ruby: prism/diagnostic.h Source File

Ruby 3.4.7p58 (2025-10-08 revision 7a5688e2a27668e48f8d6ff4af5b2208b98a2f5e)

diagnostic.h
Go to the documentation of this file.
1/* :markup: markdown */
2
3/*----------------------------------------------------------------------------*/
4/* This file is generated by the templates/template.rb script and should not */
5/* be modified manually. See */
6/* templates/include/prism/diagnostic.h.erb */
7/* if you are looking to modify the */
8/* template */
9/*----------------------------------------------------------------------------*/
10
16#ifndef PRISM_DIAGNOSTIC_H
17#define PRISM_DIAGNOSTIC_H
18
19#include "prism/ast.h"
20#include "prism/defines.h"
21#include "prism/util/pm_list.h"
22
23#include <stdbool.h>
24#include <stdlib.h>
25#include <assert.h>
26
31 typedef enum {
32 // These are the error diagnostics.
33 PM_ERR_ALIAS_ARGUMENT,
34 PM_ERR_ALIAS_ARGUMENT_NUMBERED_REFERENCE,
35 PM_ERR_AMPAMPEQ_MULTI_ASSIGN,
36 PM_ERR_ARGUMENT_AFTER_BLOCK,
37 PM_ERR_ARGUMENT_AFTER_FORWARDING_ELLIPSES,
38 PM_ERR_ARGUMENT_BARE_HASH,
39 PM_ERR_ARGUMENT_BLOCK_FORWARDING,
40 PM_ERR_ARGUMENT_BLOCK_MULTI,
41 PM_ERR_ARGUMENT_CONFLICT_AMPERSAND,
42 PM_ERR_ARGUMENT_CONFLICT_STAR,
43 PM_ERR_ARGUMENT_CONFLICT_STAR_STAR,
44 PM_ERR_ARGUMENT_FORMAL_CLASS,
45 PM_ERR_ARGUMENT_FORMAL_CONSTANT,
46 PM_ERR_ARGUMENT_FORMAL_GLOBAL,
47 PM_ERR_ARGUMENT_FORMAL_IVAR,
48 PM_ERR_ARGUMENT_FORWARDING_UNBOUND,
49 PM_ERR_ARGUMENT_NO_FORWARDING_AMPERSAND,
50 PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES,
51 PM_ERR_ARGUMENT_NO_FORWARDING_STAR,
52 PM_ERR_ARGUMENT_NO_FORWARDING_STAR_STAR,
53 PM_ERR_ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT,
54 PM_ERR_ARGUMENT_SPLAT_AFTER_SPLAT,
55 PM_ERR_ARGUMENT_TERM_PAREN,
56 PM_ERR_ARGUMENT_UNEXPECTED_BLOCK,
57 PM_ERR_ARRAY_ELEMENT,
58 PM_ERR_ARRAY_EXPRESSION,
59 PM_ERR_ARRAY_EXPRESSION_AFTER_STAR,
60 PM_ERR_ARRAY_SEPARATOR,
61 PM_ERR_ARRAY_TERM,
62 PM_ERR_BEGIN_LONELY_ELSE,
63 PM_ERR_BEGIN_TERM,
64 PM_ERR_BEGIN_UPCASE_BRACE,
65 PM_ERR_BEGIN_UPCASE_TERM,
66 PM_ERR_BEGIN_UPCASE_TOPLEVEL,
67 PM_ERR_BLOCK_PARAM_LOCAL_VARIABLE,
68 PM_ERR_BLOCK_PARAM_PIPE_TERM,
69 PM_ERR_BLOCK_TERM_BRACE,
70 PM_ERR_BLOCK_TERM_END,
71 PM_ERR_CANNOT_PARSE_EXPRESSION,
72 PM_ERR_CANNOT_PARSE_STRING_PART,
73 PM_ERR_CASE_EXPRESSION_AFTER_CASE,
74 PM_ERR_CASE_EXPRESSION_AFTER_WHEN,
75 PM_ERR_CASE_MATCH_MISSING_PREDICATE,
76 PM_ERR_CASE_MISSING_CONDITIONS,
77 PM_ERR_CASE_TERM,
78 PM_ERR_CLASS_IN_METHOD,
79 PM_ERR_CLASS_NAME,
80 PM_ERR_CLASS_SUPERCLASS,
81 PM_ERR_CLASS_TERM,
82 PM_ERR_CLASS_UNEXPECTED_END,
83 PM_ERR_CLASS_VARIABLE_BARE,
84 PM_ERR_CONDITIONAL_ELSIF_PREDICATE,
85 PM_ERR_CONDITIONAL_IF_PREDICATE,
86 PM_ERR_CONDITIONAL_PREDICATE_TERM,
87 PM_ERR_CONDITIONAL_TERM,
88 PM_ERR_CONDITIONAL_TERM_ELSE,
89 PM_ERR_CONDITIONAL_UNLESS_PREDICATE,
90 PM_ERR_CONDITIONAL_UNTIL_PREDICATE,
91 PM_ERR_CONDITIONAL_WHILE_PREDICATE,
92 PM_ERR_CONSTANT_PATH_COLON_COLON_CONSTANT,
93 PM_ERR_DEF_ENDLESS,
94 PM_ERR_DEF_ENDLESS_SETTER,
95 PM_ERR_DEF_NAME,
96 PM_ERR_DEF_PARAMS_TERM,
97 PM_ERR_DEF_PARAMS_TERM_PAREN,
98 PM_ERR_DEF_RECEIVER,
99 PM_ERR_DEF_RECEIVER_TERM,
100 PM_ERR_DEF_TERM,
101 PM_ERR_DEFINED_EXPRESSION,
102 PM_ERR_EMBDOC_TERM,
103 PM_ERR_EMBEXPR_END,
104 PM_ERR_EMBVAR_INVALID,
105 PM_ERR_END_UPCASE_BRACE,
106 PM_ERR_END_UPCASE_TERM,
107 PM_ERR_ESCAPE_INVALID_CONTROL,
108 PM_ERR_ESCAPE_INVALID_CONTROL_REPEAT,
109 PM_ERR_ESCAPE_INVALID_HEXADECIMAL,
110 PM_ERR_ESCAPE_INVALID_META,
111 PM_ERR_ESCAPE_INVALID_META_REPEAT,
112 PM_ERR_ESCAPE_INVALID_UNICODE,
113 PM_ERR_ESCAPE_INVALID_UNICODE_CM_FLAGS,
114 PM_ERR_ESCAPE_INVALID_UNICODE_LIST,
115 PM_ERR_ESCAPE_INVALID_UNICODE_LITERAL,
116 PM_ERR_ESCAPE_INVALID_UNICODE_LONG,
117 PM_ERR_ESCAPE_INVALID_UNICODE_SHORT,
118 PM_ERR_ESCAPE_INVALID_UNICODE_TERM,
119 PM_ERR_EXPECT_ARGUMENT,
120 PM_ERR_EXPECT_EOL_AFTER_STATEMENT,
121 PM_ERR_EXPECT_EXPRESSION_AFTER_AMPAMPEQ,
122 PM_ERR_EXPECT_EXPRESSION_AFTER_COMMA,
123 PM_ERR_EXPECT_EXPRESSION_AFTER_EQUAL,
124 PM_ERR_EXPECT_EXPRESSION_AFTER_LESS_LESS,
125 PM_ERR_EXPECT_EXPRESSION_AFTER_LPAREN,
126 PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR,
127 PM_ERR_EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ,
128 PM_ERR_EXPECT_EXPRESSION_AFTER_QUESTION,
129 PM_ERR_EXPECT_EXPRESSION_AFTER_SPLAT,
130 PM_ERR_EXPECT_EXPRESSION_AFTER_SPLAT_HASH,
131 PM_ERR_EXPECT_EXPRESSION_AFTER_STAR,
132 PM_ERR_EXPECT_FOR_DELIMITER,
133 PM_ERR_EXPECT_IDENT_REQ_PARAMETER,
134 PM_ERR_EXPECT_IN_DELIMITER,
135 PM_ERR_EXPECT_LPAREN_AFTER_NOT_LPAREN,
136 PM_ERR_EXPECT_LPAREN_AFTER_NOT_OTHER,
137 PM_ERR_EXPECT_LPAREN_REQ_PARAMETER,
138 PM_ERR_EXPECT_MESSAGE,
139 PM_ERR_EXPECT_RBRACKET,
140 PM_ERR_EXPECT_RPAREN,
141 PM_ERR_EXPECT_RPAREN_AFTER_MULTI,
142 PM_ERR_EXPECT_RPAREN_REQ_PARAMETER,
143 PM_ERR_EXPECT_SINGLETON_CLASS_DELIMITER,
144 PM_ERR_EXPECT_STRING_CONTENT,
145 PM_ERR_EXPECT_WHEN_DELIMITER,
146 PM_ERR_EXPRESSION_BARE_HASH,
147 PM_ERR_EXPRESSION_NOT_WRITABLE,
148 PM_ERR_EXPRESSION_NOT_WRITABLE_ENCODING,
149 PM_ERR_EXPRESSION_NOT_WRITABLE_FALSE,
150 PM_ERR_EXPRESSION_NOT_WRITABLE_FILE,
151 PM_ERR_EXPRESSION_NOT_WRITABLE_LINE,
152 PM_ERR_EXPRESSION_NOT_WRITABLE_NIL,
153 PM_ERR_EXPRESSION_NOT_WRITABLE_NUMBERED,
154 PM_ERR_EXPRESSION_NOT_WRITABLE_SELF,
155 PM_ERR_EXPRESSION_NOT_WRITABLE_TRUE,
156 PM_ERR_FLOAT_PARSE,
157 PM_ERR_FOR_COLLECTION,
158 PM_ERR_FOR_IN,
159 PM_ERR_FOR_INDEX,
160 PM_ERR_FOR_TERM,
161 PM_ERR_GLOBAL_VARIABLE_BARE,
162 PM_ERR_HASH_EXPRESSION_AFTER_LABEL,
163 PM_ERR_HASH_KEY,
164 PM_ERR_HASH_ROCKET,
165 PM_ERR_HASH_TERM,
166 PM_ERR_HASH_VALUE,
167 PM_ERR_HEREDOC_IDENTIFIER,
168 PM_ERR_HEREDOC_TERM,
169 PM_ERR_INCOMPLETE_QUESTION_MARK,
170 PM_ERR_INCOMPLETE_VARIABLE_CLASS,
171 PM_ERR_INCOMPLETE_VARIABLE_CLASS_3_3,
172 PM_ERR_INCOMPLETE_VARIABLE_INSTANCE,
173 PM_ERR_INCOMPLETE_VARIABLE_INSTANCE_3_3,
174 PM_ERR_INSTANCE_VARIABLE_BARE,
175 PM_ERR_INVALID_BLOCK_EXIT,
176 PM_ERR_INVALID_CHARACTER,
177 PM_ERR_INVALID_COMMA,
178 PM_ERR_INVALID_ENCODING_MAGIC_COMMENT,
179 PM_ERR_INVALID_ESCAPE_CHARACTER,
180 PM_ERR_INVALID_FLOAT_EXPONENT,
181 PM_ERR_INVALID_LOCAL_VARIABLE_READ,
182 PM_ERR_INVALID_LOCAL_VARIABLE_WRITE,
183 PM_ERR_INVALID_MULTIBYTE_CHAR,
184 PM_ERR_INVALID_MULTIBYTE_CHARACTER,
185 PM_ERR_INVALID_MULTIBYTE_ESCAPE,
186 PM_ERR_INVALID_NUMBER_BINARY,
187 PM_ERR_INVALID_NUMBER_DECIMAL,
188 PM_ERR_INVALID_NUMBER_FRACTION,
189 PM_ERR_INVALID_NUMBER_HEXADECIMAL,
190 PM_ERR_INVALID_NUMBER_OCTAL,
191 PM_ERR_INVALID_NUMBER_UNDERSCORE_INNER,
192 PM_ERR_INVALID_NUMBER_UNDERSCORE_TRAILING,
193 PM_ERR_INVALID_PERCENT,
194 PM_ERR_INVALID_PERCENT_EOF,
195 PM_ERR_INVALID_PRINTABLE_CHARACTER,
196 PM_ERR_INVALID_RETRY_AFTER_ELSE,
197 PM_ERR_INVALID_RETRY_AFTER_ENSURE,
198 PM_ERR_INVALID_RETRY_WITHOUT_RESCUE,
199 PM_ERR_INVALID_SYMBOL,
200 PM_ERR_INVALID_VARIABLE_GLOBAL,
201 PM_ERR_INVALID_VARIABLE_GLOBAL_3_3,
202 PM_ERR_INVALID_YIELD,
203 PM_ERR_IT_NOT_ALLOWED_NUMBERED,
204 PM_ERR_IT_NOT_ALLOWED_ORDINARY,
205 PM_ERR_LAMBDA_OPEN,
206 PM_ERR_LAMBDA_TERM_BRACE,
207 PM_ERR_LAMBDA_TERM_END,
208 PM_ERR_LIST_I_LOWER_ELEMENT,
209 PM_ERR_LIST_I_LOWER_TERM,
210 PM_ERR_LIST_I_UPPER_ELEMENT,
211 PM_ERR_LIST_I_UPPER_TERM,
212 PM_ERR_LIST_W_LOWER_ELEMENT,
213 PM_ERR_LIST_W_LOWER_TERM,
214 PM_ERR_LIST_W_UPPER_ELEMENT,
215 PM_ERR_LIST_W_UPPER_TERM,
216 PM_ERR_MALLOC_FAILED,
217 PM_ERR_MIXED_ENCODING,
218 PM_ERR_MODULE_IN_METHOD,
219 PM_ERR_MODULE_NAME,
220 PM_ERR_MODULE_TERM,
221 PM_ERR_MULTI_ASSIGN_MULTI_SPLATS,
222 PM_ERR_MULTI_ASSIGN_UNEXPECTED_REST,
223 PM_ERR_NESTING_TOO_DEEP,
224 PM_ERR_NO_LOCAL_VARIABLE,
225 PM_ERR_NON_ASSOCIATIVE_OPERATOR,
226 PM_ERR_NOT_EXPRESSION,
227 PM_ERR_NUMBER_LITERAL_UNDERSCORE,
228 PM_ERR_NUMBERED_PARAMETER_INNER_BLOCK,
229 PM_ERR_NUMBERED_PARAMETER_IT,
230 PM_ERR_NUMBERED_PARAMETER_ORDINARY,
231 PM_ERR_NUMBERED_PARAMETER_OUTER_BLOCK,
232 PM_ERR_OPERATOR_MULTI_ASSIGN,
233 PM_ERR_OPERATOR_WRITE_ARGUMENTS,
234 PM_ERR_OPERATOR_WRITE_BLOCK,
235 PM_ERR_PARAMETER_ASSOC_SPLAT_MULTI,
236 PM_ERR_PARAMETER_BLOCK_MULTI,
237 PM_ERR_PARAMETER_CIRCULAR,
238 PM_ERR_PARAMETER_FORWARDING_AFTER_REST,
239 PM_ERR_PARAMETER_METHOD_NAME,
240 PM_ERR_PARAMETER_NAME_DUPLICATED,
241 PM_ERR_PARAMETER_NO_DEFAULT,
242 PM_ERR_PARAMETER_NO_DEFAULT_KW,
243 PM_ERR_PARAMETER_NUMBERED_RESERVED,
244 PM_ERR_PARAMETER_ORDER,
245 PM_ERR_PARAMETER_SPLAT_MULTI,
246 PM_ERR_PARAMETER_STAR,
247 PM_ERR_PARAMETER_UNEXPECTED_FWD,
248 PM_ERR_PARAMETER_UNEXPECTED_NO_KW,
249 PM_ERR_PARAMETER_WILD_LOOSE_COMMA,
250 PM_ERR_PATTERN_ARRAY_MULTIPLE_RESTS,
251 PM_ERR_PATTERN_CAPTURE_DUPLICATE,
252 PM_ERR_PATTERN_EXPRESSION_AFTER_BRACKET,
253 PM_ERR_PATTERN_EXPRESSION_AFTER_COMMA,
254 PM_ERR_PATTERN_EXPRESSION_AFTER_HROCKET,
255 PM_ERR_PATTERN_EXPRESSION_AFTER_IN,
256 PM_ERR_PATTERN_EXPRESSION_AFTER_KEY,
257 PM_ERR_PATTERN_EXPRESSION_AFTER_PAREN,
258 PM_ERR_PATTERN_EXPRESSION_AFTER_PIN,
259 PM_ERR_PATTERN_EXPRESSION_AFTER_PIPE,
260 PM_ERR_PATTERN_EXPRESSION_AFTER_RANGE,
261 PM_ERR_PATTERN_EXPRESSION_AFTER_REST,
262 PM_ERR_PATTERN_FIND_MISSING_INNER,
263 PM_ERR_PATTERN_HASH_IMPLICIT,
264 PM_ERR_PATTERN_HASH_KEY,
265 PM_ERR_PATTERN_HASH_KEY_DUPLICATE,
266 PM_ERR_PATTERN_HASH_KEY_INTERPOLATED,
267 PM_ERR_PATTERN_HASH_KEY_LABEL,
268 PM_ERR_PATTERN_HASH_KEY_LOCALS,
269 PM_ERR_PATTERN_IDENT_AFTER_HROCKET,
270 PM_ERR_PATTERN_LABEL_AFTER_COMMA,
271 PM_ERR_PATTERN_REST,
272 PM_ERR_PATTERN_TERM_BRACE,
273 PM_ERR_PATTERN_TERM_BRACKET,
274 PM_ERR_PATTERN_TERM_PAREN,
275 PM_ERR_PIPEPIPEEQ_MULTI_ASSIGN,
276 PM_ERR_REGEXP_ENCODING_OPTION_MISMATCH,
277 PM_ERR_REGEXP_INCOMPAT_CHAR_ENCODING,
278 PM_ERR_REGEXP_INVALID_UNICODE_RANGE,
279 PM_ERR_REGEXP_NON_ESCAPED_MBC,
280 PM_ERR_REGEXP_PARSE_ERROR,
281 PM_ERR_REGEXP_TERM,
282 PM_ERR_REGEXP_UNKNOWN_OPTIONS,
283 PM_ERR_REGEXP_UTF8_CHAR_NON_UTF8_REGEXP,
284 PM_ERR_RESCUE_EXPRESSION,
285 PM_ERR_RESCUE_MODIFIER_VALUE,
286 PM_ERR_RESCUE_TERM,
287 PM_ERR_RESCUE_VARIABLE,
288 PM_ERR_RETURN_INVALID,
289 PM_ERR_SCRIPT_NOT_FOUND,
290 PM_ERR_SINGLETON_FOR_LITERALS,
291 PM_ERR_STATEMENT_ALIAS,
292 PM_ERR_STATEMENT_POSTEXE_END,
293 PM_ERR_STATEMENT_PREEXE_BEGIN,
294 PM_ERR_STATEMENT_UNDEF,
295 PM_ERR_STRING_CONCATENATION,
296 PM_ERR_STRING_INTERPOLATED_TERM,
297 PM_ERR_STRING_LITERAL_EOF,
298 PM_ERR_STRING_LITERAL_TERM,
299 PM_ERR_SYMBOL_INVALID,
300 PM_ERR_SYMBOL_TERM_DYNAMIC,
301 PM_ERR_SYMBOL_TERM_INTERPOLATED,
302 PM_ERR_TERNARY_COLON,
303 PM_ERR_TERNARY_EXPRESSION_FALSE,
304 PM_ERR_TERNARY_EXPRESSION_TRUE,
305 PM_ERR_UNARY_DISALLOWED,
306 PM_ERR_UNARY_RECEIVER,
307 PM_ERR_UNDEF_ARGUMENT,
308 PM_ERR_UNEXPECTED_BLOCK_ARGUMENT,
309 PM_ERR_UNEXPECTED_INDEX_BLOCK,
310 PM_ERR_UNEXPECTED_INDEX_KEYWORDS,
311 PM_ERR_UNEXPECTED_LABEL,
312 PM_ERR_UNEXPECTED_MULTI_WRITE,
313 PM_ERR_UNEXPECTED_RANGE_OPERATOR,
314 PM_ERR_UNEXPECTED_SAFE_NAVIGATION,
315 PM_ERR_UNEXPECTED_TOKEN_CLOSE_CONTEXT,
316 PM_ERR_UNEXPECTED_TOKEN_IGNORE,
317 PM_ERR_UNTIL_TERM,
318 PM_ERR_VOID_EXPRESSION,
319 PM_ERR_WHILE_TERM,
320 PM_ERR_WRITE_TARGET_IN_METHOD,
321 PM_ERR_WRITE_TARGET_READONLY,
322 PM_ERR_WRITE_TARGET_UNEXPECTED,
323 PM_ERR_XSTRING_TERM,
324
325 // These are the warning diagnostics.
326 PM_WARN_AMBIGUOUS_BINARY_OPERATOR,
327 PM_WARN_AMBIGUOUS_FIRST_ARGUMENT_MINUS,
328 PM_WARN_AMBIGUOUS_FIRST_ARGUMENT_PLUS,
329 PM_WARN_AMBIGUOUS_PREFIX_AMPERSAND,
330 PM_WARN_AMBIGUOUS_PREFIX_STAR,
331 PM_WARN_AMBIGUOUS_PREFIX_STAR_STAR,
332 PM_WARN_AMBIGUOUS_SLASH,
333 PM_WARN_COMPARISON_AFTER_COMPARISON,
334 PM_WARN_DOT_DOT_DOT_EOL,
335 PM_WARN_EQUAL_IN_CONDITIONAL,
336 PM_WARN_EQUAL_IN_CONDITIONAL_3_3,
337 PM_WARN_END_IN_METHOD,
338 PM_WARN_DUPLICATED_HASH_KEY,
339 PM_WARN_DUPLICATED_WHEN_CLAUSE,
340 PM_WARN_FLOAT_OUT_OF_RANGE,
341 PM_WARN_IGNORED_FROZEN_STRING_LITERAL,
342 PM_WARN_INDENTATION_MISMATCH,
343 PM_WARN_INTEGER_IN_FLIP_FLOP,
344 PM_WARN_INVALID_CHARACTER,
345 PM_WARN_INVALID_MAGIC_COMMENT_VALUE,
346 PM_WARN_INVALID_NUMBERED_REFERENCE,
347 PM_WARN_KEYWORD_EOL,
348 PM_WARN_LITERAL_IN_CONDITION_DEFAULT,
349 PM_WARN_LITERAL_IN_CONDITION_VERBOSE,
350 PM_WARN_SHAREABLE_CONSTANT_VALUE_LINE,
351 PM_WARN_SHEBANG_CARRIAGE_RETURN,
352 PM_WARN_UNEXPECTED_CARRIAGE_RETURN,
353 PM_WARN_UNREACHABLE_STATEMENT,
354 PM_WARN_UNUSED_LOCAL_VARIABLE,
355 PM_WARN_VOID_STATEMENT,
356} pm_diagnostic_id_t;
357
363 typedef struct {
365 pm_list_node_t node;
366
368 pm_location_t location;
369
371 pm_diagnostic_id_t diag_id;
372
374 const char *message;
375
381 bool owned;
382
387 uint8_t level;
388} pm_diagnostic_t;
389
393 typedef enum {
395 PM_ERROR_LEVEL_SYNTAX = 0,
396
398 PM_ERROR_LEVEL_ARGUMENT = 1,
399
401 PM_ERROR_LEVEL_LOAD = 2
402} pm_error_level_t;
403
407 typedef enum {
409 PM_WARNING_LEVEL_DEFAULT = 0,
410
412 PM_WARNING_LEVEL_VERBOSE = 1
413} pm_warning_level_t;
414
421const char * pm_diagnostic_id_human(pm_diagnostic_id_t diag_id);
422
433bool pm_diagnostic_list_append(pm_list_t *list, const uint8_t *start, const uint8_t *end, pm_diagnostic_id_t diag_id);
434
446bool pm_diagnostic_list_append_format(pm_list_t *list, const uint8_t *start, const uint8_t *end, pm_diagnostic_id_t diag_id, ...);
447
453void pm_diagnostic_list_free(pm_list_t *list);
454
455#endif
assert.h
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:837
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:793
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:31
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:772
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:422
pm_warning_level_t
pm_warning_level_t
The levels of warnings generated during parsing.
Definition diagnostic.h:407
PM_WARNING_LEVEL_DEFAULT
@ PM_WARNING_LEVEL_DEFAULT
For warnings which should be emitted if $VERBOSE != nil.
Definition diagnostic.h:409
PM_WARNING_LEVEL_VERBOSE
@ PM_WARNING_LEVEL_VERBOSE
For warnings which should be emitted if $VERBOSE == true.
Definition diagnostic.h:412
pm_error_level_t
pm_error_level_t
The levels of errors generated during parsing.
Definition diagnostic.h:393
PM_ERROR_LEVEL_ARGUMENT
@ PM_ERROR_LEVEL_ARGUMENT
For errors that should raise an argument error.
Definition diagnostic.h:398
PM_ERROR_LEVEL_LOAD
@ PM_ERROR_LEVEL_LOAD
For errors that should raise a load error.
Definition diagnostic.h:401
PM_ERROR_LEVEL_SYNTAX
@ PM_ERROR_LEVEL_SYNTAX
For errors that should raise a syntax error.
Definition diagnostic.h:395
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:363
pm_diagnostic_t::location
pm_location_t location
The location of the diagnostic in the source.
Definition diagnostic.h:368
pm_diagnostic_t::message
const char * message
The message associated with the diagnostic.
Definition diagnostic.h:374
pm_diagnostic_t::node
pm_list_node_t node
The embedded base node.
Definition diagnostic.h:365
pm_diagnostic_t::diag_id
pm_diagnostic_id_t diag_id
The ID of the diagnostic.
Definition diagnostic.h:371
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:381
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:387
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:544