diff options
author | Georg Brandl <georg@python.org> | 2022-10-22 21:27:36 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2022-10-22 22:31:49 +0200 |
commit | a9b5fac4c56c6c96cc9bf07ad629970b82faff21 (patch) | |
tree | 9af1e79da2417cd799b9e4672ef73016d3b1a38d /pygments/lexers/dotnet.py | |
parent | 50ed74d55b2869817c3bc9cdc9eea00223216372 (diff) | |
download | pygments-git-a9b5fac4c56c6c96cc9bf07ad629970b82faff21.tar.gz |
C#: recognize Operators as such, fix split-up numeric literals
Fixes #2256
Diffstat (limited to 'pygments/lexers/dotnet.py')
-rw-r--r-- | pygments/lexers/dotnet.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pygments/lexers/dotnet.py b/pygments/lexers/dotnet.py index de364918..b8317b8c 100644 --- a/pygments/lexers/dotnet.py +++ b/pygments/lexers/dotnet.py @@ -85,12 +85,19 @@ class CSharpLexer(RegexLexer): (r'//.*?\n', Comment.Single), (r'/[*].*?[*]/', Comment.Multiline), (r'\n', Whitespace), - (r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation), + (words(( + '>>>=', '>>=', '<<=', '<=', '>=', '+=', '-=', '*=', '/=', + '%=', '&=', '|=', '^=', '??=', '=>', '??', '?.', '!=', '==', + '&&', '||', '>>>', '>>', '<<', '++', '--', '+', '-', '*', + '/', '%', '&', '|', '^', '<', '>', '?', '!', '~', '=', + )), Operator), + (r'=~|!=|==|<<|>>|[-+/*%=<>&^|]', Operator), + (r'[()\[\];:,.]', Punctuation), (r'[{}]', Punctuation), (r'@"(""|[^"])*"', String), (r'\$?"(\\\\|\\[^\\]|[^"\\\n])*["\n]', String), (r"'\\.'|'[^\\]'", String.Char), - (r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?" + (r"[0-9]+(\.[0-9]*)?([eE][+-][0-9]+)?" r"[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?", Number), (r'(#)([ \t]*)(if|endif|else|elif|define|undef|' r'line|error|warning|region|endregion|pragma)\b(.*?)(\n)', |