php.nanorc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ## PHP Syntax Highlighting
  2. syntax "php" "\.php[2345s~]?$"
  3. color white start="<\?(php|=)?" end="\?>"
  4. # Functions
  5. color brightblue "([a-zA-Z0-9_-]*)\("
  6. # Constructs
  7. color brightblue "(class|extends|goto) ([a-zA-Z0-9_]*)"
  8. color green "[^a-z0-9_-]{1}(var|class|function|echo|case|break|default|exit|switch|if|else|elseif|endif|foreach|endforeach|@|while|public|private|protected|return|true|false|null|TRUE|FALSE|NULL|const|static|extends|as|array|require|include|require_once|include_once|define|do|continue|declare|goto|print|in|namespace|use)[^a-z0-9_-]{1}"
  9. color brightblue "[a-zA-Z0-9]+:"
  10. # Variables
  11. color white "\$[a-zA-Z_0-9$]*|[=!<>]"
  12. color white "\->[a-zA-Z_0-9$]*|[=!<>]"
  13. # Special Characters
  14. color yellow "[.,{}();]"
  15. color yellow "\["
  16. color yellow "\]"
  17. color yellow "[=][^>]"
  18. # Numbers
  19. color magenta "[+-]*([0-9]\.)*[0-9]+([eE][+-]?([0-9]\.)*[0-9])*"
  20. color magenta "0x[0-9a-zA-Z]*"
  21. # Special Variables
  22. color brightblue "(\$this|parent::|self::|\$this-\>)"
  23. # Bitwise Operations
  24. color magenta "(\;|\||\^){1}"
  25. # And/Or/SRO/etc
  26. color green "(\;\;|\|\||::|=>|->)"
  27. # Online Comments
  28. color brightyellow "(#.*|//.*)$"
  29. # STRINGS!
  30. color red "('[^']*')|(\"[^\"]*\")"
  31. # Inline Variables
  32. color white "\{\$[^}]*\}"
  33. # PHP Tags
  34. color red "(<\?(php)?|\?>)"
  35. # General HTML
  36. color red start="\?>" end="<\?(php|=)?"
  37. # trailing whitespace
  38. color ,green "[^[:space:]]{1}[[:space:]]+$"
  39. # multi-line comments
  40. color brightyellow start="/\*" end="\*/"