1 -- Copyright 2017-2021 Marc André Tanner
2 -- git-rebase(1) LPeg lexer.
4 local l
= require('lexer')
5 local token
, word_match
= l
.token
, l
.word_match
6 local P
, R
= lpeg
.P
, lpeg
.R
8 local M
= {_NAME
= 'git-rebase'}
11 local ws
= token(l
.WHITESPACE
, l
.space^
1)
14 local comment
= token(l
.COMMENT
, l
.starts_line('#') * l
.nonnewline^
0)
17 local keywords
= l
.starts_line(word_match
{
30 local keyword
= token(l
.KEYWORD
, keywords
)
33 local function patn(pat
, min, max)
34 return -pat^
(max + 1) * pat^
min
37 local commit
= token(l
.NUMBER
, patn(R('09', 'af'), 7, 40))
39 local message
= token(l
.STRING
, l
.nonnewline^
1)