lab6-72-73

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
int continued;
struct Position cur;
#define YY_USER_ACTION
{
int i;
if (! continued)
yylloc->starting = cur;
continued = 0;
for (i = 0; i < yyleng; i++)
{
if (yytext[i] == ’\n)
{
cur.line++;
cur.pos = 1;
}
else
cur.pos++;
cur.index++;
}
yylloc->following = cur;
}