Browse Source

Fix #3652: Apostrophe in identifiers must not start a char literal

The interactive view intentionally shows verbatim metadata names
(EscapeInvalidIdentifiers only runs for save/export), so names compiled
from F# or obfuscators can contain apostrophes. The Char span in the C#
highlighting grammar opened at any apostrophe, coloring everything up to
the next one as a char literal. A negative lookbehind limits the span to
positions where a real char literal can occur.

Assisted-by: Claude:claude-fable-5:Claude Code
pull/3951/head
Siegfried Pammer 2 months ago committed by Siegfried Pammer
parent
commit
be2a821b1f
  1. 5
      ILSpy/TextView/CSharp-Mode.xshd

5
ILSpy/TextView/CSharp-Mode.xshd

@ -117,7 +117,10 @@ @@ -117,7 +117,10 @@
</Span>
<Span color="Char">
<Begin>'</Begin>
<!-- Not preceded by an identifier character: names compiled from F# and
obfuscated assemblies may contain apostrophes (e.g. x'), which must not
start a char literal (issue #3652). -->
<Begin>(?&lt;![\w'])'</Begin>
<End>'</End>
<RuleSet>
<!-- span for escape sequences -->

Loading…
Cancel
Save