|
From: | Benno Schulenberg |
Subject: | Re: [Nano-devel] [PATCH] syntax: c: change the highlighting of preprocessor directives |
Date: | Sun, 17 Dec 2017 12:32:33 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
Op 13-12-17 om 06:48 schreef Liu Hao:
On 2017/12/10 22:38, Benno Schulenberg wrote:+# Preprocessor directives. +color brightcyan start="^[[:space:]]*#[[:space:]]*(if(n?def)?|elif|warning|error|pragma)\>" end="[^\\]$"There is an issue here: With this patch, both of the following lines are colored: ``` #warning blah blah ``` This is not the case if a space is appended to the first line. Apparently `\>` matches the zero-length span between the word `warning` and the LF following it immediately, but the LF of the first line is skipped somehow when searching for termination of the PP directive, resulting in the LF of the second line being the eventual terminator.
The "end=" part wants a character that is not a backslash and that is not part of what the "start=" matched. The "start=" and "end=" parts cannot overlap each other. I do not know how to solve this. (There is an additional problem: if you type a space after "#warning", the coloring of "blah blah" is dropped. But if you then remove the space again, "blah blah" is not recolored. Only when typing ^S or ^L does the color return. So a change in the multiline regex matching is not always detected. But that is a different kind of bug.) Benno
[Prev in Thread] | Current Thread | [Next in Thread] |