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 33