diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-05-14 19:58:50 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-05-14 19:58:50 +0200 |
commit | fd0c4577a4b6e85ca2db664906e1a03807ce133f (patch) | |
tree | fa23fcc04248d03ff82e34634b8ef1bb9cf28acb /context/data/scite/context/lexers/scite-context-lexer-tex.lua | |
parent | db581096187dc2d3cbdbe4cdc39d247c168b1607 (diff) | |
download | context-fd0c4577a4b6e85ca2db664906e1a03807ce133f.tar.gz |
2017-05-14 19:15:00
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.lua | 11 |
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 |