source:
trunk/essentials/sys-devel/flex/examples/manual/unput.lex
Last change on this file was 3031, checked in by , 18 years ago | |
---|---|
File size: 429 bytes |
Line | |
---|---|
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 |
Note:
See TracBrowser
for help on using the repository browser.