commit bdbd5ff0e78cb415ff18f7f426839f0142f10b68
parent f769465284eb192e87a40b89323ee28d066599a3
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 25 Dec 2017 15:50:14 +0100
syntax: javascript: add some comments, and color explicit numbers too
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/syntax/javascript.nanorc b/syntax/javascript.nanorc
@@ -1,13 +1,19 @@
-## Here is an example for Javascript.
+## Syntax highlighting for Javascript.
syntax "javascript" "\.js$"
comment "//"
+# Declarational stuff.
color green "\<(async|class|const|extends|function|let|this|typeof|var|void)\>"
+# Flow control and special keywords.
color brightyellow "\<(do|while|if|else|switch|case|default|for|each|in|of|with)\>"
color brightyellow "\<(await|export|import|throw|try|catch|finally|new|delete)\>"
+# "Exit" points.
color magenta "\<(break|continue|return|yield)\>"
+# Octal/decimal and hexadecimal numbers.
+color cyan "\<[0-9]+\>" "\<0x[0-9A-Fa-f]+\>"
+
# Strings.
color brightmagenta ""(\\.|[^"])*"" "'(\\.|[^'])*'" "`(\\.|[^`])*`"
# Comments.