From a2fcc06fa55b3d083677d1eaaaa3e8d1ccaeed4e Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 24 Mar 2014 12:39:58 +0000 Subject: [PATCH] Adding syntax highlighting for Javascript, made by Mike Frysinger, based on the C syntax. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4669 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 1 + doc/nanorc.sample.in | 3 +++ doc/syntax/javascript.nanorc | 21 +++++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 doc/syntax/javascript.nanorc diff --git a/ChangeLog b/ChangeLog index 91637673..d2f1b48d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2014-03-24 Benno Schulenberg * doc/syntax/gentoo.nanorc - Match more files, add a trailing whitespace check, and EAPI=5 updates. Patch by Mike Frysinger. + * doc/syntax/javascript.nanorc - New file, by Mike Frysinger. 2014-03-23 Benno Schulenberg * src/rcfile.c (parse_keybinding, parse_unbinding) - Improve a diff --git a/doc/nanorc.sample.in b/doc/nanorc.sample.in index 37740e54..e357a83f 100644 --- a/doc/nanorc.sample.in +++ b/doc/nanorc.sample.in @@ -280,6 +280,9 @@ ## Java # include "@PKGDATADIR@/java.nanorc" +## Javascript +# include "@PKGDATADIR@/javascript.nanorc" + ## Luan # include "@PKGDATADIR@/lua.nanorc" diff --git a/doc/syntax/javascript.nanorc b/doc/syntax/javascript.nanorc new file mode 100644 index 00000000..d68da5dd --- /dev/null +++ b/doc/syntax/javascript.nanorc @@ -0,0 +1,21 @@ +## Here is an example for Javascript. +## +syntax "javascript" "\.js$" +color brightred "\<[A-Z_][0-9A-Z_]+\>" +color green "\<(const|function|let|this|typeof|var|void)\>" +color brightyellow "\<(for|if|while|with|do|else|case|default|switch)\>" +color brightyellow "\<(export|try|throw|catch|new|delete)\>" +color magenta "\<(continue|break|return|yield)\>" +color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'" + +## String highlighting. You will in general want your comments and +## strings to come last, because syntax highlighting rules will be +## applied in the order they are read in. +color brightyellow "<[^= ]*>" ""(\\.|[^"])*"" "'(\\.|[^'])*'" + +## Comment highlighting +color brightblue "//.*" +color brightblue start="/\*" end="\*/" + +## Trailing whitespace +color ,green "[[:space:]]+$" -- 2.39.5