view nanorc.d/php.nanorc @ 156:8bf9fc90ce51

Streamline HG Prompt with `inout` command This avoids a second Mercurial invocation, which takes a couple of seconds on a Raspberry Pi. Also exported PS1 variants to make it easier to enable/disable the VCS checks but keep the rest of the formatting
author IBBoard <dev@ibboard.co.uk>
date Wed, 23 Aug 2023 20:26:28 +0100
parents 7f49998de821
children
line wrap: on
line source

## Here is an example for PHP.

syntax "php" "\.(php[23457s~]?|html?)$"
magic "PHP script"
comment "//"

# Types.
color cyan "\<(array|bool|callable|const|float|global|int|object|string|var)\>"

# Directives and structure.
color cyan "\<(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 cyan "\<(case|catch|default|do|echo|else(if)?|end(for(each)?|if|switch|while)|final(ly)?|for(each)?|if|print|switch|throw|try|while)\>"
# Operators - note, we require proper spacing to prevent false positives
color red "(^|[[:space:]])(&&|\|\||>=?|<=?|===?|!==?)([[:space:]]|$)"
color red "!"

color magenta "\$this"

# Control flow.
color magenta "\<(break|continue|goto|return)\>"

# General HTML
color brightblue start="<[a-zA-Z/]" end=">"
color red "&[^;[[:space:]]]*;"
color green start="<!--" end="-->"
color white start="<!DOCTYPE" end=">"
# xhtml
color white start="<\?xml" end="\?>"

# Strings.
color yellow ""((\\")?(\.|[^"])*[^\\])?"" "'((\\')?(\.|[^'])*[^\\])?'"

# Comments.
color green "(^|[[:space:]]+)//.*"
color green start="/\*" end="\*/"

# PHP tags
color brightblue "<\?(php|=)|\?>"

# Trailing whitespace.
color ,green "[[:space:]]+$"