summaryrefslogtreecommitdiff
path: root/context/data/scite/context/lexers/scite-context-lexer-tex.lua
diff options
context:
space:
mode:
Diffstat (limited to 'context/data/scite/context/lexers/scite-context-lexer-tex.lua')
-rw-r--r--context/data/scite/context/lexers/scite-context-lexer-tex.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/context/data/scite/context/lexers/scite-context-lexer-tex.lua b/context/data/scite/context/lexers/scite-context-lexer-tex.lua
index 027c8767e..4787263a3 100644
--- a/context/data/scite/context/lexers/scite-context-lexer-tex.lua
+++ b/context/data/scite/context/lexers/scite-context-lexer-tex.lua
@@ -31,7 +31,7 @@ local P, R, S, V, C, Cmt, Cp, Cc, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.C, l
local type, next = type, next
local find, match, lower, upper = string.find, string.match, string.lower, string.upper
-local lexer = require("lexer")
+local lexer = require("scite-context-lexer")
local context = lexer.context
local patterns = context.patterns
local inform = context.inform
@@ -144,17 +144,20 @@ local validminimum = 3
-- fails (empty loop message) ... latest lpeg issue?
+-- todo: Make sure we only do this at the beginning .. a pitty that we
+-- can't store a state .. now is done too often.
+
local knownpreamble = Cmt(P("% "), function(input,i,_) -- todo : utfbomb, was #P("% ")
if i < 10 then
validwords, validminimum = false, 3
- local s, e, word = find(input,"^(.+)[\n\r]",i) -- combine with match
+ local s, e, word = find(input,"^(.-)[\n\r]",i) -- combine with match
if word then
- local interface = match(word,"interface=([a-z]+)")
+ local interface = match(word,"interface=([a-z][a-z]+)")
if interface and #interface == 2 then
inform("enabling context user interface '%s'",interface)
currentcommands = commands[interface] or commands.en or { }
end
- local language = match(word,"language=([a-z]+)")
+ local language = match(word,"language=([a-z][a-z]+)")
validwords, validminimum = setwordlist(language)
end
end