summaryrefslogtreecommitdiff
path: root/context/data/scite/lexers/scite-context-lexer-txt.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-02-08 21:04:00 +0100
committerHans Hagen <pragma@wxs.nl>2012-02-08 21:04:00 +0100
commitc5de3b109d06dbee374f754a7c86d7aac2c4ec3f (patch)
treef931e06e45076cd7f0c8c6232ff593fa8f464d54 /context/data/scite/lexers/scite-context-lexer-txt.lua
parent586e8f786598e3f3447e3dbe3589a54c9e6bb696 (diff)
downloadcontext-c5de3b109d06dbee374f754a7c86d7aac2c4ec3f.tar.gz
beta 2012.02.08 21:04
Diffstat (limited to 'context/data/scite/lexers/scite-context-lexer-txt.lua')
-rw-r--r--context/data/scite/lexers/scite-context-lexer-txt.lua22
1 files changed, 17 insertions, 5 deletions
diff --git a/context/data/scite/lexers/scite-context-lexer-txt.lua b/context/data/scite/lexers/scite-context-lexer-txt.lua
index 07dff2970..d92be8ed7 100644
--- a/context/data/scite/lexers/scite-context-lexer-txt.lua
+++ b/context/data/scite/lexers/scite-context-lexer-txt.lua
@@ -1,15 +1,26 @@
+local info = {
+ version = 1.002,
+ comment = "scintilla lpeg lexer for plain text (with spell checking)",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files",
+}
+
+if not lexer._CONTEXTEXTENSIONS then dofile(_LEXERHOME .. "/scite-context-lexer.lua") 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
-module(...)
+-- 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 = _M
+local textlexer = { _NAME = "text" }
local context = lexer.context
-local whitespace = textlexer.WHITESPACE -- triggers states
+local whitespace = lexer.WHITESPACE
local space = lexer.space
local any = lexer.any
@@ -57,7 +68,7 @@ local t_rest =
local t_spacing =
token(whitespace, space^1)
-_rules = {
+textlexer._rules = {
{ "whitespace", t_spacing },
{ "preamble", t_preamble },
{ "word", t_word }, -- words >= 3
@@ -65,5 +76,6 @@ _rules = {
{ "rest", t_rest },
}
-_tokenstyles = lexer.context.styleset
+textlexer._tokenstyles = lexer.context.styleset
+return textlexer