lua.nanorc 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ##############################################################################
  2. #
  3. # Lua syntax highlighting for Nano.
  4. #
  5. # Author: Matthew Wild <mwild1 (at) gmail.com>
  6. # License: GPL 2 or later
  7. #
  8. # Version: 2007-06-06
  9. #
  10. # Notes: Originally based on Ruby syntax rc by Josef 'Jupp' Schugt
  11. ##############################################################################
  12. # Automatically use for '.lua' files
  13. syntax "lua" ".*\.lua$"
  14. # General
  15. color brightwhite ".+"
  16. # Operators
  17. color brightyellow ":|\*\*|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\<(not|and|or)\>"
  18. # Statements
  19. color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return)\>"
  20. # Keywords
  21. color brightyellow "\<(debug|string|math|table|io|coroutine|os)\>\."
  22. color brightyellow "\<(_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|module|next|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\s*\("
  23. # Standard library
  24. color brightyellow "io\.\<(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)\>"
  25. color brightyellow "math\.\<(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log|max|min|modf|pi|pow|rad|random|randomseed|sinh|tan)\>"
  26. color brightyellow "os\.\<(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\>"
  27. color brightyellow "package\.\<(cpath|loaded|loadlib|path|preload|seeall)\>"
  28. color brightyellow "string\.\<(byte|char|dump|find|format|gmatch|gsub|len|lower|match|rep|reverse|sub|upper)\>"
  29. color brightyellow "table\.\<(concat|insert|maxn|remove|sort)\>"
  30. color brightyellow "coroutine\.\<(create|resume|running|status|wrap|yield)\>"
  31. color brightyellow "debug\.\<(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)\>"
  32. # File handle methods
  33. color brightyellow "\:\<(close|flush|lines|read|seek|setvbuf|write)\>"
  34. # false, nil, true
  35. color brightmagenta "\<(false|nil|true)\>"
  36. # External files
  37. color brightgreen "(\<(dofile|require|include)|%q|%!|%Q|%r|%x)\>"
  38. # Numbers
  39. color red "\<([0-9]+)\>"
  40. # Symbols
  41. color brightmagenta "(\(|\)|\[|\]|\{|\})"
  42. # Strings
  43. #color green "\"(\\.|[^\\\"])*\"|'(\\.|[^\\'])*'"
  44. # Strings
  45. color red "\"(\\.|[^\\\"])*\"|'(\\.|[^\\'])*'"
  46. # Escapes
  47. color red "\\[0-7][0-7][0-7]|\\x[0-9a-fA-F][0-9a-fA-F]|\\[abefnrs]|(\\c|\\C-|\\M-|\\M-\\C-)."
  48. # Shebang
  49. color brightcyan "^#!.*"
  50. # Simple comments
  51. color green "\-\-.*$"
  52. # Multiline comments
  53. color green start="\-\-\[" end="]"