summaryrefslogtreecommitdiff
path: root/pygments/lexers/compiled.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-01-10 10:08:13 +0100
committerGeorg Brandl <georg@python.org>2014-01-10 10:08:13 +0100
commitc68bb4e8176d57deead99b768847b87c73c8699e (patch)
tree0330a4e8f1263c58e03509364dc0fcd52813ca4d /pygments/lexers/compiled.py
parent1fede84d263990555cc90d585642e8c338f47b3d (diff)
parentdb761d984af38381560e7b5a1100ef4ae1c95d59 (diff)
downloadpygments-c68bb4e8176d57deead99b768847b87c73c8699e.tar.gz
Merged in kprofic/pygments-main (pull request #265)
Objective-C improvements
Diffstat (limited to 'pygments/lexers/compiled.py')
-rw-r--r--pygments/lexers/compiled.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py
index a272878c..db17ec32 100644
--- a/pygments/lexers/compiled.py
+++ b/pygments/lexers/compiled.py
@@ -1372,20 +1372,23 @@ def objective(baselexer):
tokens = {
'statements': [
(r'@"', String, 'string'),
- (r"@'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'",
- String.Char),
+ (r"@'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
(r'@(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),
(r'@(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
(r'@0x[0-9a-fA-F]+[Ll]?', Number.Hex),
(r'@0[0-7]+[Ll]?', Number.Oct),
(r'@\d+[Ll]?', Number.Integer),
- (r'(in|@selector|@private|@protected|@public|@encode|'
+ (r'@\([^()]+\)', Number),
+ (r'(@selector|@private|@protected|@public|@encode|'
r'@synchronized|@try|@throw|@catch|@finally|@end|@property|'
- r'@synthesize|@dynamic|@optional)\b', Keyword),
- (r'(id|Class|IMP|SEL|BOOL|IBOutlet|IBAction|unichar)\b',
+ r'__bridge|__bridge_transfer|__autoreleasing|__block|__weak|__strong|'
+ r'weak|strong|retain|assign|unsafe_unretained|nonatomic|'
+ r'readonly|readwrite|setter|getter|typeof|in|out|inout|'
+ r'@synthesize|@dynamic|@optional|@required|@autoreleasepool)\b', Keyword),
+ (r'(id|instancetype|Class|IMP|SEL|BOOL|IBOutlet|IBAction|unichar)\b',
Keyword.Type),
(r'@(true|false|YES|NO)\n', Name.Builtin),
- (r'(YES|NO|nil)\b', Name.Builtin),
+ (r'(YES|NO|nil|self|super)\b', Name.Builtin),
(r'(@interface|@implementation)(\s+)', bygroups(Keyword, Text),
('#pop', 'oc_classname')),
(r'(@class|@protocol)(\s+)', bygroups(Keyword, Text),
@@ -1444,6 +1447,17 @@ def objective(baselexer):
return 0.8
return 0
+ def get_tokens_unprocessed(self, text):
+ from pygments.lexers._cocoabuiltins import COCOA_INTERFACES, COCOA_PROTOCOLS, COCOA_PRIMITIVES
+
+ for index, token, value in \
+ baselexer.get_tokens_unprocessed(self, text):
+ if token is Name:
+ if value in COCOA_INTERFACES or value in COCOA_PROTOCOLS or value in COCOA_PRIMITIVES:
+ token = Name.Builtin.Pseudo
+
+ yield index, token, value
+
return GeneratedObjectiveCVariant