summaryrefslogtreecommitdiff
path: root/context/data/scite/lexers/scite-context-lexer-xml.lua
diff options
context:
space:
mode:
Diffstat (limited to 'context/data/scite/lexers/scite-context-lexer-xml.lua')
-rw-r--r--context/data/scite/lexers/scite-context-lexer-xml.lua17
1 files changed, 13 insertions, 4 deletions
diff --git a/context/data/scite/lexers/scite-context-lexer-xml.lua b/context/data/scite/lexers/scite-context-lexer-xml.lua
index 62cbb2d2c..34636127f 100644
--- a/context/data/scite/lexers/scite-context-lexer-xml.lua
+++ b/context/data/scite/lexers/scite-context-lexer-xml.lua
@@ -71,7 +71,7 @@ local checkedword = context.checkedword
local styleofword = context.styleofword
local setwordlist = context.setwordlist
local validwords = false
-local validminimum = 3
+
-- <?xml version="1.0" encoding="UTF-8" language="uk" ?>
--
@@ -79,20 +79,29 @@ local validminimum = 3
local p_preamble = Cmt(#P("<?xml "), function(input,i,_) -- todo: utf bomb
if i < 200 then
- validwords, validminimum = false, 3
+ validwords = false
local language = match(input,"^<%?xml[^>]*%?>%s*<%?context%-directive%s+editor%s+language%s+(..)%s+%?>")
-- if not language then
-- language = match(input,'^<%?xml[^>]*language=[\"\'](..)[\"\'][^>]*%?>',i)
-- end
if language then
- validwords, validminimum = setwordlist(language)
+ validwords = setwordlist(language)
end
end
return false
end)
+-- local p_word =
+-- Cmt(iwordpattern, function(_,i,s)
+-- if validwords then
+-- return checkedword(validwords,s,i)
+-- else
+-- return true, { "text", i } -- or default
+-- end
+-- end)
+
local p_word =
- Ct( iwordpattern / function(s) return styleofword(validwords,validminimum,s) end * Cp() ) -- the function can be inlined
+ Ct( iwordpattern / function(s) return styleofword(validwords,s) end * Cp() ) -- the function can be inlined
local p_rest =
token("default", any)