Home | History | Annotate | Download | only in geshi
      1 <?php
      2 /*************************************************************************************
      3  * objc.php
      4  * --------
      5  * Author: M. Uli Kusterer (witness.of.teachtext (at) gmx.net)
      6  * Contributors: Quinn Taylor (quinntaylor (at) mac.com)
      7  * Copyright: (c) 2008 Quinn Taylor, 2004 M. Uli Kusterer, Nigel McNie (http://qbnz.com/highlighter/)
      8  * Release Version: 1.0.8.3
      9  * Date Started: 2004/06/04
     10  *
     11  * Objective-C language file for GeSHi.
     12  *
     13  * CHANGES
     14  * -------
     15  * 2008/07/11 (1.0.8)
     16  *   -  Added support for @ before strings being highlighted
     17  * 2008/06/10 (1.0.7.22)
     18  *   -  Added keywords for Objective-C 2.0 (Leopard+).
     19  *   -  Changed colors to match Xcode 3 highlighting more closely.
     20  *   -  Updated API for AppKit and Foundation; added CoreData classes.
     21  *   -  Updated URLs for AppKit and Foundation; split classes and protocols.
     22  *   -  Sorted all keyword group in reverse-alpha order for correct matching.
     23  *   -  Changed all keyword groups to be case-sensitive.
     24  * 2004/11/27 (1.0.0)
     25  *   -  First Release
     26  *
     27  * TODO (updated 2004/11/27)
     28  * -------------------------
     29  *
     30  *************************************************************************************
     31  *
     32  *     This file is part of GeSHi.
     33  *
     34  *   GeSHi is free software; you can redistribute it and/or modify
     35  *   it under the terms of the GNU General Public License as published by
     36  *   the Free Software Foundation; either version 2 of the License, or
     37  *   (at your option) any later version.
     38  *
     39  *   GeSHi is distributed in the hope that it will be useful,
     40  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     41  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     42  *   GNU General Public License for more details.
     43  *
     44  *   You should have received a copy of the GNU General Public License
     45  *   along with GeSHi; if not, write to the Free Software
     46  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     47  *
     48  ************************************************************************************/
     49 
     50 $language_data = array (
     51     'LANG_NAME' => 'Objective-C',
     52     'COMMENT_SINGLE' => array(
     53         //Compiler directives
     54         1 => '#',
     55         //Single line C-Comments
     56         2 => '//'
     57         ),
     58     'COMMENT_MULTI' => array('/*' => '*/'),
     59     'COMMENT_REGEXP' => array(
     60         //Multiline Continuation for single-line comment
     61         2 => '/\/\/(?:\\\\\\\\|\\\\\\n|.)*$/m',
     62         //Pseudo-Highlighting of the @-sign before strings
     63         3 => "/@(?=\")/"
     64         ),
     65     'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
     66     'QUOTEMARKS' => array('"', "'"),
     67     'ESCAPE_CHAR' => '\\',
     68 
     69     'KEYWORDS' => array(
     70         // Objective-C keywords
     71         1 => array(
     72             'while', 'switch', 'return', 'in', 'if', 'goto', 'foreach', 'for',
     73             'else', 'do', 'default', 'continue', 'case', '@try', '@throw',
     74             '@synthesize', '@synchronized', '@selector', '@public', '@protocol',
     75             '@protected', '@property', '@private', '@interface',
     76             '@implementation', '@finally', '@end', '@encode', '@defs', '@class',
     77             '@catch'
     78             ),
     79         // Macros and constants
     80         2 => array(
     81             'YES', 'USHRT_MAX', 'ULONG_MAX', 'UINT_MAX', 'UCHAR_MAX', 'true',
     82             'TMP_MAX', 'stdout', 'stdin', 'stderr', 'SIGTERM', 'SIGSEGV',
     83             'SIGINT', 'SIGILL', 'SIG_IGN', 'SIGFPE', 'SIG_ERR', 'SIG_DFL',
     84             'SIGABRT', 'SHRT_MIN', 'SHRT_MAX', 'SEEK_SET', 'SEEK_END',
     85             'SEEK_CUR', 'SCHAR_MIN', 'SCHAR_MAX', 'RAND_MAX', 'NULL',
     86             'NO', 'nil', 'Nil', 'L_tmpnam', 'LONG_MIN', 'LONG_MAX',
     87             'LDBL_MIN_EXP', 'LDBL_MIN', 'LDBL_MAX_EXP', 'LDBL_MAX',
     88             'LDBL_MANT_DIG', 'LDBL_EPSILON', 'LDBL_DIG', 'INT_MIN', 'INT_MAX',
     89             'HUGE_VAL', 'FOPEN_MAX', 'FLT_ROUNDS', 'FLT_RADIX', 'FLT_MIN_EXP',
     90             'FLT_MIN', 'FLT_MAX_EXP', 'FLT_MAX', 'FLT_MANT_DIG', 'FLT_EPSILON',
     91             'FLT_DIG', 'FILENAME_MAX', 'false', 'EXIT_SUCCESS', 'EXIT_FAILURE',
     92             'errno', 'ERANGE', 'EOF', 'enum', 'EDOM', 'DBL_MIN_EXP', 'DBL_MIN',
     93             'DBL_MAX_EXP', 'DBL_MAX', 'DBL_MANT_DIG', 'DBL_EPSILON', 'DBL_DIG',
     94             'CLOCKS_PER_SEC', 'CHAR_MIN', 'CHAR_MAX', 'CHAR_BIT', 'BUFSIZ',
     95             'break'
     96             ),
     97         // C standard library functions
     98         3 => array(
     99             'vsprintf', 'vprintf', 'vfprintf', 'va_start', 'va_end', 'va_arg',
    100             'ungetc', 'toupper', 'tolower', 'tmpname', 'tmpfile', 'time',
    101             'tanh', 'tan', 'system', 'strxfrm', 'strtoul', 'strtol', 'strtok',
    102             'strtod', 'strstr', 'strspn', 'strrchr', 'strpbrk', 'strncpy',
    103             'strncmp', 'strncat', 'strlen', 'strftime', 'strerror', 'strcspn',
    104             'strcpy', 'strcoll', 'strcmp', 'strchr', 'strcat', 'sscanf',
    105             'srand', 'sqrt', 'sprintf', 'snprintf', 'sizeof', 'sinh', 'sin',
    106             'setvbuf', 'setjmp', 'setbuf', 'scanf', 'rewind', 'rename',
    107             'remove', 'realloc', 'rand', 'qsort', 'puts', 'putchar', 'putc',
    108             'printf', 'pow', 'perror', 'offsetof', 'modf', 'mktime', 'memset',
    109             'memmove', 'memcpy', 'memcmp', 'memchr', 'malloc', 'longjmp',
    110             'log10', 'log', 'localtime', 'ldiv', 'ldexp', 'labs', 'isxdigit',
    111             'isupper', 'isspace', 'ispunct', 'isprint', 'islower',
    112             'isgraph', 'isdigit', 'iscntrl', 'isalpha', 'isalnum', 'gmtime',
    113             'gets', 'getenv', 'getchar', 'getc', 'fwrite', 'ftell', 'fsetpos',
    114             'fseek', 'fscanf', 'frexp', 'freopen', 'free', 'fread', 'fputs',
    115             'fputc', 'fprintf', 'fopen', 'fmod', 'floor', 'fgets', 'fgetpos',
    116             'fgetc', 'fflush', 'ferror', 'feof', 'fclose', 'fabs', 'exp',
    117             'exit', 'div', 'difftime', 'ctime', 'cosh', 'cos', 'clock',
    118             'clearerr', 'ceil', 'calloc', 'bsearch', 'atol', 'atoi', 'atof',
    119             'atexit', 'atan2', 'atan', 'assert', 'asin', 'asctime', 'acos',
    120             'abs', 'abort'
    121             ),
    122         // Data types (C, Objective-C, Cocoa)
    123         4 => array(
    124             'volatile', 'void', 'va_list', 'unsigned', 'union', 'typedef', 'tm',
    125             'time_t', 'struct', 'string', 'static', 'size_t',
    126             'signed', 'signal', 'short', 'SEL', 'register', 'raise',
    127             'ptrdiff_t', 'NSZone', 'NSRect', 'NSRange', 'NSPoint', 'long',
    128             'ldiv_t', 'jmp_buf', 'int', 'IMP', 'id', 'fpos_t', 'float', 'FILE',
    129             'extern', 'double', 'div_t', 'const', 'clock_t', 'Class', 'char',
    130             'BOOL', 'auto'
    131             ),
    132         // Foundation classes
    133         5 => array(
    134             'NSXMLParser', 'NSXMLNode', 'NSXMLElement', 'NSXMLDTDNode',
    135             'NSXMLDTD', 'NSXMLDocument', 'NSWhoseSpecifier',
    136             'NSValueTransformer', 'NSValue', 'NSUserDefaults', 'NSURLResponse',
    137             'NSURLRequest', 'NSURLProtocol', 'NSURLProtectionSpace',
    138             'NSURLHandle', 'NSURLDownload', 'NSURLCredentialStorage',
    139             'NSURLCredential', 'NSURLConnection', 'NSURLCache',
    140             'NSURLAuthenticationChallenge', 'NSURL', 'NSUniqueIDSpecifier',
    141             'NSUndoManager', 'NSUnarchiver', 'NSTimeZone', 'NSTimer',
    142             'NSThread', 'NSTask', 'NSString', 'NSStream', 'NSSpellServer',
    143             'NSSpecifierTest', 'NSSortDescriptor', 'NSSocketPortNameServer',
    144             'NSSocketPort', 'NSSetCommand', 'NSSet', 'NSSerializer',
    145             'NSScriptWhoseTest', 'NSScriptSuiteRegistry',
    146             'NSScriptObjectSpecifier', 'NSScriptExecutionContext',
    147             'NSScriptCommandDescription', 'NSScriptCommand',
    148             'NSScriptCoercionHandler', 'NSScriptClassDescription', 'NSScanner',
    149             'NSRunLoop', 'NSRelativeSpecifier', 'NSRecursiveLock',
    150             'NSRangeSpecifier', 'NSRandomSpecifier', 'NSQuitCommand', 'NSProxy',
    151             'NSProtocolChecker', 'NSPropertySpecifier',
    152             'NSPropertyListSerialization', 'NSProcessInfo', 'NSPredicate',
    153             'NSPositionalSpecifier', 'NSPortNameServer', 'NSPortMessage',
    154             'NSPortCoder', 'NSPort', 'NSPointerFunctions', 'NSPointerArray',
    155             'NSPipe', 'NSOutputStream', 'NSOperationQueue', 'NSOperation',
    156             'NSObject', 'NSNumberFormatter', 'NSNumber', 'NSNull',
    157             'NSNotificationQueue', 'NSNotificationCenter', 'NSNotification',
    158             'NSNetServiceBrowser', 'NSNetService', 'NSNameSpecifier',
    159             'NSMutableURLRequest', 'NSMutableString', 'NSMutableSet',
    160             'NSMutableIndexSet', 'NSMutableDictionary', 'NSMutableData',
    161             'NSMutableCharacterSet', 'NSMutableAttributedString',
    162             'NSMutableArray', 'NSMoveCommand', 'NSMiddleSpecifier',
    163             'NSMethodSignature', 'NSMetadataQueryResultGroup',
    164             'NSMetadataQueryAttributeValueTuple', 'NSMetadataQuery',
    165             'NSMetadataItem', 'NSMessagePortNameServer', 'NSMessagePort',
    166             'NSMapTable', 'NSMachPort', 'NSMachBootstrapServer',
    167             'NSLogicalTest', 'NSLock', 'NSLocale', 'NSKeyedUnarchiver',
    168             'NSKeyedArchiver', 'NSInvocationOperation', 'NSInvocation',
    169             'NSInputStream', 'NSIndexSpecifier', 'NSIndexSet', 'NSIndexPath',
    170             'NSHTTPURLResponse', 'NSHTTPCookieStorage', 'NSHTTPCookie',
    171             'NSHost', 'NSHashTable', 'NSGetCommand', 'NSGarbageCollector',
    172             'NSFormatter', 'NSFileManager', 'NSFileHandle', 'NSExpression',
    173             'NSExistsCommand', 'NSException', 'NSError', 'NSEnumerator',
    174             'NSDistributedNotificationCenter', 'NSDistributedLock',
    175             'NSDistantObjectRequest', 'NSDistantObject',
    176             'NSDirectoryEnumerator', 'NSDictionary', 'NSDeserializer',
    177             'NSDeleteCommand', 'NSDecimalNumberHandler', 'NSDecimalNumber',
    178             'NSDateFormatter', 'NSDateComponents', 'NSDate', 'NSData',
    179             'NSCreateCommand', 'NSCountedSet', 'NSCountCommand', 'NSConnection',
    180             'NSConditionLock', 'NSCondition', 'NSCompoundPredicate',
    181             'NSComparisonPredicate', 'NSCoder', 'NSCloseCommand',
    182             'NSCloneCommand', 'NSClassDescription', 'NSCharacterSet',
    183             'NSCalendarDate', 'NSCalendar', 'NSCachedURLResponse', 'NSBundle',
    184             'NSAutoreleasePool', 'NSAttributedString', 'NSAssertionHandler',
    185             'NSArray', 'NSArchiver', 'NSAppleScript', 'NSAppleEventManager',
    186             'NSAppleEventDescriptor', 'NSAffineTransform'
    187             ),
    188         // Foundation protocols
    189         6 => array(
    190             'NSURLProtocolClient', 'NSURLHandleClient', 'NSURLClient',
    191             'NSURLAuthenticationChallengeSender', 'NSScriptObjectSpecifiers',
    192             'NSScriptKeyValueCoding', 'NSScriptingComparisonMethods',
    193             'NSObjCTypeSerializationCallBack', 'NSMutableCopying',
    194             'NSLocking', 'NSKeyValueObserving', 'NSKeyValueCoding',
    195             'NSFastEnumeration', 'NSErrorRecoveryAttempting',
    196             'NSDecimalNumberBehaviors', 'NSCopying', 'NSComparisonMethods',
    197             'NSCoding'
    198             ),
    199         // AppKit classes
    200         7 => array(
    201             'NSWorkspace', 'NSWindowController', 'NSWindow', 'NSViewController',
    202             'NSViewAnimation', 'NSView', 'NSUserDefaultsController',
    203             'NSTypesetter', 'NSTreeNode', 'NSTreeController', 'NSTrackingArea',
    204             'NSToolbarItemGroup', 'NSToolbarItem', 'NSToolbar',
    205             'NSTokenFieldCell', 'NSTokenField', 'NSTextView',
    206             'NSTextTableBlock', 'NSTextTable', 'NSTextTab', 'NSTextStorage',
    207             'NSTextList', 'NSTextFieldCell', 'NSTextField', 'NSTextContainer',
    208             'NSTextBlock', 'NSTextAttachmentCell', 'NSTextAttachment', 'NSText',
    209             'NSTabViewItem', 'NSTabView', 'NSTableView', 'NSTableHeaderView',
    210             'NSTableHeaderCell', 'NSTableColumn', 'NSStepperCell', 'NSStepper',
    211             'NSStatusItem', 'NSStatusBar', 'NSSplitView', 'NSSpellChecker',
    212             'NSSpeechSynthesizer', 'NSSpeechRecognizer', 'NSSound',
    213             'NSSliderCell', 'NSSlider', 'NSSimpleHorizontalTypesetter',
    214             'NSShadow', 'NSSegmentedControl', 'NSSegmentedCell',
    215             'NSSecureTextFieldCell', 'NSSecureTextField', 'NSSearchFieldCell',
    216             'NSSearchField', 'NSScrollView', 'NSScroller', 'NSScreen',
    217             'NSSavePanel', 'NSRulerView', 'NSRulerMarker', 'NSRuleEditor',
    218             'NSResponder', 'NSQuickDrawView', 'NSProgressIndicator',
    219             'NSPrintPanel', 'NSPrintOperation', 'NSPrintInfo', 'NSPrinter',
    220             'NSPredicateEditorRowTemplate', 'NSPredicateEditor',
    221             'NSPopUpButtonCell', 'NSPopUpButton', 'NSPICTImageRep',
    222             'NSPersistentDocument', 'NSPDFImageRep', 'NSPathControl',
    223             'NSPathComponentCell', 'NSPathCell', 'NSPasteboard',
    224             'NSParagraphStyle', 'NSPanel', 'NSPageLayout', 'NSOutlineView',
    225             'NSOpenPanel', 'NSOpenGLView', 'NSOpenGLPixelFormat',
    226             'NSOpenGLPixelBuffer', 'NSOpenGLContext', 'NSObjectController',
    227             'NSNibOutletConnector', 'NSNibControlConnector', 'NSNibConnector',
    228             'NSNib', 'NSMutableParagraphStyle', 'NSMovieView', 'NSMovie',
    229             'NSMenuView', 'NSMenuItemCell', 'NSMenuItem', 'NSMenu', 'NSMatrix',
    230             'NSLevelIndicatorCell', 'NSLevelIndicator', 'NSLayoutManager',
    231             'NSInputServer', 'NSInputManager', 'NSImageView', 'NSImageRep',
    232             'NSImageCell', 'NSImage', 'NSHelpManager', 'NSGraphicsContext',
    233             'NSGradient', 'NSGlyphInfo', 'NSGlyphGenerator', 'NSFormCell',
    234             'NSForm', 'NSFontPanel', 'NSFontManager', 'NSFontDescriptor',
    235             'NSFont', 'NSFileWrapper', 'NSEvent', 'NSEPSImageRep', 'NSDrawer',
    236             'NSDocumentController', 'NSDocument', 'NSDockTile',
    237             'NSDictionaryController', 'NSDatePickerCell', 'NSDatePicker',
    238             'NSCustomImageRep', 'NSCursor', 'NSController', 'NSControl',
    239             'NSComboBoxCell', 'NSComboBox', 'NSColorWell', 'NSColorSpace',
    240             'NSColorPicker', 'NSColorPanel', 'NSColorList', 'NSColor',
    241             'NSCollectionViewItem', 'NSCollectionView', 'NSClipView',
    242             'NSCIImageRep', 'NSCell', 'NSCachedImageRep', 'NSButtonCell',
    243             'NSButton', 'NSBrowserCell', 'NSBrowser', 'NSBox',
    244             'NSBitmapImageRep', 'NSBezierPath', 'NSATSTypesetter',
    245             'NSArrayController', 'NSApplication', 'NSAnimationContext',
    246             'NSAnimation', 'NSAlert', 'NSActionCell'
    247             ),
    248         // AppKit protocols
    249         8 => array(
    250             'NSWindowScripting', 'NSValidatedUserInterfaceItem',
    251             'NSUserInterfaceValidations', 'NSToolTipOwner',
    252             'NSToolbarItemValidation', 'NSTextInput',
    253             'NSTableDataSource', 'NSServicesRequests',
    254             'NSPrintPanelAccessorizing', 'NSPlaceholders',
    255             'NSPathControlDelegate', 'NSPathCellDelegate',
    256             'NSOutlineViewDataSource', 'NSNibAwaking', 'NSMenuValidation',
    257             'NSKeyValueBindingCreation', 'NSInputServiceProvider',
    258             'NSInputServerMouseTracker', 'NSIgnoreMisspelledWords',
    259             'NSGlyphStorage', 'NSFontPanelValidation', 'NSEditorRegistration',
    260             'NSEditor', 'NSDraggingSource', 'NSDraggingInfo',
    261             'NSDraggingDestination', 'NSDictionaryControllerKeyValuePair',
    262             'NSComboBoxDataSource', 'NSComboBoxCellDataSource',
    263             'NSColorPickingDefault', 'NSColorPickingCustom', 'NSChangeSpelling',
    264             'NSAnimatablePropertyContainer', 'NSAccessibility'
    265             ),
    266         // CoreData classes
    267         9 => array(
    268             'NSRelationshipDescription', 'NSPropertyMapping',
    269             'NSPropertyDescription', 'NSPersistentStoreCoordinator',
    270             'NSPersistentStore', 'NSMigrationManager', 'NSMappingModel',
    271             'NSManagedObjectModel', 'NSManagedObjectID',
    272             'NSManagedObjectContext', 'NSManagedObject',
    273             'NSFetchRequestExpression', 'NSFetchRequest',
    274             'NSFetchedPropertyDescription', 'NSEntityMigrationPolicy',
    275             'NSEntityMapping', 'NSEntityDescription', 'NSAttributeDescription',
    276             'NSAtomicStoreCacheNode', 'NSAtomicStore'
    277             )
    278         ),
    279     'SYMBOLS' => array(
    280         '(', ')', '{', '}', '[', ']', '=', '+', '-', '*', '/', '!', '%', '^', '&', ':'
    281         ),
    282     'CASE_SENSITIVE' => array(
    283         GESHI_COMMENTS => true,
    284         1 => true,
    285         2 => true,
    286         3 => true,
    287         4 => true,
    288         5 => true,
    289         6 => true,
    290         7 => true,
    291         8 => true,
    292         9 => true
    293         ),
    294     // Define the colors for the groups listed above
    295     'STYLES' => array(
    296         'KEYWORDS' => array(
    297             1 => 'color: #a61390;', // Objective-C keywords
    298             2 => 'color: #a61390;', // Macros and constants
    299             3 => 'color: #a61390;', // C standard library functions
    300             4 => 'color: #a61390;', // data types
    301             5 => 'color: #400080;', // Foundation classes
    302             6 => 'color: #2a6f76;', // Foundation protocols
    303             7 => 'color: #400080;', // AppKit classes
    304             8 => 'color: #2a6f76;', // AppKit protocols
    305             9 => 'color: #400080;' // CoreData classes
    306             ),
    307         'COMMENTS' => array(
    308             1 => 'color: #6e371a;', // Preprocessor directives
    309             2 => 'color: #11740a; font-style: italic;', // Normal C single-line comments
    310             3 => 'color: #bf1d1a;', // Q-sign in front of Strings
    311             'MULTI' => 'color: #11740a; font-style: italic;'
    312             ),
    313         'ESCAPE_CHAR' => array(
    314             0 => 'color: #2400d9;'
    315             ),
    316         'BRACKETS' => array(
    317             0 => 'color: #002200;'
    318             ),
    319         'STRINGS' => array(
    320             0 => 'color: #bf1d1a;'
    321             ),
    322         'NUMBERS' => array(
    323             0 => 'color: #2400d9;'
    324             ),
    325         'METHODS' => array(
    326             ),
    327         'SYMBOLS' => array(
    328             0 => 'color: #002200;'
    329             ),
    330         'REGEXPS' => array(
    331             ),
    332         'SCRIPT' => array(
    333             )
    334         ),
    335     'URLS' => array(
    336         1 => '',
    337         2 => '',
    338         3 => 'http://www.opengroup.org/onlinepubs/009695399/functions/{FNAME}.html',
    339         4 => '',
    340         5 => 'http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/{FNAME}_Class/',
    341         6 => 'http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Protocols/{FNAME}_Protocol/',
    342         7 => 'http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/{FNAME}_Class/',
    343         8 => 'http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Protocols/{FNAME}_Protocol/',
    344         9 => 'http://developer.apple.com/documentation/Cocoa/Reference/CoreDataFramework/Classes/{FNAME}_Class/'
    345         ),
    346     'OOLANG' => false,
    347     'OBJECT_SPLITTERS' => array(
    348         ),
    349     'REGEXPS' => array(
    350         ),
    351     'STRICT_MODE_APPLIES' => GESHI_NEVER,
    352     'SCRIPT_DELIMITERS' => array(
    353         ),
    354     'HIGHLIGHT_STRICT_BLOCK' => array(
    355         )
    356 );
    357 
    358 ?>
    359