mirror of
https://github.com/scopatz/nanorc
synced 2024-11-23 19:00:27 +01:00
Update php.nanorc
A much better grammar for php. Found and taken from: https://code.google.com/p/nanosyntax/issues/detail?id=4
This commit is contained in:
parent
a9584ec937
commit
7f97ded8d8
60
php.nanorc
60
php.nanorc
|
@ -1,20 +1,40 @@
|
||||||
## PHP syntax highlighting
|
## PHP Syntax Highlighting
|
||||||
##
|
syntax "php" "\.php[2345s~]?$"
|
||||||
syntax "php" "\.php$" "\.php[2345s]$" "\.phtml$"
|
color white start="<\?(php|=)?" end="\?>"
|
||||||
#functions
|
# Functions
|
||||||
color brightmagenta "([A-Za-z0-9])"
|
color brightblue "([a-zA-Z0-9_-]*)\("
|
||||||
#numbers
|
# Constructs
|
||||||
color brightblue "[0-9]"
|
color brightblue "(class|extends|goto) ([a-zA-Z0-9_]*)"
|
||||||
#special
|
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|returtrue|false|null|TRUE|FALSE|NULL|const|static|extends|as|array|require|include|require_once|include_once|define|do|continue|declare|goto|print|in)[^a-z0-9_-]{1}"
|
||||||
color brightwhite "(^|[^A-Za-z0-9])(<\?php|\?>|var|and|or|default|class|extends|true|false|global|function|new|switch|case|break|next|prev|elseif|if|else|foreach|for|as|do|while|exit|die|declare|require_once|require|include_once|include|return|echo|static|array|isset)([^A-Za-z0-9])"
|
color brightblue "[a-zA-Z0-9]+:"
|
||||||
#types
|
# Variables
|
||||||
color brightred "([^A-Za-z0-9])|[^A-Za-z](null|int|string|float|bool|object|resource)[^A-Za-z0-9_]+[^A-Za-z]"
|
color white "\$[a-zA-Z_0-9$]*|[=!<>]"
|
||||||
#strings
|
color white "\->[a-zA-Z_0-9$]*|[=!<>]"
|
||||||
color brightyellow ""(\\.|[^\"])*""
|
# Special Characters
|
||||||
color brightyellow "'(\\.|[^\'])*'"
|
color yellow "[.,{}();]"
|
||||||
#Variables
|
color yellow "\["
|
||||||
color brightcyan "\$[]\[A-Za-z0-9_'\"]*"
|
color yellow "\]"
|
||||||
#comments
|
color yellow "[=][^>]"
|
||||||
color green "//.*"
|
# Numbers
|
||||||
color green "#.*"
|
color magenta "[+-]*([0-9]\.)*[0-9]+([eE][+-]?([0-9]\.)*[0-9])*"
|
||||||
color green start="/\*" end="\*/"
|
color magenta "0x[0-9a-zA-Z]*"
|
||||||
|
# Special Variables
|
||||||
|
color brightblue "(\$this|parent::|self::|\$this-\>)"
|
||||||
|
# Bitwise Operations
|
||||||
|
color magenta "(\;|\||\^){1}"
|
||||||
|
# And/Or/SRO/etc
|
||||||
|
color green "(\;\;|\|\||::|=>|->)"
|
||||||
|
# Online Comments
|
||||||
|
color brightyellow "(#.*|//.*)$"
|
||||||
|
# STRINGS!
|
||||||
|
color red "('[^']*?')|(\"[^\"]*?\")"
|
||||||
|
# Inline Variables
|
||||||
|
color white "\{\$[^}]*\}"
|
||||||
|
# PHP Tags
|
||||||
|
color red "(<\?(php)?|\?>)"
|
||||||
|
# General HTML
|
||||||
|
color red start="\?>" end="<\?(php|=)?"
|
||||||
|
# trailing whitespace
|
||||||
|
color ,green "[^[:space:]]{1}[[:space:]]+$"
|
||||||
|
# multi-line comments
|
||||||
|
color brightyellow start="/\*" end="\*/"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user