ui: make primary cursor blink even if no lua theme has been loaded
[vis.git] / lexers / lilypond.lua
blobf5af7716a1d5a5ba37b5efda6b0f31c27db53d6f
1 -- Copyright 2006-2013 Robert Gieseke. See LICENSE.
2 -- Lilypond LPeg lexer.
3 -- TODO Embed Scheme; Notes?, Numbers?
5 local l = require('lexer')
6 local token, word_match = l.token, l.word_match
7 local P, R, S = lpeg.P, lpeg.R, lpeg.S
9 local M = {_NAME = 'lilypond'}
11 -- Whitespace.
12 local ws = token(l.WHITESPACE, l.space^1)
14 -- Comments.
15 local line_comment = '%' * l.nonnewline^0
16 -- TODO: block comment.
17 local comment = token(l.COMMENT, line_comment)
19 -- Strings.
20 local string = token(l.STRING, l.delimited_range('"', false, true))
22 -- Keywords, commands.
23 local keyword = token(l.KEYWORD, '\\' * l.word)
25 -- Identifiers.
26 local identifier = token(l.IDENTIFIER, l.word)
28 -- Operators.
29 local operator = token(l.OPERATOR, S("{}'~<>|"))
31 M._rules = {
32 {'whitespace', ws},
33 {'comment', comment},
34 {'string', string},
35 {'keyword', keyword},
36 {'operator', operator},
37 {'identifier', identifier},
40 return M