SHARE
TWEET

python.nanorc

a guest Sep 17th, 2011 293 Never
  1. ## Python syntax highlighting
  2. syntax "python" "\.py$"
  3. header "^#!.*/python[-0-9._]*"
  4.  
  5. ## default
  6. color  white       "^.+$"
  7. icolor brightwhite "[0-9a-z_]+"
  8.  
  9. ## keywords
  10. color brightyellow "\<(and|as|assert|break|class|continue|def|del|elif|else)\>"
  11. color brightyellow "\<(except|exec|finally|for|from|global|if|import|in|is)\>"
  12. color brightyellow "\<(lambda|not|or|pass|print|raise|return|try|while|with|yield)\>"
  13.  
  14. ## reserved classes of identifiers
  15. icolor brightred "\<_[0-9a-z_]*\>"
  16.  
  17. ## smth
  18. color brightmagenta "\<(True|False|None)\>"
  19.  
  20. ## numbers
  21. icolor brightcyan "\<(0|[1-9][0-9]*|0x[0-9a-f]+|0o[0-7]+|0[0-7]+|0b[01]+)L?\>"
  22. icolor brightcyan "\<([0-9]+\.?|[0-9]*\.[0-9]+)(e[+-]?[0-9]+)?j?\>" "\<[0-9]+j\>"
  23.  
  24. ## strings
  25. icolor green       "(b|u)?r?"(\\"|[^"])*""
  26. icolor brightgreen "(b|u)?r?'(\'|[^'])*'"
  27. icolor brightgreen start="(b|u)?r?"""" end="""""
  28. icolor green       start="(b|u)?r?'''" end="'''"
  29.  
  30. ## escapes
  31. color red "\\[0-7]{3}" "\\x[0-9a-fA-F]{2}" "\\u[0-9a-fA-F]{4}" "\\U[0-9a-fA-F]{8}"
  32. color red "\\[abfnrtv'"\\]" "\\N\{[0-9a-z_]+\}"
  33.  
  34. ## comments
  35. color magenta "#.*"
  36.  
  37. ## whitespace
  38. color ,green "[[:space:]]+$"
  39. color ,red   "[[:cntrl:]]+"
RAW Paste Data
Top