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. # PHP markings.
color brightgreen "(<\?(php)?|\?>)" color brightgreen "(<\?(php)?|\?>)"
# Functions. # Function names.
color white "\<[a-z_]*\(" color white "\<[a-z_]*\("
# Variable names.
color cyan "\$[a-z_]+"
# Types. # 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. # Directives and structure.
color brightyellow "\<(class|function|new|private|protected|public|for|foreach|while|do|if|else|elseif|switch|case|default)\>" 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. # Control flow.
color magenta "\<(break|continue|goto|return)\>" color magenta "\<(break|continue|goto|return)\>"
# Strings. # Strings.
color brightyellow "<[^= ]*>" ""(\.|[^"])*"" color brightyellow ""(\.|[^"])*"" "'(\.|[^'])*'"
# Comments. # Comments.
color brightblue "//.*" color brightblue "(^|[[:space:]]+)//.*"
color brightblue start="/\*" end="\*/" color brightblue start="/\*" end="\*/"
##color blue start="<" end=">"
##color red "&[^;[:space:]]*;"
# Trailing whitespace. # Trailing whitespace.
color ,green "[[:space:]]+$" color ,green "[[:space:]]+$"