summaryrefslogtreecommitdiff
path: root/context/data/scite/lexers/scite-context-lexer-txt.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-04-13 09:31:00 +0200
committerHans Hagen <pragma@wxs.nl>2012-04-13 09:31:00 +0200
commit6f3a12a2ae923e7f35429a8d26c638520a445f61 (patch)
tree09034dcd66c1d2865316fb6d7117048500a20594 /context/data/scite/lexers/scite-context-lexer-txt.lua
parent9311bdd3e0435224831865fdb1c236892cd80ad8 (diff)
downloadcontext-6f3a12a2ae923e7f35429a8d26c638520a445f61.tar.gz
beta 2012.04.13 09:31
Diffstat (limited to 'context/data/scite/lexers/scite-context-lexer-txt.lua')
-rw-r--r--context/data/scite/lexers/scite-context-lexer-txt.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/context/data/scite/lexers/scite-context-lexer-txt.lua b/context/data/scite/lexers/scite-context-lexer-txt.lua
index d92be8ed7..2f476a6a8 100644
--- a/context/data/scite/lexers/scite-context-lexer-txt.lua
+++ b/context/data/scite/lexers/scite-context-lexer-txt.lua
@@ -6,16 +6,13 @@ local info = {
license = "see context related readme files",
}
-if not lexer._CONTEXTEXTENSIONS then dofile(_LEXERHOME .. "/scite-context-lexer.lua") end
+if not lexer._CONTEXTEXTENSIONS then require("scite-context-lexer") end
local lexer = lexer
local token = lexer.token
local P, S, Cmt = lpeg.P, lpeg.S, lpeg.Cmt
local find, match = string.find, string.match
--- local textlexer = (_VERSION == "Lua 5.1" and (module(...) or true) and _M) or { }
--- (_VERSION == "Lua 5.1" and (module(...) or true) and _M) or { }
-
local textlexer = { _NAME = "text" }
local context = lexer.context
@@ -31,6 +28,12 @@ local checkedword = context.checkedword
local setwordlist = context.setwordlist
local validwords = false
+-- local styleset = context.newstyleset {
+-- "default",
+-- "text", "okay", "error", "warning",
+-- "preamble",
+-- }
+
-- [#!-%] language=uk
local p_preamble = Cmt(#(S("#!-%") * P(" ")), function(input,i,_) -- todo: utf bomb
@@ -48,7 +51,7 @@ local p_preamble = Cmt(#(S("#!-%") * P(" ")), function(input,i,_) -- todo: utf b
end)
local t_preamble =
- token('preamble', p_preamble)
+ token("preamble", p_preamble)
local t_word =
Cmt(wordpattern, function(_,i,s)
@@ -76,6 +79,6 @@ textlexer._rules = {
{ "rest", t_rest },
}
-textlexer._tokenstyles = lexer.context.styleset
+textlexer._tokenstyles = context.styleset
return textlexer