diff options
Diffstat (limited to 'language.lua')
-rw-r--r-- | language.lua | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/language.lua b/language.lua index cf6725f..b6a2f77 100644 --- a/language.lua +++ b/language.lua @@ -53,8 +53,12 @@ end local function parse_syllables(str) local syllables = {} for line in lines(str) do - line = string.gsub(line, "%s", "") - table.insert(syllables, string_to_array(line)) + if string.match(line, "^%s*$") then + -- ignore blank lines + else + line = string.gsub(line, "%s", "") + table.insert(syllables, string_to_array(line)) + end end return syllables end @@ -70,13 +74,17 @@ local function parse_orthography(str, phonemes) -- trim whitespace line = string.gsub(line, "%s*$", "") local pattern, replace = string.match(line, "(.*)=(.*)") - pattern = string.gsub(pattern, "%%(.)", function(class) - if phonemes[class] == nil then - return '%' .. class - end - return '[' .. table.concat(phonemes[class], '') .. ']' - end) - table.insert(rules, { pattern=pattern, replace=replace }) + if not pattern then + -- ??? + else + pattern = string.gsub(pattern, "%%(.)", function(class) + if phonemes[class] == nil then + return '%' .. class + end + return '[' .. table.concat(phonemes[class], '') .. ']' + end) + table.insert(rules, { pattern=pattern, replace=replace }) + end end end return rules |