From 3757bab25c88cfb9d0c85ae9c86047b190a83b2d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 10:51:47 -1000 Subject: Check the lexer modules the filter cannot use A module called lexer that is not Scintillua, a Scintillua older than 6.0 without detect(), lexers that cannot load lpeg and a lexer that returns no token list were all documented and none was tried. --- tests/extensions/fake-lexers/lexer.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'tests/extensions/fake-lexers/lexer.lua') 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 -- cgit 2.12.1