summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pygments/lexers/_cocoabuiltins.py32
-rw-r--r--pygments/lexers/compiled.py12
-rw-r--r--pygments/styles/xcode.py2
3 files changed, 45 insertions, 1 deletions
diff --git a/pygments/lexers/_cocoabuiltins.py b/pygments/lexers/_cocoabuiltins.py
new file mode 100644
index 00000000..651a5708
--- /dev/null
+++ b/pygments/lexers/_cocoabuiltins.py
@@ -0,0 +1,32 @@
+import os
+import re
+
+FRAMEWORKS_PATH = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/'
+frameworks = os.listdir(FRAMEWORKS_PATH)
+
+all_types = set()
+for framework in frameworks:
+ frameworkHeadersDir = FRAMEWORKS_PATH + framework + '/Headers/'
+ if (not os.path.exists(frameworkHeadersDir)): continue
+
+ headerFilenames = os.listdir(frameworkHeadersDir)
+
+ types = set()
+
+ for f in headerFilenames:
+ if (not f.endswith('.h')): continue
+
+ headerFilePath = frameworkHeadersDir + f
+ content = open(headerFilePath).read()
+ res = re.search('(?<=@interface )\w+', content)
+ if (res):
+ types.add(res.group(0))
+ all_types.add(res.group(0))
+
+
+ print framework + "\n"
+ # print types
+
+
+print "ALL: \n"
+print all_types \ No newline at end of file
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py
index 076d6aa8..5911f3c1 100644
--- a/pygments/lexers/compiled.py
+++ b/pygments/lexers/compiled.py
@@ -1399,6 +1399,9 @@ def objective(baselexer):
],
}
+ # TODO extranct to separate file
+ cocoa_types = ['UITableViewCell', 'NSLinguisticTagger', 'NSStream', 'UIPrintInfo', 'SKPaymentTransaction', 'SKPhysicsWorld', 'NSString', 'CMAttitude', 'SKSpriteNode', 'JSContext', 'UICollectionReusableView', 'GKLeaderboard', 'NSFetchedResultsController', 'MKTileOverlayRenderer', 'UIMenuController', 'NSURLSession', 'GLKEffectPropertyLight', 'UIAccessibilityElement', 'NSShadow', 'CAEmitterCell', 'UIPushBehavior', 'CBCharacteristic', 'CBUUID', 'CMStepCounter', 'NSNetService', 'UICollectionView', 'CAShapeLayer', 'MCPeerID', 'NSFileVersion', 'CMGyroData', 'CIFilter', 'UIView', 'MKMapItem', 'PKPass', 'GKMatchRequest', 'AVMetadataObject', 'CLGeocoder', 'NSByteCountFormatter', 'CAEmitterLayer', 'CAAnimation', 'MKOverlayPathView', 'UIActionSheet', 'UIBarItem', 'SKProduct', 'AVAssetExportSession', 'CATextLayer', 'AVAssetTrackSegment', 'GKSession', 'CLCircularRegion', 'MKTileOverlay', 'UICollisionBehavior', 'ACAccountCredential', 'AVMediaSelectionGroup', 'NSIndexSet', 'AVAudioRecorder', 'NSURL', 'CBCentral', 'UITableView', 'GCController', 'GCControllerElement', 'UISwipeGestureRecognizer', 'MKOverlayRenderer', 'MKPolyline', 'EKReminder', 'MKPolylineView', 'UIImagePickerController', 'EKParticipant', 'UIActivityItemProvider', 'CLLocation', 'GKLeaderboardViewController', 'GKNotificationBanner', 'GKScore', 'NSURLConnection', 'ABUnknownPersonViewController', 'SKTextureAtlas', 'NSKeyedArchiver', 'GKLeaderboardSet', 'CBATTRequest', 'MKPolygonRenderer', 'JSValue', 'UIAlertView', 'NSIncrementalStore', 'MFMailComposeViewController', 'SSReadingList', 'SKLabelNode', 'NSManagedObjectContext', 'ACAccount', 'AVMetadataItem', 'CLLocationManager', 'UIStepper', 'UIRefreshControl', 'GKTurnBasedParticipant', 'UICollectionViewTransitionLayout', 'CBCentralManager', 'SLComposeViewController', 'NSHashTable', 'MKUserTrackingBarButtonItem', 'UITabBarController', 'CMMotionActivity', 'SKAction', 'AVPlayerItemOutput', 'UIDocumentInteractionController', 'UILabel', 'NSExpression', 'UIStoryboardSegue', 'NSOrderedSet', 'UIPopoverBackgroundView', 'UIToolbar', 'NSEntityMigrationPolicy', 'NSLocale', 'NSTimeZone', 'UIManagedDocument', 'ALAssetRepresentation', 'NSLayoutManager', 'EKCalendarChooser', 'EKObject', 'CATiledLayer', 'GLKReflectionMapEffect', 'NSManagedObjectID', 'NSUserDefaults', 'SLRequest', 'AVPlayerLayer', 'NSPointerArray', 'AVAudioMix', 'MCAdvertiserAssistant', 'MKMapSnapshotOptions', 'GKMatch', 'AVTimedMetadataGroup', 'UIDynamicItemBehavior', 'NSFetchRequest', 'UIDevice', 'NSManagedObject', 'NKAssetDownload', 'AVOutputSettingsAssistant', 'UITabBar', 'NSFetchRequestExpression', 'CTSubscriber', 'NSPersistentStoreRequest', 'ADBannerView', 'AVPlayerItem', 'AVSynchronizedLayer', 'MKDirectionsRequest', 'CBPeripheralManager', 'UIStoryboardPopoverSegue', 'SKProductsRequest', 'UIGravityBehavior', 'UIWindow', 'UIBezierPath', 'UINavigationController', 'ABPeoplePickerNavigationController', 'EKSource', 'AVAssetWriterInput', 'AVPlayerItemTrack', 'NSURLResponse', 'SKPaymentQueue', 'MKReverseGeocoder', 'GCControllerAxisInput', 'MKMapSnapshotter', 'NSOrthography', 'NSCharacterSet', 'AVAssetReaderOutput', 'CIFeature', 'UICollectionViewController', 'AVAssetTrack', 'SKEmitterNode', 'CTCall', 'CMAccelerometerData', 'CIColor', 'CAGradientLayer', 'NSFormatter', 'CATransaction', 'UIStoryboard', 'MPMediaLibrary', 'UITapGestureRecognizer', 'GKAchievementDescription', 'MCBrowserViewController', 'NSRelationshipDescription', 'NSMutableAttributedString', 'MPNowPlayingInfoCenter', 'MKLocalSearch', 'EAAccessory', 'NSNotificationQueue', 'NSValue', 'SKPhysicsContact', 'NSProgress', 'NSTextCheckingResult', 'NSEntityDescription', 'NSURLCredentialStorage', 'UIApplication', 'SKDownload', 'MKLocalSearchRequest', 'SKScene', 'UISearchDisplayController', 'CAReplicatorLayer', 'UIPrintPageRenderer', 'EKCalendarItem', 'NSUUID', 'EAAccessoryManager', 'AVAssetResourceLoader', 'MyClass', 'NSURLRequest', 'CIVector', 'UINavigationBar', 'UIPanGestureRecognizer', 'MPMediaQuery', 'ABNewPersonViewController', 'ACAccountType', 'MFMessageComposeViewController', 'SKVideoNode', 'MKGeodesicPolyline', 'GCExtendedGamepad', 'CAValueFunction', 'UIActivityIndicatorView', 'NSNotification', 'SKReceiptRefreshRequest', 'NSMapTable', 'NSSet', 'CMMotionManager', 'GKVoiceChatService', 'UIPageControl', 'GCExtendedGamepadSnapshot', 'NSLayoutConstraint', 'UIWebView', 'NSIncrementalStoreNode', 'EKEventStore', 'UISlider', 'AVCaptureInput', 'SKPhysicsBody', 'NSOperation', 'MKMapCamera', 'GLKEffectPropertyMaterial', 'AVCaptureDevice', 'CTCallCenter', 'UIDynamicAnimator', 'UIGestureRecognizer', 'MCNearbyServiceBrowser', 'MPVolumeView', 'MKPolylineRenderer', 'UICollectionViewLayoutAttributes', 'NSValueTransformer', 'NSEntityMapping', 'SKTexture', 'AVAsset', 'NSUndoManager', 'MPMediaPickerController', 'NSFileCoordinator', 'NSFileHandle', 'UISegmentedControl', 'NSManagedObjectModel', 'UITabBarItem', 'MPMediaItem', 'EKRecurrenceRule', 'UIEvent', 'UITouch', 'UIPrintInteractionController', 'CMDeviceMotion', 'NSCompoundPredicate', 'MKMultiPoint', 'UIPrintFormatter', 'SKView', 'UIPopoverController', 'EKEventViewController', 'NSPort', 'MKCircleRenderer', 'AVCompositionTrack', 'UINib', 'NSUbiquitousKeyValueStore', 'UITableViewHeaderFooterView', 'UISplitViewController', 'AVAudioSession', 'NSNull', 'MKCircleView', 'UIColor', 'UIAttachmentBehavior', 'MKCircle', 'GKPlayer', 'NSMappingModel', 'NSHTTPCookie', 'NSAttributeDescription', 'AVPlayer', 'MKAnnotationView', 'UIFontDescriptor', 'NSTimer', 'CBDescriptor', 'MKOverlayView', 'EKEventEditViewController', 'NSSaveChangesRequest', 'UIReferenceLibraryViewController', 'UILocalizedIndexedCollation', 'AVAssetWriter', 'NSBundle', 'SKStoreProductViewController', 'GLKViewController', 'UIActivity', 'MKShape', 'NSMergeConflict', 'CIImage', 'UIRotationGestureRecognizer', 'AVAssetImageGenerator', 'GCControllerButtonInput', 'NSSortDescriptor', 'NKIssue', 'UIScreenMode', 'JSVirtualMachine', 'AVAssetReader', 'NSAttributedString', 'GKMatchmakerViewController', 'UIButton', 'GKLocalPlayer', 'NSJSONSerialization', 'CBPeripheral', 'UIPercentDrivenInteractiveTransition', 'NSEnumerator', 'UIDocument', 'MKLocalSearchResponse', 'CBService', 'MCSession', 'QLPreviewController', 'CAMediaTimingFunction', 'NSNumberFormatter', 'NSMetadataQuery', 'CTCarrier', 'UIAcceleration', 'UIMotionEffect', 'CLHeading', 'NSHTTPCookieStorage', 'MKDirectionsResponse', 'UILocalNotification', 'UITextView', 'CMMagnetometerData', 'UIProgressView', 'UIPinchGestureRecognizer', 'UISearchBar', 'MKPlacemark', 'ALAssetsFilter', 'CAEAGLLayer', 'ABPersonViewController', 'CIDetector', 'GKTurnBasedMatchmakerViewController', 'MPMediaItemCollection', 'NSURLCredential', 'NSAtomicStoreCacheNode', 'EKCalendar', 'NSDictionary', 'MKPolygon', 'MKMapView', 'NSExpressionDescription', 'UIViewController', 'NSURLAuthenticationChallenge', 'MKDistanceFormatter', 'NSPropertyListSerialization', 'GKPeerPickerController', 'UITableViewController', 'MPMoviePlayerController', 'MKPointAnnotation', 'NSCache', 'SKPhysicsJoint', 'NSXMLParser', 'AVCaptureSession', 'AVCaptureVideoPreviewLayer', 'UISnapBehavior', 'UIPageViewController', 'NSTextAttachment', 'NSException', 'CMMotionActivityManager', 'MKUserLocation', 'EAGLContext', 'UIPasteboard', 'ALAsset', 'MPMoviePlayerViewController', 'NSCachedURLResponse', 'ALAssetsLibrary', 'NSInvocation', 'UILongPressGestureRecognizer', 'NSTextStorage', 'MKMapSnapshot', 'GLKEffectPropertyFog', 'AVComposition', 'PKPassLibrary', 'NSLock', 'UIDynamicBehavior', 'AVPlayerMediaSelectionCriteria', 'CALayer', 'UIBarButtonItem', 'CLBeaconRegion', 'SKEffectNode', 'EKRecurrenceEnd', 'NSTextContainer', 'TWTweetComposeViewController', 'UIScrollView', 'EKRecurrenceDayOfWeek', 'ASIdentifierManager', 'UIScreen', 'CLRegion', 'NSProcessInfo', 'GLKTextureInfo', 'NSTextTab', 'JSManagedValue', 'NSDate', 'UITextChecker', 'NSData', 'EKAlarm', 'UIVideoEditorController', 'NSAtomicStore', 'UIResponder', 'AVCompositionTrackSegment', 'GCGamepadSnapshot', 'CAEmitterBehavior', 'GLKSkyboxEffect', 'UISwitch', 'EKStructuredLocation', 'NSProxy', 'GLKBaseEffect', 'NSCoder', 'MPMediaPlaylist', 'EKEvent', 'NSDateFormatter', 'UICollectionViewFlowLayoutInvalidationContext', 'UITextField', 'CLPlacemark', 'AVCaptureOutput', 'NSPropertyDescription', 'GCGamepad', 'NSPersistentStoreCoordinator', 'CIContext', 'NSThread', 'SKRequest', 'NSPredicate', 'GKVoiceChat', 'SKCropNode', 'SKKeyframeSequence', 'NSStringDrawingContext', 'GKGameCenterViewController', 'UIPrintPaper', 'GLKEffectPropertyTransform', 'UIDatePicker', 'MKDirections', 'ALAssetsGroup', 'SKTransition', 'UIFont', 'MKPinAnnotationView', 'UIPickerView', 'UIImageView', 'SKNode', 'MPMediaQuerySection', 'GKFriendRequestComposeViewController', 'NSError', 'CTSubscriberInfo', 'CMLogItem', 'NSAutoreleasePool', 'AVSpeechSynthesisVoice', 'UIImage', 'NSDecimalNumber', 'AVAssetTrackGroup', 'GKChallengeEventHandler', 'UIControl', 'SKPayment', 'ADInterstitialAd', 'GLKEffectPropertyTexture', 'NSArray', 'GCControllerDirectionPad', 'NSFileManager', 'CAScrollLayer', 'UIScreenEdgePanGestureRecognizer', 'EASession', 'UIInputView', 'NSFileWrapper', 'NSPointerFunctions', 'NSRunLoop', 'NSMigrationManager', 'GLKEffectProperty', 'SKShapeNode', 'MKPolygonView', 'NSScanner', 'AVAudioPlayer', 'AVVideoComposition', 'NKLibrary', 'NSPersistentStore', 'NSPropertyMapping', 'GKChallenge', 'NSURLProtectionSpace', 'ACAccountStore', 'NSComparisonPredicate', 'PKAddPassesViewController', 'CTTelephonyNetworkInfo', 'AVTextStyleRule', 'NSFetchedPropertyDescription', 'CATransformLayer', 'MCNearbyServiceAdvertiser', 'NSObject', 'MPMusicPlayerController', 'MKOverlayPathRenderer', 'GKAchievement', 'MPMediaEntity', 'TWRequest', 'MIDINetworkHost', 'NSIndexPath', 'AVVideoCompositionRenderContext', 'CADisplayLink', 'GLKView', 'UIActivityViewController', 'GKAchievementViewController', 'NSURLProtocol', 'NSCalendar', 'NSMethodSignature', 'NSRegularExpression', 'EAGLSharegroup', 'UIDictationPhrase']
+
def analyse_text(text):
if _oc_keywords.search(text):
return 1.0
@@ -1408,6 +1411,15 @@ def objective(baselexer):
return 0.8
return 0
+ def get_tokens_unprocessed(self, text):
+ for index, token, value in \
+ baselexer.get_tokens_unprocessed(self, text):
+ if token is Name:
+ if value in self.cocoa_types:
+ token = Name.Builtin.Pseudo # TODO new token type
+
+ yield index, token, value
+
return GeneratedObjectiveCVariant
diff --git a/pygments/styles/xcode.py b/pygments/styles/xcode.py
index 26d92ed7..a18dd93a 100644
--- a/pygments/styles/xcode.py
+++ b/pygments/styles/xcode.py
@@ -41,7 +41,7 @@ class XcodeStyle(Style):
# Name.Property: '#000000',
# Name.Namespace: '#000000',
Name.Builtin: '#AA0D92',
- # Name.Builtin.Pseudo: '#000000',
+ Name.Builtin.Pseudo: '#5B269A', # In Obj-C code this token is used to colour Cocoa types, TODO new token type
Name.Variable: '#000000', # it was method argument (but not always recognized successfully)
# Name.Variable.Class: '#000000',
# Name.Variable.Instance: '#000000',