diff options
author | sanine <sanine.not@pm.me> | 2022-12-19 03:42:29 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-12-19 03:42:29 -0600 |
commit | 4e006be646fba8dde7284cfe4c18f0222e8298ad (patch) | |
tree | a4f7ee2c7c1f38164781a04a6306b3dd6a35fca4 /language.lua | |
parent | fab85f8d639c8b7792775d02a2d3fe22fe96befd (diff) |
add help page and hidden mode
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 |