Fix typo in key string: ">" -> ")".
[m17n/m17n-db.git] / MIM / bo-ewts.mim
1 ;; bo-ewts.mim -- Tibetan input method with EWTS
2 ;; Copyright (C) 2007
3 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
4 ;;   Registration Number H15PRO112
5
6 ;; This file is part of the m17n database; a sub-part of the m17n
7 ;; library.
8
9 ;; The m17n library is free software; you can redistribute it and/or
10 ;; modify it under the terms of the GNU Lesser General Public License
11 ;; as published by the Free Software Foundation; either version 2.1 of
12 ;; the License, or (at your option) any later version.
13
14 ;; The m17n library is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 ;; Lesser General Public License for more details.
18
19 ;; You should have received a copy of the GNU Lesser General Public
20 ;; License along with the m17n library; if not, write to the Free
21 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, USA.
23
24 (input-method bo ewts)
25
26 (description "Tibetan input method based on EWTS.
27 This implementation is based on THDL Extended Wylie Transliteration Scheme
28 Version 2.0 <http://www.thdl.org/collections/langling/ewts/ewts.php>.")
29
30 (variable
31  (precomposed
32   (_"Flag to tell whether or not to generate precomposed characters.
33 If 1, generate precomposed characters if available (e.g. \"ྲྀ\"(U+0F76).
34 If 0, generate only decomposed characters (e.g. \"ྲྀ\" (U+0FB2 U+0F80).")
35   0 0 1))
36
37 (title "ཀ")
38
39 (map
40  ;; This map is used also for subjoined consonants.
41  (consonant
42   ("k" "ཀ")
43   ("kh" "ཁ")
44   ("g" "ག")
45   ("ng" "ང")
46   ("c" "ཅ")
47   ("ch" "ཆ")
48   ("j" "ཇ")
49   ("ny" "ཉ")
50   ("t" "ཏ")
51   ("th" "ཐ")
52   ("d" "ད")
53   ("n" "ན")
54   ("p" "པ")
55   ("ph" "ཕ")
56   ("b" "བ")
57   ("m" "མ")
58   ("ts" "ཙ")
59   ("tsh" "ཚ")
60   ("dz" "ཛ")
61   ("w" "ཝ")
62   ("zh" "ཞ")
63   ("z" "ཟ")
64   ("'" "འ")
65   ("y" "ཡ")
66   ("r" "ར")
67   ("l" "ལ")
68   ("sh" "ཤ")
69   ("s" "ས")
70   ("h" "ཧ")
71   ("a" "ཨ"))
72
73  ;; Standard Tibetan Stacks listed at:
74  ;; <http://www.thdl.org/collections/langling/tibstacks.html>
75  (standard-stack
76   ("kl" "ཀླ")
77   ("kr" "ཀྲ")
78   ("kw" "ཀྭ")
79   ("ky" "ཀྱ")
80   ("khr" "ཁྲ")
81   ("khw" "ཁྭ")
82   ("khy" "ཁྱ")
83   ("gl" "གླ")
84   ("gr" "གྲ")
85   ("grw" "གྲྭ")
86   ("gw" "གྭ")
87   ("gy" "གྱ")
88   ("cw" "ཅྭ")
89   ("nyw" "ཉྭ")
90   ("tr" "ཏྲ")
91   ("tw" "ཏྭ")
92   ("thr" "ཐྲ")
93   ("dr" "དྲ")
94   ("drw" "དྲྭ")
95   ("dw" "དྭ")
96   ("pr" "པྲ")
97   ("py" "པྱ")
98   ("phr" "ཕྲ")
99   ("phy" "ཕྱ")
100   ("phyw" "ཕྱྭ")
101   ("bl" "བླ")
102   ("br" "བྲ")
103   ("by" "བྱ")
104   ("mr" "མྲ")
105   ("my" "མྱ")
106   ("tsw" "ཙྭ")
107   ("tshw" "ཚྭ")
108   ("zhw" "ཞྭ")
109   ("zl" "ཟླ")
110   ("zw" "ཟྭ")
111   ("rb" "རྦ")
112   ("rd" "རྡ")
113   ("rdz" "རྫ")
114   ("rg" "རྒ")
115   ("rgw" "རྒྭ")
116   ("rgy" "རྒྱ")
117   ("rj" "རྗ")
118   ("rk" "རྐ")
119   ("rky" "རྐྱ")
120   ("rl" "རླ")
121   ("rm" "རྨ")
122   ("rmy" "རྨྱ")
123   ("rn" "རྣ")
124   ("rng" "རྔ")
125   ("rny" "རྙ")
126   ("rt" "རྟ")
127   ("rts" "རྩ")
128   ("rtsw" "རྩྭ")
129   ("rw" "རྭ")
130   ("lb" "ལྦ")
131   ("lc" "ལྕ")
132   ("ld" "ལྡ")
133   ("lg" "ལྒ")
134   ("lh" "ལྷ")
135   ("lj" "ལྗ")
136   ("lk" "ལྐ")
137   ("lng" "ལྔ")
138   ("lp" "ལྤ")
139   ("lt" "ལྟ")
140   ("shr" "ཤྲ")
141   ("shw" "ཤྭ")
142   ("sb" "སྦ")
143   ("sbr" "སྦྲ")
144   ("sby" "སྦྱ")
145   ("sd" "སྡ")
146   ("sg" "སྒ")
147   ("sgr" "སྒྲ")
148   ("sgy" "སྒྱ")
149   ("sk" "སྐ")
150   ("skr" "སྐྲ")
151   ("sky" "སྐྱ")
152   ("sl" "སླ")
153   ("sm" "སྨ")
154   ("smr" "སྨྲ")
155   ("smy" "སྨྱ")
156   ("sn" "སྣ")
157   ("sng" "སྔ")
158   ("snr" "སྣྲ")
159   ("sny" "སྙ")
160   ("sp" "སྤ")
161   ("spr" "སྤྲ")
162   ("spy" "སྤྱ")
163   ("sr" "སྲ")
164   ("st" "སྟ")
165   ("sts" "སྩ")
166   ("sw" "སྭ")
167   ("hr" "ཧྲ")
168   ("hw" "ཧྭ"))
169
170  (sanskrit
171   ("T" "ཊ")
172   ("Th" "ཋ")
173   ("D" "ཌ")
174   ("N" "ཎ")
175   ("Sh" "ཥ")
176   ("oM" (cond (precomposed "ༀ") (1 "ཨོཾ")))
177   ("R+" "ཪ"))
178
179  (force-stack
180   ("+"))
181
182  (break-stack
183   ("."))
184
185  (special-subjoined
186   ("h" (cond ((= precomposed 0) "ྷ")
187              ((= @-1 ?ག) (delete @-1) "གྷ")
188              ((= @-1 ?ད) (delete @-1)  "དྷ")
189              ((= @-1 ?བ) (delete @-1)  "བྷ")
190              ((= @-1 ?ཛ) (delete @-1)  "ཛྷ")
191              (1 "ྷ")))
192   ("Sh" (cond ((= precomposed 0) "ྵ")
193               ((= @-1 ?ཀ) (delete @-1) "ཀྵ")
194               (1 "ྵ")))
195   ("W" "ྺ")
196   ("Y" "ྻ")
197   ("R" "ྼ"))
198
199  (vowel
200   ("a" "")
201   ("i" "ི")
202   ("u" "ུ")
203   ("e" "ེ")
204   ("o" "ོ")
205   ("-i" (cond ((= precomposed 0) "ྀ")
206               ((= @-1 ?ྲ) "ྲྀ")
207               ((= @-1 ?ླ) "ླྀ")
208               (1 "ྀ")))
209   ("A" "ཱ")
210   ("I" "ཱི")
211   ("U" "ཱུ")
212   ("ai" "ཻ")
213   ("au" "ཽ")
214   ("r-I" "ཷ")
215   ("l-I" "ཹ")
216   ("-I" (cond ((= precomposed 0) "ཱྀ")
217               ((= @-1 ?ྲ) "ཷ")
218               ((= @-1 ?ླ) "ཹ")
219               (1 "ཱྀ"))))
220
221  (others
222   ;; Numbers
223   ("0" "༠")
224   ("1" "༡")
225   ("2" "༢")
226   ("3" "༣")
227   ("4" "༤")
228   ("5" "༥")
229   ("6" "༦")
230   ("7" "༧")
231   ("8" "༨")
232   ("9" "༩")
233   ;; These half numbers are not in EWTS but for convenience.
234   ("-1" "༪")
235   ("-2" "༫")
236   ("-3" "༬")
237   ("-4" "༭")
238   ("-5" "༮")
239   ("-6" "༯")
240   ("-7" "༰")
241   ("-8" "༱")
242   ("-9" "༲")
243   ("-0" "༳")
244   ;; Sanskrit-related marks
245   ("H" "ཿ")
246   ("M" "ཾ")
247   ("~M" "ྃ")
248   ("~M`" "ྂ")
249   ("?" "྄")
250   ("&" "྅")
251   ;; Intersyllabic marks
252   (" " "་")
253   ("*" "༌")
254   ;; Phrase deliminating marks
255   ("/" "།")
256   ("//" "༎")
257   (";" "༏")
258   ("|" "༑")
259   ("!" "༈")
260   (":" "༔")
261   ("_" " ")
262   ("=" "༴")
263   ;; Head marks
264   ("@" "༄")
265   ("#" "༅")
266   ("$" "༆")
267   ("%" "༇")
268   ;; Paired punctuation marks (brackets)
269   ("<" "༺")
270   (">" "༻")
271   ("(" "༼")
272   (")" "༽")
273   ;; Miscellaneous
274   ("~X" "༵")
275   ("X" "༷")
276   ("^" "༹"))
277  
278  (escape
279   ("\\" (mark @BEG) "\\"))
280
281  (non-tibetan
282   ("["))
283
284  (unicode
285   ("u" "u" (set MAX-COUNT 4))
286   ("U" "U" (set MAX-COUNT 8)))
287
288  (unescape
289   ("]"))
290
291  (hexadigit
292   ("0" "0")
293   ("1" "1")
294   ("2" "2")
295   ("3" "3")
296   ("4" "4")
297   ("5" "5")
298   ("6" "6")
299   ("7" "7")
300   ("8" "8")
301   ("9" "9")
302   ("A" "A") ("a" "A")
303   ("B" "B") ("b" "B")
304   ("C" "C") ("c" "C")
305   ("D" "D") ("d" "D")
306   ("E" "E") ("e" "E")
307   ("F" "F") ("f" "F"))
308
309  (backspace
310   ((Backspace) (undo))))
311
312 (state
313  (init
314   (consonant (shift after-consonant))
315   (standard-stack (shift after-consonant))
316   (sanskrit (shift after-consonant))
317   (vowel (move @<) "ཨ" (move @>) (shift after-vowel))
318   (others)
319   (escape (shift dispatch-escape))
320   (non-tibetan (shift non-tibetan))
321   (backsapce))
322
323  (after-consonant
324   (force-stack (shift consonant-stack))
325   (break-stack (shift init))
326   (vowel (shift after-vowel)))
327   
328  (consonant-stack
329   "ཀ+"
330   (special-subjoined (shift after-consonant))
331   (consonant (set C @-1) (delete @-1) (add C #x50) (insert C)
332              (shift after-consonant))
333   (force-stack)
334   (nil (pop)))
335
336  (after-vowel
337   (force-stack (shift vowel-stack)))
338
339  (vowel-stack
340   "ཀ+"
341   (vowel (shift after-vowel)))
342
343  (dispatch-escape
344   (unicode (shift unicode))
345   (nil (delete @BEG) (shift init) (unhandle)))
346
347  (unicode
348   "ཀu"
349   (t (set COUNT 0) (set UNICODE 0))
350   (hexadigit (cond ((> @-1 ?9) (set UNICODE (+ (* UNICODE 16) (- @-1 55))))
351                    (1 (set UNICODE (+ (* UNICODE 16) (- @-1 48)))))
352              (set COUNT (+ COUNT 1))
353              (cond ((= COUNT MAX-COUNT) (delete @BEG) (insert UNICODE)
354                     (shift init)))))
355
356  (non-tibetan
357   "ཀA"
358   (unescape (shift init))
359   (nil (unhandle))))
360
361 ;; Local Variables:
362 ;; mode: lisp
363 ;; End: