syntax: php: color also variable names, and color more reserved words

Most of the keywords listed on the following URL are now highlighted:
  http://php.net/manual/en/reserved.keywords.php

Also color single-quoted strings, and require that //-type comments
are preceded by whitespace or are alone on a line.

With-feedback-from: M <taur@mail.com>
This commit is contained in:
Benno Schulenberg 2017-05-16 11:34:24 +02:00
parent cd7c3483b4
commit e4775c2060
1 changed files with 11 additions and 8 deletions

View File

@ -7,26 +7,29 @@ comment "//"
# PHP markings.
color brightgreen "(<\?(php)?|\?>)"
# Functions.
# Function names.
color white "\<[a-z_]*\("
# Variable names.
color cyan "\$[a-z_]+"
# Types.
color green "\<(bool|char|const|double|enum|float|global|int|var)\>"
color green "\<(array|bool|callable|const|float|global|int|object|static|string|var)\>"
# Structure.
color brightyellow "\<(class|function|new|private|protected|public|for|foreach|while|do|if|else|elseif|switch|case|default)\>"
# Directives and structure.
color brightyellow "\<(abstract|as|class|clone|declare|enddeclare|extends|function|implements|include(_once)?|inst(ance|ead)of|interface|namespace|new|private|protected|public|require(_once)?|trait|use|yield)\>"
color brightyellow "\<(case|catch|default|do|echo|else(if)?|end(for(each)?|if|switch|while)|final(ly)?|for(each)?|if|print|switch|throw|try|while)\>"
# Operators.
color brightyellow "\<(and|or|xor)\>"
# Control flow.
color magenta "\<(break|continue|goto|return)\>"
# Strings.
color brightyellow "<[^= ]*>" ""(\.|[^"])*""
color brightyellow ""(\.|[^"])*"" "'(\.|[^'])*'"
# Comments.
color brightblue "//.*"
color brightblue "(^|[[:space:]]+)//.*"
color brightblue start="/\*" end="\*/"
##color blue start="<" end=">"
##color red "&[^;[:space:]]*;"
# Trailing whitespace.
color ,green "[[:space:]]+$"