diff options
author | Gaurav Jain <gaurav@gauravjain.org> | 2014-05-13 00:06:36 -0400 |
---|---|---|
committer | Gaurav Jain <gaurav@gauravjain.org> | 2014-05-13 00:06:36 -0400 |
commit | 4a78a4133c7c0806b731d87e4b4d1d5144a28d1b (patch) | |
tree | 56426e11ccbe333ace3bca1e791e25254a5623fd /pygments/lexers/jvm.py | |
parent | df61ba5e5541191c743adfc3c4efb0e73e102f00 (diff) | |
download | pygments-4a78a4133c7c0806b731d87e4b4d1d5144a28d1b.tar.gz |
Improve support $ symbol in Java identifiers
Diffstat (limited to 'pygments/lexers/jvm.py')
-rw-r--r-- | pygments/lexers/jvm.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pygments/lexers/jvm.py b/pygments/lexers/jvm.py index e26e46c8..7b72fc74 100644 --- a/pygments/lexers/jvm.py +++ b/pygments/lexers/jvm.py @@ -42,9 +42,9 @@ class JavaLexer(RegexLexer): (r'//.*?\n', Comment.Single), (r'/\*.*?\*/', Comment.Multiline), # method names - (r'((?:[^\W\d][\w\.\[\]<>]*\s+)+?)' # return arguments - r'([^\W\d]\w*)' # method name - r'(\s*)(\()', # signature start + (r'((?:(?:[^\W\d]|\$)[\w\.\[\]\$<>]*\s+)+?)' # return arguments + r'((?:[^\W\d]|\$)[\w\$]*)' # method name + r'(\s*)(\()', # signature start bygroups(using(this), Name.Function, Text, Operator)), (r'@[^\W\d][\w\.]*', Name.Decorator), (r'(assert|break|case|catch|continue|default|do|else|finally|for|' @@ -61,8 +61,8 @@ class JavaLexer(RegexLexer): (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'), (r'"(\\\\|\\"|[^"])*"', String), (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char), - (r'(\.)([^\W\d]\w*)', bygroups(Operator, Name.Attribute)), - (r'[^\W\d]\w*:', Name.Label), + (r'(\.)((?:[^\W\d]|\$)[\w\$]*)', bygroups(Operator, Name.Attribute)), + (r'([^\W\d]|\$)[\w\$]*:', Name.Label), (r'([^\W\d]|\$)[\w\$]*', Name), (r'[~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]', Operator), (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), @@ -71,7 +71,7 @@ class JavaLexer(RegexLexer): (r'\n', Text) ], 'class': [ - (r'[^\W\d]\w*', Name.Class, '#pop') + (r'([^\W\d]|\$)[\w\$]*', Name.Class, '#pop') ], 'import': [ (r'[\w.]+\*?', Name.Namespace, '#pop') |