Last change
on this file since 2ff1f65 was
5f4d9c3,
checked in by Maciej Prill <mprill@…>, 13 years ago
|
Rewritten the build system, added lem UTF-8 version.
|
-
Property mode set to
100644
|
File size:
600 bytes
|
Line | |
---|
1 | %{ |
---|
2 | #include<string.h> |
---|
3 | int n=0; |
---|
4 | %} |
---|
5 | |
---|
6 | %% |
---|
7 | |
---|
8 | PATTERN { |
---|
9 | int start, end, len; |
---|
10 | char *lastseg, *tmp; |
---|
11 | if(yytext[yyleng-1]!='\n') |
---|
12 | {fprintf(stderr,"ser: pattern matches incomplete line\n"); exit(1);} |
---|
13 | n++; |
---|
14 | sscanf(yytext,"%d %d",&start,&len); |
---|
15 | yytext[yyleng-1]='\0'; |
---|
16 | if(tmp=strrchr(yytext,'\n')) |
---|
17 | { |
---|
18 | lastseg=tmp+1; |
---|
19 | sscanf(lastseg,"%d %d", &end, &len); |
---|
20 | } |
---|
21 | else |
---|
22 | end=start; |
---|
23 | yytext[yyleng-1]='\n'; |
---|
24 | printf("%04d 00 BOM * ser:%d\n",start,n); |
---|
25 | ECHO; |
---|
26 | printf("%04d 00 EOM * ser:%d\n",end+len,n); |
---|
27 | } |
---|
28 | |
---|
29 | |
---|
30 | .*\n DEFAULTACTION; |
---|
Note: See
TracBrowser
for help on using the repository browser.