Ruby: prism/token_type.c Source File

Ruby 4.0.6p0 (2026-07-14 revision 03b6d3f8898a28604fe6cb00eae3226b821168f4)

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