[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] [PATCH] syntax: javascript: add newer keywords/syntax

From: Benno Schulenberg
Subject: Re: [Nano-devel] [PATCH] syntax: javascript: add newer keywords/syntax
Date: Sat, 6 Jan 2018 18:37:22 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

Op 04-01-18 om 10:58 schreef Mike Frysinger:
i'm assuming you mean these rules: color brightred "\<[A-Z_][0-9A-Z_]+\>" color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'"

i think you've misread them entirely.

the first is meant to capture constant variable names which are commonly written using uppercase. that should be restored imo, especially since we do
it for many other languages in nano.

I had gathered some example fragments from
and put them all together in a file, and look at it.

In the following line "PI" and "SQRT2" would become bright red:

  const foo = Math.PI + Math.SQRT2

and the second "JSON" in this fragment too:

  export function getUsefulContents(url, callback) {
    getJSON(url, data => callback(JSON.parse(data)));

I think both are undesirable.  Are they not?

the second is for colorizing escape sequences, not arbitrary numbers. then again, i think they end up always being clobbered by the following string highlighting rule. so probably best to delete both it and your new number rule.

You don't like the number literals getting colored?

your commit ab62d28817ed7ba46aa04113aa9b99f0fe827d9d breaks valid syntax. var
foo = 'value';// some comment.
It is valid but ugly syntax.  Not requiring such a space before a comment
makes that half of the following URL gets colored as if it were a comment:

      data => { doSomethingUseful(data); });

I'm guessing that URLs are relatively frequent in Javascript files, and
nano shouldn't color them as if they are comments.

The Python syntax also requires that a comment is preceded by whitespace
(or start of line), to avoid coloring things with an embedded hash.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]