mirror of
https://github.com/westes/flex.git
synced 2026-01-26 07:37:52 +00:00
33 lines
433 B
Plaintext
33 lines
433 B
Plaintext
/*
|
|
* unput.l : An example of what *not*
|
|
* to do with yyunput().
|
|
*/
|
|
|
|
|
|
%{
|
|
#include <stdio.h>
|
|
|
|
void putback_yytext(void);
|
|
%}
|
|
|
|
%%
|
|
foobar putback_yytext();
|
|
raboof putback_yytext();
|
|
%%
|
|
|
|
void putback_yytext(void)
|
|
{
|
|
int i;
|
|
int l = strlen(yytext);
|
|
char buffer[YY_BUF_SIZE];
|
|
|
|
strcpy(buffer,yytext);
|
|
printf("Got: %s\n",yytext);
|
|
for(i=0; i<l; i++){
|
|
yyunput(buffer[i]);
|
|
}
|
|
}
|
|
|
|
|
|
|