Diff options
Diffstat (limited to 'tests/extensions/fake-lexers/lexer.lua')
| -rw-r--r-- | tests/extensions/fake-lexers/lexer.lua | 14 |
1 file changed, 11 insertions, 3 deletions
diff --git a/tests/extensions/fake-lexers/lexer.lua b/tests/extensions/fake-lexers/lexer.lua index bb869de..c9d8cff 100644 --- a/tests/extensions/fake-lexers/lexer.lua +++ b/tests/extensions/fake-lexers/lexer.lua @@ -3,8 +3,9 @@ -- real collection installed. detect() answers for the suffixes it knows, -- matched by case as Scintillua's own does, or fake for a shebang naming it, -- and load() hands out the toy lexer of that name. Besides fake there is one --- that stops short and one that raises, and python, which detect() knows but --- load() cannot find, as a collection missing a lexer would answer. +-- that stops short, one that raises and one that returns no tokens at all, +-- and python, which detect() knows but load() cannot find, as a collection +-- missing a lexer would answer. local M = {} @@ -54,10 +55,15 @@ local function lex_raise(self, text) error("this lexer always raises") end +local function lex_nothing(self, text) + return nil +end + local lexers = { fake = { lex = lex_words }, short = { lex = lex_short }, badlex = { lex = lex_raise }, + nothing = { lex = lex_nothing }, } function M.load(name) @@ -68,7 +74,9 @@ function M.load(name) return lexer end -local suffixes = { fake = "fake", short = "short", badlex = "badlex", py = "python" } +local suffixes = { + fake = "fake", short = "short", badlex = "badlex", nothing = "nothing", py = "python", +} function M.detect(filename, line) if line ~= nil and line:match("^#!.*fake") then |
