prism 0.18.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -1
  3. data/README.md +2 -1
  4. data/config.yml +188 -55
  5. data/docs/building.md +9 -2
  6. data/docs/configuration.md +10 -9
  7. data/docs/encoding.md +24 -56
  8. data/docs/local_variable_depth.md +229 -0
  9. data/docs/ruby_api.md +2 -0
  10. data/docs/serialization.md +18 -13
  11. data/ext/prism/api_node.c +337 -195
  12. data/ext/prism/extconf.rb +13 -7
  13. data/ext/prism/extension.c +96 -32
  14. data/ext/prism/extension.h +1 -1
  15. data/include/prism/ast.h +340 -137
  16. data/include/prism/defines.h +17 -0
  17. data/include/prism/diagnostic.h +11 -5
  18. data/include/prism/encoding.h +248 -0
  19. data/include/prism/options.h +2 -2
  20. data/include/prism/parser.h +62 -42
  21. data/include/prism/regexp.h +2 -2
  22. data/include/prism/util/pm_buffer.h +9 -1
  23. data/include/prism/util/pm_memchr.h +2 -2
  24. data/include/prism/util/pm_strpbrk.h +3 -3
  25. data/include/prism/version.h +2 -2
  26. data/include/prism.h +13 -15
  27. data/lib/prism/compiler.rb +12 -0
  28. data/lib/prism/debug.rb +9 -4
  29. data/lib/prism/desugar_compiler.rb +3 -3
  30. data/lib/prism/dispatcher.rb +56 -0
  31. data/lib/prism/dot_visitor.rb +476 -198
  32. data/lib/prism/dsl.rb +66 -46
  33. data/lib/prism/ffi.rb +16 -3
  34. data/lib/prism/lex_compat.rb +19 -9
  35. data/lib/prism/mutation_compiler.rb +20 -0
  36. data/lib/prism/node.rb +1173 -450
  37. data/lib/prism/node_ext.rb +41 -16
  38. data/lib/prism/parse_result.rb +12 -15
  39. data/lib/prism/ripper_compat.rb +49 -34
  40. data/lib/prism/serialize.rb +242 -212
  41. data/lib/prism/visitor.rb +12 -0
  42. data/lib/prism.rb +20 -4
  43. data/prism.gemspec +4 -10
  44. data/rbi/prism.rbi +605 -230
  45. data/rbi/prism_static.rbi +3 -0
  46. data/sig/prism.rbs +379 -124
  47. data/sig/prism_static.rbs +1 -0
  48. data/src/diagnostic.c +228 -222
  49. data/src/encoding.c +5137 -0
  50. data/src/node.c +66 -0
  51. data/src/options.c +21 -2
  52. data/src/prettyprint.c +806 -406
  53. data/src/prism.c +1092 -700
  54. data/src/regexp.c +3 -3
  55. data/src/serialize.c +227 -157
  56. data/src/util/pm_buffer.c +10 -1
  57. data/src/util/pm_memchr.c +1 -1
  58. data/src/util/pm_strpbrk.c +4 -4
  59. metadata +5 -11
  60. data/include/prism/enc/pm_encoding.h +0 -227
  61. data/src/enc/pm_big5.c +0 -116
  62. data/src/enc/pm_cp51932.c +0 -57
  63. data/src/enc/pm_euc_jp.c +0 -69
  64. data/src/enc/pm_gbk.c +0 -65
  65. data/src/enc/pm_shift_jis.c +0 -57
  66. data/src/enc/pm_tables.c +0 -2073
  67. data/src/enc/pm_unicode.c +0 -2369
  68. data/src/enc/pm_windows_31j.c +0 -57
data/sig/prism_static.rbs CHANGED
@@ -21,6 +21,7 @@ module Prism
21
21
  def child_nodes: () -> Array[Node?]
22
22
  def location: () -> Location
23
23
  def slice: () -> String
24
+ def to_dot: () -> String
24
25
  end
25
26
 
26
27
  class Comment
data/src/diagnostic.c CHANGED
@@ -5,32 +5,33 @@
5
5
  *
6
6
  * When composing an error message, use sentence fragments.
7
7
  *
8
- * Try describing the property of the code that caused the error, rather than the rule that is being
9
- * violated. It may help to use a fragment that completes a sentence beginning, "The parser
10
- * encountered (a) ...". If appropriate, add a description of the rule violation (or other helpful
11
- * context) after a semicolon.
8
+ * Try describing the property of the code that caused the error, rather than
9
+ * the rule that is being violated. It may help to use a fragment that completes
10
+ * a sentence beginning, "the parser encountered (a) ...". If appropriate, add a
11
+ * description of the rule violation (or other helpful context) after a
12
+ * semicolon.
12
13
  *
13
- * For example:, instead of "Control escape sequence cannot be doubled", prefer:
14
+ * For example:, instead of "control escape sequence cannot be doubled", prefer:
14
15
  *
15
- * > "Invalid control escape sequence; control cannot be repeated"
16
+ * > "invalid control escape sequence; control cannot be repeated"
16
17
  *
17
- * In some cases, where the failure is more general or syntax expectations are violated, it may make
18
- * more sense to use a fragment that completes a sentence beginning, "The parser ...".
18
+ * In some cases, where the failure is more general or syntax expectations are
19
+ * violated, it may make more sense to use a fragment that completes a sentence
20
+ * beginning, "the parser ...".
19
21
  *
20
22
  * For example:
21
23
  *
22
- * > "Expected an expression after `(`"
23
- * > "Cannot parse the expression"
24
- *
24
+ * > "expected an expression after `(`"
25
+ * > "cannot parse the expression"
25
26
  *
26
27
  * ## Message style guide
27
28
  *
28
29
  * - Use articles like "a", "an", and "the" when appropriate.
29
- * - e.g., prefer "Cannot parse the expression" to "Cannot parse expression".
30
+ * - e.g., prefer "cannot parse the expression" to "cannot parse expression".
30
31
  * - Use the common name for tokens and nodes.
31
32
  * - e.g., prefer "keyword splat" to "assoc splat"
32
33
  * - e.g., prefer "embedded document" to "embdoc"
33
- * - Capitalize the initial word of the message.
34
+ * - Do not capitalize the initial word of the message.
34
35
  * - Use back ticks around token literals
35
36
  * - e.g., "Expected a `=>` between the hash key and value"
36
37
  * - Do not use `.` or other punctuation at the end of the message.
@@ -38,7 +39,6 @@
38
39
  * - For tokens that can have multiple meanings, reference the token and its meaning.
39
40
  * - e.g., "`*` splat argument" is clearer and more complete than "splat argument" or "`*` argument"
40
41
  *
41
- *
42
42
  * ## Error names (PM_ERR_*)
43
43
  *
44
44
  * - When appropriate, prefer node name to token name.
@@ -51,211 +51,219 @@
51
51
  * sorted. See PM_ERR_ARGUMENT_NO_FORWARDING_* for an example.
52
52
  */
53
53
  static const char* const diagnostic_messages[PM_DIAGNOSTIC_ID_LEN] = {
54
- [PM_ERR_ALIAS_ARGUMENT] = "Invalid argument being passed to `alias`; expected a bare word, symbol, constant, or global variable",
55
- [PM_ERR_AMPAMPEQ_MULTI_ASSIGN] = "Unexpected `&&=` in a multiple assignment",
56
- [PM_ERR_ARGUMENT_AFTER_BLOCK] = "Unexpected argument after a block argument",
57
- [PM_ERR_ARGUMENT_AFTER_FORWARDING_ELLIPSES] = "Unexpected argument after `...`",
58
- [PM_ERR_ARGUMENT_BARE_HASH] = "Unexpected bare hash argument",
59
- [PM_ERR_ARGUMENT_BLOCK_MULTI] = "Multiple block arguments; only one block is allowed",
60
- [PM_ERR_ARGUMENT_FORMAL_CLASS] = "Invalid formal argument; formal argument cannot be a class variable",
61
- [PM_ERR_ARGUMENT_FORMAL_CONSTANT] = "Invalid formal argument; formal argument cannot be a constant",
62
- [PM_ERR_ARGUMENT_FORMAL_GLOBAL] = "Invalid formal argument; formal argument cannot be a global variable",
63
- [PM_ERR_ARGUMENT_FORMAL_IVAR] = "Invalid formal argument; formal argument cannot be an instance variable",
64
- [PM_ERR_ARGUMENT_FORWARDING_UNBOUND] = "Unexpected `...` in an non-parenthesized call",
65
- [PM_ERR_ARGUMENT_NO_FORWARDING_AMP] = "Unexpected `&` when the parent method is not forwarding",
66
- [PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES] = "Unexpected `...` when the parent method is not forwarding",
67
- [PM_ERR_ARGUMENT_NO_FORWARDING_STAR] = "Unexpected `*` when the parent method is not forwarding",
68
- [PM_ERR_ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT] = "Unexpected `*` splat argument after a `**` keyword splat argument",
69
- [PM_ERR_ARGUMENT_SPLAT_AFTER_SPLAT] = "Unexpected `*` splat argument after a `*` splat argument",
70
- [PM_ERR_ARGUMENT_TERM_PAREN] = "Expected a `)` to close the arguments",
71
- [PM_ERR_ARGUMENT_UNEXPECTED_BLOCK] = "Unexpected `{` after a method call without parenthesis",
72
- [PM_ERR_ARRAY_ELEMENT] = "Expected an element for the array",
73
- [PM_ERR_ARRAY_EXPRESSION] = "Expected an expression for the array element",
74
- [PM_ERR_ARRAY_EXPRESSION_AFTER_STAR] = "Expected an expression after `*` in the array",
75
- [PM_ERR_ARRAY_SEPARATOR] = "Expected a `,` separator for the array elements",
76
- [PM_ERR_ARRAY_TERM] = "Expected a `]` to close the array",
77
- [PM_ERR_BEGIN_LONELY_ELSE] = "Unexpected `else` in `begin` block; a `rescue` clause must precede `else`",
78
- [PM_ERR_BEGIN_TERM] = "Expected an `end` to close the `begin` statement",
79
- [PM_ERR_BEGIN_UPCASE_BRACE] = "Expected a `{` after `BEGIN`",
80
- [PM_ERR_BEGIN_UPCASE_TERM] = "Expected a `}` to close the `BEGIN` statement",
54
+ [PM_ERR_ALIAS_ARGUMENT] = "invalid argument being passed to `alias`; expected a bare word, symbol, constant, or global variable",
55
+ [PM_ERR_AMPAMPEQ_MULTI_ASSIGN] = "unexpected `&&=` in a multiple assignment",
56
+ [PM_ERR_ARGUMENT_AFTER_BLOCK] = "unexpected argument after a block argument",
57
+ [PM_ERR_ARGUMENT_AFTER_FORWARDING_ELLIPSES] = "unexpected argument after `...`",
58
+ [PM_ERR_ARGUMENT_BARE_HASH] = "unexpected bare hash argument",
59
+ [PM_ERR_ARGUMENT_BLOCK_MULTI] = "multiple block arguments; only one block is allowed",
60
+ [PM_ERR_ARGUMENT_FORMAL_CLASS] = "invalid formal argument; formal argument cannot be a class variable",
61
+ [PM_ERR_ARGUMENT_FORMAL_CONSTANT] = "invalid formal argument; formal argument cannot be a constant",
62
+ [PM_ERR_ARGUMENT_FORMAL_GLOBAL] = "invalid formal argument; formal argument cannot be a global variable",
63
+ [PM_ERR_ARGUMENT_FORMAL_IVAR] = "invalid formal argument; formal argument cannot be an instance variable",
64
+ [PM_ERR_ARGUMENT_FORWARDING_UNBOUND] = "unexpected `...` in an non-parenthesized call",
65
+ [PM_ERR_ARGUMENT_NO_FORWARDING_AMP] = "unexpected `&` when the parent method is not forwarding",
66
+ [PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES] = "unexpected `...` when the parent method is not forwarding",
67
+ [PM_ERR_ARGUMENT_NO_FORWARDING_STAR] = "unexpected `*` when the parent method is not forwarding",
68
+ [PM_ERR_ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT] = "unexpected `*` splat argument after a `**` keyword splat argument",
69
+ [PM_ERR_ARGUMENT_SPLAT_AFTER_SPLAT] = "unexpected `*` splat argument after a `*` splat argument",
70
+ [PM_ERR_ARGUMENT_TERM_PAREN] = "expected a `)` to close the arguments",
71
+ [PM_ERR_ARGUMENT_UNEXPECTED_BLOCK] = "unexpected `{` after a method call without parenthesis",
72
+ [PM_ERR_ARRAY_ELEMENT] = "expected an element for the array",
73
+ [PM_ERR_ARRAY_EXPRESSION] = "expected an expression for the array element",
74
+ [PM_ERR_ARRAY_EXPRESSION_AFTER_STAR] = "expected an expression after `*` in the array",
75
+ [PM_ERR_ARRAY_SEPARATOR] = "expected a `,` separator for the array elements",
76
+ [PM_ERR_ARRAY_TERM] = "expected a `]` to close the array",
77
+ [PM_ERR_BEGIN_LONELY_ELSE] = "unexpected `else` in `begin` block; a `rescue` clause must precede `else`",
78
+ [PM_ERR_BEGIN_TERM] = "expected an `end` to close the `begin` statement",
79
+ [PM_ERR_BEGIN_UPCASE_BRACE] = "expected a `{` after `BEGIN`",
80
+ [PM_ERR_BEGIN_UPCASE_TERM] = "expected a `}` to close the `BEGIN` statement",
81
81
  [PM_ERR_BEGIN_UPCASE_TOPLEVEL] = "BEGIN is permitted only at toplevel",
82
- [PM_ERR_BLOCK_PARAM_LOCAL_VARIABLE] = "Expected a local variable name in the block parameters",
83
- [PM_ERR_BLOCK_PARAM_PIPE_TERM] = "Expected the block parameters to end with `|`",
84
- [PM_ERR_BLOCK_TERM_BRACE] = "Expected a block beginning with `{` to end with `}`",
85
- [PM_ERR_BLOCK_TERM_END] = "Expected a block beginning with `do` to end with `end`",
86
- [PM_ERR_CANNOT_PARSE_EXPRESSION] = "Cannot parse the expression",
87
- [PM_ERR_CANNOT_PARSE_STRING_PART] = "Cannot parse the string part",
88
- [PM_ERR_CASE_EXPRESSION_AFTER_CASE] = "Expected an expression after `case`",
89
- [PM_ERR_CASE_EXPRESSION_AFTER_WHEN] = "Expected an expression after `when`",
90
- [PM_ERR_CASE_MATCH_MISSING_PREDICATE] = "Expected a predicate for a case matching statement",
91
- [PM_ERR_CASE_MISSING_CONDITIONS] = "Expected a `when` or `in` clause after `case`",
92
- [PM_ERR_CASE_TERM] = "Expected an `end` to close the `case` statement",
93
- [PM_ERR_CLASS_IN_METHOD] = "Unexpected class definition in a method body",
94
- [PM_ERR_CLASS_NAME] = "Expected a constant name after `class`",
95
- [PM_ERR_CLASS_SUPERCLASS] = "Expected a superclass after `<`",
96
- [PM_ERR_CLASS_TERM] = "Expected an `end` to close the `class` statement",
97
- [PM_ERR_CLASS_UNEXPECTED_END] = "Unexpected `end`, expecting ';' or '\n'",
98
- [PM_ERR_CONDITIONAL_ELSIF_PREDICATE] = "Expected a predicate expression for the `elsif` statement",
99
- [PM_ERR_CONDITIONAL_IF_PREDICATE] = "Expected a predicate expression for the `if` statement",
100
- [PM_ERR_CONDITIONAL_PREDICATE_TERM] = "Expected `then` or `;` or '\n'",
101
- [PM_ERR_CONDITIONAL_TERM] = "Expected an `end` to close the conditional clause",
102
- [PM_ERR_CONDITIONAL_TERM_ELSE] = "Expected an `end` to close the `else` clause",
103
- [PM_ERR_CONDITIONAL_UNLESS_PREDICATE] = "Expected a predicate expression for the `unless` statement",
104
- [PM_ERR_CONDITIONAL_UNTIL_PREDICATE] = "Expected a predicate expression for the `until` statement",
105
- [PM_ERR_CONDITIONAL_WHILE_PREDICATE] = "Expected a predicate expression for the `while` statement",
106
- [PM_ERR_CONSTANT_PATH_COLON_COLON_CONSTANT] = "Expected a constant after the `::` operator",
107
- [PM_ERR_DEF_ENDLESS] = "Could not parse the endless method body",
108
- [PM_ERR_DEF_ENDLESS_SETTER] = "Invalid method name; a setter method cannot be defined in an endless method definition",
109
- [PM_ERR_DEF_NAME] = "Expected a method name",
110
- [PM_ERR_DEF_NAME_AFTER_RECEIVER] = "Expected a method name after the receiver",
111
- [PM_ERR_DEF_PARAMS_TERM] = "Expected a delimiter to close the parameters",
112
- [PM_ERR_DEF_PARAMS_TERM_PAREN] = "Expected a `)` to close the parameters",
113
- [PM_ERR_DEF_RECEIVER] = "Expected a receiver for the method definition",
114
- [PM_ERR_DEF_RECEIVER_TERM] = "Expected a `.` or `::` after the receiver in a method definition",
115
- [PM_ERR_DEF_TERM] = "Expected an `end` to close the `def` statement",
116
- [PM_ERR_DEFINED_EXPRESSION] = "Expected an expression after `defined?`",
117
- [PM_ERR_EMBDOC_TERM] = "Could not find a terminator for the embedded document",
118
- [PM_ERR_EMBEXPR_END] = "Expected a `}` to close the embedded expression",
119
- [PM_ERR_EMBVAR_INVALID] = "Invalid embedded variable",
120
- [PM_ERR_END_UPCASE_BRACE] = "Expected a `{` after `END`",
121
- [PM_ERR_END_UPCASE_TERM] = "Expected a `}` to close the `END` statement",
122
- [PM_ERR_ESCAPE_INVALID_CONTROL] = "Invalid control escape sequence",
123
- [PM_ERR_ESCAPE_INVALID_CONTROL_REPEAT] = "Invalid control escape sequence; control cannot be repeated",
124
- [PM_ERR_ESCAPE_INVALID_HEXADECIMAL] = "Invalid hexadecimal escape sequence",
125
- [PM_ERR_ESCAPE_INVALID_META] = "Invalid meta escape sequence",
126
- [PM_ERR_ESCAPE_INVALID_META_REPEAT] = "Invalid meta escape sequence; meta cannot be repeated",
127
- [PM_ERR_ESCAPE_INVALID_UNICODE] = "Invalid Unicode escape sequence",
128
- [PM_ERR_ESCAPE_INVALID_UNICODE_CM_FLAGS] = "Invalid Unicode escape sequence; Unicode cannot be combined with control or meta flags",
129
- [PM_ERR_ESCAPE_INVALID_UNICODE_LITERAL] = "Invalid Unicode escape sequence; multiple codepoints are not allowed in a character literal",
130
- [PM_ERR_ESCAPE_INVALID_UNICODE_LONG] = "Invalid Unicode escape sequence; maximum length is 6 digits",
131
- [PM_ERR_ESCAPE_INVALID_UNICODE_TERM] = "Invalid Unicode escape sequence; needs closing `}`",
132
- [PM_ERR_EXPECT_ARGUMENT] = "Expected an argument",
133
- [PM_ERR_EXPECT_EOL_AFTER_STATEMENT] = "Expected a newline or semicolon after the statement",
134
- [PM_ERR_EXPECT_EXPRESSION_AFTER_AMPAMPEQ] = "Expected an expression after `&&=`",
135
- [PM_ERR_EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ] = "Expected an expression after `||=`",
136
- [PM_ERR_EXPECT_EXPRESSION_AFTER_COMMA] = "Expected an expression after `,`",
137
- [PM_ERR_EXPECT_EXPRESSION_AFTER_EQUAL] = "Expected an expression after `=`",
138
- [PM_ERR_EXPECT_EXPRESSION_AFTER_LESS_LESS] = "Expected an expression after `<<`",
139
- [PM_ERR_EXPECT_EXPRESSION_AFTER_LPAREN] = "Expected an expression after `(`",
140
- [PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR] = "Expected an expression after the operator",
141
- [PM_ERR_EXPECT_EXPRESSION_AFTER_SPLAT] = "Expected an expression after `*` splat in an argument",
142
- [PM_ERR_EXPECT_EXPRESSION_AFTER_SPLAT_HASH] = "Expected an expression after `**` in a hash",
143
- [PM_ERR_EXPECT_EXPRESSION_AFTER_STAR] = "Expected an expression after `*`",
144
- [PM_ERR_EXPECT_IDENT_REQ_PARAMETER] = "Expected an identifier for the required parameter",
145
- [PM_ERR_EXPECT_LPAREN_REQ_PARAMETER] = "Expected a `(` to start a required parameter",
146
- [PM_ERR_EXPECT_RBRACKET] = "Expected a matching `]`",
147
- [PM_ERR_EXPECT_RPAREN] = "Expected a matching `)`",
148
- [PM_ERR_EXPECT_RPAREN_AFTER_MULTI] = "Expected a `)` after multiple assignment",
149
- [PM_ERR_EXPECT_RPAREN_REQ_PARAMETER] = "Expected a `)` to end a required parameter",
150
- [PM_ERR_EXPECT_STRING_CONTENT] = "Expected string content after opening string delimiter",
151
- [PM_ERR_EXPECT_WHEN_DELIMITER] = "Expected a delimiter after the predicates of a `when` clause",
152
- [PM_ERR_EXPRESSION_BARE_HASH] = "Unexpected bare hash in expression",
153
- [PM_ERR_FOR_COLLECTION] = "Expected a collection after the `in` in a `for` statement",
154
- [PM_ERR_FOR_INDEX] = "Expected an index after `for`",
155
- [PM_ERR_FOR_IN] = "Expected an `in` after the index in a `for` statement",
156
- [PM_ERR_FOR_TERM] = "Expected an `end` to close the `for` loop",
157
- [PM_ERR_HASH_EXPRESSION_AFTER_LABEL] = "Expected an expression after the label in a hash",
158
- [PM_ERR_HASH_KEY] = "Expected a key in the hash literal",
159
- [PM_ERR_HASH_ROCKET] = "Expected a `=>` between the hash key and value",
160
- [PM_ERR_HASH_TERM] = "Expected a `}` to close the hash literal",
161
- [PM_ERR_HASH_VALUE] = "Expected a value in the hash literal",
162
- [PM_ERR_HEREDOC_TERM] = "Could not find a terminator for the heredoc",
163
- [PM_ERR_INCOMPLETE_QUESTION_MARK] = "Incomplete expression at `?`",
164
- [PM_ERR_INCOMPLETE_VARIABLE_CLASS] = "Incomplete class variable",
165
- [PM_ERR_INCOMPLETE_VARIABLE_INSTANCE] = "Incomplete instance variable",
166
- [PM_ERR_INVALID_ENCODING_MAGIC_COMMENT] = "Unknown or invalid encoding in the magic comment",
167
- [PM_ERR_INVALID_FLOAT_EXPONENT] = "Invalid exponent",
168
- [PM_ERR_INVALID_NUMBER_BINARY] = "Invalid binary number",
169
- [PM_ERR_INVALID_NUMBER_DECIMAL] = "Invalid decimal number",
170
- [PM_ERR_INVALID_NUMBER_HEXADECIMAL] = "Invalid hexadecimal number",
171
- [PM_ERR_INVALID_NUMBER_OCTAL] = "Invalid octal number",
172
- [PM_ERR_INVALID_NUMBER_UNDERSCORE] = "Invalid underscore placement in number",
173
- [PM_ERR_INVALID_PERCENT] = "Invalid `%` token", // TODO WHAT?
174
- [PM_ERR_INVALID_TOKEN] = "Invalid token", // TODO WHAT?
175
- [PM_ERR_INVALID_VARIABLE_GLOBAL] = "Invalid global variable",
176
- [PM_ERR_LAMBDA_OPEN] = "Expected a `do` keyword or a `{` to open the lambda block",
177
- [PM_ERR_LAMBDA_TERM_BRACE] = "Expected a lambda block beginning with `{` to end with `}`",
178
- [PM_ERR_LAMBDA_TERM_END] = "Expected a lambda block beginning with `do` to end with `end`",
179
- [PM_ERR_LIST_I_LOWER_ELEMENT] = "Expected a symbol in a `%i` list",
180
- [PM_ERR_LIST_I_LOWER_TERM] = "Expected a closing delimiter for the `%i` list",
181
- [PM_ERR_LIST_I_UPPER_ELEMENT] = "Expected a symbol in a `%I` list",
182
- [PM_ERR_LIST_I_UPPER_TERM] = "Expected a closing delimiter for the `%I` list",
183
- [PM_ERR_LIST_W_LOWER_ELEMENT] = "Expected a string in a `%w` list",
184
- [PM_ERR_LIST_W_LOWER_TERM] = "Expected a closing delimiter for the `%w` list",
185
- [PM_ERR_LIST_W_UPPER_ELEMENT] = "Expected a string in a `%W` list",
186
- [PM_ERR_LIST_W_UPPER_TERM] = "Expected a closing delimiter for the `%W` list",
187
- [PM_ERR_MALLOC_FAILED] = "Failed to allocate memory",
188
- [PM_ERR_MODULE_IN_METHOD] = "Unexpected module definition in a method body",
189
- [PM_ERR_MODULE_NAME] = "Expected a constant name after `module`",
190
- [PM_ERR_MODULE_TERM] = "Expected an `end` to close the `module` statement",
191
- [PM_ERR_MULTI_ASSIGN_MULTI_SPLATS] = "Multiple splats in multiple assignment",
192
- [PM_ERR_NOT_EXPRESSION] = "Expected an expression after `not`",
193
- [PM_ERR_NUMBER_LITERAL_UNDERSCORE] = "Number literal ending with a `_`",
194
- [PM_ERR_NUMBERED_PARAMETER_NOT_ALLOWED] = "Numbered parameters are not allowed alongside explicit parameters",
195
- [PM_ERR_NUMBERED_PARAMETER_OUTER_SCOPE] = "Numbered parameter is already used in outer scope",
196
- [PM_ERR_OPERATOR_MULTI_ASSIGN] = "Unexpected operator for a multiple assignment",
197
- [PM_ERR_OPERATOR_WRITE_ARGUMENTS] = "Unexpected operator after a call with arguments",
198
- [PM_ERR_OPERATOR_WRITE_BLOCK] = "Unexpected operator after a call with a block",
199
- [PM_ERR_PARAMETER_ASSOC_SPLAT_MULTI] = "Unexpected multiple `**` splat parameters",
200
- [PM_ERR_PARAMETER_BLOCK_MULTI] = "Multiple block parameters; only one block is allowed",
201
- [PM_ERR_PARAMETER_METHOD_NAME] = "Unexpected name for a parameter",
202
- [PM_ERR_PARAMETER_NAME_REPEAT] = "Repeated parameter name",
203
- [PM_ERR_PARAMETER_NO_DEFAULT] = "Expected a default value for the parameter",
204
- [PM_ERR_PARAMETER_NO_DEFAULT_KW] = "Expected a default value for the keyword parameter",
205
- [PM_ERR_PARAMETER_NUMBERED_RESERVED] = "%.2s is reserved for a numbered parameter",
206
- [PM_ERR_PARAMETER_ORDER] = "Unexpected parameter order",
207
- [PM_ERR_PARAMETER_SPLAT_MULTI] = "Unexpected multiple `*` splat parameters",
208
- [PM_ERR_PARAMETER_STAR] = "Unexpected parameter `*`",
209
- [PM_ERR_PARAMETER_UNEXPECTED_FWD] = "Unexpected `...` in parameters",
210
- [PM_ERR_PARAMETER_WILD_LOOSE_COMMA] = "Unexpected `,` in parameters",
211
- [PM_ERR_PATTERN_EXPRESSION_AFTER_BRACKET] = "Expected a pattern expression after the `[` operator",
212
- [PM_ERR_PATTERN_EXPRESSION_AFTER_COMMA] = "Expected a pattern expression after `,`",
213
- [PM_ERR_PATTERN_EXPRESSION_AFTER_HROCKET] = "Expected a pattern expression after `=>`",
214
- [PM_ERR_PATTERN_EXPRESSION_AFTER_IN] = "Expected a pattern expression after the `in` keyword",
215
- [PM_ERR_PATTERN_EXPRESSION_AFTER_KEY] = "Expected a pattern expression after the key",
216
- [PM_ERR_PATTERN_EXPRESSION_AFTER_PAREN] = "Expected a pattern expression after the `(` operator",
217
- [PM_ERR_PATTERN_EXPRESSION_AFTER_PIN] = "Expected a pattern expression after the `^` pin operator",
218
- [PM_ERR_PATTERN_EXPRESSION_AFTER_PIPE] = "Expected a pattern expression after the `|` operator",
219
- [PM_ERR_PATTERN_EXPRESSION_AFTER_RANGE] = "Expected a pattern expression after the range operator",
220
- [PM_ERR_PATTERN_HASH_KEY] = "Expected a key in the hash pattern",
221
- [PM_ERR_PATTERN_HASH_KEY_LABEL] = "Expected a label as the key in the hash pattern", // TODO // THIS // AND // ABOVE // IS WEIRD
222
- [PM_ERR_PATTERN_IDENT_AFTER_HROCKET] = "Expected an identifier after the `=>` operator",
223
- [PM_ERR_PATTERN_LABEL_AFTER_COMMA] = "Expected a label after the `,` in the hash pattern",
224
- [PM_ERR_PATTERN_REST] = "Unexpected rest pattern",
225
- [PM_ERR_PATTERN_TERM_BRACE] = "Expected a `}` to close the pattern expression",
226
- [PM_ERR_PATTERN_TERM_BRACKET] = "Expected a `]` to close the pattern expression",
227
- [PM_ERR_PATTERN_TERM_PAREN] = "Expected a `)` to close the pattern expression",
228
- [PM_ERR_PIPEPIPEEQ_MULTI_ASSIGN] = "Unexpected `||=` in a multiple assignment",
229
- [PM_ERR_REGEXP_TERM] = "Expected a closing delimiter for the regular expression",
230
- [PM_ERR_RESCUE_EXPRESSION] = "Expected a rescued expression",
231
- [PM_ERR_RESCUE_MODIFIER_VALUE] = "Expected a value after the `rescue` modifier",
232
- [PM_ERR_RESCUE_TERM] = "Expected a closing delimiter for the `rescue` clause",
233
- [PM_ERR_RESCUE_VARIABLE] = "Expected an exception variable after `=>` in a rescue statement",
234
- [PM_ERR_RETURN_INVALID] = "Invalid `return` in a class or module body",
235
- [PM_ERR_STRING_CONCATENATION] = "Expected a string for concatenation",
236
- [PM_ERR_STRING_INTERPOLATED_TERM] = "Expected a closing delimiter for the interpolated string",
237
- [PM_ERR_STRING_LITERAL_TERM] = "Expected a closing delimiter for the string literal",
238
- [PM_ERR_SYMBOL_INVALID] = "Invalid symbol", // TODO expected symbol? prism.c ~9719
239
- [PM_ERR_SYMBOL_TERM_DYNAMIC] = "Expected a closing delimiter for the dynamic symbol",
240
- [PM_ERR_SYMBOL_TERM_INTERPOLATED] = "Expected a closing delimiter for the interpolated symbol",
241
- [PM_ERR_TERNARY_COLON] = "Expected a `:` after the true expression of a ternary operator",
242
- [PM_ERR_TERNARY_EXPRESSION_FALSE] = "Expected an expression after `:` in the ternary operator",
243
- [PM_ERR_TERNARY_EXPRESSION_TRUE] = "Expected an expression after `?` in the ternary operator",
244
- [PM_ERR_UNDEF_ARGUMENT] = "Invalid argument being passed to `undef`; expected a bare word, constant, or symbol argument",
245
- [PM_ERR_UNARY_RECEIVER_BANG] = "Expected a receiver for unary `!`",
246
- [PM_ERR_UNARY_RECEIVER_MINUS] = "Expected a receiver for unary `-`",
247
- [PM_ERR_UNARY_RECEIVER_PLUS] = "Expected a receiver for unary `+`",
248
- [PM_ERR_UNARY_RECEIVER_TILDE] = "Expected a receiver for unary `~`",
249
- [PM_ERR_UNTIL_TERM] = "Expected an `end` to close the `until` statement",
250
- [PM_ERR_VOID_EXPRESSION] = "Unexpected void value expression",
251
- [PM_ERR_WHILE_TERM] = "Expected an `end` to close the `while` statement",
252
- [PM_ERR_WRITE_TARGET_READONLY] = "Immutable variable as a write target",
253
- [PM_ERR_WRITE_TARGET_UNEXPECTED] = "Unexpected write target",
254
- [PM_ERR_XSTRING_TERM] = "Expected a closing delimiter for the `%x` or backtick string",
255
- [PM_WARN_AMBIGUOUS_FIRST_ARGUMENT_MINUS] = "Ambiguous first argument; put parentheses or a space even after `-` operator",
256
- [PM_WARN_AMBIGUOUS_FIRST_ARGUMENT_PLUS] = "Ambiguous first argument; put parentheses or a space even after `+` operator",
257
- [PM_WARN_AMBIGUOUS_PREFIX_STAR] = "Ambiguous `*` has been interpreted as an argument prefix",
258
- [PM_WARN_AMBIGUOUS_SLASH] = "Ambiguous `/`; wrap regexp in parentheses or add a space after `/` operator",
82
+ [PM_ERR_BLOCK_PARAM_LOCAL_VARIABLE] = "expected a local variable name in the block parameters",
83
+ [PM_ERR_BLOCK_PARAM_PIPE_TERM] = "expected the block parameters to end with `|`",
84
+ [PM_ERR_BLOCK_TERM_BRACE] = "expected a block beginning with `{` to end with `}`",
85
+ [PM_ERR_BLOCK_TERM_END] = "expected a block beginning with `do` to end with `end`",
86
+ [PM_ERR_CANNOT_PARSE_EXPRESSION] = "cannot parse the expression",
87
+ [PM_ERR_CANNOT_PARSE_STRING_PART] = "cannot parse the string part",
88
+ [PM_ERR_CASE_EXPRESSION_AFTER_CASE] = "expected an expression after `case`",
89
+ [PM_ERR_CASE_EXPRESSION_AFTER_WHEN] = "expected an expression after `when`",
90
+ [PM_ERR_CASE_MATCH_MISSING_PREDICATE] = "expected a predicate for a case matching statement",
91
+ [PM_ERR_CASE_MISSING_CONDITIONS] = "expected a `when` or `in` clause after `case`",
92
+ [PM_ERR_CASE_TERM] = "expected an `end` to close the `case` statement",
93
+ [PM_ERR_CLASS_IN_METHOD] = "unexpected class definition in a method definition",
94
+ [PM_ERR_CLASS_NAME] = "expected a constant name after `class`",
95
+ [PM_ERR_CLASS_SUPERCLASS] = "expected a superclass after `<`",
96
+ [PM_ERR_CLASS_TERM] = "expected an `end` to close the `class` statement",
97
+ [PM_ERR_CLASS_UNEXPECTED_END] = "unexpected `end`, expecting ';' or '\\n'",
98
+ [PM_ERR_CONDITIONAL_ELSIF_PREDICATE] = "expected a predicate expression for the `elsif` statement",
99
+ [PM_ERR_CONDITIONAL_IF_PREDICATE] = "expected a predicate expression for the `if` statement",
100
+ [PM_ERR_CONDITIONAL_PREDICATE_TERM] = "expected `then` or `;` or '\\n'",
101
+ [PM_ERR_CONDITIONAL_TERM] = "expected an `end` to close the conditional clause",
102
+ [PM_ERR_CONDITIONAL_TERM_ELSE] = "expected an `end` to close the `else` clause",
103
+ [PM_ERR_CONDITIONAL_UNLESS_PREDICATE] = "expected a predicate expression for the `unless` statement",
104
+ [PM_ERR_CONDITIONAL_UNTIL_PREDICATE] = "expected a predicate expression for the `until` statement",
105
+ [PM_ERR_CONDITIONAL_WHILE_PREDICATE] = "expected a predicate expression for the `while` statement",
106
+ [PM_ERR_CONSTANT_PATH_COLON_COLON_CONSTANT] = "expected a constant after the `::` operator",
107
+ [PM_ERR_DEF_ENDLESS] = "could not parse the endless method body",
108
+ [PM_ERR_DEF_ENDLESS_SETTER] = "invalid method name; a setter method cannot be defined in an endless method definition",
109
+ [PM_ERR_DEF_NAME] = "expected a method name",
110
+ [PM_ERR_DEF_NAME_AFTER_RECEIVER] = "expected a method name after the receiver",
111
+ [PM_ERR_DEF_PARAMS_TERM] = "expected a delimiter to close the parameters",
112
+ [PM_ERR_DEF_PARAMS_TERM_PAREN] = "expected a `)` to close the parameters",
113
+ [PM_ERR_DEF_RECEIVER] = "expected a receiver for the method definition",
114
+ [PM_ERR_DEF_RECEIVER_TERM] = "expected a `.` or `::` after the receiver in a method definition",
115
+ [PM_ERR_DEF_TERM] = "expected an `end` to close the `def` statement",
116
+ [PM_ERR_DEFINED_EXPRESSION] = "expected an expression after `defined?`",
117
+ [PM_ERR_EMBDOC_TERM] = "could not find a terminator for the embedded document",
118
+ [PM_ERR_EMBEXPR_END] = "expected a `}` to close the embedded expression",
119
+ [PM_ERR_EMBVAR_INVALID] = "invalid embedded variable",
120
+ [PM_ERR_END_UPCASE_BRACE] = "expected a `{` after `END`",
121
+ [PM_ERR_END_UPCASE_TERM] = "expected a `}` to close the `END` statement",
122
+ [PM_ERR_ESCAPE_INVALID_CONTROL] = "invalid control escape sequence",
123
+ [PM_ERR_ESCAPE_INVALID_CONTROL_REPEAT] = "invalid control escape sequence; control cannot be repeated",
124
+ [PM_ERR_ESCAPE_INVALID_HEXADECIMAL] = "invalid hexadecimal escape sequence",
125
+ [PM_ERR_ESCAPE_INVALID_META] = "invalid meta escape sequence",
126
+ [PM_ERR_ESCAPE_INVALID_META_REPEAT] = "invalid meta escape sequence; meta cannot be repeated",
127
+ [PM_ERR_ESCAPE_INVALID_UNICODE] = "invalid Unicode escape sequence",
128
+ [PM_ERR_ESCAPE_INVALID_UNICODE_CM_FLAGS] = "invalid Unicode escape sequence; Unicode cannot be combined with control or meta flags",
129
+ [PM_ERR_ESCAPE_INVALID_UNICODE_LITERAL] = "invalid Unicode escape sequence; multiple codepoints are not allowed in a character literal",
130
+ [PM_ERR_ESCAPE_INVALID_UNICODE_LONG] = "invalid Unicode escape sequence; maximum length is 6 digits",
131
+ [PM_ERR_ESCAPE_INVALID_UNICODE_TERM] = "invalid Unicode escape sequence; needs closing `}`",
132
+ [PM_ERR_EXPECT_ARGUMENT] = "expected an argument",
133
+ [PM_ERR_EXPECT_EOL_AFTER_STATEMENT] = "expected a newline or semicolon after the statement",
134
+ [PM_ERR_EXPECT_EXPRESSION_AFTER_AMPAMPEQ] = "expected an expression after `&&=`",
135
+ [PM_ERR_EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ] = "expected an expression after `||=`",
136
+ [PM_ERR_EXPECT_EXPRESSION_AFTER_COMMA] = "expected an expression after `,`",
137
+ [PM_ERR_EXPECT_EXPRESSION_AFTER_EQUAL] = "expected an expression after `=`",
138
+ [PM_ERR_EXPECT_EXPRESSION_AFTER_LESS_LESS] = "expected an expression after `<<`",
139
+ [PM_ERR_EXPECT_EXPRESSION_AFTER_LPAREN] = "expected an expression after `(`",
140
+ [PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR] = "expected an expression after the operator",
141
+ [PM_ERR_EXPECT_EXPRESSION_AFTER_SPLAT] = "expected an expression after `*` splat in an argument",
142
+ [PM_ERR_EXPECT_EXPRESSION_AFTER_SPLAT_HASH] = "expected an expression after `**` in a hash",
143
+ [PM_ERR_EXPECT_EXPRESSION_AFTER_STAR] = "expected an expression after `*`",
144
+ [PM_ERR_EXPECT_IDENT_REQ_PARAMETER] = "expected an identifier for the required parameter",
145
+ [PM_ERR_EXPECT_LPAREN_REQ_PARAMETER] = "expected a `(` to start a required parameter",
146
+ [PM_ERR_EXPECT_RBRACKET] = "expected a matching `]`",
147
+ [PM_ERR_EXPECT_RPAREN] = "expected a matching `)`",
148
+ [PM_ERR_EXPECT_RPAREN_AFTER_MULTI] = "expected a `)` after multiple assignment",
149
+ [PM_ERR_EXPECT_RPAREN_REQ_PARAMETER] = "expected a `)` to end a required parameter",
150
+ [PM_ERR_EXPECT_STRING_CONTENT] = "expected string content after opening string delimiter",
151
+ [PM_ERR_EXPECT_WHEN_DELIMITER] = "expected a delimiter after the predicates of a `when` clause",
152
+ [PM_ERR_EXPRESSION_BARE_HASH] = "unexpected bare hash in expression",
153
+ [PM_ERR_FOR_COLLECTION] = "expected a collection after the `in` in a `for` statement",
154
+ [PM_ERR_FOR_INDEX] = "expected an index after `for`",
155
+ [PM_ERR_FOR_IN] = "expected an `in` after the index in a `for` statement",
156
+ [PM_ERR_FOR_TERM] = "expected an `end` to close the `for` loop",
157
+ [PM_ERR_HASH_EXPRESSION_AFTER_LABEL] = "expected an expression after the label in a hash",
158
+ [PM_ERR_HASH_KEY] = "expected a key in the hash literal",
159
+ [PM_ERR_HASH_ROCKET] = "expected a `=>` between the hash key and value",
160
+ [PM_ERR_HASH_TERM] = "expected a `}` to close the hash literal",
161
+ [PM_ERR_HASH_VALUE] = "expected a value in the hash literal",
162
+ [PM_ERR_HEREDOC_TERM] = "could not find a terminator for the heredoc",
163
+ [PM_ERR_INCOMPLETE_QUESTION_MARK] = "incomplete expression at `?`",
164
+ [PM_ERR_INCOMPLETE_VARIABLE_CLASS] = "incomplete class variable",
165
+ [PM_ERR_INCOMPLETE_VARIABLE_INSTANCE] = "incomplete instance variable",
166
+ [PM_ERR_INVALID_ENCODING_MAGIC_COMMENT] = "unknown or invalid encoding in the magic comment",
167
+ [PM_ERR_INVALID_FLOAT_EXPONENT] = "invalid exponent",
168
+ [PM_ERR_INVALID_NUMBER_BINARY] = "invalid binary number",
169
+ [PM_ERR_INVALID_NUMBER_DECIMAL] = "invalid decimal number",
170
+ [PM_ERR_INVALID_NUMBER_HEXADECIMAL] = "invalid hexadecimal number",
171
+ [PM_ERR_INVALID_NUMBER_OCTAL] = "invalid octal number",
172
+ [PM_ERR_INVALID_NUMBER_UNDERSCORE] = "invalid underscore placement in number",
173
+ [PM_ERR_INVALID_PERCENT] = "invalid `%` token", // TODO WHAT?
174
+ [PM_ERR_INVALID_TOKEN] = "invalid token", // TODO WHAT?
175
+ [PM_ERR_INVALID_VARIABLE_GLOBAL] = "invalid global variable",
176
+ [PM_ERR_LAMBDA_OPEN] = "expected a `do` keyword or a `{` to open the lambda block",
177
+ [PM_ERR_LAMBDA_TERM_BRACE] = "expected a lambda block beginning with `{` to end with `}`",
178
+ [PM_ERR_LAMBDA_TERM_END] = "expected a lambda block beginning with `do` to end with `end`",
179
+ [PM_ERR_LIST_I_LOWER_ELEMENT] = "expected a symbol in a `%i` list",
180
+ [PM_ERR_LIST_I_LOWER_TERM] = "expected a closing delimiter for the `%i` list",
181
+ [PM_ERR_LIST_I_UPPER_ELEMENT] = "expected a symbol in a `%I` list",
182
+ [PM_ERR_LIST_I_UPPER_TERM] = "expected a closing delimiter for the `%I` list",
183
+ [PM_ERR_LIST_W_LOWER_ELEMENT] = "expected a string in a `%w` list",
184
+ [PM_ERR_LIST_W_LOWER_TERM] = "expected a closing delimiter for the `%w` list",
185
+ [PM_ERR_LIST_W_UPPER_ELEMENT] = "expected a string in a `%W` list",
186
+ [PM_ERR_LIST_W_UPPER_TERM] = "expected a closing delimiter for the `%W` list",
187
+ [PM_ERR_MALLOC_FAILED] = "failed to allocate memory",
188
+ [PM_ERR_MIXED_ENCODING] = "UTF-8 mixed within %s source",
189
+ [PM_ERR_MODULE_IN_METHOD] = "unexpected module definition in a method definition",
190
+ [PM_ERR_MODULE_NAME] = "expected a constant name after `module`",
191
+ [PM_ERR_MODULE_TERM] = "expected an `end` to close the `module` statement",
192
+ [PM_ERR_MULTI_ASSIGN_MULTI_SPLATS] = "multiple splats in multiple assignment",
193
+ [PM_ERR_NOT_EXPRESSION] = "expected an expression after `not`",
194
+ [PM_ERR_NUMBER_LITERAL_UNDERSCORE] = "number literal ending with a `_`",
195
+ [PM_ERR_NUMBERED_PARAMETER_NOT_ALLOWED] = "numbered parameters are not allowed when an ordinary parameter is defined",
196
+ [PM_ERR_NUMBERED_PARAMETER_OUTER_SCOPE] = "numbered parameter is already used in outer scope",
197
+ [PM_ERR_OPERATOR_MULTI_ASSIGN] = "unexpected operator for a multiple assignment",
198
+ [PM_ERR_OPERATOR_WRITE_ARGUMENTS] = "unexpected operator after a call with arguments",
199
+ [PM_ERR_OPERATOR_WRITE_BLOCK] = "unexpected operator after a call with a block",
200
+ [PM_ERR_PARAMETER_ASSOC_SPLAT_MULTI] = "unexpected multiple `**` splat parameters",
201
+ [PM_ERR_PARAMETER_BLOCK_MULTI] = "multiple block parameters; only one block is allowed",
202
+ [PM_ERR_PARAMETER_CIRCULAR] = "parameter default value references itself",
203
+ [PM_ERR_PARAMETER_METHOD_NAME] = "unexpected name for a parameter",
204
+ [PM_ERR_PARAMETER_NAME_REPEAT] = "repeated parameter name",
205
+ [PM_ERR_PARAMETER_NO_DEFAULT] = "expected a default value for the parameter",
206
+ [PM_ERR_PARAMETER_NO_DEFAULT_KW] = "expected a default value for the keyword parameter",
207
+ [PM_ERR_PARAMETER_NUMBERED_RESERVED] = "%.2s is reserved for numbered parameters",
208
+ [PM_ERR_PARAMETER_ORDER] = "unexpected parameter order",
209
+ [PM_ERR_PARAMETER_SPLAT_MULTI] = "unexpected multiple `*` splat parameters",
210
+ [PM_ERR_PARAMETER_STAR] = "unexpected parameter `*`",
211
+ [PM_ERR_PARAMETER_UNEXPECTED_FWD] = "unexpected `...` in parameters",
212
+ [PM_ERR_PARAMETER_WILD_LOOSE_COMMA] = "unexpected `,` in parameters",
213
+ [PM_ERR_PATTERN_EXPRESSION_AFTER_BRACKET] = "expected a pattern expression after the `[` operator",
214
+ [PM_ERR_PATTERN_EXPRESSION_AFTER_COMMA] = "expected a pattern expression after `,`",
215
+ [PM_ERR_PATTERN_EXPRESSION_AFTER_HROCKET] = "expected a pattern expression after `=>`",
216
+ [PM_ERR_PATTERN_EXPRESSION_AFTER_IN] = "expected a pattern expression after the `in` keyword",
217
+ [PM_ERR_PATTERN_EXPRESSION_AFTER_KEY] = "expected a pattern expression after the key",
218
+ [PM_ERR_PATTERN_EXPRESSION_AFTER_PAREN] = "expected a pattern expression after the `(` operator",
219
+ [PM_ERR_PATTERN_EXPRESSION_AFTER_PIN] = "expected a pattern expression after the `^` pin operator",
220
+ [PM_ERR_PATTERN_EXPRESSION_AFTER_PIPE] = "expected a pattern expression after the `|` operator",
221
+ [PM_ERR_PATTERN_EXPRESSION_AFTER_RANGE] = "expected a pattern expression after the range operator",
222
+ [PM_ERR_PATTERN_EXPRESSION_AFTER_REST] = "unexpected pattern expression after the `**` expression",
223
+ [PM_ERR_PATTERN_HASH_KEY] = "expected a key in the hash pattern",
224
+ [PM_ERR_PATTERN_HASH_KEY_LABEL] = "expected a label as the key in the hash pattern", // TODO // THIS // AND // ABOVE // IS WEIRD
225
+ [PM_ERR_PATTERN_IDENT_AFTER_HROCKET] = "expected an identifier after the `=>` operator",
226
+ [PM_ERR_PATTERN_LABEL_AFTER_COMMA] = "expected a label after the `,` in the hash pattern",
227
+ [PM_ERR_PATTERN_REST] = "unexpected rest pattern",
228
+ [PM_ERR_PATTERN_TERM_BRACE] = "expected a `}` to close the pattern expression",
229
+ [PM_ERR_PATTERN_TERM_BRACKET] = "expected a `]` to close the pattern expression",
230
+ [PM_ERR_PATTERN_TERM_PAREN] = "expected a `)` to close the pattern expression",
231
+ [PM_ERR_PIPEPIPEEQ_MULTI_ASSIGN] = "unexpected `||=` in a multiple assignment",
232
+ [PM_ERR_REGEXP_TERM] = "expected a closing delimiter for the regular expression",
233
+ [PM_ERR_RESCUE_EXPRESSION] = "expected a rescued expression",
234
+ [PM_ERR_RESCUE_MODIFIER_VALUE] = "expected a value after the `rescue` modifier",
235
+ [PM_ERR_RESCUE_TERM] = "expected a closing delimiter for the `rescue` clause",
236
+ [PM_ERR_RESCUE_VARIABLE] = "expected an exception variable after `=>` in a rescue statement",
237
+ [PM_ERR_RETURN_INVALID] = "invalid `return` in a class or module body",
238
+ [PM_ERR_STATEMENT_ALIAS] = "unexpected an `alias` at a non-statement position",
239
+ [PM_ERR_STATEMENT_POSTEXE_END] = "unexpected an `END` at a non-statement position",
240
+ [PM_ERR_STATEMENT_PREEXE_BEGIN] = "unexpected a `BEGIN` at a non-statement position",
241
+ [PM_ERR_STATEMENT_UNDEF] = "unexpected an `undef` at a non-statement position",
242
+ [PM_ERR_STRING_CONCATENATION] = "expected a string for concatenation",
243
+ [PM_ERR_STRING_INTERPOLATED_TERM] = "expected a closing delimiter for the interpolated string",
244
+ [PM_ERR_STRING_LITERAL_TERM] = "expected a closing delimiter for the string literal",
245
+ [PM_ERR_SYMBOL_INVALID] = "invalid symbol", // TODO expected symbol? prism.c ~9719
246
+ [PM_ERR_SYMBOL_TERM_DYNAMIC] = "expected a closing delimiter for the dynamic symbol",
247
+ [PM_ERR_SYMBOL_TERM_INTERPOLATED] = "expected a closing delimiter for the interpolated symbol",
248
+ [PM_ERR_TERNARY_COLON] = "expected a `:` after the true expression of a ternary operator",
249
+ [PM_ERR_TERNARY_EXPRESSION_FALSE] = "expected an expression after `:` in the ternary operator",
250
+ [PM_ERR_TERNARY_EXPRESSION_TRUE] = "expected an expression after `?` in the ternary operator",
251
+ [PM_ERR_UNDEF_ARGUMENT] = "invalid argument being passed to `undef`; expected a bare word, constant, or symbol argument",
252
+ [PM_ERR_UNARY_RECEIVER_BANG] = "expected a receiver for unary `!`",
253
+ [PM_ERR_UNARY_RECEIVER_MINUS] = "expected a receiver for unary `-`",
254
+ [PM_ERR_UNARY_RECEIVER_PLUS] = "expected a receiver for unary `+`",
255
+ [PM_ERR_UNARY_RECEIVER_TILDE] = "expected a receiver for unary `~`",
256
+ [PM_ERR_UNTIL_TERM] = "expected an `end` to close the `until` statement",
257
+ [PM_ERR_VOID_EXPRESSION] = "unexpected void value expression",
258
+ [PM_ERR_WHILE_TERM] = "expected an `end` to close the `while` statement",
259
+ [PM_ERR_WRITE_TARGET_IN_METHOD] = "dynamic constant assignment",
260
+ [PM_ERR_WRITE_TARGET_READONLY] = "immutable variable as a write target",
261
+ [PM_ERR_WRITE_TARGET_UNEXPECTED] = "unexpected write target",
262
+ [PM_ERR_XSTRING_TERM] = "expected a closing delimiter for the `%x` or backtick string",
263
+ [PM_WARN_AMBIGUOUS_FIRST_ARGUMENT_MINUS] = "ambiguous first argument; put parentheses or a space even after `-` operator",
264
+ [PM_WARN_AMBIGUOUS_FIRST_ARGUMENT_PLUS] = "ambiguous first argument; put parentheses or a space even after `+` operator",
265
+ [PM_WARN_AMBIGUOUS_PREFIX_STAR] = "ambiguous `*` has been interpreted as an argument prefix",
266
+ [PM_WARN_AMBIGUOUS_SLASH] = "ambiguous `/`; wrap regexp in parentheses or add a space after `/` operator",
259
267
  [PM_WARN_END_IN_METHOD] = "END in method; use at_exit",
260
268
  };
261
269
 
@@ -278,8 +286,7 @@ pm_diagnostic_list_append(pm_list_t *list, const uint8_t *start, const uint8_t *
278
286
  if (diagnostic == NULL) return false;
279
287
 
280
288
  *diagnostic = (pm_diagnostic_t) {
281
- .start = start,
282
- .end = end,
289
+ .location = { start, end },
283
290
  .message = pm_diagnostic_message(diag_id),
284
291
  .owned = false
285
292
  };
@@ -322,8 +329,7 @@ pm_diagnostic_list_append_format(pm_list_t *list, const uint8_t *start, const ui
322
329
  va_end(arguments);
323
330
 
324
331
  *diagnostic = (pm_diagnostic_t) {
325
- .start = start,
326
- .end = end,
332
+ .location = { start, end },
327
333
  .message = message,
328
334
  .owned = true
329
335
  };