diff options
author | Marius <mariausol@gmail.com> | 2012-04-14 00:40:14 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-04-14 00:40:14 +0300 |
commit | 69bafd00a14cf4d886d6ed79273f4437f7e2add2 (patch) | |
tree | 049e9d9cc17ed7a008c56172c13299b764173c92 /context | |
parent | 8864864867b1e1b3dddbf332046594715a9bdc0f (diff) | |
download | context-69bafd00a14cf4d886d6ed79273f4437f7e2add2.tar.gz |
beta 2012.04.13 23:23
Diffstat (limited to 'context')
-rw-r--r-- | context/data/scite/lexers/scite-context-lexer-xml.lua | 31 | ||||
-rw-r--r-- | context/data/scite/lexers/scite-context-lexer.lua | 4 |
2 files changed, 21 insertions, 14 deletions
diff --git a/context/data/scite/lexers/scite-context-lexer-xml.lua b/context/data/scite/lexers/scite-context-lexer-xml.lua index 89b20f3a4..b74a43cc7 100644 --- a/context/data/scite/lexers/scite-context-lexer-xml.lua +++ b/context/data/scite/lexers/scite-context-lexer-xml.lua @@ -61,24 +61,28 @@ local closedoctype = P("]>") + P(">") local entity = ampersand * (1-semicolon)^1 * semicolon -local wordpattern = context.patterns.iwordpattern -local iwordpattern = context.patterns.wordpattern -local checkedword = context.patterns.checkedword -local setwordlist = context.setwordlist -local invisibles = context.patterns.invisibles -local validwords = false +local utfchar = context.utfchar +local wordtoken = context.patterns.wordtoken +local iwordtoken = context.patterns.iwordtoken +local wordpattern = context.patterns.wordpattern +local iwordpattern = context.patterns.iwordpattern +local invisibles = context.patterns.invisibles +local checkedword = context.checkedword +local setwordlist = context.setwordlist +local validwords = false + -- <?xml version="1.0" encoding="UTF-8" language="uk" ?> -- --- <?context-xml-directive editor language us ?> +-- <?context-directive editor language us ?> local p_preamble = Cmt(#P("<?xml "), function(input,i,_) -- todo: utf bomb - if i < 10 then + if i < 200 then validwords = false - local language = match(input,"^<%?xml[^>]*%?>%s*<%?context%-xml%-directive%s+editor%s+language%s+(..)%s+%?>") - if not language then - language = match(input,'^<%?xml[^>]*language=[\"\'](..)[\"\'][^>]*%?>',i) - end + 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 = setwordlist(language) end @@ -278,6 +282,9 @@ local p_instruction = local p_invisible = token("invisible",invisibles^1) +-- local p_preamble = +-- token('preamble', p_preamble ) + xmllexer._rules = { { "whitespace", p_spacing }, { "preamble", p_preamble }, diff --git a/context/data/scite/lexers/scite-context-lexer.lua b/context/data/scite/lexers/scite-context-lexer.lua index 04eb8400c..2d1e8b205 100644 --- a/context/data/scite/lexers/scite-context-lexer.lua +++ b/context/data/scite/lexers/scite-context-lexer.lua @@ -224,9 +224,9 @@ function context.setwordlist(tag,limit) -- returns hash (lowercase keys and orig local list = context.loaddefinitions("spell-" .. tag) if not list or type(list) ~= "table" then lists[tag] = false - return nil + return false elseif type(list.words) == "string" then - list = splitwords(list.words) + list = splitwords(list.words) or false lists[tag] = list return list else |