]> git.lizzy.rs Git - plan9front.git/blob - sys/src/ape/lib/l/yyless.c
merge
[plan9front.git] / sys / src / ape / lib / l / yyless.c
1 #include        <libl.h>
2 #include        <stdio.h>
3
4 extern  char    yytext[];
5 extern  int     yyleng;
6 extern  int     yyprevious;
7
8 void    yyunput(int c);
9
10 void
11 yyless(int x)
12 {
13         char *lastch, *ptr;
14
15         lastch = yytext+yyleng;
16         if(x>=0 && x <= yyleng)
17                 ptr = x + yytext;
18         else
19                 ptr = (char*)x;
20         while(lastch > ptr)
21                 yyunput(*--lastch);
22         *lastch = 0;
23         if (ptr >yytext)
24                 yyprevious = *--lastch;
25         yyleng = ptr-yytext;
26 }