logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

lilypond.lua (844B)


  1. -- Copyright 2006-2024 Robert Gieseke. See LICENSE.
  2. -- Lilypond LPeg lexer.
  3. -- TODO Embed Scheme; Notes?, Numbers?
  4. local lexer = require('lexer')
  5. local token, word_match = lexer.token, lexer.word_match
  6. local P, S = lpeg.P, lpeg.S
  7. local lex = lexer.new('lilypond')
  8. -- Whitespace.
  9. lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1))
  10. -- Keywords, commands.
  11. lex:add_rule('keyword', token(lexer.KEYWORD, '\\' * lexer.word))
  12. -- Identifiers.
  13. lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word))
  14. -- Strings.
  15. lex:add_rule('string', token(lexer.STRING, lexer.range('"', false, false)))
  16. -- Comments.
  17. -- TODO: block comment.
  18. lex:add_rule('comment', token(lexer.COMMENT, lexer.to_eol('%')))
  19. -- Operators.
  20. lex:add_rule('operator', token(lexer.OPERATOR, S("{}'~<>|")))
  21. lexer.property['scintillua.comment'] = '%'
  22. return lex