source: app/lib/ser.l.template @ 4518a0b

Last change on this file since 4518a0b was 25ae32e, checked in by obrebski <obrebski@…>, 16 years ago

git-svn-id: svn://atos.wmid.amu.edu.pl/utt@4 e293616e-ec6a-49c2-aa92-f4a8b91c5d16

  • Property mode set to 100644
File size: 600 bytes
Line 
1%{
2                #include<string.h>
3                int n=0;
4%}
5
6%%
7
8PATTERN                 {
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.