[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-nano] syntax highlighting rules for C++
From: |
Benno Schulenberg |
Subject: |
Re: [Help-nano] syntax highlighting rules for C++ |
Date: |
Sun, 16 Oct 2016 11:29:32 +0200 |
On Sun, Oct 16, 2016, at 07:40, Mark Yagnatinsky wrote:
> Here's a simple example of what I had in mind:
>
> #include<vector>
> using namespace std;
> int main(){} // whatever
> vector<int> v;
>
> In the example above, <int> is colored yellow (last line). I don't think
> this is good, and I don't think it was the intent of the person who wrote
> these rules.
You would want the "int" between angular brackets to be colored
green, like any other type? Adding the following line to your
~/.nanorc should partially achieve that:
extendsyntax c color green "<(bool|enum|float|wchar_t|((un?)signed )?(long
|short )?char|double|int)>"
But it colors the angular brackets green too, which is not nice.
So better would be to... not "allow" comments after include
statements: add a "$" at the end of the string coloring rule,
so only strings of the form <word> at line's end get colored.
color brightyellow ""([^"]|\\")*"" "<[^[:blank:]=]*>$"
Benno
--
http://www.fastmail.com - Does exactly what it says on the tin