Fix several rules.
[m17n/m17n-contrib.git] / im / tai-sonla.mim
1 ;; tai-sonla.mim -- Tai Viet input method with Phonetic sequence
2 ;; Copyright (C) 2007
3 ;;   Thua Thien Hue Center of Information Technology (HueCIT, Vietnam)
4 ;; Copyright (C) 2007
5 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
6 ;;   Registration Number H15PRO112
7
8 ;; This file is part of the m17n contrib; a sub-part of the m17n
9 ;; library.
10
11 ;; The m17n library is free software; you can redistribute it and/or
12 ;; modify it under the terms of the GNU Lesser General Public License
13 ;; as published by the Free Software Foundation; either version 2.1 of
14 ;; the License, or (at your option) any later version.
15
16 ;; The m17n library is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 ;; Lesser General Public License for more details.
20
21 ;; You should have received a copy of the GNU Lesser General Public
22 ;; License along with the m17n library; if not, write to the Free
23 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
25
26 (input-method tai sonla-kbd)
27
28 (title "꫞")
29
30 (description (_"Tai Viet input method using the phonetic key sequence using the Tai Son La keyboard layout.
31 The phonetic key sequence means that you type a syllable in this order:
32   C W? V v? F? T?
33 where
34   C is an initial consonant,
35   W is a label to labializing C ('ꪫ'),
36   V is a vowel (prefix, postfix, or combining),
37   v is the second vowel of a digraph vowel
38         (in the case that V is 'ꪹ' and v is 'ꪸ' or 'ꪷ'),
39   F is a final consonant,
40   T is a tonemark (spacing or combining).
41
42 You can type special symbols by these keys:
43   '$' -> 'ꫛ'
44   '#' -> 'ꫜ'
45   '%' -> 'ꫝ'
46   '!' -> '꫞'
47   '@' -> '꫟'
48 "))
49
50 (map
51  (consonant
52   ("k" "ꪀ")
53   ("K" "ꪁ")
54   ("x" "ꪂ")
55   ("X" "ꪃ")
56   ("q" "ꪄ")
57   ("Q" "ꪅ")
58   ("|" "ꪆ")
59   ("\"" "ꪇ")
60   ("g" "ꪈ")
61   ("G" "ꪉ")
62   ("c" "ꪊ")
63   ("C" "ꪋ")
64   ("." "ꪌ")
65   (">" "ꪍ")
66   ("s" "ꪎ")
67   ("S" "ꪏ")
68   ("z" "ꪐ")
69   ("Z" "ꪑ")
70   ("d" "ꪒ")
71   ("D" "ꪓ")
72   ("t" "ꪔ")
73   ("T" "ꪕ")
74   ("w" "ꪖ")
75   ("W" "ꪗ")
76   ("n" "ꪘ")
77   ("N" "ꪙ")
78   ("b" "ꪚ")
79   ("B" "ꪛ")
80   ("p" "ꪜ")
81   ("P" "ꪝ")
82   ("/" "ꪞ")
83   ("?" "ꪟ")
84   ("f" "ꪠ")
85   ("F" "ꪡ")
86   ("m" "ꪢ")
87   ("M" "ꪣ")
88   ("j" "ꪤ")
89   ("J" "ꪥ")
90   ("r" "ꪦ")
91   ("R" "ꪧ")
92   ("l" "ꪨ")
93   ("L" "ꪩ")
94   ("v" "ꪪ")
95   ("V" "ꪫ")
96   ("h" "ꪬ")
97   ("H" "ꪭ")
98   ("o" "ꪮ")
99   ("O" "ꪯ"))
100
101  (final-c
102   ("b" "ꪚ")
103   ("d" "ꪒ")
104   ("k" "ꪀ")
105   ("J" "ꪥ")
106   ("M" "ꪣ")
107   ("N" "ꪙ")
108   ("G" "ꪉ")
109   ("V" "ꪫ"))  
110
111  (high-v
112   ("V" "ꪫ"))  
113
114  (special
115   ("$" "ꫛ")
116   ("#" "ꫜ")
117   ("%" "ꫝ")
118   ("!" "꫞")
119   ("@" "꫟")
120   ("coon" "ꫛ") ;; kon
121   ("nwng" "ꫜ") ;; nueng
122   ("sawmj" "ꫝ") ;; sam
123   )
124
125  (vowel-pre
126   ("e" "ꪵ")
127   ("," "ꪶ")
128   ("E" "ꪹ")
129   ("Y" "ꪻ")
130   ("y" "ꪼ")
131   ("o^" "ꪶ")
132   ("ay" "ꪼ"))
133
134  (vowel-combining
135   ("}" "ꪰ")
136   ("i" "ꪲ")
137   ("U" "ꪳ")
138   ("u" "ꪴ")
139   ("[" "ꪷ")
140   ("I" "ꪸ")
141   ("{" "ꪾ")
142   ("ia" "ꪸ")
143   ("iee" "ꪸ")
144   ("ie^" "ꪸ")
145   ("aw" "ꪰ") ;; that is “ă”
146   ("uw" "ꪳ")
147   ("awm" "ꪾ"))
148
149  (vowel-post
150   ("a" "ꪱ")
151   ;; ("A" "ꪱꪲ")
152   ("<" "ꪺ")
153   ("]" "ꪽ")
154   ("ua" "ꪺ")
155   ("uo^" "ꪺ")
156   ("uoo" "ꪺ")
157   ("awn" "ꪽ")
158   ;; Note: "ꪮ" and "ꪯ" can be consonant and vowel. 
159   ("o" "ꪮ")
160   ("O" "ꪯ"))
161
162  (vowel-digraph
163   ("r" "ꪸ")
164   ("R" "ꪰ"))
165
166  (tone-spacing
167   (":" "ꫀ")
168   (";" "ꫂ"))
169
170  (tone-combining
171   ("\"" "꪿")
172   ("'" "꫁"))
173
174  (punctuation
175   ("!!" "!")
176   ("@@" "@")
177   ("##" "#")
178   ("$$" "$")
179   ("%%" "%")
180   (",," ",")
181   (".." ".")
182   (";;" ";")
183   ("::" ":")
184   (";;" ";")
185   ("\"\"" "\"")
186   ("//" "/")
187   ("||" "|")
188   ("''" "'")
189   ("!!" "?")
190   ("??" "?")
191   ("[[" "[")
192   ("]]" "]")
193   ("{{" "{")
194   ("}}" "}")
195   ("<<" "<")
196   (">>" ">")))
197
198 (state
199  (init
200   (t (mark M) (set U 0))
201   (consonant (mark M) (shift after-c))
202   (special)
203   (punctuation)
204   (vowel-pre)
205   (vowel-post)
206   (vowel-combining)
207   (tone-spacing)
208   (tone-combining))
209
210  (after-c
211   (high-v (mark M))
212   (vowel-pre (set V @-1)
213              (delete @-)
214              (move @<) (insert V) (move @>) (shift after-c-vpre))
215   (vowel-combining (set U @-1) (mark M) (shift after-c-v))
216   (vowel-post (shift after-c-v))
217   (vowel-digraph (set U @-1) (mark M) (move @-) (insert "ꪹ") (move @>)
218                  (shift after-c-v)))
219   
220  (after-c-vpre
221   (vowel-combining (set U @-1) (mark M) (shift after-c-v))
222   (vowel-post (shift after-c-v))
223   (nil (shift after-c-v)))
224
225  (after-c-v
226   (tone-spacing (shift init))
227   (tone-combining (set T @-1) (delete @-) (move M) (insert T) (move @>)
228                   (shift init))
229   (final-c (cond ((> U 0) (move M) (delete @-) (move @>) insert U))
230            (shift after-c-v-f)))
231
232  (after-c-v-f
233   (tone-spacing (shift init))
234   (tone-combining (set T @-1) (delete @-) (move M) (insert T) (move @>)
235                   (shift init))))