[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Two tiny tweaks to c.nanorc
From: |
Benno Schulenberg |
Subject: |
Re: Two tiny tweaks to c.nanorc |
Date: |
Thu, 3 Sep 2020 09:56:47 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
Op 02-09-2020 om 19:02 schreef Hussam al-Homsi:
> Patch 1: Highlight uppercase single character C identifiers as constants.
>
> Patch 2: Highlight the C null directive.
> # Constants.
> -color brightred "\<[A-Z_][0-9A-Z_]+\>"
> +color brightred "\<[A-Z_][0-9A-Z_]*\>"
Good. This will color also the single-underscore macro -- only now I realize
that it should have been all along.
> # Preprocessor directives.
> color brightcyan
> start="^[[:space:]]*#[[:space:]]*(if(n?def)?|elif|warning|error|pragma)\>"
> end="(\`|[^\\])$"
> -color brightcyan
> "^[[:space:]]*#[[:space:]]*(define|else|endif|include(_next)?|undef)\>"
> +color brightcyan
> "^[[:space:]]*#[[:space:]]*((define|else|endif|include(_next)?|undef)\>)?"
This is not precise enough. A stray "#" in the leading whitespace of a line
of text would get colored as a directive, which is not right. Instead of
")?" at the end I think it should be "|$)". Do you agree?
Benno
signature.asc
Description: OpenPGP digital signature