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

tex.lua (726B)


  1. -- Copyright 2006-2024 Mitchell. See LICENSE.
  2. -- Plain TeX LPeg lexer.
  3. -- Modified by Robert Gieseke.
  4. local lexer = lexer
  5. local P, S = lpeg.P, lpeg.S
  6. local lex = lexer.new(...)
  7. -- Comments.
  8. lex:add_rule('comment', lex:tag(lexer.COMMENT, lexer.to_eol('%')))
  9. -- TeX environments.
  10. lex:add_rule('environment', lex:tag('environment', '\\' * (P('begin') + 'end') * lexer.word))
  11. -- Commands.
  12. lex:add_rule('command', lex:tag('command', '\\' * (lexer.alpha^1 + S('#$&~_^%{}'))))
  13. -- Operators.
  14. lex:add_rule('operator', lex:tag(lexer.OPERATOR, S('$&#{}[]')))
  15. -- Fold points.
  16. lex:add_fold_point('environment', '\\begin', '\\end')
  17. lex:add_fold_point(lexer.OPERATOR, '{', '}')
  18. lexer.property['scintillua.comment'] = '%'
  19. return lex