diff options
Diffstat (limited to 'context/data/scite/lexers/scite-context-lexer-tex.lua')
-rw-r--r-- | context/data/scite/lexers/scite-context-lexer-tex.lua | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/context/data/scite/lexers/scite-context-lexer-tex.lua b/context/data/scite/lexers/scite-context-lexer-tex.lua index a7da24001..2e982365a 100644 --- a/context/data/scite/lexers/scite-context-lexer-tex.lua +++ b/context/data/scite/lexers/scite-context-lexer-tex.lua @@ -128,12 +128,13 @@ local checkedword = context.checkedword local styleofword = context.styleofword local setwordlist = context.setwordlist local validwords = false +local validminimum = 3 -- % language=uk local knownpreamble = Cmt(#P("% "), function(input,i,_) -- todo : utfbomb if i < 10 then - validwords = false + validwords, validminimum = false, 3 local s, e, word = find(input,'^(.+)[\n\r]',i) -- combine with match if word then local interface = match(word,"interface=([a-z]+)") @@ -141,7 +142,7 @@ local knownpreamble = Cmt(#P("% "), function(input,i,_) -- todo : utfbomb currentcommands = commands[interface] or commands.en or { } end local language = match(word,"language=([a-z]+)") - validwords = language and setwordlist(language) + validwords, validminimum = setwordlist(language) end end return false @@ -224,7 +225,7 @@ local p_unit = P("pt") + P("bp") + P("sp") + P("mm") + P("cm") + -- -- local p_word = Cmt(iwordpattern, function(_,i,s) -- if validwords then --- return checkedword(validwords,s,i) +-- return checkedword(validwords,validminimum,s,i) -- else -- return true, { "text", i } -- end @@ -232,7 +233,7 @@ local p_unit = P("pt") + P("bp") + P("sp") + P("mm") + P("cm") + -- -- So we use this one instead: -local p_word = Ct( iwordpattern / function(s) return styleofword(validwords,s) end * Cp() ) -- the function can be inlined +local p_word = Ct( iwordpattern / function(s) return styleofword(validwords,validminimum,s) end * Cp() ) -- the function can be inlined ----- p_text = (1 - p_grouping - p_special - p_extra - backslash - space + hspace)^1 |