[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] [PATCH V2] syntax: c: change the highlighting of prepro
From: |
Liu Hao |
Subject: |
Re: [Nano-devel] [PATCH V2] syntax: c: change the highlighting of preprocessor directives |
Date: |
Tue, 2 Apr 2019 23:16:26 +0800 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
在 2019/4/2 20:46, Benno Schulenberg 写道:
> +# 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)\>"
> +
I would suggest moving `define` to the first group. In the so-called
'include guards' seen in common headers, which look like follows:
```
#ifndef FOO_H
#define FOO_H
#endif
```
, the first `FOO_H` follows `#ifndef`, so it would be colored
brightcyan; while the second `FOO_H` follows `#define` that only gets
itself colored, so the very first syntax rule for 'constants' apply,
which makes it colored `brightred`. So in this example they would be
colored differently, ending up in inconsistency.
--
Best regards,
LH_Mouse
signature.asc
Description: OpenPGP digital signature