commit e4775c206071644c943a88ce6398748ab6957752 parent cd7c3483b45c06db4b2fcbb9b40d5dfac076c8c2 Author: Benno Schulenberg <bensberg@justemail.net> Date: Tue, 16 May 2017 11:34:24 +0200 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> Diffstat:
M | syntax/php.nanorc | | | 19 | +++++++++++-------- |
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/syntax/php.nanorc b/syntax/php.nanorc @@ -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:]]+$"