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

pico8.lua (972B)


  1. -- Copyright 2016-2024 Alejandro Baez (https://keybase.io/baez). See LICENSE.
  2. -- PICO-8 lexer.
  3. -- http://www.lexaloffle.com/pico-8.php
  4. local lexer = lexer
  5. local word_match = lexer.word_match
  6. local P, S = lpeg.P, lpeg.S
  7. local lex = lexer.new(...)
  8. -- Keywords
  9. lex:add_rule('keyword',
  10. lex:tag(lexer.KEYWORD, lexer.word_match('__gff__ __map__ __sfx__ __music__')))
  11. -- Identifiers
  12. lex:add_rule('identifier', lex:tag(lexer.IDENTIFIER, lexer.word))
  13. -- Comments
  14. lex:add_rule('comment', lex:tag(lexer.COMMENT, lexer.to_eol('//', true)))
  15. -- Numbers
  16. lex:add_rule('number', lex:tag(lexer.NUMBER, lexer.integer))
  17. -- Operators
  18. lex:add_rule('operator', lex:tag(lexer.OPERATOR, '_'))
  19. -- Embed Lua into PICO-8.
  20. local lua = lexer.load('lua')
  21. local lua_start_rule = lex:tag(lexer.KEYWORD, word_match('__lua__'))
  22. local lua_end_rule = lex:tag(lexer.KEYWORD, word_match('__gfx__'))
  23. lex:embed(lua, lua_start_rule, lua_end_rule)
  24. lexer.property['scintillua.comment'] = '//'
  25. return lex