Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for Yaml and PHP, improvements for XML #378

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions php.nanorc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ comment "//"
color white start="<\?(php|=)?" end="\?>"
# Constructs
color brightblue "(class|extends|goto) ([a-zA-Z0-9_]*)"
color brightblue "[^a-z0-9_-]{1}(var|class|function|echo|case|break|default|exit|switch|if|else|elseif|endif|foreach|endforeach|@|while|public|private|protected|return|true|false|null|TRUE|FALSE|NULL|const|static|extends|as|array|require|include|require_once|include_once|define|do|continue|declare|goto|print|in|namespace|use)[^a-z0-9_-]{1}"
color brightblue "[^a-z0-9_-]{1}(var|class|function|echo|case|break|default|exit|switch|if|else|elseif|endif|foreach|endforeach|@|while|public|private|protected|return|const|static|extends|as|array|require|include|require_once|include_once|define|do|continue|declare|goto|print|in|namespace|use)[^a-z0-9_-]{1}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it [^a-z0-9_-]{1} instead of just [^a-z0-9_-]?
Also, if the [^a-z0-9_-]{1} at the beginning and the end is to make sure these keywords (eg. echo) are not part of another word, why not just wrap them up with \< and \>? (as described here)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably I have no reason here. Notice that my change is just removing true|false|null|TRUE|FALSE|NULL| since they should be highlighted brightmagenta below. Feel free to add a suggestion using github's suggestion feature if you want me to make a specific change to this PR. (I don't use nano these days (switched to micro), and I don't use PHP too much either).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, never mind. I'm just a volunteer so maybe we'll fix that some other day? By the way, thanks for mentioning micro!

color brightblue "[a-zA-Z0-9_]+:"
# Variables
color green "\$[a-zA-Z_0-9$]*|[=!<>]"
Expand All @@ -14,7 +14,7 @@ color green "\->[a-zA-Z_0-9$]*|[=!<>]"
color brightblue "([a-zA-Z0-9_-]*)\("
# Special values
color brightmagenta "[^a-z0-9_-]{1}(true|false|null|TRUE|FALSE|NULL)$"
color brightmagenta "[^a-z0-9_-]{1}(true|false|null|TRUE|FALSE|NULL)[^a-z0-9_-]{1}"
color brightmagenta "[^a-z0-9_-]{1}(true|false|null|TRUE|FALSE|NULL)[^A-Za-z0-9_-]{1}"
# Special Characters
color yellow "[.,{}();]"
color cyan "\["
Expand Down
11 changes: 9 additions & 2 deletions xml.nanorc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ magic "(XML|SGML) (sub)?document"
comment "<!--|-->"

color white "^.+$"
# Attributes
color green start="<" end=">"
color cyan "<[^> ]+"
color cyan ">"
color brightgreen "=\"[^\"]*\""
# Opening tags
color brightcyan "<[^/][^> ]*"
color brightcyan ">"
# Closing tags
color cyan "</[^> ]*>"
# Self-closing part
color cyan "/>"
color yellow start="<!DOCTYPE" end="[/]?>"
color yellow start="<!--" end="-->"
color red "&[^;]*;"
Expand Down
2 changes: 1 addition & 1 deletion yaml.nanorc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ color yellow "(^| )!!(binary|bool|float|int|map|null|omap|seq|set|str) "

# Separator
color brightwhite "^\s+-"
color brightwhite ":(\s|\t|$)"
color brightwhite ":(\s|$)"

# Comments
color brightblue "(^|[[:space:]])#.*$"
Expand Down