diff options
author | Georg Brandl <georg@python.org> | 2014-11-06 11:08:40 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-11-06 11:08:40 +0100 |
commit | 92d445ccf0dd68391520ecdc27faf8e0339347c2 (patch) | |
tree | 5110da59f44068e73d4e777d67aa78350d254e6f | |
parent | 6b3c586f3ff4918b53222a57bd12a960bf29f312 (diff) | |
download | pygments-92d445ccf0dd68391520ecdc27faf8e0339347c2.tar.gz |
VB.net: support Unicode identifiers
-rw-r--r-- | pygments/lexers/dotnet.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/pygments/lexers/dotnet.py b/pygments/lexers/dotnet.py index 4c7f96f8..931d0c86 100644 --- a/pygments/lexers/dotnet.py +++ b/pygments/lexers/dotnet.py @@ -375,6 +375,10 @@ class VbNetLexer(RegexLexer): filenames = ['*.vb', '*.bas'] mimetypes = ['text/x-vbnet', 'text/x-vba'] # (?) + uni_name = '[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' + \ + '[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc', + 'Cf', 'Mn', 'Mc') + ']*' + flags = re.MULTILINE | re.IGNORECASE tokens = { 'root': [ @@ -426,13 +430,13 @@ class VbNetLexer(RegexLexer): r'<=|>=|<>|[-&*/\\^+=<>\[\]]', Operator), ('"', String, 'string'), - ('[a-z_]\w*[%&@!#$]?', Name), + (r'_\n', Text), # Line continuation (must be before Name) + (uni_name + '[%&@!#$]?', Name), ('#.*?#', Literal.Date), (r'(\d+\.\d*|\d*\.\d+)([fF][+-]?[0-9]+)?', Number.Float), (r'\d+([SILDFR]|US|UI|UL)?', Number.Integer), (r'&H[0-9a-f]+([SILDFR]|US|UI|UL)?', Number.Integer), (r'&O[0-7]+([SILDFR]|US|UI|UL)?', Number.Integer), - (r'_\n', Text), # Line continuation ], 'string': [ (r'""', String), @@ -440,17 +444,19 @@ class VbNetLexer(RegexLexer): (r'[^"]+', String), ], 'dim': [ - (r'[a-z_]\w*', Name.Variable, '#pop'), + (uni_name, Name.Variable, '#pop'), default('#pop'), # any other syntax ], 'funcname': [ - (r'[a-z_]\w*', Name.Function, '#pop'), + (uni_name, Name.Function, '#pop'), ], 'classname': [ - (r'[a-z_]\w*', Name.Class, '#pop'), + (uni_name, Name.Class, '#pop'), ], 'namespace': [ - (r'[a-z_][\w.]*', Name.Namespace, '#pop'), + (uni_name, Name.Namespace), + (r'\.', Name.Namespace), + default('#pop'), ], 'end': [ (r'\s+', Text), |