Mercurial > repos > other > linux
annotate nanorc.d/php.nanorc @ 154:99a7805cb924
Fix Ubuntu's alias shortcomings
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 30 May 2023 15:20:24 +0100 |
parents | 7f49998de821 |
children |
rev | line source |
---|---|
85
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
1 ## Here is an example for PHP. |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
2 |
92
5f2c5800fa8a
Fix small differences with older Nano on the server
IBBoard <dev@ibboard.co.uk>
parents:
87
diff
changeset
|
3 syntax "php" "\.(php[23457s~]?|html?)$" |
85
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
4 magic "PHP script" |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
5 comment "//" |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
6 |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
7 # Types. |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
8 color cyan "\<(array|bool|callable|const|float|global|int|object|string|var)\>" |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
9 |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
10 # Directives and structure. |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
11 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)\>" |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
12 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)\>" |
100
c432b0708d6d
Fix PHP operators so they don't interfere with object notation
IBBoard <dev@ibboard.co.uk>
parents:
97
diff
changeset
|
13 # Operators - note, we require proper spacing to prevent false positives |
c432b0708d6d
Fix PHP operators so they don't interfere with object notation
IBBoard <dev@ibboard.co.uk>
parents:
97
diff
changeset
|
14 color red "(^|[[:space:]])(&&|\|\||>=?|<=?|===?|!==?)([[:space:]]|$)" |
c432b0708d6d
Fix PHP operators so they don't interfere with object notation
IBBoard <dev@ibboard.co.uk>
parents:
97
diff
changeset
|
15 color red "!" |
85
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
16 |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
17 color magenta "\$this" |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
18 |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
19 # Control flow. |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
20 color magenta "\<(break|continue|goto|return)\>" |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
21 |
101
845e08259ab0
Syntax highlighting strings in PHP/HTML is complicated!
IBBoard <dev@ibboard.co.uk>
parents:
100
diff
changeset
|
22 # General HTML |
845e08259ab0
Syntax highlighting strings in PHP/HTML is complicated!
IBBoard <dev@ibboard.co.uk>
parents:
100
diff
changeset
|
23 color brightblue start="<[a-zA-Z/]" end=">" |
845e08259ab0
Syntax highlighting strings in PHP/HTML is complicated!
IBBoard <dev@ibboard.co.uk>
parents:
100
diff
changeset
|
24 color red "&[^;[[:space:]]]*;" |
845e08259ab0
Syntax highlighting strings in PHP/HTML is complicated!
IBBoard <dev@ibboard.co.uk>
parents:
100
diff
changeset
|
25 color green start="<!--" end="-->" |
845e08259ab0
Syntax highlighting strings in PHP/HTML is complicated!
IBBoard <dev@ibboard.co.uk>
parents:
100
diff
changeset
|
26 color white start="<!DOCTYPE" end=">" |
845e08259ab0
Syntax highlighting strings in PHP/HTML is complicated!
IBBoard <dev@ibboard.co.uk>
parents:
100
diff
changeset
|
27 # xhtml |
845e08259ab0
Syntax highlighting strings in PHP/HTML is complicated!
IBBoard <dev@ibboard.co.uk>
parents:
100
diff
changeset
|
28 color white start="<\?xml" end="\?>" |
845e08259ab0
Syntax highlighting strings in PHP/HTML is complicated!
IBBoard <dev@ibboard.co.uk>
parents:
100
diff
changeset
|
29 |
845e08259ab0
Syntax highlighting strings in PHP/HTML is complicated!
IBBoard <dev@ibboard.co.uk>
parents:
100
diff
changeset
|
30 # Strings. |
845e08259ab0
Syntax highlighting strings in PHP/HTML is complicated!
IBBoard <dev@ibboard.co.uk>
parents:
100
diff
changeset
|
31 color yellow ""((\\")?(\.|[^"])*[^\\])?"" "'((\\')?(\.|[^'])*[^\\])?'" |
845e08259ab0
Syntax highlighting strings in PHP/HTML is complicated!
IBBoard <dev@ibboard.co.uk>
parents:
100
diff
changeset
|
32 |
85
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
33 # Comments. |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
34 color green "(^|[[:space:]]+)//.*" |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
35 color green start="/\*" end="\*/" |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
36 |
86 | 37 # PHP tags |
38 color brightblue "<\?(php|=)|\?>" | |
85
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
39 |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
40 # Trailing whitespace. |
ef08bb127ede
Ditch third-party nanorc configs and just add what we use
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
41 color ,green "[[:space:]]+$" |