2020-04-20 20:15:43 +03:00
## Syntax highlighting for PHP.
2014-05-17 00:21:34 +04:00
2024-06-08 12:28:06 +03:00
## Original author: Mike Frysinger
2019-08-06 19:51:58 +03:00
syntax php "\.(php[23457s~]?|phtml|ctp)$"
2017-11-19 13:10:53 +03:00
magic "PHP script"
2016-05-25 23:13:50 +03:00
comment "//"
2008-03-20 07:45:55 +03:00
2014-05-17 00:21:34 +04:00
# PHP markings.
2021-05-05 13:09:17 +03:00
color brightgreen "(<\?(php|=)?|\?>)"
2008-03-20 07:45:55 +03:00
2017-05-16 12:34:24 +03:00
# Function names.
2017-12-09 18:29:56 +03:00
color white "\<[A-Za-z_][A-Za-z_0-9]*\("
2017-05-16 12:34:24 +03:00
# Variable names.
2017-12-09 18:29:56 +03:00
color cyan "\$[A-Za-z_][A-Za-z_0-9]*"
2008-03-20 07:45:55 +03:00
2014-05-17 00:21:34 +04:00
# Types.
2017-05-21 11:11:42 +03:00
color green "\<(array|bool|callable|const|float|global|int|object|string|var)\>"
2008-03-20 07:45:55 +03:00
2017-05-16 12:34:24 +03:00
# Directives and structure.
2017-12-09 18:29:56 +03:00
color brightcyan "\<(abstract|as|class|clone|(end)?declare|extends|function|implements|include(_once)?|inst(ance|ead)of|interface|namespace|new|private|protected|public|require(_once)?|static|trait|use|yield)\>"
color brightcyan "\<(case|catch|default|do|echo|else(if)?|end(for(each)?|if|switch|while)|final(ly)?|for(each)?|if|print|switch|throw|try|while)\>"
2017-05-16 12:34:24 +03:00
# Operators.
2017-12-09 18:29:56 +03:00
color brightcyan "\<(and|or|xor)\>"
2008-03-20 07:45:55 +03:00
2014-05-17 00:21:34 +04:00
# Control flow.
2017-05-15 10:52:14 +03:00
color magenta "\<(break|continue|goto|return)\>"
2008-03-20 07:45:55 +03:00
2014-05-17 00:21:34 +04:00
# Strings.
2021-10-27 10:45:42 +03:00
color brightyellow ""([^"\]|\\.)*"|'([^'\]|\\.)*'"
2008-03-20 07:45:55 +03:00
2014-05-17 00:21:34 +04:00
# Comments.
2021-04-27 12:18:41 +03:00
color brightblue "(^|[[:blank:]]+)//.*"
2008-03-20 07:45:55 +03:00
color brightblue start="/\*" end="\*/"
2014-05-17 00:21:34 +04:00
# Trailing whitespace.
2008-03-20 07:45:55 +03:00
color ,green "[[:space:]]+$"