summaryrefslogtreecommitdiff
path: root/tex/context/third/transliterator/trans_tables_trsc.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2010-04-17 17:16:05 +0200
committerPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2010-04-17 17:16:05 +0200
commit16e4920a632a4a7981381955bb4f35ae46565c96 (patch)
tree8cfb2a69eaeafd87acbe13350c0babf0b3f93eac /tex/context/third/transliterator/trans_tables_trsc.lua
parentd69d1ec6541c7956fae49c6354ee391044dd415e (diff)
downloadtransliterator-16e4920a632a4a7981381955bb4f35ae46565c96.tar.gz
using metatables for table generation, allowing “addition” of dictionaries
Diffstat (limited to 'tex/context/third/transliterator/trans_tables_trsc.lua')
-rw-r--r--tex/context/third/transliterator/trans_tables_trsc.lua56
1 files changed, 28 insertions, 28 deletions
diff --git a/tex/context/third/transliterator/trans_tables_trsc.lua b/tex/context/third/transliterator/trans_tables_trsc.lua
index b3061c0..cad3567 100644
--- a/tex/context/third/transliterator/trans_tables_trsc.lua
+++ b/tex/context/third/transliterator/trans_tables_trsc.lua
@@ -11,7 +11,7 @@
-- Lowercase German simple transcription---first pass --
--------------------------------------------------------
-translit.ru_trsc_low_first = {
+translit.ru_trsc_low_first = translit.make_add_dict{
[" е"] = " je",
["ъе"] = "je",
["ье"] = "je",
@@ -36,7 +36,7 @@ translit.tables["German transcription first pass lowercase"] = translit.ru_trsc_
-- Uppercase German simple transcription---first pass --
--------------------------------------------------------
-translit.ru_trsc_upp_first = {
+translit.ru_trsc_upp_first = translit.make_add_dict{
[" Е"] = " Je",
["Ъe"] = "Je", -- Pedantic, isn't it?
["Ье"] = "Je",
@@ -56,7 +56,7 @@ translit.tables["German transcription first pass uppercase"] = translit.ru_trsc_
-- Lowercase German simple transcription --
-------------------------------------------
-translit.ru_trsc_low = {
+translit.ru_trsc_low = translit.make_add_dict{
["а"] = "a",
["б"] = "b",
["в"] = "w",
@@ -98,7 +98,7 @@ translit.tables["German transcription second pass lowercase"] = translit.ru_trsc
-- Uppercase German simple transcription --
-------------------------------------------
-translit.ru_trsc_upp = {
+translit.ru_trsc_upp = translit.make_add_dict{
["А"] = "A",
["Б"] = "B",
["В"] = "W",
@@ -147,7 +147,7 @@ function translit.gen_rules_de()
-- Russian vowels as well consonants that were defined earlier.
-- The й-rule, VйC -> ViC
- translit.ru_trsc_irule = {}
+ translit.ru_trsc_irule = translit.make_add_dict{}
for _, vow in ipairs(translit.ru_vowels) do
for _, cons in ipairs(translit.ru_consonants) do
local new_ante = vow .. "й" .. cons
@@ -177,7 +177,7 @@ function translit.gen_rules_de()
translit.tables["German transcription j-rule"] = translit.ru_trsc_jrule
-- The с-rule, VсV -> VssV
- translit.ru_trsc_srule = {}
+ translit.ru_trsc_srule = translit.make_add_dict{}
for i, vow_1 in ipairs(translit.ru_vowels) do
for j, vow_2 in ipairs(translit.ru_vowels) do
local new_ante = vow_1 .. "с" .. vow_2
@@ -189,7 +189,7 @@ function translit.gen_rules_de()
translit.tables["German transcription s-rule"] = translit.ru_trsc_srule
-- The sharp-s-rule, Vсх -> Vßх
- translit.ru_trsc_sharpsrule = {}
+ translit.ru_trsc_sharpsrule = translit.make_add_dict{}
for i, vow in ipairs(translit.ru_vowels) do
local new_ante = vow .. "сх"
local new_post = vow .. "ßх"
@@ -199,7 +199,7 @@ function translit.gen_rules_de()
translit.tables["German transcription sharp-s-rule"] = translit.ru_trsc_sharpsrule
-- The е-rule, Vе -> Vje
- translit.ru_trsc_jerule = {}
+ translit.ru_trsc_jerule = translit.make_add_dict{}
for i, vow in ipairs(translit.ru_vowels) do
local new_ante = vow .. "е"
local new_post = vow .. "je"
@@ -211,7 +211,7 @@ function translit.gen_rules_de()
-- The ё-rule, Vё -> Vjo
-- This should be redundant as [жцчшщ]ё -> o, else ё -> jo .
-- Somebody should teach those DUDEN-guys parsimony.
- translit.ru_trsc_jorule = {}
+ translit.ru_trsc_jorule = translit.make_add_dict{}
for i, vow in ipairs(translit.ru_vowels) do
local new_ante = vow .. "ё"
local new_post = vow .. "jo"
@@ -226,7 +226,7 @@ end
-- Lowercase English simple transcription---first pass --
---------------------------------------------------------
-translit.ru_trsc_en_low_first = {
+translit.ru_trsc_en_low_first = translit.make_add_dict{
[" е"] = " ye",
["ъе"] = "ye",
["ье"] = "ye",
@@ -240,7 +240,7 @@ translit.tables["English transcription lowercase first pass"] = translit.ru_trsc
-- Uppercase English simple transcription---first pass --
---------------------------------------------------------
-translit.ru_trsc_en_upp_first = {
+translit.ru_trsc_en_upp_first = translit.make_add_dict{
[" Е"] = " Ye",
["Ъe"] = "Ye",
["Ье"] = "Ye",
@@ -252,7 +252,7 @@ translit.tables["English transcription uppercase first pass"] = translit.ru_trsc
-- Lowercase English simple transcription --
--------------------------------------------
-translit.ru_trsc_en_low = {
+translit.ru_trsc_en_low = translit.make_add_dict{
["а"] = "a",
["б"] = "b",
["в"] = "v",
@@ -294,7 +294,7 @@ translit.tables["English transcription lowercase second pass"] = translit.ru_trs
-- Uppercase English simple transcription --
--------------------------------------------
-translit.ru_trsc_en_upp = {
+translit.ru_trsc_en_upp = translit.make_add_dict{
["А"] = "A",
["Б"] = "B",
["В"] = "V",
@@ -335,7 +335,7 @@ translit.tables["English transcription uppercase second pass"] = translit.ru_trs
function translit.gen_rules_en ()
-- The english е-rule, Vе -> Vye
- translit.ru_trsc_en_jerule = {}
+ translit.ru_trsc_en_jerule = translit.make_add_dict{}
for i, vow in ipairs(translit.ru_vowels) do
local new_ante = vow .. "е"
local new_post = vow .. "ye"
@@ -350,7 +350,7 @@ end
-- Lowercase Czech transcription --
-----------------------------------
-translit.ru_trsc_cz_low = {
+translit.ru_trsc_cz_low = translit.make_add_dict{
["а"] = "a",
["б"] = "b",
["в"] = "v",
@@ -392,7 +392,7 @@ translit.tables["Czech transcription lowercase"] = translit.ru_trsc_cz_low
-- Uppercase Czech transcription --
-----------------------------------
-translit.ru_trsc_cz_upp = {
+translit.ru_trsc_cz_upp = translit.make_add_dict{
["А"] = "A",
["Б"] = "B",
["В"] = "V",
@@ -434,7 +434,7 @@ translit.tables["Czech transcription uppercase"] = translit.ru_trsc_cz_upp
-- Lowercase Additional Czech Transcription --
----------------------------------------------
-translit.ru_trsc_cz_add_low = {
+translit.ru_trsc_cz_add_low = translit.make_add_dict{
["ѕ"] = "dz",
["з"] = "z",
["ꙁ"] = "z",
@@ -460,7 +460,7 @@ translit.tables["Czech transcription for OCS and pre-1918 lowercase"] = translit
-- Uppercase Additional Czech Transcription --
----------------------------------------------
-translit.ru_trsc_cz_add_upp = {
+translit.ru_trsc_cz_add_upp = translit.make_add_dict{
["Ѕ"] = "Dz",
["З"] = "Z",
["Ꙁ"] = "Z",
@@ -500,9 +500,9 @@ function translit.transcript (mode, text)
local p_de
function tab_subst (s, ...)
- local p_tmp, tmp = nil, {}
+ local p_tmp, tmp = nil, translit.make_add_dict{}
for _,tab in ipairs(arg) do
- translit.add_table( tmp, tab)
+ tmp = tmp + tab
end
p_tmp = addrules(tmp, p_tmp)
local fp = Cs((Cs(P(p_tmp) / tmp) + utfchar)^0)
@@ -541,16 +541,16 @@ function translit.transcript (mode, text)
if mode == "ru_transcript_de_exp" then
- local de_low_upp = {}
- de_low_upp = translit.add_table( de_low_upp, translit.ru_trsc_upp, translit.ru_trsc_low )
+ local de_low_upp = translit.make_add_dict{}
+ de_low_upp = translit.ru_trsc_upp + translit.ru_trsc_low
local twochar
- local tworepl = {}
+ local tworepl = translit.make_add_dict{}
twochar = addrules( translit.ru_trsc_low_first, twochar )
twochar = addrules( translit.ru_trsc_upp_first, twochar )
- tworepl = translit.add_table( tworepl, translit.ru_trsc_low_first, translit.ru_trsc_upp_first )
+ tworepl = translit.ru_trsc_low_first + translit.ru_trsc_upp_first
-- The й-rule, VйC -> ViC
local function V_i_C (s)
@@ -653,16 +653,16 @@ function translit.transcript (mode, text)
elseif mode == "ru_transcript_en_exp" then
- local en_low_upp = {}
- en_low_upp = translit.add_table(en_low_upp, translit.ru_trsc_en_low, translit.ru_trsc_en_upp)
+ local en_low_upp = translit.make_add_dict{}
+ en_low_upp = translit.ru_trsc_en_low + translit.ru_trsc_en_upp
local twochar
- local tworepl = {}
+ local tworepl = translit.make_add_dict{}
twochar = addrules( translit.ru_trsc_en_low_first, twochar)
twochar = addrules( translit.ru_trsc_en_upp_first, twochar)
- tworepl = translit.add_table(tworepl, translit.ru_trsc_en_low_first, translit.ru_trsc_en_upp_first)
+ tworepl = translit.ru_trsc_en_low_first + translit.ru_trsc_en_upp_first
-- The е-rule, Vе -> Vye
local function V_je (s)