Debian Codegraph @

examples/manual/unput.lex

raw
1 /*
2 * unput.l : An example of what *not*
3 * to do with unput().
4 */
5
6
7 %{
8 #include <stdio.h>
9
10 void putback_yytext(void);
11 %}
12
13 %%
14 foobar putback_yytext();
15 raboof putback_yytext();
16 %%
17
18 void putback_yytext(void)
19 {
20 int i;
21 int l = strlen(yytext);
22 char buffer[YY_BUF_SIZE];
23
24 strcpy(buffer,yytext);
25 printf("Got: %s\n",yytext);
26 for(i=0; i<l; i++){
27 unput(buffer[i]);
28 }
29 }
30
31
32