lex_names.c (350B)
1 #include <stdlib.h> 2 #include <stdio.h> 3 #include "lex.h" 4 5 #define is(f) if (func == f) 6 7 char *get_name(lex_val *(*func)(void)) { 8 is(lex_type) return "type"; 9 is(lex_comma) return "comma"; 10 is(lex_semi) return ";"; 11 is(lex_assign) return "="; 12 is(lex_sym) return "symbol"; 13 is(lex_number) return "[0-9]+"; 14 is(lex_name) return "name"; 15 return NULL; 16 }