scite-context-lexer-dummy.lua /size: 979 b    last modification: 2021-10-28 13:49
1local info = {
2    version   = 1.002,
3    comment   = "scintilla lpeg lexer that triggers whitespace backtracking",
4    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5    copyright = "PRAGMA ADE / ConTeXt Development Team",
6    license   = "see context related readme files",
7}
8
9-- the lexer dll doesn't backtrack when there is no embedded lexer so
10-- we need to trigger that, for instance in the bibtex lexer, but still
11-- we get failed lexing
12
13local lexers          = require("scite-context-lexer")
14
15local patterns        = lexers.patterns
16local token           = lexers.token
17
18local dummylexer      = lexers.new("dummy","scite-context-lexer-dummy")
19local dummywhitespace = dummylexer.whitespace
20
21local space      = patterns.space
22local nospace    = (1-space)
23
24local t_spacing  = token(dummywhitespace, space^1)
25local t_rest     = token("default",       nospace^1)
26
27dummylexer.rules = {
28    { "whitespace", t_spacing },
29    { "rest",       t_rest    },
30}
31
32return dummylexer
33