mirror of
https://github.com/scopatz/nanorc
synced 2024-11-10 19:29:48 +01:00
Merge pull request #320 from earboxer/php-symbols
* PHP: Improve operator coloring, support Nowdocs, Heredocs
This commit is contained in:
commit
7e40acc1e3
47
php.nanorc
47
php.nanorc
@ -3,35 +3,52 @@ syntax "PHP" "\.php[2345s~]?$|\.module$"
|
|||||||
magic "PHP script"
|
magic "PHP script"
|
||||||
comment "//"
|
comment "//"
|
||||||
color white start="<\?(php|=)?" end="\?>"
|
color white start="<\?(php|=)?" end="\?>"
|
||||||
# Functions
|
|
||||||
color brightblue "([a-zA-Z0-9_-]*)\("
|
|
||||||
# Constructs
|
# Constructs
|
||||||
color brightblue "(class|extends|goto) ([a-zA-Z0-9_]*)"
|
color brightblue "(class|extends|goto) ([a-zA-Z0-9_]*)"
|
||||||
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}"
|
color brightblue "[^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}"
|
||||||
color brightblue "[a-zA-Z0-9_]+:"
|
color brightblue "[a-zA-Z0-9_]+:"
|
||||||
# Variables
|
# Variables
|
||||||
color white "\$[a-zA-Z_0-9$]*|[=!<>]"
|
color green "\$[a-zA-Z_0-9$]*|[=!<>]"
|
||||||
color white "\->[a-zA-Z_0-9$]*|[=!<>]"
|
color green "\->[a-zA-Z_0-9$]*|[=!<>]"
|
||||||
|
# Functions
|
||||||
|
color brightblue "([a-zA-Z0-9_-]*)\("
|
||||||
|
# Special values
|
||||||
|
color brightmagenta "[^a-z0-9_-]{1}(true|false|null|TRUE|FALSE|NULL)$"
|
||||||
|
color brightmagenta "[^a-z0-9_-]{1}(true|false|null|TRUE|FALSE|NULL)[^a-z0-9_-]{1}"
|
||||||
# Special Characters
|
# Special Characters
|
||||||
color yellow "[.,{}();]"
|
color yellow "[.,{}();]"
|
||||||
color yellow "\["
|
color cyan "\["
|
||||||
color yellow "\]"
|
color cyan "\]"
|
||||||
color yellow "[=][^>]"
|
|
||||||
# Numbers
|
# Numbers
|
||||||
color magenta "[+-]*([0-9]\.)*[0-9]+([eE][+-]?([0-9]\.)*[0-9])*"
|
color magenta "[+-]*([0-9]\.)*[0-9]+([eE][+-]?([0-9]\.)*[0-9])*"
|
||||||
color magenta "0x[0-9a-zA-Z]*"
|
color magenta "0x[0-9a-zA-Z]*"
|
||||||
# Special Variables
|
# Special Variables
|
||||||
color brightblue "(\$this|parent::|self::|\$this->)"
|
color brightblue "(\$this|parent::|self::|\$this->)"
|
||||||
|
color magenta ";"
|
||||||
|
# Comparison operators
|
||||||
|
color yellow "(<|>)"
|
||||||
|
# Assignment operator
|
||||||
|
color brightblue "="
|
||||||
# Bitwise Operations
|
# Bitwise Operations
|
||||||
color magenta "(\;|\||\^){1}"
|
color magenta "(&|\||\^)"
|
||||||
|
color magenta "(<<|>>)"
|
||||||
|
# Comparison operators
|
||||||
|
color yellow "(==|===|!=|<>|!==|<=|>=|<=>)"
|
||||||
|
# Logical Operators
|
||||||
|
color yellow "( and | or | xor |!|&&|\|\|)"
|
||||||
# And/Or/SRO/etc
|
# And/Or/SRO/etc
|
||||||
color green "(\;\;|\|\||::|=>|->)"
|
color cyan "(\;\;|\|\||::|=>|->)"
|
||||||
# Online Comments
|
# Double quoted STRINGS!
|
||||||
color brightyellow "(#.*|//.*)$"
|
color red "(\"[^\"]*\")"
|
||||||
# STRINGS!
|
# Heredoc (typically ends with a semicolon).
|
||||||
color red "('[^']*')|(\"[^\"]*\")"
|
color red start="<<<['\"]?[A-Z][A-Z0-9_]*['\"]?" end="^[A-Z][A-Z0-9_]*;"
|
||||||
# Inline Variables
|
# Inline Variables
|
||||||
color white "\{\$[^}]*\}"
|
color white "\{\$[^}]*\}"
|
||||||
|
# Single quoted string
|
||||||
|
color red "('[^']*')"
|
||||||
|
# Online Comments
|
||||||
|
color brightyellow "^(#.*|//.*)$"
|
||||||
|
color brightyellow "[ | ](#.*|//.*)$"
|
||||||
# PHP Tags
|
# PHP Tags
|
||||||
color red "(<\?(php)?|\?>)"
|
color red "(<\?(php)?|\?>)"
|
||||||
# General HTML
|
# General HTML
|
||||||
@ -40,3 +57,5 @@ color red start="\?>" end="<\?(php|=)?"
|
|||||||
color ,green "[[:space:]]+$"
|
color ,green "[[:space:]]+$"
|
||||||
# multi-line comments
|
# multi-line comments
|
||||||
color brightyellow start="/\*" end="\*/"
|
color brightyellow start="/\*" end="\*/"
|
||||||
|
# Nowdoc
|
||||||
|
color red start="<<<'[A-Z][A-Z0-9_]*'" end="^[A-Z][A-Z0-9_]*;"
|
||||||
|
Loading…
Reference in New Issue
Block a user