scss.js 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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/scss/scss", ["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/scss/scss.ts
  28. var scss_exports = {};
  29. __export(scss_exports, {
  30. conf: () => conf,
  31. language: () => language
  32. });
  33. var conf = {
  34. wordPattern: /(#?-?\d*\.\d\w*%?)|([@$#!.:]?[\w-?]+%?)|[@#!.]/g,
  35. comments: {
  36. blockComment: ["/*", "*/"],
  37. lineComment: "//"
  38. },
  39. brackets: [
  40. ["{", "}"],
  41. ["[", "]"],
  42. ["(", ")"]
  43. ],
  44. autoClosingPairs: [
  45. { open: "{", close: "}", notIn: ["string", "comment"] },
  46. { open: "[", close: "]", notIn: ["string", "comment"] },
  47. { open: "(", close: ")", notIn: ["string", "comment"] },
  48. { open: '"', close: '"', notIn: ["string", "comment"] },
  49. { open: "'", close: "'", notIn: ["string", "comment"] }
  50. ],
  51. surroundingPairs: [
  52. { open: "{", close: "}" },
  53. { open: "[", close: "]" },
  54. { open: "(", close: ")" },
  55. { open: '"', close: '"' },
  56. { open: "'", close: "'" }
  57. ],
  58. folding: {
  59. markers: {
  60. start: new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"),
  61. end: new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/")
  62. }
  63. }
  64. };
  65. var language = {
  66. defaultToken: "",
  67. tokenPostfix: ".scss",
  68. ws: "[ \n\r\f]*",
  69. identifier: "-?-?([a-zA-Z]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))([\\w\\-]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))*",
  70. brackets: [
  71. { open: "{", close: "}", token: "delimiter.curly" },
  72. { open: "[", close: "]", token: "delimiter.bracket" },
  73. { open: "(", close: ")", token: "delimiter.parenthesis" },
  74. { open: "<", close: ">", token: "delimiter.angle" }
  75. ],
  76. tokenizer: {
  77. root: [{ include: "@selector" }],
  78. selector: [
  79. { include: "@comments" },
  80. { include: "@import" },
  81. { include: "@variabledeclaration" },
  82. { include: "@warndebug" },
  83. ["[@](include)", { token: "keyword", next: "@includedeclaration" }],
  84. [
  85. "[@](keyframes|-webkit-keyframes|-moz-keyframes|-o-keyframes)",
  86. { token: "keyword", next: "@keyframedeclaration" }
  87. ],
  88. ["[@](page|content|font-face|-moz-document)", { token: "keyword" }],
  89. ["[@](charset|namespace)", { token: "keyword", next: "@declarationbody" }],
  90. ["[@](function)", { token: "keyword", next: "@functiondeclaration" }],
  91. ["[@](mixin)", { token: "keyword", next: "@mixindeclaration" }],
  92. ["url(\\-prefix)?\\(", { token: "meta", next: "@urldeclaration" }],
  93. { include: "@controlstatement" },
  94. { include: "@selectorname" },
  95. ["[&\\*]", "tag"],
  96. ["[>\\+,]", "delimiter"],
  97. ["\\[", { token: "delimiter.bracket", next: "@selectorattribute" }],
  98. ["{", { token: "delimiter.curly", next: "@selectorbody" }]
  99. ],
  100. selectorbody: [
  101. ["[*_]?@identifier@ws:(?=(\\s|\\d|[^{;}]*[;}]))", "attribute.name", "@rulevalue"],
  102. { include: "@selector" },
  103. ["[@](extend)", { token: "keyword", next: "@extendbody" }],
  104. ["[@](return)", { token: "keyword", next: "@declarationbody" }],
  105. ["}", { token: "delimiter.curly", next: "@pop" }]
  106. ],
  107. selectorname: [
  108. ["#{", { token: "meta", next: "@variableinterpolation" }],
  109. ["(\\.|#(?=[^{])|%|(@identifier)|:)+", "tag"]
  110. ],
  111. selectorattribute: [{ include: "@term" }, ["]", { token: "delimiter.bracket", next: "@pop" }]],
  112. term: [
  113. { include: "@comments" },
  114. ["url(\\-prefix)?\\(", { token: "meta", next: "@urldeclaration" }],
  115. { include: "@functioninvocation" },
  116. { include: "@numbers" },
  117. { include: "@strings" },
  118. { include: "@variablereference" },
  119. ["(and\\b|or\\b|not\\b)", "operator"],
  120. { include: "@name" },
  121. ["([<>=\\+\\-\\*\\/\\^\\|\\~,])", "operator"],
  122. [",", "delimiter"],
  123. ["!default", "literal"],
  124. ["\\(", { token: "delimiter.parenthesis", next: "@parenthizedterm" }]
  125. ],
  126. rulevalue: [
  127. { include: "@term" },
  128. ["!important", "literal"],
  129. [";", "delimiter", "@pop"],
  130. ["{", { token: "delimiter.curly", switchTo: "@nestedproperty" }],
  131. ["(?=})", { token: "", next: "@pop" }]
  132. ],
  133. nestedproperty: [
  134. ["[*_]?@identifier@ws:", "attribute.name", "@rulevalue"],
  135. { include: "@comments" },
  136. ["}", { token: "delimiter.curly", next: "@pop" }]
  137. ],
  138. warndebug: [["[@](warn|debug)", { token: "keyword", next: "@declarationbody" }]],
  139. import: [["[@](import)", { token: "keyword", next: "@declarationbody" }]],
  140. variabledeclaration: [
  141. ["\\$@identifier@ws:", "variable.decl", "@declarationbody"]
  142. ],
  143. urldeclaration: [
  144. { include: "@strings" },
  145. ["[^)\r\n]+", "string"],
  146. ["\\)", { token: "meta", next: "@pop" }]
  147. ],
  148. parenthizedterm: [
  149. { include: "@term" },
  150. ["\\)", { token: "delimiter.parenthesis", next: "@pop" }]
  151. ],
  152. declarationbody: [
  153. { include: "@term" },
  154. [";", "delimiter", "@pop"],
  155. ["(?=})", { token: "", next: "@pop" }]
  156. ],
  157. extendbody: [
  158. { include: "@selectorname" },
  159. ["!optional", "literal"],
  160. [";", "delimiter", "@pop"],
  161. ["(?=})", { token: "", next: "@pop" }]
  162. ],
  163. variablereference: [
  164. ["\\$@identifier", "variable.ref"],
  165. ["\\.\\.\\.", "operator"],
  166. ["#{", { token: "meta", next: "@variableinterpolation" }]
  167. ],
  168. variableinterpolation: [
  169. { include: "@variablereference" },
  170. ["}", { token: "meta", next: "@pop" }]
  171. ],
  172. comments: [
  173. ["\\/\\*", "comment", "@comment"],
  174. ["\\/\\/+.*", "comment"]
  175. ],
  176. comment: [
  177. ["\\*\\/", "comment", "@pop"],
  178. [".", "comment"]
  179. ],
  180. name: [["@identifier", "attribute.value"]],
  181. numbers: [
  182. ["(\\d*\\.)?\\d+([eE][\\-+]?\\d+)?", { token: "number", next: "@units" }],
  183. ["#[0-9a-fA-F_]+(?!\\w)", "number.hex"]
  184. ],
  185. units: [
  186. [
  187. "(em|ex|ch|rem|fr|vmin|vmax|vw|vh|vm|cm|mm|in|px|pt|pc|deg|grad|rad|turn|s|ms|Hz|kHz|%)?",
  188. "number",
  189. "@pop"
  190. ]
  191. ],
  192. functiondeclaration: [
  193. ["@identifier@ws\\(", { token: "meta", next: "@parameterdeclaration" }],
  194. ["{", { token: "delimiter.curly", switchTo: "@functionbody" }]
  195. ],
  196. mixindeclaration: [
  197. ["@identifier@ws\\(", { token: "meta", next: "@parameterdeclaration" }],
  198. ["@identifier", "meta"],
  199. ["{", { token: "delimiter.curly", switchTo: "@selectorbody" }]
  200. ],
  201. parameterdeclaration: [
  202. ["\\$@identifier@ws:", "variable.decl"],
  203. ["\\.\\.\\.", "operator"],
  204. [",", "delimiter"],
  205. { include: "@term" },
  206. ["\\)", { token: "meta", next: "@pop" }]
  207. ],
  208. includedeclaration: [
  209. { include: "@functioninvocation" },
  210. ["@identifier", "meta"],
  211. [";", "delimiter", "@pop"],
  212. ["(?=})", { token: "", next: "@pop" }],
  213. ["{", { token: "delimiter.curly", switchTo: "@selectorbody" }]
  214. ],
  215. keyframedeclaration: [
  216. ["@identifier", "meta"],
  217. ["{", { token: "delimiter.curly", switchTo: "@keyframebody" }]
  218. ],
  219. keyframebody: [
  220. { include: "@term" },
  221. ["{", { token: "delimiter.curly", next: "@selectorbody" }],
  222. ["}", { token: "delimiter.curly", next: "@pop" }]
  223. ],
  224. controlstatement: [
  225. [
  226. "[@](if|else|for|while|each|media)",
  227. { token: "keyword.flow", next: "@controlstatementdeclaration" }
  228. ]
  229. ],
  230. controlstatementdeclaration: [
  231. ["(in|from|through|if|to)\\b", { token: "keyword.flow" }],
  232. { include: "@term" },
  233. ["{", { token: "delimiter.curly", switchTo: "@selectorbody" }]
  234. ],
  235. functionbody: [
  236. ["[@](return)", { token: "keyword" }],
  237. { include: "@variabledeclaration" },
  238. { include: "@term" },
  239. { include: "@controlstatement" },
  240. [";", "delimiter"],
  241. ["}", { token: "delimiter.curly", next: "@pop" }]
  242. ],
  243. functioninvocation: [["@identifier\\(", { token: "meta", next: "@functionarguments" }]],
  244. functionarguments: [
  245. ["\\$@identifier@ws:", "attribute.name"],
  246. ["[,]", "delimiter"],
  247. { include: "@term" },
  248. ["\\)", { token: "meta", next: "@pop" }]
  249. ],
  250. strings: [
  251. ['~?"', { token: "string.delimiter", next: "@stringenddoublequote" }],
  252. ["~?'", { token: "string.delimiter", next: "@stringendquote" }]
  253. ],
  254. stringenddoublequote: [
  255. ["\\\\.", "string"],
  256. ['"', { token: "string.delimiter", next: "@pop" }],
  257. [".", "string"]
  258. ],
  259. stringendquote: [
  260. ["\\\\.", "string"],
  261. ["'", { token: "string.delimiter", next: "@pop" }],
  262. [".", "string"]
  263. ]
  264. }
  265. };
  266. return __toCommonJS(scss_exports);
  267. })();
  268. return moduleExports;
  269. });