KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

359 lines
18KB

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