Skip to content

Commit

Permalink
Fix for C# identifiers with leading underscores
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin authored and alecthomas committed Apr 21, 2022
1 parent f7d2bb0 commit d070b1c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lexers/embedded/csharp.xml
Expand Up @@ -49,7 +49,7 @@
<rule pattern="&#39;\\.&#39;|&#39;[^\\]&#39;">
<token type="LiteralStringChar"/>
</rule>
<rule pattern="0[xX][0-9a-fA-F]+[Ll]?|[0-9_](\.[0-9]*)?([eE][+-]?[0-9]+)?[flFLdD]?">
<rule pattern="0[xX][0-9a-fA-F]+[Ll]?|\d[_\d]*(\.\d*)?([eE][+-]?\d+)?[flFLdD]?">
<token type="LiteralNumber"/>
</rule>
<rule pattern="#[ \t]*(if|endif|else|elif|define|undef|line|error|warning|region|endregion|pragma|nullable)\b[^\n\r]+">
Expand Down
1 change: 1 addition & 0 deletions lexers/testdata/csharp/csharp_var.actual
@@ -0,0 +1 @@
var _abc = 123;
11 changes: 11 additions & 0 deletions lexers/testdata/csharp/csharp_var.expected
@@ -0,0 +1,11 @@
[
{"type":"KeywordType","value":"var"},
{"type":"Text","value":" "},
{"type":"Name","value":"_abc"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"="},
{"type":"Text","value":" "},
{"type":"LiteralNumber","value":"123"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":"\n"}
]

0 comments on commit d070b1c

Please sign in to comment.