summaryrefslogtreecommitdiff
path: root/context/data/scite/context/lexers/scite-context-lexer-lua-longstring.lua
blob: 5e7fa1256aadd29054b80f9106a4fcf102858f12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
local info = {
    version   = 1.002,
    comment   = "scintilla lpeg lexer for lua longstrings",
    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
    copyright = "PRAGMA ADE / ConTeXt Development Team",
    license   = "see context related readme files",
}

-- This one is needed because we have spaces in strings and partial lexing depends
-- on them being different.

local lexers      = require("scite-context-lexer")

local patterns    = lexers.patterns
local token       = lexers.token

local stringlexer = lexers.new("lua-longstring","scite-context-lexer-lua-longstring")

local space       = patterns.space
local nospace     = 1 - space

local p_spaces    = token("whitespace", space^1)
local p_string    = token("string",     nospace^1)

stringlexer.rules = {
    { "whitespace", p_spaces },
    { "string",     p_string },
}

return stringlexer