objective-c.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /*---------------------------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Licensed under the MIT License. See License.txt in the project root for license information.
  4. *--------------------------------------------------------------------------------------------*/
  5. define('vs/basic-languages/objective-c/objective-c',["require", "exports"], function (require, exports) {
  6. "use strict";
  7. Object.defineProperty(exports, "__esModule", { value: true });
  8. exports.language = exports.conf = void 0;
  9. exports.conf = {
  10. comments: {
  11. lineComment: '//',
  12. blockComment: ['/*', '*/']
  13. },
  14. brackets: [
  15. ['{', '}'],
  16. ['[', ']'],
  17. ['(', ')']
  18. ],
  19. autoClosingPairs: [
  20. { open: '{', close: '}' },
  21. { open: '[', close: ']' },
  22. { open: '(', close: ')' },
  23. { open: '"', close: '"' },
  24. { open: "'", close: "'" }
  25. ],
  26. surroundingPairs: [
  27. { open: '{', close: '}' },
  28. { open: '[', close: ']' },
  29. { open: '(', close: ')' },
  30. { open: '"', close: '"' },
  31. { open: "'", close: "'" }
  32. ]
  33. };
  34. exports.language = {
  35. defaultToken: '',
  36. tokenPostfix: '.objective-c',
  37. keywords: [
  38. '#import',
  39. '#include',
  40. '#define',
  41. '#else',
  42. '#endif',
  43. '#if',
  44. '#ifdef',
  45. '#ifndef',
  46. '#ident',
  47. '#undef',
  48. '@class',
  49. '@defs',
  50. '@dynamic',
  51. '@encode',
  52. '@end',
  53. '@implementation',
  54. '@interface',
  55. '@package',
  56. '@private',
  57. '@protected',
  58. '@property',
  59. '@protocol',
  60. '@public',
  61. '@selector',
  62. '@synthesize',
  63. '__declspec',
  64. 'assign',
  65. 'auto',
  66. 'BOOL',
  67. 'break',
  68. 'bycopy',
  69. 'byref',
  70. 'case',
  71. 'char',
  72. 'Class',
  73. 'const',
  74. 'copy',
  75. 'continue',
  76. 'default',
  77. 'do',
  78. 'double',
  79. 'else',
  80. 'enum',
  81. 'extern',
  82. 'FALSE',
  83. 'false',
  84. 'float',
  85. 'for',
  86. 'goto',
  87. 'if',
  88. 'in',
  89. 'int',
  90. 'id',
  91. 'inout',
  92. 'IMP',
  93. 'long',
  94. 'nil',
  95. 'nonatomic',
  96. 'NULL',
  97. 'oneway',
  98. 'out',
  99. 'private',
  100. 'public',
  101. 'protected',
  102. 'readwrite',
  103. 'readonly',
  104. 'register',
  105. 'return',
  106. 'SEL',
  107. 'self',
  108. 'short',
  109. 'signed',
  110. 'sizeof',
  111. 'static',
  112. 'struct',
  113. 'super',
  114. 'switch',
  115. 'typedef',
  116. 'TRUE',
  117. 'true',
  118. 'union',
  119. 'unsigned',
  120. 'volatile',
  121. 'void',
  122. 'while'
  123. ],
  124. decpart: /\d(_?\d)*/,
  125. decimal: /0|@decpart/,
  126. tokenizer: {
  127. root: [
  128. { include: '@comments' },
  129. { include: '@whitespace' },
  130. { include: '@numbers' },
  131. { include: '@strings' },
  132. [/[,:;]/, 'delimiter'],
  133. [/[{}\[\]()<>]/, '@brackets'],
  134. [
  135. /[a-zA-Z@#]\w*/,
  136. {
  137. cases: {
  138. '@keywords': 'keyword',
  139. '@default': 'identifier'
  140. }
  141. }
  142. ],
  143. [/[<>=\\+\\-\\*\\/\\^\\|\\~,]|and\\b|or\\b|not\\b]/, 'operator']
  144. ],
  145. whitespace: [[/\s+/, 'white']],
  146. comments: [
  147. ['\\/\\*', 'comment', '@comment'],
  148. ['\\/\\/+.*', 'comment']
  149. ],
  150. comment: [
  151. ['\\*\\/', 'comment', '@pop'],
  152. ['.', 'comment']
  153. ],
  154. numbers: [
  155. [/0[xX][0-9a-fA-F]*(_?[0-9a-fA-F])*/, 'number.hex'],
  156. [
  157. /@decimal((\.@decpart)?([eE][\-+]?@decpart)?)[fF]*/,
  158. {
  159. cases: {
  160. '(\\d)*': 'number',
  161. $0: 'number.float'
  162. }
  163. }
  164. ]
  165. ],
  166. // Recognize strings, including those broken across lines with \ (but not without)
  167. strings: [
  168. [/'$/, 'string.escape', '@popall'],
  169. [/'/, 'string.escape', '@stringBody'],
  170. [/"$/, 'string.escape', '@popall'],
  171. [/"/, 'string.escape', '@dblStringBody']
  172. ],
  173. stringBody: [
  174. [/[^\\']+$/, 'string', '@popall'],
  175. [/[^\\']+/, 'string'],
  176. [/\\./, 'string'],
  177. [/'/, 'string.escape', '@popall'],
  178. [/\\$/, 'string']
  179. ],
  180. dblStringBody: [
  181. [/[^\\"]+$/, 'string', '@popall'],
  182. [/[^\\"]+/, 'string'],
  183. [/\\./, 'string'],
  184. [/"/, 'string.escape', '@popall'],
  185. [/\\$/, 'string']
  186. ]
  187. }
  188. };
  189. });