Last change
on this file since 555c7f8 was
ac25afd,
checked in by Tomasz Obrebski <to@…>, 13 years ago
|
sen component added
|
-
Property mode set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | %{ |
---|
2 | |
---|
3 | void print_EOS(void); |
---|
4 | void set_position(void); |
---|
5 | |
---|
6 | int pos=0; |
---|
7 | int len=0; |
---|
8 | |
---|
9 | %} |
---|
10 | |
---|
11 | ul [A-Z¡ÆÊ£ÑÓŠ¯¬] |
---|
12 | ll [a-z±æê³ñ󶿌] |
---|
13 | l ul|ll |
---|
14 | n [0-9]+ |
---|
15 | s [ \t]+ |
---|
16 | |
---|
17 | |
---|
18 | ab1 (mgr|in¿|prof|hab|doc|dyr|kier|zast) |
---|
19 | ab2 (ul|pl|al) |
---|
20 | ab3 (str|ryc|rys) |
---|
21 | ab4 (np|tzw) |
---|
22 | |
---|
23 | abrv ({ab1}|{ab2}|{ab3}) |
---|
24 | |
---|
25 | SEG .*\n |
---|
26 | N {n}{s}{n}{s}N{s}.*\n |
---|
27 | S {n}{s}{n}{s}S{s}.*\n |
---|
28 | P {n}{s}{n}{s}P{s}.*\n |
---|
29 | W {n}{s}{n}{s}W{s}.*\n |
---|
30 | UL {n}{s}{n}{s}W{s}{ul}.*\n |
---|
31 | Cap {n}{s}{n}{s}W{s}{ul}{ll}*.*\n |
---|
32 | POINT {n}{s}{n}{s}P{s}\.({s}.*)?\n |
---|
33 | QMARK {n}{s}{n}{s}P{s}\?({s}.*)?\n |
---|
34 | EXCL {n}{s}{n}{s}P{s}\!({s}.*)?\n |
---|
35 | DASH {n}{s}{n}{s}P{s}\-({s}.*)?\n |
---|
36 | POINTS {POINT}+ |
---|
37 | |
---|
38 | ABRV {n}{s}{n}{s}W{s}{abrv}({s}.*)?\n |
---|
39 | |
---|
40 | EOS {POINT}|{POINTS}|{QMARK}|{EXCL} |
---|
41 | |
---|
42 | |
---|
43 | %% |
---|
44 | |
---|
45 | |
---|
46 | {N}({POINT}{N})+ { ECHO; set_position(); } |
---|
47 | ({UL}{POINT}{S}?)+{Cap} { ECHO; set_position(); } |
---|
48 | {ABRV}{POINT} { ECHO; set_position(); } |
---|
49 | |
---|
50 | |
---|
51 | {P}/{S}{DASH} { ECHO; set_position(); print_EOS(); } |
---|
52 | {EOS}/{S}({Cap}|{P}|{N}) { ECHO; set_position(); print_EOS(); } |
---|
53 | |
---|
54 | .* { ECHO; set_position(); } |
---|
55 | |
---|
56 | <<EOF>> { printf("%04d 00 EOS *\n",pos+len); exit(1); } |
---|
57 | |
---|
58 | %% |
---|
59 | |
---|
60 | int main() |
---|
61 | { |
---|
62 | printf("0000 00 BOS *\n"); |
---|
63 | yylex(); |
---|
64 | return 0; |
---|
65 | } |
---|
66 | |
---|
67 | int yywrap() |
---|
68 | { |
---|
69 | return 1; |
---|
70 | } |
---|
71 | |
---|
72 | void set_position() |
---|
73 | { |
---|
74 | char *lastseg; |
---|
75 | char *tmp; |
---|
76 | |
---|
77 | yytext[yyleng-1] = '\0'; |
---|
78 | |
---|
79 | tmp = strrchr(yytext, '\n'); |
---|
80 | if( tmp ) |
---|
81 | { |
---|
82 | lastseg = tmp + 1; |
---|
83 | } |
---|
84 | else |
---|
85 | { |
---|
86 | lastseg = yytext; |
---|
87 | } |
---|
88 | |
---|
89 | sscanf(lastseg, "%d %d", &pos, &len); |
---|
90 | yytext[yyleng-1] = '\n'; |
---|
91 | |
---|
92 | } |
---|
93 | |
---|
94 | void print_EOS() |
---|
95 | { |
---|
96 | printf("%04d 00 EOS *\n%04d 00 BOS *\n", pos+len, pos+len); |
---|
97 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.