jruby-prism-parser 0.23.0.pre.SNAPSHOT-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +401 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +62 -0
- data/LICENSE.md +7 -0
- data/Makefile +101 -0
- data/README.md +98 -0
- data/config.yml +2902 -0
- data/docs/build_system.md +91 -0
- data/docs/configuration.md +64 -0
- data/docs/cruby_compilation.md +27 -0
- data/docs/design.md +53 -0
- data/docs/encoding.md +121 -0
- data/docs/fuzzing.md +88 -0
- data/docs/heredocs.md +36 -0
- data/docs/javascript.md +118 -0
- data/docs/local_variable_depth.md +229 -0
- data/docs/mapping.md +117 -0
- data/docs/parser_translation.md +34 -0
- data/docs/parsing_rules.md +19 -0
- data/docs/releasing.md +98 -0
- data/docs/ripper.md +36 -0
- data/docs/ruby_api.md +43 -0
- data/docs/ruby_parser_translation.md +19 -0
- data/docs/serialization.md +209 -0
- data/docs/testing.md +55 -0
- data/ext/prism/api_node.c +5098 -0
- data/ext/prism/api_pack.c +267 -0
- data/ext/prism/extconf.rb +110 -0
- data/ext/prism/extension.c +1155 -0
- data/ext/prism/extension.h +18 -0
- data/include/prism/ast.h +5807 -0
- data/include/prism/defines.h +102 -0
- data/include/prism/diagnostic.h +339 -0
- data/include/prism/encoding.h +265 -0
- data/include/prism/node.h +57 -0
- data/include/prism/options.h +230 -0
- data/include/prism/pack.h +152 -0
- data/include/prism/parser.h +732 -0
- data/include/prism/prettyprint.h +26 -0
- data/include/prism/regexp.h +33 -0
- data/include/prism/util/pm_buffer.h +155 -0
- data/include/prism/util/pm_char.h +205 -0
- data/include/prism/util/pm_constant_pool.h +209 -0
- data/include/prism/util/pm_list.h +97 -0
- data/include/prism/util/pm_memchr.h +29 -0
- data/include/prism/util/pm_newline_list.h +93 -0
- data/include/prism/util/pm_state_stack.h +42 -0
- data/include/prism/util/pm_string.h +150 -0
- data/include/prism/util/pm_string_list.h +44 -0
- data/include/prism/util/pm_strncasecmp.h +32 -0
- data/include/prism/util/pm_strpbrk.h +46 -0
- data/include/prism/version.h +29 -0
- data/include/prism.h +289 -0
- data/jruby-prism.jar +0 -0
- data/lib/prism/compiler.rb +486 -0
- data/lib/prism/debug.rb +206 -0
- data/lib/prism/desugar_compiler.rb +207 -0
- data/lib/prism/dispatcher.rb +2150 -0
- data/lib/prism/dot_visitor.rb +4634 -0
- data/lib/prism/dsl.rb +785 -0
- data/lib/prism/ffi.rb +346 -0
- data/lib/prism/lex_compat.rb +908 -0
- data/lib/prism/mutation_compiler.rb +753 -0
- data/lib/prism/node.rb +17864 -0
- data/lib/prism/node_ext.rb +212 -0
- data/lib/prism/node_inspector.rb +68 -0
- data/lib/prism/pack.rb +224 -0
- data/lib/prism/parse_result/comments.rb +177 -0
- data/lib/prism/parse_result/newlines.rb +64 -0
- data/lib/prism/parse_result.rb +498 -0
- data/lib/prism/pattern.rb +250 -0
- data/lib/prism/serialize.rb +1354 -0
- data/lib/prism/translation/parser/compiler.rb +1838 -0
- data/lib/prism/translation/parser/lexer.rb +335 -0
- data/lib/prism/translation/parser/rubocop.rb +37 -0
- data/lib/prism/translation/parser.rb +178 -0
- data/lib/prism/translation/ripper.rb +577 -0
- data/lib/prism/translation/ruby_parser.rb +1521 -0
- data/lib/prism/translation.rb +11 -0
- data/lib/prism/version.rb +3 -0
- data/lib/prism/visitor.rb +495 -0
- data/lib/prism.rb +99 -0
- data/prism.gemspec +135 -0
- data/rbi/prism.rbi +7767 -0
- data/rbi/prism_static.rbi +207 -0
- data/sig/prism.rbs +4773 -0
- data/sig/prism_static.rbs +201 -0
- data/src/diagnostic.c +400 -0
- data/src/encoding.c +5132 -0
- data/src/node.c +2786 -0
- data/src/options.c +213 -0
- data/src/pack.c +493 -0
- data/src/prettyprint.c +8881 -0
- data/src/prism.c +18406 -0
- data/src/regexp.c +638 -0
- data/src/serialize.c +1554 -0
- data/src/token_type.c +700 -0
- data/src/util/pm_buffer.c +190 -0
- data/src/util/pm_char.c +318 -0
- data/src/util/pm_constant_pool.c +322 -0
- data/src/util/pm_list.c +49 -0
- data/src/util/pm_memchr.c +35 -0
- data/src/util/pm_newline_list.c +84 -0
- data/src/util/pm_state_stack.c +25 -0
- data/src/util/pm_string.c +203 -0
- data/src/util/pm_string_list.c +28 -0
- data/src/util/pm_strncasecmp.c +24 -0
- data/src/util/pm_strpbrk.c +180 -0
- metadata +156 -0
data/src/token_type.c
ADDED
@@ -0,0 +1,700 @@
|
|
1
|
+
/******************************************************************************/
|
2
|
+
/* This file is generated by the templates/template.rb script and should not */
|
3
|
+
/* be modified manually. See */
|
4
|
+
/* templates/src/token_type.c.erb */
|
5
|
+
/* if you are looking to modify the */
|
6
|
+
/* template */
|
7
|
+
/******************************************************************************/
|
8
|
+
#include <string.h>
|
9
|
+
|
10
|
+
#include "prism/ast.h"
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Returns a string representation of the given token type.
|
14
|
+
*/
|
15
|
+
PRISM_EXPORTED_FUNCTION const char *
|
16
|
+
pm_token_type_name(pm_token_type_t token_type) {
|
17
|
+
switch (token_type) {
|
18
|
+
case PM_TOKEN_EOF:
|
19
|
+
return "EOF";
|
20
|
+
case PM_TOKEN_MISSING:
|
21
|
+
return "MISSING";
|
22
|
+
case PM_TOKEN_NOT_PROVIDED:
|
23
|
+
return "NOT_PROVIDED";
|
24
|
+
case PM_TOKEN_AMPERSAND:
|
25
|
+
return "AMPERSAND";
|
26
|
+
case PM_TOKEN_AMPERSAND_AMPERSAND:
|
27
|
+
return "AMPERSAND_AMPERSAND";
|
28
|
+
case PM_TOKEN_AMPERSAND_AMPERSAND_EQUAL:
|
29
|
+
return "AMPERSAND_AMPERSAND_EQUAL";
|
30
|
+
case PM_TOKEN_AMPERSAND_DOT:
|
31
|
+
return "AMPERSAND_DOT";
|
32
|
+
case PM_TOKEN_AMPERSAND_EQUAL:
|
33
|
+
return "AMPERSAND_EQUAL";
|
34
|
+
case PM_TOKEN_BACKTICK:
|
35
|
+
return "BACKTICK";
|
36
|
+
case PM_TOKEN_BACK_REFERENCE:
|
37
|
+
return "BACK_REFERENCE";
|
38
|
+
case PM_TOKEN_BANG:
|
39
|
+
return "BANG";
|
40
|
+
case PM_TOKEN_BANG_EQUAL:
|
41
|
+
return "BANG_EQUAL";
|
42
|
+
case PM_TOKEN_BANG_TILDE:
|
43
|
+
return "BANG_TILDE";
|
44
|
+
case PM_TOKEN_BRACE_LEFT:
|
45
|
+
return "BRACE_LEFT";
|
46
|
+
case PM_TOKEN_BRACE_RIGHT:
|
47
|
+
return "BRACE_RIGHT";
|
48
|
+
case PM_TOKEN_BRACKET_LEFT:
|
49
|
+
return "BRACKET_LEFT";
|
50
|
+
case PM_TOKEN_BRACKET_LEFT_ARRAY:
|
51
|
+
return "BRACKET_LEFT_ARRAY";
|
52
|
+
case PM_TOKEN_BRACKET_LEFT_RIGHT:
|
53
|
+
return "BRACKET_LEFT_RIGHT";
|
54
|
+
case PM_TOKEN_BRACKET_LEFT_RIGHT_EQUAL:
|
55
|
+
return "BRACKET_LEFT_RIGHT_EQUAL";
|
56
|
+
case PM_TOKEN_BRACKET_RIGHT:
|
57
|
+
return "BRACKET_RIGHT";
|
58
|
+
case PM_TOKEN_CARET:
|
59
|
+
return "CARET";
|
60
|
+
case PM_TOKEN_CARET_EQUAL:
|
61
|
+
return "CARET_EQUAL";
|
62
|
+
case PM_TOKEN_CHARACTER_LITERAL:
|
63
|
+
return "CHARACTER_LITERAL";
|
64
|
+
case PM_TOKEN_CLASS_VARIABLE:
|
65
|
+
return "CLASS_VARIABLE";
|
66
|
+
case PM_TOKEN_COLON:
|
67
|
+
return "COLON";
|
68
|
+
case PM_TOKEN_COLON_COLON:
|
69
|
+
return "COLON_COLON";
|
70
|
+
case PM_TOKEN_COMMA:
|
71
|
+
return "COMMA";
|
72
|
+
case PM_TOKEN_COMMENT:
|
73
|
+
return "COMMENT";
|
74
|
+
case PM_TOKEN_CONSTANT:
|
75
|
+
return "CONSTANT";
|
76
|
+
case PM_TOKEN_DOT:
|
77
|
+
return "DOT";
|
78
|
+
case PM_TOKEN_DOT_DOT:
|
79
|
+
return "DOT_DOT";
|
80
|
+
case PM_TOKEN_DOT_DOT_DOT:
|
81
|
+
return "DOT_DOT_DOT";
|
82
|
+
case PM_TOKEN_EMBDOC_BEGIN:
|
83
|
+
return "EMBDOC_BEGIN";
|
84
|
+
case PM_TOKEN_EMBDOC_END:
|
85
|
+
return "EMBDOC_END";
|
86
|
+
case PM_TOKEN_EMBDOC_LINE:
|
87
|
+
return "EMBDOC_LINE";
|
88
|
+
case PM_TOKEN_EMBEXPR_BEGIN:
|
89
|
+
return "EMBEXPR_BEGIN";
|
90
|
+
case PM_TOKEN_EMBEXPR_END:
|
91
|
+
return "EMBEXPR_END";
|
92
|
+
case PM_TOKEN_EMBVAR:
|
93
|
+
return "EMBVAR";
|
94
|
+
case PM_TOKEN_EQUAL:
|
95
|
+
return "EQUAL";
|
96
|
+
case PM_TOKEN_EQUAL_EQUAL:
|
97
|
+
return "EQUAL_EQUAL";
|
98
|
+
case PM_TOKEN_EQUAL_EQUAL_EQUAL:
|
99
|
+
return "EQUAL_EQUAL_EQUAL";
|
100
|
+
case PM_TOKEN_EQUAL_GREATER:
|
101
|
+
return "EQUAL_GREATER";
|
102
|
+
case PM_TOKEN_EQUAL_TILDE:
|
103
|
+
return "EQUAL_TILDE";
|
104
|
+
case PM_TOKEN_FLOAT:
|
105
|
+
return "FLOAT";
|
106
|
+
case PM_TOKEN_FLOAT_IMAGINARY:
|
107
|
+
return "FLOAT_IMAGINARY";
|
108
|
+
case PM_TOKEN_FLOAT_RATIONAL:
|
109
|
+
return "FLOAT_RATIONAL";
|
110
|
+
case PM_TOKEN_FLOAT_RATIONAL_IMAGINARY:
|
111
|
+
return "FLOAT_RATIONAL_IMAGINARY";
|
112
|
+
case PM_TOKEN_GLOBAL_VARIABLE:
|
113
|
+
return "GLOBAL_VARIABLE";
|
114
|
+
case PM_TOKEN_GREATER:
|
115
|
+
return "GREATER";
|
116
|
+
case PM_TOKEN_GREATER_EQUAL:
|
117
|
+
return "GREATER_EQUAL";
|
118
|
+
case PM_TOKEN_GREATER_GREATER:
|
119
|
+
return "GREATER_GREATER";
|
120
|
+
case PM_TOKEN_GREATER_GREATER_EQUAL:
|
121
|
+
return "GREATER_GREATER_EQUAL";
|
122
|
+
case PM_TOKEN_HEREDOC_END:
|
123
|
+
return "HEREDOC_END";
|
124
|
+
case PM_TOKEN_HEREDOC_START:
|
125
|
+
return "HEREDOC_START";
|
126
|
+
case PM_TOKEN_IDENTIFIER:
|
127
|
+
return "IDENTIFIER";
|
128
|
+
case PM_TOKEN_IGNORED_NEWLINE:
|
129
|
+
return "IGNORED_NEWLINE";
|
130
|
+
case PM_TOKEN_INSTANCE_VARIABLE:
|
131
|
+
return "INSTANCE_VARIABLE";
|
132
|
+
case PM_TOKEN_INTEGER:
|
133
|
+
return "INTEGER";
|
134
|
+
case PM_TOKEN_INTEGER_IMAGINARY:
|
135
|
+
return "INTEGER_IMAGINARY";
|
136
|
+
case PM_TOKEN_INTEGER_RATIONAL:
|
137
|
+
return "INTEGER_RATIONAL";
|
138
|
+
case PM_TOKEN_INTEGER_RATIONAL_IMAGINARY:
|
139
|
+
return "INTEGER_RATIONAL_IMAGINARY";
|
140
|
+
case PM_TOKEN_KEYWORD_ALIAS:
|
141
|
+
return "KEYWORD_ALIAS";
|
142
|
+
case PM_TOKEN_KEYWORD_AND:
|
143
|
+
return "KEYWORD_AND";
|
144
|
+
case PM_TOKEN_KEYWORD_BEGIN:
|
145
|
+
return "KEYWORD_BEGIN";
|
146
|
+
case PM_TOKEN_KEYWORD_BEGIN_UPCASE:
|
147
|
+
return "KEYWORD_BEGIN_UPCASE";
|
148
|
+
case PM_TOKEN_KEYWORD_BREAK:
|
149
|
+
return "KEYWORD_BREAK";
|
150
|
+
case PM_TOKEN_KEYWORD_CASE:
|
151
|
+
return "KEYWORD_CASE";
|
152
|
+
case PM_TOKEN_KEYWORD_CLASS:
|
153
|
+
return "KEYWORD_CLASS";
|
154
|
+
case PM_TOKEN_KEYWORD_DEF:
|
155
|
+
return "KEYWORD_DEF";
|
156
|
+
case PM_TOKEN_KEYWORD_DEFINED:
|
157
|
+
return "KEYWORD_DEFINED";
|
158
|
+
case PM_TOKEN_KEYWORD_DO:
|
159
|
+
return "KEYWORD_DO";
|
160
|
+
case PM_TOKEN_KEYWORD_DO_LOOP:
|
161
|
+
return "KEYWORD_DO_LOOP";
|
162
|
+
case PM_TOKEN_KEYWORD_ELSE:
|
163
|
+
return "KEYWORD_ELSE";
|
164
|
+
case PM_TOKEN_KEYWORD_ELSIF:
|
165
|
+
return "KEYWORD_ELSIF";
|
166
|
+
case PM_TOKEN_KEYWORD_END:
|
167
|
+
return "KEYWORD_END";
|
168
|
+
case PM_TOKEN_KEYWORD_END_UPCASE:
|
169
|
+
return "KEYWORD_END_UPCASE";
|
170
|
+
case PM_TOKEN_KEYWORD_ENSURE:
|
171
|
+
return "KEYWORD_ENSURE";
|
172
|
+
case PM_TOKEN_KEYWORD_FALSE:
|
173
|
+
return "KEYWORD_FALSE";
|
174
|
+
case PM_TOKEN_KEYWORD_FOR:
|
175
|
+
return "KEYWORD_FOR";
|
176
|
+
case PM_TOKEN_KEYWORD_IF:
|
177
|
+
return "KEYWORD_IF";
|
178
|
+
case PM_TOKEN_KEYWORD_IF_MODIFIER:
|
179
|
+
return "KEYWORD_IF_MODIFIER";
|
180
|
+
case PM_TOKEN_KEYWORD_IN:
|
181
|
+
return "KEYWORD_IN";
|
182
|
+
case PM_TOKEN_KEYWORD_MODULE:
|
183
|
+
return "KEYWORD_MODULE";
|
184
|
+
case PM_TOKEN_KEYWORD_NEXT:
|
185
|
+
return "KEYWORD_NEXT";
|
186
|
+
case PM_TOKEN_KEYWORD_NIL:
|
187
|
+
return "KEYWORD_NIL";
|
188
|
+
case PM_TOKEN_KEYWORD_NOT:
|
189
|
+
return "KEYWORD_NOT";
|
190
|
+
case PM_TOKEN_KEYWORD_OR:
|
191
|
+
return "KEYWORD_OR";
|
192
|
+
case PM_TOKEN_KEYWORD_REDO:
|
193
|
+
return "KEYWORD_REDO";
|
194
|
+
case PM_TOKEN_KEYWORD_RESCUE:
|
195
|
+
return "KEYWORD_RESCUE";
|
196
|
+
case PM_TOKEN_KEYWORD_RESCUE_MODIFIER:
|
197
|
+
return "KEYWORD_RESCUE_MODIFIER";
|
198
|
+
case PM_TOKEN_KEYWORD_RETRY:
|
199
|
+
return "KEYWORD_RETRY";
|
200
|
+
case PM_TOKEN_KEYWORD_RETURN:
|
201
|
+
return "KEYWORD_RETURN";
|
202
|
+
case PM_TOKEN_KEYWORD_SELF:
|
203
|
+
return "KEYWORD_SELF";
|
204
|
+
case PM_TOKEN_KEYWORD_SUPER:
|
205
|
+
return "KEYWORD_SUPER";
|
206
|
+
case PM_TOKEN_KEYWORD_THEN:
|
207
|
+
return "KEYWORD_THEN";
|
208
|
+
case PM_TOKEN_KEYWORD_TRUE:
|
209
|
+
return "KEYWORD_TRUE";
|
210
|
+
case PM_TOKEN_KEYWORD_UNDEF:
|
211
|
+
return "KEYWORD_UNDEF";
|
212
|
+
case PM_TOKEN_KEYWORD_UNLESS:
|
213
|
+
return "KEYWORD_UNLESS";
|
214
|
+
case PM_TOKEN_KEYWORD_UNLESS_MODIFIER:
|
215
|
+
return "KEYWORD_UNLESS_MODIFIER";
|
216
|
+
case PM_TOKEN_KEYWORD_UNTIL:
|
217
|
+
return "KEYWORD_UNTIL";
|
218
|
+
case PM_TOKEN_KEYWORD_UNTIL_MODIFIER:
|
219
|
+
return "KEYWORD_UNTIL_MODIFIER";
|
220
|
+
case PM_TOKEN_KEYWORD_WHEN:
|
221
|
+
return "KEYWORD_WHEN";
|
222
|
+
case PM_TOKEN_KEYWORD_WHILE:
|
223
|
+
return "KEYWORD_WHILE";
|
224
|
+
case PM_TOKEN_KEYWORD_WHILE_MODIFIER:
|
225
|
+
return "KEYWORD_WHILE_MODIFIER";
|
226
|
+
case PM_TOKEN_KEYWORD_YIELD:
|
227
|
+
return "KEYWORD_YIELD";
|
228
|
+
case PM_TOKEN_KEYWORD___ENCODING__:
|
229
|
+
return "KEYWORD___ENCODING__";
|
230
|
+
case PM_TOKEN_KEYWORD___FILE__:
|
231
|
+
return "KEYWORD___FILE__";
|
232
|
+
case PM_TOKEN_KEYWORD___LINE__:
|
233
|
+
return "KEYWORD___LINE__";
|
234
|
+
case PM_TOKEN_LABEL:
|
235
|
+
return "LABEL";
|
236
|
+
case PM_TOKEN_LABEL_END:
|
237
|
+
return "LABEL_END";
|
238
|
+
case PM_TOKEN_LAMBDA_BEGIN:
|
239
|
+
return "LAMBDA_BEGIN";
|
240
|
+
case PM_TOKEN_LESS:
|
241
|
+
return "LESS";
|
242
|
+
case PM_TOKEN_LESS_EQUAL:
|
243
|
+
return "LESS_EQUAL";
|
244
|
+
case PM_TOKEN_LESS_EQUAL_GREATER:
|
245
|
+
return "LESS_EQUAL_GREATER";
|
246
|
+
case PM_TOKEN_LESS_LESS:
|
247
|
+
return "LESS_LESS";
|
248
|
+
case PM_TOKEN_LESS_LESS_EQUAL:
|
249
|
+
return "LESS_LESS_EQUAL";
|
250
|
+
case PM_TOKEN_METHOD_NAME:
|
251
|
+
return "METHOD_NAME";
|
252
|
+
case PM_TOKEN_MINUS:
|
253
|
+
return "MINUS";
|
254
|
+
case PM_TOKEN_MINUS_EQUAL:
|
255
|
+
return "MINUS_EQUAL";
|
256
|
+
case PM_TOKEN_MINUS_GREATER:
|
257
|
+
return "MINUS_GREATER";
|
258
|
+
case PM_TOKEN_NEWLINE:
|
259
|
+
return "NEWLINE";
|
260
|
+
case PM_TOKEN_NUMBERED_REFERENCE:
|
261
|
+
return "NUMBERED_REFERENCE";
|
262
|
+
case PM_TOKEN_PARENTHESIS_LEFT:
|
263
|
+
return "PARENTHESIS_LEFT";
|
264
|
+
case PM_TOKEN_PARENTHESIS_LEFT_PARENTHESES:
|
265
|
+
return "PARENTHESIS_LEFT_PARENTHESES";
|
266
|
+
case PM_TOKEN_PARENTHESIS_RIGHT:
|
267
|
+
return "PARENTHESIS_RIGHT";
|
268
|
+
case PM_TOKEN_PERCENT:
|
269
|
+
return "PERCENT";
|
270
|
+
case PM_TOKEN_PERCENT_EQUAL:
|
271
|
+
return "PERCENT_EQUAL";
|
272
|
+
case PM_TOKEN_PERCENT_LOWER_I:
|
273
|
+
return "PERCENT_LOWER_I";
|
274
|
+
case PM_TOKEN_PERCENT_LOWER_W:
|
275
|
+
return "PERCENT_LOWER_W";
|
276
|
+
case PM_TOKEN_PERCENT_LOWER_X:
|
277
|
+
return "PERCENT_LOWER_X";
|
278
|
+
case PM_TOKEN_PERCENT_UPPER_I:
|
279
|
+
return "PERCENT_UPPER_I";
|
280
|
+
case PM_TOKEN_PERCENT_UPPER_W:
|
281
|
+
return "PERCENT_UPPER_W";
|
282
|
+
case PM_TOKEN_PIPE:
|
283
|
+
return "PIPE";
|
284
|
+
case PM_TOKEN_PIPE_EQUAL:
|
285
|
+
return "PIPE_EQUAL";
|
286
|
+
case PM_TOKEN_PIPE_PIPE:
|
287
|
+
return "PIPE_PIPE";
|
288
|
+
case PM_TOKEN_PIPE_PIPE_EQUAL:
|
289
|
+
return "PIPE_PIPE_EQUAL";
|
290
|
+
case PM_TOKEN_PLUS:
|
291
|
+
return "PLUS";
|
292
|
+
case PM_TOKEN_PLUS_EQUAL:
|
293
|
+
return "PLUS_EQUAL";
|
294
|
+
case PM_TOKEN_QUESTION_MARK:
|
295
|
+
return "QUESTION_MARK";
|
296
|
+
case PM_TOKEN_REGEXP_BEGIN:
|
297
|
+
return "REGEXP_BEGIN";
|
298
|
+
case PM_TOKEN_REGEXP_END:
|
299
|
+
return "REGEXP_END";
|
300
|
+
case PM_TOKEN_SEMICOLON:
|
301
|
+
return "SEMICOLON";
|
302
|
+
case PM_TOKEN_SLASH:
|
303
|
+
return "SLASH";
|
304
|
+
case PM_TOKEN_SLASH_EQUAL:
|
305
|
+
return "SLASH_EQUAL";
|
306
|
+
case PM_TOKEN_STAR:
|
307
|
+
return "STAR";
|
308
|
+
case PM_TOKEN_STAR_EQUAL:
|
309
|
+
return "STAR_EQUAL";
|
310
|
+
case PM_TOKEN_STAR_STAR:
|
311
|
+
return "STAR_STAR";
|
312
|
+
case PM_TOKEN_STAR_STAR_EQUAL:
|
313
|
+
return "STAR_STAR_EQUAL";
|
314
|
+
case PM_TOKEN_STRING_BEGIN:
|
315
|
+
return "STRING_BEGIN";
|
316
|
+
case PM_TOKEN_STRING_CONTENT:
|
317
|
+
return "STRING_CONTENT";
|
318
|
+
case PM_TOKEN_STRING_END:
|
319
|
+
return "STRING_END";
|
320
|
+
case PM_TOKEN_SYMBOL_BEGIN:
|
321
|
+
return "SYMBOL_BEGIN";
|
322
|
+
case PM_TOKEN_TILDE:
|
323
|
+
return "TILDE";
|
324
|
+
case PM_TOKEN_UAMPERSAND:
|
325
|
+
return "UAMPERSAND";
|
326
|
+
case PM_TOKEN_UCOLON_COLON:
|
327
|
+
return "UCOLON_COLON";
|
328
|
+
case PM_TOKEN_UDOT_DOT:
|
329
|
+
return "UDOT_DOT";
|
330
|
+
case PM_TOKEN_UDOT_DOT_DOT:
|
331
|
+
return "UDOT_DOT_DOT";
|
332
|
+
case PM_TOKEN_UMINUS:
|
333
|
+
return "UMINUS";
|
334
|
+
case PM_TOKEN_UMINUS_NUM:
|
335
|
+
return "UMINUS_NUM";
|
336
|
+
case PM_TOKEN_UPLUS:
|
337
|
+
return "UPLUS";
|
338
|
+
case PM_TOKEN_USTAR:
|
339
|
+
return "USTAR";
|
340
|
+
case PM_TOKEN_USTAR_STAR:
|
341
|
+
return "USTAR_STAR";
|
342
|
+
case PM_TOKEN_WORDS_SEP:
|
343
|
+
return "WORDS_SEP";
|
344
|
+
case PM_TOKEN___END__:
|
345
|
+
return "__END__";
|
346
|
+
case PM_TOKEN_MAXIMUM:
|
347
|
+
assert(false && "unreachable");
|
348
|
+
return "";
|
349
|
+
}
|
350
|
+
|
351
|
+
// Provide a default, because some compilers can't determine that the above
|
352
|
+
// switch is exhaustive.
|
353
|
+
assert(false && "unreachable");
|
354
|
+
return "";
|
355
|
+
}
|
356
|
+
|
357
|
+
/**
|
358
|
+
* Returns the human name of the given token type.
|
359
|
+
*/
|
360
|
+
const char *
|
361
|
+
pm_token_type_human(pm_token_type_t token_type) {
|
362
|
+
switch (token_type) {
|
363
|
+
case PM_TOKEN_EOF:
|
364
|
+
return "end of file";
|
365
|
+
case PM_TOKEN_MISSING:
|
366
|
+
return "missing token";
|
367
|
+
case PM_TOKEN_NOT_PROVIDED:
|
368
|
+
return "not provided token";
|
369
|
+
case PM_TOKEN_AMPERSAND:
|
370
|
+
return "'&'";
|
371
|
+
case PM_TOKEN_AMPERSAND_AMPERSAND:
|
372
|
+
return "'&&'";
|
373
|
+
case PM_TOKEN_AMPERSAND_AMPERSAND_EQUAL:
|
374
|
+
return "'&&='";
|
375
|
+
case PM_TOKEN_AMPERSAND_DOT:
|
376
|
+
return "'&.'";
|
377
|
+
case PM_TOKEN_AMPERSAND_EQUAL:
|
378
|
+
return "'&='";
|
379
|
+
case PM_TOKEN_BACKTICK:
|
380
|
+
return "'`'";
|
381
|
+
case PM_TOKEN_BACK_REFERENCE:
|
382
|
+
return "back reference";
|
383
|
+
case PM_TOKEN_BANG:
|
384
|
+
return "'!'";
|
385
|
+
case PM_TOKEN_BANG_EQUAL:
|
386
|
+
return "'!='";
|
387
|
+
case PM_TOKEN_BANG_TILDE:
|
388
|
+
return "'!~'";
|
389
|
+
case PM_TOKEN_BRACE_LEFT:
|
390
|
+
return "'{'";
|
391
|
+
case PM_TOKEN_BRACE_RIGHT:
|
392
|
+
return "'}'";
|
393
|
+
case PM_TOKEN_BRACKET_LEFT:
|
394
|
+
return "'['";
|
395
|
+
case PM_TOKEN_BRACKET_LEFT_ARRAY:
|
396
|
+
return "'['";
|
397
|
+
case PM_TOKEN_BRACKET_LEFT_RIGHT:
|
398
|
+
return "'[]'";
|
399
|
+
case PM_TOKEN_BRACKET_LEFT_RIGHT_EQUAL:
|
400
|
+
return "'[]='";
|
401
|
+
case PM_TOKEN_BRACKET_RIGHT:
|
402
|
+
return "']'";
|
403
|
+
case PM_TOKEN_CARET:
|
404
|
+
return "'^'";
|
405
|
+
case PM_TOKEN_CARET_EQUAL:
|
406
|
+
return "'^='";
|
407
|
+
case PM_TOKEN_CHARACTER_LITERAL:
|
408
|
+
return "character literal";
|
409
|
+
case PM_TOKEN_CLASS_VARIABLE:
|
410
|
+
return "class variable";
|
411
|
+
case PM_TOKEN_COLON:
|
412
|
+
return "':'";
|
413
|
+
case PM_TOKEN_COLON_COLON:
|
414
|
+
return "'::'";
|
415
|
+
case PM_TOKEN_COMMA:
|
416
|
+
return "','";
|
417
|
+
case PM_TOKEN_COMMENT:
|
418
|
+
return "comment";
|
419
|
+
case PM_TOKEN_CONSTANT:
|
420
|
+
return "constant";
|
421
|
+
case PM_TOKEN_DOT:
|
422
|
+
return "'.'";
|
423
|
+
case PM_TOKEN_DOT_DOT:
|
424
|
+
return "'..'";
|
425
|
+
case PM_TOKEN_DOT_DOT_DOT:
|
426
|
+
return "'...'";
|
427
|
+
case PM_TOKEN_EMBDOC_BEGIN:
|
428
|
+
return "'=begin'";
|
429
|
+
case PM_TOKEN_EMBDOC_END:
|
430
|
+
return "'=end'";
|
431
|
+
case PM_TOKEN_EMBDOC_LINE:
|
432
|
+
return "embedded documentation line";
|
433
|
+
case PM_TOKEN_EMBEXPR_BEGIN:
|
434
|
+
return "'#{'";
|
435
|
+
case PM_TOKEN_EMBEXPR_END:
|
436
|
+
return "'}'";
|
437
|
+
case PM_TOKEN_EMBVAR:
|
438
|
+
return "'#'";
|
439
|
+
case PM_TOKEN_EQUAL:
|
440
|
+
return "'='";
|
441
|
+
case PM_TOKEN_EQUAL_EQUAL:
|
442
|
+
return "'=='";
|
443
|
+
case PM_TOKEN_EQUAL_EQUAL_EQUAL:
|
444
|
+
return "'==='";
|
445
|
+
case PM_TOKEN_EQUAL_GREATER:
|
446
|
+
return "'=>'";
|
447
|
+
case PM_TOKEN_EQUAL_TILDE:
|
448
|
+
return "'=~'";
|
449
|
+
case PM_TOKEN_FLOAT:
|
450
|
+
return "float";
|
451
|
+
case PM_TOKEN_FLOAT_IMAGINARY:
|
452
|
+
return "imaginary";
|
453
|
+
case PM_TOKEN_FLOAT_RATIONAL:
|
454
|
+
return "rational";
|
455
|
+
case PM_TOKEN_FLOAT_RATIONAL_IMAGINARY:
|
456
|
+
return "imaginary";
|
457
|
+
case PM_TOKEN_GLOBAL_VARIABLE:
|
458
|
+
return "global variable";
|
459
|
+
case PM_TOKEN_GREATER:
|
460
|
+
return "'>'";
|
461
|
+
case PM_TOKEN_GREATER_EQUAL:
|
462
|
+
return "'>='";
|
463
|
+
case PM_TOKEN_GREATER_GREATER:
|
464
|
+
return "'>>'";
|
465
|
+
case PM_TOKEN_GREATER_GREATER_EQUAL:
|
466
|
+
return "'>>='";
|
467
|
+
case PM_TOKEN_HEREDOC_END:
|
468
|
+
return "heredoc ending";
|
469
|
+
case PM_TOKEN_HEREDOC_START:
|
470
|
+
return "heredoc beginning";
|
471
|
+
case PM_TOKEN_IDENTIFIER:
|
472
|
+
return "local variable or method";
|
473
|
+
case PM_TOKEN_IGNORED_NEWLINE:
|
474
|
+
return "ignored newline";
|
475
|
+
case PM_TOKEN_INSTANCE_VARIABLE:
|
476
|
+
return "instance variable";
|
477
|
+
case PM_TOKEN_INTEGER:
|
478
|
+
return "integer";
|
479
|
+
case PM_TOKEN_INTEGER_IMAGINARY:
|
480
|
+
return "imaginary";
|
481
|
+
case PM_TOKEN_INTEGER_RATIONAL:
|
482
|
+
return "rational";
|
483
|
+
case PM_TOKEN_INTEGER_RATIONAL_IMAGINARY:
|
484
|
+
return "imaginary";
|
485
|
+
case PM_TOKEN_KEYWORD_ALIAS:
|
486
|
+
return "'alias'";
|
487
|
+
case PM_TOKEN_KEYWORD_AND:
|
488
|
+
return "'and'";
|
489
|
+
case PM_TOKEN_KEYWORD_BEGIN:
|
490
|
+
return "'begin'";
|
491
|
+
case PM_TOKEN_KEYWORD_BEGIN_UPCASE:
|
492
|
+
return "'BEGIN'";
|
493
|
+
case PM_TOKEN_KEYWORD_BREAK:
|
494
|
+
return "'break'";
|
495
|
+
case PM_TOKEN_KEYWORD_CASE:
|
496
|
+
return "'case'";
|
497
|
+
case PM_TOKEN_KEYWORD_CLASS:
|
498
|
+
return "'class'";
|
499
|
+
case PM_TOKEN_KEYWORD_DEF:
|
500
|
+
return "'def'";
|
501
|
+
case PM_TOKEN_KEYWORD_DEFINED:
|
502
|
+
return "'defined?'";
|
503
|
+
case PM_TOKEN_KEYWORD_DO:
|
504
|
+
return "'do'";
|
505
|
+
case PM_TOKEN_KEYWORD_DO_LOOP:
|
506
|
+
return "'do'";
|
507
|
+
case PM_TOKEN_KEYWORD_ELSE:
|
508
|
+
return "'else'";
|
509
|
+
case PM_TOKEN_KEYWORD_ELSIF:
|
510
|
+
return "'elsif'";
|
511
|
+
case PM_TOKEN_KEYWORD_END:
|
512
|
+
return "'end'";
|
513
|
+
case PM_TOKEN_KEYWORD_END_UPCASE:
|
514
|
+
return "'END'";
|
515
|
+
case PM_TOKEN_KEYWORD_ENSURE:
|
516
|
+
return "'ensure'";
|
517
|
+
case PM_TOKEN_KEYWORD_FALSE:
|
518
|
+
return "'false'";
|
519
|
+
case PM_TOKEN_KEYWORD_FOR:
|
520
|
+
return "'for'";
|
521
|
+
case PM_TOKEN_KEYWORD_IF:
|
522
|
+
return "'if'";
|
523
|
+
case PM_TOKEN_KEYWORD_IF_MODIFIER:
|
524
|
+
return "'if'";
|
525
|
+
case PM_TOKEN_KEYWORD_IN:
|
526
|
+
return "'in'";
|
527
|
+
case PM_TOKEN_KEYWORD_MODULE:
|
528
|
+
return "'module'";
|
529
|
+
case PM_TOKEN_KEYWORD_NEXT:
|
530
|
+
return "'next'";
|
531
|
+
case PM_TOKEN_KEYWORD_NIL:
|
532
|
+
return "'nil'";
|
533
|
+
case PM_TOKEN_KEYWORD_NOT:
|
534
|
+
return "'not'";
|
535
|
+
case PM_TOKEN_KEYWORD_OR:
|
536
|
+
return "'or'";
|
537
|
+
case PM_TOKEN_KEYWORD_REDO:
|
538
|
+
return "'redo'";
|
539
|
+
case PM_TOKEN_KEYWORD_RESCUE:
|
540
|
+
return "'rescue'";
|
541
|
+
case PM_TOKEN_KEYWORD_RESCUE_MODIFIER:
|
542
|
+
return "'rescue'";
|
543
|
+
case PM_TOKEN_KEYWORD_RETRY:
|
544
|
+
return "'retry'";
|
545
|
+
case PM_TOKEN_KEYWORD_RETURN:
|
546
|
+
return "'return'";
|
547
|
+
case PM_TOKEN_KEYWORD_SELF:
|
548
|
+
return "'self'";
|
549
|
+
case PM_TOKEN_KEYWORD_SUPER:
|
550
|
+
return "'super'";
|
551
|
+
case PM_TOKEN_KEYWORD_THEN:
|
552
|
+
return "'then'";
|
553
|
+
case PM_TOKEN_KEYWORD_TRUE:
|
554
|
+
return "'true'";
|
555
|
+
case PM_TOKEN_KEYWORD_UNDEF:
|
556
|
+
return "'undef'";
|
557
|
+
case PM_TOKEN_KEYWORD_UNLESS:
|
558
|
+
return "'unless'";
|
559
|
+
case PM_TOKEN_KEYWORD_UNLESS_MODIFIER:
|
560
|
+
return "'unless'";
|
561
|
+
case PM_TOKEN_KEYWORD_UNTIL:
|
562
|
+
return "'until'";
|
563
|
+
case PM_TOKEN_KEYWORD_UNTIL_MODIFIER:
|
564
|
+
return "'until'";
|
565
|
+
case PM_TOKEN_KEYWORD_WHEN:
|
566
|
+
return "'when'";
|
567
|
+
case PM_TOKEN_KEYWORD_WHILE:
|
568
|
+
return "'while'";
|
569
|
+
case PM_TOKEN_KEYWORD_WHILE_MODIFIER:
|
570
|
+
return "'while'";
|
571
|
+
case PM_TOKEN_KEYWORD_YIELD:
|
572
|
+
return "'yield'";
|
573
|
+
case PM_TOKEN_KEYWORD___ENCODING__:
|
574
|
+
return "'__ENCODING__'";
|
575
|
+
case PM_TOKEN_KEYWORD___FILE__:
|
576
|
+
return "'__FILE__'";
|
577
|
+
case PM_TOKEN_KEYWORD___LINE__:
|
578
|
+
return "'__LINE__'";
|
579
|
+
case PM_TOKEN_LABEL:
|
580
|
+
return "label";
|
581
|
+
case PM_TOKEN_LABEL_END:
|
582
|
+
return "label terminator";
|
583
|
+
case PM_TOKEN_LAMBDA_BEGIN:
|
584
|
+
return "'{'";
|
585
|
+
case PM_TOKEN_LESS:
|
586
|
+
return "'<'";
|
587
|
+
case PM_TOKEN_LESS_EQUAL:
|
588
|
+
return "'<='";
|
589
|
+
case PM_TOKEN_LESS_EQUAL_GREATER:
|
590
|
+
return "'<=>'";
|
591
|
+
case PM_TOKEN_LESS_LESS:
|
592
|
+
return "'<<'";
|
593
|
+
case PM_TOKEN_LESS_LESS_EQUAL:
|
594
|
+
return "'<<='";
|
595
|
+
case PM_TOKEN_METHOD_NAME:
|
596
|
+
return "method name";
|
597
|
+
case PM_TOKEN_MINUS:
|
598
|
+
return "'-'";
|
599
|
+
case PM_TOKEN_MINUS_EQUAL:
|
600
|
+
return "'-='";
|
601
|
+
case PM_TOKEN_MINUS_GREATER:
|
602
|
+
return "'->'";
|
603
|
+
case PM_TOKEN_NEWLINE:
|
604
|
+
return "newline";
|
605
|
+
case PM_TOKEN_NUMBERED_REFERENCE:
|
606
|
+
return "numbered reference";
|
607
|
+
case PM_TOKEN_PARENTHESIS_LEFT:
|
608
|
+
return "'('";
|
609
|
+
case PM_TOKEN_PARENTHESIS_LEFT_PARENTHESES:
|
610
|
+
return "'('";
|
611
|
+
case PM_TOKEN_PARENTHESIS_RIGHT:
|
612
|
+
return "')'";
|
613
|
+
case PM_TOKEN_PERCENT:
|
614
|
+
return "'%'";
|
615
|
+
case PM_TOKEN_PERCENT_EQUAL:
|
616
|
+
return "'%='";
|
617
|
+
case PM_TOKEN_PERCENT_LOWER_I:
|
618
|
+
return "'%i'";
|
619
|
+
case PM_TOKEN_PERCENT_LOWER_W:
|
620
|
+
return "'%w'";
|
621
|
+
case PM_TOKEN_PERCENT_LOWER_X:
|
622
|
+
return "'%x'";
|
623
|
+
case PM_TOKEN_PERCENT_UPPER_I:
|
624
|
+
return "'%I'";
|
625
|
+
case PM_TOKEN_PERCENT_UPPER_W:
|
626
|
+
return "'%W'";
|
627
|
+
case PM_TOKEN_PIPE:
|
628
|
+
return "'|'";
|
629
|
+
case PM_TOKEN_PIPE_EQUAL:
|
630
|
+
return "'|='";
|
631
|
+
case PM_TOKEN_PIPE_PIPE:
|
632
|
+
return "'||'";
|
633
|
+
case PM_TOKEN_PIPE_PIPE_EQUAL:
|
634
|
+
return "'||='";
|
635
|
+
case PM_TOKEN_PLUS:
|
636
|
+
return "'+'";
|
637
|
+
case PM_TOKEN_PLUS_EQUAL:
|
638
|
+
return "'+='";
|
639
|
+
case PM_TOKEN_QUESTION_MARK:
|
640
|
+
return "'?'";
|
641
|
+
case PM_TOKEN_REGEXP_BEGIN:
|
642
|
+
return "regular expression beginning";
|
643
|
+
case PM_TOKEN_REGEXP_END:
|
644
|
+
return "regular expression ending";
|
645
|
+
case PM_TOKEN_SEMICOLON:
|
646
|
+
return "';'";
|
647
|
+
case PM_TOKEN_SLASH:
|
648
|
+
return "'/'";
|
649
|
+
case PM_TOKEN_SLASH_EQUAL:
|
650
|
+
return "'/='";
|
651
|
+
case PM_TOKEN_STAR:
|
652
|
+
return "'*'";
|
653
|
+
case PM_TOKEN_STAR_EQUAL:
|
654
|
+
return "'*='";
|
655
|
+
case PM_TOKEN_STAR_STAR:
|
656
|
+
return "'**'";
|
657
|
+
case PM_TOKEN_STAR_STAR_EQUAL:
|
658
|
+
return "'**='";
|
659
|
+
case PM_TOKEN_STRING_BEGIN:
|
660
|
+
return "string beginning";
|
661
|
+
case PM_TOKEN_STRING_CONTENT:
|
662
|
+
return "string content";
|
663
|
+
case PM_TOKEN_STRING_END:
|
664
|
+
return "string ending";
|
665
|
+
case PM_TOKEN_SYMBOL_BEGIN:
|
666
|
+
return "symbol beginning";
|
667
|
+
case PM_TOKEN_TILDE:
|
668
|
+
return "'~'";
|
669
|
+
case PM_TOKEN_UAMPERSAND:
|
670
|
+
return "'&'";
|
671
|
+
case PM_TOKEN_UCOLON_COLON:
|
672
|
+
return "'::'";
|
673
|
+
case PM_TOKEN_UDOT_DOT:
|
674
|
+
return "'..'";
|
675
|
+
case PM_TOKEN_UDOT_DOT_DOT:
|
676
|
+
return "'...'";
|
677
|
+
case PM_TOKEN_UMINUS:
|
678
|
+
return "'-'";
|
679
|
+
case PM_TOKEN_UMINUS_NUM:
|
680
|
+
return "'-'";
|
681
|
+
case PM_TOKEN_UPLUS:
|
682
|
+
return "'+'";
|
683
|
+
case PM_TOKEN_USTAR:
|
684
|
+
return "*";
|
685
|
+
case PM_TOKEN_USTAR_STAR:
|
686
|
+
return "'**'";
|
687
|
+
case PM_TOKEN_WORDS_SEP:
|
688
|
+
return "string separator";
|
689
|
+
case PM_TOKEN___END__:
|
690
|
+
return "'__END__'";
|
691
|
+
case PM_TOKEN_MAXIMUM:
|
692
|
+
assert(false && "unreachable");
|
693
|
+
return "";
|
694
|
+
}
|
695
|
+
|
696
|
+
// Provide a default, because some compilers can't determine that the above
|
697
|
+
// switch is exhaustive.
|
698
|
+
assert(false && "unreachable");
|
699
|
+
return "";
|
700
|
+
}
|