/metalualib/mlp_lexer.lua

http://github.com/davidm/lua-inspect · Lua · 32 lines · 12 code · 6 blank · 14 comment · 1 complexity · 6a83e7cd06017fee1351cc39e64ca625 MD5 · raw file

  1. ----------------------------------------------------------------------
  2. -- Metalua: $Id: mll.lua,v 1.3 2006/11/15 09:07:50 fab13n Exp $
  3. --
  4. -- Summary: Source file lexer. ~~Currently only works on strings.
  5. -- Some API refactoring is needed.
  6. --
  7. ----------------------------------------------------------------------
  8. --
  9. -- Copyright (c) 2006-2007, Fabien Fleutot <metalua@gmail.com>.
  10. --
  11. -- This software is released under the MIT Licence, see licence.txt
  12. -- for details.
  13. --
  14. ----------------------------------------------------------------------
  15. module ("mlp", package.seeall)
  16. require "lexer"
  17. local mlp_lexer = lexer.lexer:clone()
  18. local keywords = {
  19. "and", "break", "do", "else", "elseif",
  20. "end", "false", "for", "function", "if",
  21. "in", "local", "nil", "not", "or", "repeat",
  22. "return", "then", "true", "until", "while",
  23. "...", "..", "==", ">=", "<=", "~=",
  24. "+{", "-{" }
  25. for w in values(keywords) do mlp_lexer:add(w) end
  26. _M.lexer = mlp_lexer