Closed efa closed 2 years ago
in the past a Nedit's maillist subscriber sent me some steps to add C99 comments recognition by menu Prefences, Default Settings, Syntax Highlighting but I cannot find that anymore, maybe lost on an old work computer installation and I cannot find the email too
Preferences -> Default Settings -> Syntax Highlighting -> Recognition Patterns
Language Mode: C New Pattern
Pattern Type: Pass 2 Highlight Style: Comment Pattern Name: commentc99 Starting Regular Expression: // Ending Regular Expression: (?<!\)$
I will add this to the next release. Can't do it yet, because I want to add some other syntax highlighting changes and want to do all in one go, because I need to create a patch for existing nedit.rc files and increment nedit.fileVersion. It is better to do this at the end before the release.
there is the other related request: https://github.com/unixwork/xnedit/issues/21 for bool and other new (really old in 2021) keywords
you probably mean:
Ending Regular Expression: \(?<!\)$
instead of
Ending Regular Expression: (?<!\)$
and maybe need something similar for comments on preprocessor lines
Actually (?<!\\)$
markdown killed one \
I didn't even used lookbehind negative regexp: (?<!pattern)
Did it mean: look for strings that is \\
and are at the of a line, and skip (negative)?
other C99 new syntax hightlight other than the one asked in #21 should be the fixed size type: https://en.cppreference.com/w/c/types/integer
other new types are:
ptrdiff_t
off_t
ssize_t
size_t
wchar_t
gcc -std=gnu99
accept those complex:
float complex
long complex
complex
double complex
long double complex
size_t is not new in C99. It is also not a type of the language, just a typedef.
The best solution would probably be to highlight all words that end with _t, because that are probably always types (no sane C programmer would end a variable or function name with _t).
complex is similar to bool, it is not a language keyword, just a define. The language keywords are _Complex or _Bool. The libc provides headers for these defines (stdbool.h, complex.h), but the libc has a lot of defines and I can't add highlighting for everything.
xnedit 1.4.0 has updated C syntax highlighting
// C99 comments (single line) are not italics like happen for C89 comments (multi line)