dart.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. "use strict";
  2. /*!-----------------------------------------------------------------------------
  3. * Copyright (c) Microsoft Corporation. All rights reserved.
  4. * Version: 0.38.0(0e330ae453813de4e6cf272460fb79c7117073d0)
  5. * Released under the MIT license
  6. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  7. *-----------------------------------------------------------------------------*/
  8. define("vs/basic-languages/dart/dart", ["require"],(require)=>{
  9. var moduleExports = (() => {
  10. var __defProp = Object.defineProperty;
  11. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  12. var __getOwnPropNames = Object.getOwnPropertyNames;
  13. var __hasOwnProp = Object.prototype.hasOwnProperty;
  14. var __export = (target, all) => {
  15. for (var name in all)
  16. __defProp(target, name, { get: all[name], enumerable: true });
  17. };
  18. var __copyProps = (to, from, except, desc) => {
  19. if (from && typeof from === "object" || typeof from === "function") {
  20. for (let key of __getOwnPropNames(from))
  21. if (!__hasOwnProp.call(to, key) && key !== except)
  22. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  23. }
  24. return to;
  25. };
  26. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  27. // src/basic-languages/dart/dart.ts
  28. var dart_exports = {};
  29. __export(dart_exports, {
  30. conf: () => conf,
  31. language: () => language
  32. });
  33. var conf = {
  34. comments: {
  35. lineComment: "//",
  36. blockComment: ["/*", "*/"]
  37. },
  38. brackets: [
  39. ["{", "}"],
  40. ["[", "]"],
  41. ["(", ")"]
  42. ],
  43. autoClosingPairs: [
  44. { open: "{", close: "}" },
  45. { open: "[", close: "]" },
  46. { open: "(", close: ")" },
  47. { open: "'", close: "'", notIn: ["string", "comment"] },
  48. { open: '"', close: '"', notIn: ["string"] },
  49. { open: "`", close: "`", notIn: ["string", "comment"] },
  50. { open: "/**", close: " */", notIn: ["string"] }
  51. ],
  52. surroundingPairs: [
  53. { open: "{", close: "}" },
  54. { open: "[", close: "]" },
  55. { open: "(", close: ")" },
  56. { open: "<", close: ">" },
  57. { open: "'", close: "'" },
  58. { open: "(", close: ")" },
  59. { open: '"', close: '"' },
  60. { open: "`", close: "`" }
  61. ],
  62. folding: {
  63. markers: {
  64. start: /^\s*\s*#?region\b/,
  65. end: /^\s*\s*#?endregion\b/
  66. }
  67. }
  68. };
  69. var language = {
  70. defaultToken: "invalid",
  71. tokenPostfix: ".dart",
  72. keywords: [
  73. "abstract",
  74. "dynamic",
  75. "implements",
  76. "show",
  77. "as",
  78. "else",
  79. "import",
  80. "static",
  81. "assert",
  82. "enum",
  83. "in",
  84. "super",
  85. "async",
  86. "export",
  87. "interface",
  88. "switch",
  89. "await",
  90. "extends",
  91. "is",
  92. "sync",
  93. "break",
  94. "external",
  95. "library",
  96. "this",
  97. "case",
  98. "factory",
  99. "mixin",
  100. "throw",
  101. "catch",
  102. "false",
  103. "new",
  104. "true",
  105. "class",
  106. "final",
  107. "null",
  108. "try",
  109. "const",
  110. "finally",
  111. "on",
  112. "typedef",
  113. "continue",
  114. "for",
  115. "operator",
  116. "var",
  117. "covariant",
  118. "Function",
  119. "part",
  120. "void",
  121. "default",
  122. "get",
  123. "rethrow",
  124. "while",
  125. "deferred",
  126. "hide",
  127. "return",
  128. "with",
  129. "do",
  130. "if",
  131. "set",
  132. "yield"
  133. ],
  134. typeKeywords: ["int", "double", "String", "bool"],
  135. operators: [
  136. "+",
  137. "-",
  138. "*",
  139. "/",
  140. "~/",
  141. "%",
  142. "++",
  143. "--",
  144. "==",
  145. "!=",
  146. ">",
  147. "<",
  148. ">=",
  149. "<=",
  150. "=",
  151. "-=",
  152. "/=",
  153. "%=",
  154. ">>=",
  155. "^=",
  156. "+=",
  157. "*=",
  158. "~/=",
  159. "<<=",
  160. "&=",
  161. "!=",
  162. "||",
  163. "&&",
  164. "&",
  165. "|",
  166. "^",
  167. "~",
  168. "<<",
  169. ">>",
  170. "!",
  171. ">>>",
  172. "??",
  173. "?",
  174. ":",
  175. "|="
  176. ],
  177. symbols: /[=><!~?:&|+\-*\/\^%]+/,
  178. escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
  179. digits: /\d+(_+\d+)*/,
  180. octaldigits: /[0-7]+(_+[0-7]+)*/,
  181. binarydigits: /[0-1]+(_+[0-1]+)*/,
  182. hexdigits: /[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,
  183. regexpctl: /[(){}\[\]\$\^|\-*+?\.]/,
  184. regexpesc: /\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,
  185. tokenizer: {
  186. root: [[/[{}]/, "delimiter.bracket"], { include: "common" }],
  187. common: [
  188. [
  189. /[a-z_$][\w$]*/,
  190. {
  191. cases: {
  192. "@typeKeywords": "type.identifier",
  193. "@keywords": "keyword",
  194. "@default": "identifier"
  195. }
  196. }
  197. ],
  198. [/[A-Z_$][\w\$]*/, "type.identifier"],
  199. { include: "@whitespace" },
  200. [
  201. /\/(?=([^\\\/]|\\.)+\/([gimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/,
  202. { token: "regexp", bracket: "@open", next: "@regexp" }
  203. ],
  204. [/@[a-zA-Z]+/, "annotation"],
  205. [/[()\[\]]/, "@brackets"],
  206. [/[<>](?!@symbols)/, "@brackets"],
  207. [/!(?=([^=]|$))/, "delimiter"],
  208. [
  209. /@symbols/,
  210. {
  211. cases: {
  212. "@operators": "delimiter",
  213. "@default": ""
  214. }
  215. }
  216. ],
  217. [/(@digits)[eE]([\-+]?(@digits))?/, "number.float"],
  218. [/(@digits)\.(@digits)([eE][\-+]?(@digits))?/, "number.float"],
  219. [/0[xX](@hexdigits)n?/, "number.hex"],
  220. [/0[oO]?(@octaldigits)n?/, "number.octal"],
  221. [/0[bB](@binarydigits)n?/, "number.binary"],
  222. [/(@digits)n?/, "number"],
  223. [/[;,.]/, "delimiter"],
  224. [/"([^"\\]|\\.)*$/, "string.invalid"],
  225. [/'([^'\\]|\\.)*$/, "string.invalid"],
  226. [/"/, "string", "@string_double"],
  227. [/'/, "string", "@string_single"]
  228. ],
  229. whitespace: [
  230. [/[ \t\r\n]+/, ""],
  231. [/\/\*\*(?!\/)/, "comment.doc", "@jsdoc"],
  232. [/\/\*/, "comment", "@comment"],
  233. [/\/\/\/.*$/, "comment.doc"],
  234. [/\/\/.*$/, "comment"]
  235. ],
  236. comment: [
  237. [/[^\/*]+/, "comment"],
  238. [/\*\//, "comment", "@pop"],
  239. [/[\/*]/, "comment"]
  240. ],
  241. jsdoc: [
  242. [/[^\/*]+/, "comment.doc"],
  243. [/\*\//, "comment.doc", "@pop"],
  244. [/[\/*]/, "comment.doc"]
  245. ],
  246. regexp: [
  247. [
  248. /(\{)(\d+(?:,\d*)?)(\})/,
  249. ["regexp.escape.control", "regexp.escape.control", "regexp.escape.control"]
  250. ],
  251. [
  252. /(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,
  253. ["regexp.escape.control", { token: "regexp.escape.control", next: "@regexrange" }]
  254. ],
  255. [/(\()(\?:|\?=|\?!)/, ["regexp.escape.control", "regexp.escape.control"]],
  256. [/[()]/, "regexp.escape.control"],
  257. [/@regexpctl/, "regexp.escape.control"],
  258. [/[^\\\/]/, "regexp"],
  259. [/@regexpesc/, "regexp.escape"],
  260. [/\\\./, "regexp.invalid"],
  261. [/(\/)([gimsuy]*)/, [{ token: "regexp", bracket: "@close", next: "@pop" }, "keyword.other"]]
  262. ],
  263. regexrange: [
  264. [/-/, "regexp.escape.control"],
  265. [/\^/, "regexp.invalid"],
  266. [/@regexpesc/, "regexp.escape"],
  267. [/[^\]]/, "regexp"],
  268. [
  269. /\]/,
  270. {
  271. token: "regexp.escape.control",
  272. next: "@pop",
  273. bracket: "@close"
  274. }
  275. ]
  276. ],
  277. string_double: [
  278. [/[^\\"\$]+/, "string"],
  279. [/[^\\"]+/, "string"],
  280. [/@escapes/, "string.escape"],
  281. [/\\./, "string.escape.invalid"],
  282. [/"/, "string", "@pop"],
  283. [/\$\w+/, "identifier"]
  284. ],
  285. string_single: [
  286. [/[^\\'\$]+/, "string"],
  287. [/@escapes/, "string.escape"],
  288. [/\\./, "string.escape.invalid"],
  289. [/'/, "string", "@pop"],
  290. [/\$\w+/, "identifier"]
  291. ]
  292. }
  293. };
  294. return __toCommonJS(dart_exports);
  295. })();
  296. return moduleExports;
  297. });