12 EXPONENT [Ee][+-]?{DIGIT}+
14 INTQUAL (l|L|ll|LL|lL|Ll|u|U)
23 /* Prevent compilation of static input() function in generated scanner
24 code. This function is never actually used, and GCC 4.3 will emit
28 int filter_snarfage = 0;
38 enum t_state state = SKIP;
39 int cookie_was_last = 0;
41 #define OUT_RAW(type,text) if (print) printf ("(%s . \"%s\")\n", #type, text)
43 #define OUT_T(type) OUT_RAW (type, yytext)
44 #define OUT_S if (print) printf ("%s\n", yytext)
45 #define OUT(type) if (print) printf ("%s\n", #type)
47 #define IS_COOKIE cookie_was_last = 1
48 #define IS_NOT_COOKIE cookie_was_last = 0
54 \/\*(\n|[^*]|\*[^/])*\*\/ { OUT_T (comment); }
56 ({SPACE}*(\\\n)*{SPACE}*)+ ;
58 ({SPACE}*\n*{SPACE}*)+ { OUT(eol); }
60 #.*\n { OUT(hash); IS_NOT_COOKIE; }
62 {LETTER}({LETTER}|{DIGIT})* { OUT_T (id); IS_NOT_COOKIE; }
64 0[xX]{HEXDIGIT}+{INTQUAL}? { OUT_RAW (int_hex, yytext + 2); IS_NOT_COOKIE; }
65 0{OCTDIGIT}+{INTQUAL}? { OUT_RAW (int_oct, yytext + 1); IS_NOT_COOKIE; }
66 {DIGIT}+{INTQUAL}? { OUT_T (int_dec); IS_NOT_COOKIE; }
68 L?\'(\\.|[^\\\'])+\' { OUT_T (char); IS_NOT_COOKIE; }
70 {DIGIT}+{EXPONENT}{FLOQUAL}? { OUT_T (flo_dec); IS_NOT_COOKIE; }
71 {DIGIT}*"."{DIGIT}+({EXPONENT})?{FLOQUAL}? { OUT_T (flo_dec); IS_NOT_COOKIE; }
72 {DIGIT}+"."{DIGIT}*({EXPONENT})?{FLOQUAL}? { OUT_T (flo_dec); IS_NOT_COOKIE; }
74 L?\"(\\.|[^\\\"])*\" { OUT_S; IS_NOT_COOKIE; }
76 "..." { OUT (ellipsis); IS_NOT_COOKIE; }
78 ">>=" { OUT (shift_right_assign); IS_NOT_COOKIE; }
79 "<<=" { OUT (shift_left_assign); IS_NOT_COOKIE; }
80 "+=" { OUT (add_assign); IS_NOT_COOKIE; }
81 "-=" { OUT (sub_assign); IS_NOT_COOKIE; }
82 "*=" { OUT (mul-assign); IS_NOT_COOKIE; }
83 "/=" { OUT (div_assign); IS_NOT_COOKIE; }
84 "%=" { OUT (mod_assign); IS_NOT_COOKIE; }
85 "&=" { OUT (logand_assign); IS_NOT_COOKIE; }
86 "^=" { OUT (logxor_assign); IS_NOT_COOKIE; }
87 "|=" { OUT (logior_assign); IS_NOT_COOKIE; }
88 ">>" { OUT (right_shift); IS_NOT_COOKIE; }
89 "<<" { OUT (left_shift); IS_NOT_COOKIE; }
90 "++" { OUT (inc); IS_NOT_COOKIE; }
91 "--" { OUT (dec); IS_NOT_COOKIE; }
92 "->" { OUT (ptr); IS_NOT_COOKIE; }
93 "&&" { OUT (and); IS_NOT_COOKIE; }
94 "||" { OUT (or); IS_NOT_COOKIE; }
95 "<=" { OUT (le); IS_NOT_COOKIE; }
96 ">=" { OUT (ge); IS_NOT_COOKIE; }
97 "==" { OUT (eq); IS_NOT_COOKIE; }
98 "!=" { OUT (ne); IS_NOT_COOKIE; }
99 ";" { OUT (semicolon); IS_NOT_COOKIE; }
103 if (filter_snarfage && cookie_was_last && state == COOKIE)
109 if (filter_snarfage && cookie_was_last && state == MULTILINE_COOKIE) {
115 "," { OUT (comma); IS_NOT_COOKIE; }
116 ":" { OUT (colon); IS_NOT_COOKIE; }
117 "=" { OUT (assign); IS_NOT_COOKIE; }
118 "(" { OUT (paren_open); IS_NOT_COOKIE; }
119 ")" { OUT (paren_close); IS_NOT_COOKIE; }
120 ("["|"<:") { OUT (bracket_open); IS_NOT_COOKIE; }
121 ("]"|":>") { OUT (bracket_close); IS_NOT_COOKIE; }
122 "." { OUT (dot); IS_NOT_COOKIE; }
123 "&" { OUT (amp); IS_NOT_COOKIE; }
124 "!" { OUT (bang); IS_NOT_COOKIE; }
125 "~" { OUT (tilde); IS_NOT_COOKIE; }
126 "-" { OUT (minus); IS_NOT_COOKIE; }
127 "+" { OUT (plus); IS_NOT_COOKIE; }
128 "*" { OUT (star); IS_NOT_COOKIE; }
129 "/" { OUT (slash); IS_NOT_COOKIE; }
130 "%" { OUT (percent); IS_NOT_COOKIE; }
131 "<" { OUT (lt); IS_NOT_COOKIE; }
132 ">" { OUT (gt); IS_NOT_COOKIE; }
143 case MULTILINE_COOKIE:
144 state = MULTILINE_COOKIE;
162 "^" { OUT (caret); IS_NOT_COOKIE; }
163 "|" { OUT (pipe); IS_NOT_COOKIE; }
164 "?" { OUT (question); IS_NOT_COOKIE; }
166 . { fprintf (stderr, "*%s", yytext); fflush (stderr); IS_NOT_COOKIE; }
171 main (int argc, char *argv[])
173 if (argc > 1 && !strcmp (argv[1], "--filter-snarfage")) {