source: trunk/flex/examples/manual/unput.lex@ 3032

Last change on this file since 3032 was 3031, checked in by bird, 18 years ago

flex 2.5.33.

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
10void putback_yytext(void);
11%}
12
13%%
14foobar putback_yytext();
15raboof putback_yytext();
16%%
17
18void 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.