2014-08-02 06:24:56 +02:00
## PHP Syntax Highlighting
2020-02-05 12:48:21 +01:00
syntax "PHP" "\.php[2345s~]?$|\.module$"
2022-01-03 14:27:48 +01:00
header "^#!.*php"
2019-12-18 17:20:31 +01:00
magic "PHP script"
2019-12-18 17:13:13 +01:00
comment "//"
2014-08-02 06:24:56 +02:00
color white start="<\?(php|=)?" end="\?>"
# Constructs
color brightblue "(class|extends|goto) ([a-zA-Z0-9_]*)"
2020-07-14 23:00:56 +02:00
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}"
2018-12-17 12:31:25 +01:00
color brightblue "[a-zA-Z0-9_]+:"
2014-08-02 06:24:56 +02:00
# Variables
2020-07-14 23:00:56 +02:00
color green "\$[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}"
2014-08-02 06:24:56 +02:00
# Special Characters
color yellow "[.,{}();]"
2020-07-14 23:00:56 +02:00
color cyan "\["
color cyan "\]"
2014-08-02 06:24:56 +02:00
# Numbers
color magenta "[+-]*([0-9]\.)*[0-9]+([eE][+-]?([0-9]\.)*[0-9])*"
color magenta "0x[0-9a-zA-Z]*"
# Special Variables
2016-03-03 00:50:39 +01:00
color brightblue "(\$this|parent::|self::|\$this->)"
2020-07-14 23:00:56 +02:00
color magenta ";"
# Comparison operators
color yellow "(<|>)"
# Assignment operator
color brightblue "="
2014-08-02 06:24:56 +02:00
# Bitwise Operations
2020-07-14 23:00:56 +02:00
color magenta "(&|\||\^)"
color magenta "(<<|>>)"
# Comparison operators
color yellow "(==|===|!=|<>|!==|<=|>=|<=>)"
# Logical Operators
color yellow "( and | or | xor |!|&&|\|\|)"
2014-08-02 06:24:56 +02:00
# And/Or/SRO/etc
2020-07-15 20:50:36 +02:00
color cyan "(\;\;|\|\||::|=>|->)"
2020-07-14 23:00:56 +02:00
# Double quoted STRINGS!
color red "(\"[^\"]*\")"
# Heredoc (typically ends with a semicolon).
color red start="<<<['\"]?[A-Z][A-Z0-9_]*['\"]?" end="^[A-Z][A-Z0-9_]*;"
2014-08-02 06:24:56 +02:00
# Inline Variables
color white "\{\$[^}]*\}"
2020-07-14 23:00:56 +02:00
# Single quoted string
color red "('[^']*')"
2020-07-14 23:20:52 +02:00
# Online Comments
color brightyellow "^(#.*|//.*)$"
color brightyellow "[ | ](#.*|//.*)$"
2014-08-02 06:24:56 +02:00
# PHP Tags
color red "(<\?(php)?|\?>)"
# General HTML
color red start="\?>" end="<\?(php|=)?"
# trailing whitespace
2020-05-01 00:22:23 +02:00
color ,green "[[:space:]]+$"
2014-08-02 06:24:56 +02:00
# multi-line comments
color brightyellow start="/\*" end="\*/"
2020-07-14 23:00:56 +02:00
# Nowdoc
color red start="<<<'[A-Z][A-Z0-9_]*'" end="^[A-Z][A-Z0-9_]*;"