Debian Codegraph @

src/txtelat1.l

raw
1 /* Conversion of files between different charsets and surfaces.
2 Copyright © 1990-2000 Free Software Foundation, Inc.
3 Contributed by François Pinard <[email protected]>, 1989.
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License
7 as published by the Free Software Foundation; either version 3 of the
8 License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be
11 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with the Recode Library; see the file `COPYING.LIB'.
17 If not, see <https://www.gnu.org/licenses/>.
18 */
19
20 /* Step name: texte_latin1. */
21
22 %{
23
24 void texte_latin1_diaeresis (void);
25
26 %}
27
28 s (^|[^a-zA-Z])
29 d [:"]
30 l [a-zA-Z]
31 %%
32
33 `` { recode_put_byte (171, subtask); }
34 '' { recode_put_byte (187, subtask); }
35
36 A` { recode_put_byte (192, subtask); }
37 A^ { recode_put_byte (194, subtask); }
38 A{d}/{l} { if (yytext[1] == request->diaeresis_char)
39 recode_put_byte (196, subtask);
40 else
41 ECHO;
42 }
43 a` { recode_put_byte (224, subtask); }
44 a^ { recode_put_byte (226, subtask); }
45 a{d}/{l} { if (yytext[1] == request->diaeresis_char)
46 recode_put_byte (228, subtask);
47 else
48 ECHO;
49 }
50
51 C\,/[aAoOuU] { recode_put_byte (199, subtask); }
52 c\,/[aAoOuU] { recode_put_byte (231, subtask); }
53
54 E` { recode_put_byte (200, subtask); }
55 E''' { recode_put_byte (201, subtask); recode_put_byte (187, subtask); }
56 E'' { recode_put_byte ('E', subtask); recode_put_byte (187, subtask); }
57 E' { recode_put_byte (201, subtask); }
58 E^ { recode_put_byte (202, subtask); }
59 E{d}/{l} { if (yytext[1] == request->diaeresis_char)
60 recode_put_byte (203, subtask);
61 else
62 ECHO;
63 }
64 e` { recode_put_byte (232, subtask); }
65 e''' { recode_put_byte (233, subtask); recode_put_byte (187, subtask); }
66 e'' { recode_put_byte ('e', subtask); recode_put_byte (187, subtask); }
67 e' { recode_put_byte (233, subtask); }
68 e^ { recode_put_byte (234, subtask); }
69 e{d}/{l} { if (yytext[1] == request->diaeresis_char)
70 recode_put_byte (235, subtask);
71 else
72 ECHO;
73 }
74
75 I` { recode_put_byte (204, subtask); }
76 I^ { recode_put_byte (206, subtask); }
77 I{d}/{l} { if (yytext[1] == request->diaeresis_char)
78 recode_put_byte (207, subtask);
79 else
80 ECHO;
81 }
82 i` { recode_put_byte (236, subtask); }
83 i^ { recode_put_byte (238, subtask); }
84 i{d}/{l} { if (yytext[1] == request->diaeresis_char)
85 recode_put_byte (239, subtask);
86 else
87 ECHO;
88 }
89
90 O` { recode_put_byte (210, subtask); }
91 O^ { recode_put_byte (212, subtask); }
92 O{d}/{l} { if (yytext[1] == request->diaeresis_char)
93 recode_put_byte (214, subtask);
94 else
95 ECHO;
96 }
97 o` { recode_put_byte (242, subtask); }
98 o^ { recode_put_byte (244, subtask); }
99 o{d}/{l} { if (yytext[1] == request->diaeresis_char)
100 recode_put_byte (246, subtask);
101 else
102 ECHO;
103 }
104
105 U` { recode_put_byte (217, subtask); }
106 U^ { recode_put_byte (219, subtask); }
107 U{d}/{l} { if (yytext[1] == request->diaeresis_char)
108 recode_put_byte (220, subtask);
109 else
110 ECHO;
111 }
112 u` { recode_put_byte (249, subtask); }
113 u^ { recode_put_byte (251, subtask); }
114 u{d}/{l} { if (yytext[1] == request->diaeresis_char)
115 recode_put_byte (252, subtask);
116 else
117 ECHO;
118 }
119
120 {s}[Bb]esaigue{d} { texte_latin1_diaeresis (); }
121 {s}[Cc]igue{d} { texte_latin1_diaeresis (); }
122 {s}[Aa]igue{d} { texte_latin1_diaeresis (); }
123 {s}[Aa]mbigue{d} { texte_latin1_diaeresis (); }
124 {s}[Cc]ontigue{d} { texte_latin1_diaeresis (); }
125 {s}[Ee]xigue{d} { texte_latin1_diaeresis (); }
126 {s}[Ss]ubaigue{d} { texte_latin1_diaeresis (); }
127 {s}[Ss]uraigue{d} { texte_latin1_diaeresis (); }
128 {s}[Aa]i{d} { texte_latin1_diaeresis (); }
129 {s}[Cc]ongai{d} { texte_latin1_diaeresis (); }
130 {s}[Gg]oi{d} { texte_latin1_diaeresis (); }
131 {s}[Hh]ai{d}kai{d} { if (yytext[4] == request->diaeresis_char)
132 texte_latin1_diaeresis ();
133 else
134 ECHO;
135 }
136 {s}[Ii]noui{d} { texte_latin1_diaeresis (); }
137 [JjTtLl]'[Aa][Ii]{d} { ECHO; }
138 {s}[Ss]ai{d} { texte_latin1_diaeresis (); }
139 {s}[Ss]amurai{d} { texte_latin1_diaeresis (); }
140 {s}[Tt]hai{d} { texte_latin1_diaeresis (); }
141 {s}[Tt]okai{d} { texte_latin1_diaeresis (); }
142 {s}[Cc]anoe{d} { texte_latin1_diaeresis (); }
143 {s}Esau{d} { texte_latin1_diaeresis (); }
144 %%
145
146 void
147 texte_latin1_diaeresis (void)
148 {
149 unsigned counter;
150
151 for (counter = 0; counter < yyleng; counter++)
152 if (yytext[counter+1] == request->diaeresis_char)
153 {
154 switch (yytext[counter])
155 {
156 /* The next "case 'A'" line once triggered a `NULL in input'
157 diagnostic in flex. This astonishing bug has been hard to
158 isolate, so I'll leave this comment around for a while. */
159
160 case 'A': recode_put_byte (196, subtask); break;
161 case 'E': recode_put_byte (203, subtask); break;
162 case 'I': recode_put_byte (207, subtask); break;
163 case 'O': recode_put_byte (214, subtask); break;
164 case 'U': recode_put_byte (220, subtask); break;
165 case 'a': recode_put_byte (228, subtask); break;
166 case 'e': recode_put_byte (235, subtask); break;
167 case 'i': recode_put_byte (239, subtask); break;
168 case 'o': recode_put_byte (246, subtask); break;
169 case 'u': recode_put_byte (252, subtask); break;
170 case 'y': recode_put_byte (255, subtask); break;
171 default: recode_put_byte (yytext[counter], subtask);
172 }
173 counter++;
174 }
175 else
176 recode_put_byte (yytext[counter], subtask);
177 }
178
179 bool
180 module_texte_latin1 (RECODE_OUTER outer)
181 {
182 return
183 recode_declare_single (outer, "Texte", "Latin-1",
184 outer->quality_variable_to_byte, NULL,
185 transform_texte_latin1)
186 && recode_declare_alias (outer, "txte", "Texte");
187 }
188
189 void
190 delmodule_texte_latin1 (RECODE_OUTER outer)
191 {
192 }