Last change
on this file since 9e0afb5 was
1e551bd,
checked in by Mateusz Hromada <ruanda@…>, 15 years ago
|
Migration to new build system.
|
-
Property mode set to
100644
|
File size:
1.5 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 | |
---|
21 | abrv (ab1|ab2) |
---|
22 | |
---|
23 | SEG .*\n |
---|
24 | N {n}{s}{n}{s}N{s}.*\n |
---|
25 | S {n}{s}{n}{s}S{s}.*\n |
---|
26 | P {n}{s}{n}{s}P{s}.*\n |
---|
27 | W {n}{s}{n}{s}W{s}.*\n |
---|
28 | UL {n}{s}{n}{s}W{s}{ul}.*\n |
---|
29 | Cap {n}{s}{n}{s}W{s}{ul}{ll}*.*\n |
---|
30 | POINT {n}{s}{n}{s}P{s}\.({s}.*)?\n |
---|
31 | QMARK {n}{s}{n}{s}P{s}\?({s}.*)?\n |
---|
32 | EXCL {n}{s}{n}{s}P{s}\!({s}.*)?\n |
---|
33 | DASH {n}{s}{n}{s}P{s}\-({s}.*)?\n |
---|
34 | POINTS {POINT}+ |
---|
35 | |
---|
36 | ABRV {n}{s}{n}{s}W{s}{abrv}({s}.*)?\n |
---|
37 | |
---|
38 | EOS {POINT}|{POINTS}|{QMARK}|{EXCL} |
---|
39 | |
---|
40 | |
---|
41 | %% |
---|
42 | |
---|
43 | |
---|
44 | {N}({POINT}{N})+ { ECHO; set_position(); } |
---|
45 | ({UL}{POINT}{S}?)+{Cap} { ECHO; set_position(); } |
---|
46 | {ABRV}{POINT} { ECHO; set_position(); } |
---|
47 | |
---|
48 | |
---|
49 | {P}/{S}{DASH} { ECHO; set_position(); print_EOS(); } |
---|
50 | {EOS}/{S}({Cap}|{P}|{N}) { ECHO; set_position(); print_EOS(); } |
---|
51 | |
---|
52 | .* { ECHO; set_position(); } |
---|
53 | |
---|
54 | <<EOF>> { printf("%04d 00 EOS *\n",pos+len); exit(1); } |
---|
55 | |
---|
56 | %% |
---|
57 | |
---|
58 | int main() |
---|
59 | { |
---|
60 | printf("0000 00 BOS *\n"); |
---|
61 | yylex(); |
---|
62 | return 0; |
---|
63 | } |
---|
64 | |
---|
65 | int yywrap() |
---|
66 | { |
---|
67 | return 1; |
---|
68 | } |
---|
69 | |
---|
70 | void set_position() |
---|
71 | { |
---|
72 | char *lastseg; |
---|
73 | char *tmp; |
---|
74 | |
---|
75 | yytext[yyleng-1] = '\0'; |
---|
76 | |
---|
77 | tmp = strrchr(yytext, '\n'); |
---|
78 | if( tmp ) |
---|
79 | { |
---|
80 | lastseg = tmp + 1; |
---|
81 | } |
---|
82 | else |
---|
83 | { |
---|
84 | lastseg = yytext; |
---|
85 | } |
---|
86 | |
---|
87 | sscanf(lastseg, "%d %d", &pos, &len); |
---|
88 | yytext[yyleng-1] = '\n'; |
---|
89 | |
---|
90 | } |
---|
91 | |
---|
92 | void print_EOS() |
---|
93 | { |
---|
94 | printf("%04d 00 EOS *\n%04d 00 BOS *\n", pos+len, pos+len); |
---|
95 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.