diff options
author | Georg Brandl <georg@python.org> | 2011-06-18 12:02:59 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2011-06-18 12:02:59 +0200 |
commit | 0131fa0a15b442550367b477e24aa99640b4a99b (patch) | |
tree | 3bf634573ed9e792978179e283ad402cd4f554ba /pygments/lexers/compiled.py | |
parent | d42e51c060bbaeef64863f53e2cfbfbcfcecdbb9 (diff) | |
download | pygments-0131fa0a15b442550367b477e24aa99640b4a99b.tar.gz |
Recognize methods in the ObjC lexer (#638).
Diffstat (limited to 'pygments/lexers/compiled.py')
-rw-r--r-- | pygments/lexers/compiled.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py index a3e871af..6c9d7c87 100644 --- a/pygments/lexers/compiled.py +++ b/pygments/lexers/compiled.py @@ -1309,6 +1309,13 @@ class ObjectiveCLexer(RegexLexer): bygroups(using(this), Name.Function, using(this), Text, Punctuation), 'function'), + # methods + (r'^([-+])(\s*)' # method marker + r'(\(.*?\))?(\s*)' # return type + r'([a-zA-Z$_][a-zA-Z0-9$_]*:?)', # begin of method name + bygroups(Keyword, Text, using(this), + Text, Name.Function), + 'method'), # function declarations (r'((?:[a-zA-Z0-9_*\s])+?(?:\s|[*]))' # return arguments r'([a-zA-Z$_][a-zA-Z0-9$_]*)' # method name @@ -1352,6 +1359,15 @@ class ObjectiveCLexer(RegexLexer): ('{', Punctuation, '#push'), ('}', Punctuation, '#pop'), ], + 'method': [ + include('whitespace'), + (r'(\(.*?\))([a-zA-Z$_][a-zA-Z0-9$_]*)', bygroups(using(this), + Name.Variable)), + (r'[a-zA-Z$_][a-zA-Z0-9$_]*:', Name.Function), + (';', Punctuation, '#pop'), + ('{', Punctuation, 'function'), + ('', Text, '#pop'), + ], 'string': [ (r'"', String, '#pop'), (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape), |