1 -- Copyright 2006-2017 Mitchell mitchell.att.foicica.com. See LICENSE.
4 local l
= require('lexer')
5 local token
, word_match
= l
.token
, l
.word_match
6 local P
, R
, S
= lpeg
.P
, lpeg
.R
, lpeg
.S
8 local M
= {_NAME
= 'gettext'}
11 local ws
= token(l
.WHITESPACE
, l
.space^
1)
14 local comment
= token(l
.COMMENT
, '#' * S(': .~') * l
.nonnewline^
0)
17 local string = token(l
.STRING
, l
.delimited_range('"', true))
20 local keyword
= token(l
.KEYWORD
, word_match({
21 'msgid', 'msgid_plural', 'msgstr', 'fuzzy', 'c-format', 'no-c-format'
25 local identifier
= token(l
.IDENTIFIER
, l
.word
)
28 local variable
= token(l
.VARIABLE
, S('%$@') * l
.word
)
35 {'identifier', identifier
},
36 {'variable', variable
},