objective-c.js 3.7 KB

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