wgsl-5RK3VJZI.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. import "./chunk-2LSFTFF7.js";
  2. // node_modules/.pnpm/monaco-editor@0.38.0/node_modules/monaco-editor/esm/vs/basic-languages/wgsl/wgsl.js
  3. var conf = {
  4. comments: {
  5. lineComment: "//",
  6. blockComment: ["/*", "*/"]
  7. },
  8. brackets: [
  9. ["{", "}"],
  10. ["[", "]"],
  11. ["(", ")"]
  12. ],
  13. autoClosingPairs: [
  14. { open: "[", close: "]" },
  15. { open: "{", close: "}" },
  16. { open: "(", close: ")" }
  17. ],
  18. surroundingPairs: [
  19. { open: "{", close: "}" },
  20. { open: "[", close: "]" },
  21. { open: "(", close: ")" }
  22. ]
  23. };
  24. function qw(str) {
  25. let result = [];
  26. const words = str.split(/\t+|\r+|\n+| +/);
  27. for (let i = 0; i < words.length; ++i) {
  28. if (words[i].length > 0) {
  29. result.push(words[i]);
  30. }
  31. }
  32. return result;
  33. }
  34. var atoms = qw("true false");
  35. var keywords = qw(`
  36. alias
  37. break
  38. case
  39. const
  40. const_assert
  41. continue
  42. continuing
  43. default
  44. diagnostic
  45. discard
  46. else
  47. enable
  48. fn
  49. for
  50. if
  51. let
  52. loop
  53. override
  54. requires
  55. return
  56. struct
  57. switch
  58. var
  59. while
  60. `);
  61. var reserved = qw(`
  62. NULL
  63. Self
  64. abstract
  65. active
  66. alignas
  67. alignof
  68. as
  69. asm
  70. asm_fragment
  71. async
  72. attribute
  73. auto
  74. await
  75. become
  76. binding_array
  77. cast
  78. catch
  79. class
  80. co_await
  81. co_return
  82. co_yield
  83. coherent
  84. column_major
  85. common
  86. compile
  87. compile_fragment
  88. concept
  89. const_cast
  90. consteval
  91. constexpr
  92. constinit
  93. crate
  94. debugger
  95. decltype
  96. delete
  97. demote
  98. demote_to_helper
  99. do
  100. dynamic_cast
  101. enum
  102. explicit
  103. export
  104. extends
  105. extern
  106. external
  107. fallthrough
  108. filter
  109. final
  110. finally
  111. friend
  112. from
  113. fxgroup
  114. get
  115. goto
  116. groupshared
  117. highp
  118. impl
  119. implements
  120. import
  121. inline
  122. instanceof
  123. interface
  124. layout
  125. lowp
  126. macro
  127. macro_rules
  128. match
  129. mediump
  130. meta
  131. mod
  132. module
  133. move
  134. mut
  135. mutable
  136. namespace
  137. new
  138. nil
  139. noexcept
  140. noinline
  141. nointerpolation
  142. noperspective
  143. null
  144. nullptr
  145. of
  146. operator
  147. package
  148. packoffset
  149. partition
  150. pass
  151. patch
  152. pixelfragment
  153. precise
  154. precision
  155. premerge
  156. priv
  157. protected
  158. pub
  159. public
  160. readonly
  161. ref
  162. regardless
  163. register
  164. reinterpret_cast
  165. require
  166. resource
  167. restrict
  168. self
  169. set
  170. shared
  171. sizeof
  172. smooth
  173. snorm
  174. static
  175. static_assert
  176. static_cast
  177. std
  178. subroutine
  179. super
  180. target
  181. template
  182. this
  183. thread_local
  184. throw
  185. trait
  186. try
  187. type
  188. typedef
  189. typeid
  190. typename
  191. typeof
  192. union
  193. unless
  194. unorm
  195. unsafe
  196. unsized
  197. use
  198. using
  199. varying
  200. virtual
  201. volatile
  202. wgsl
  203. where
  204. with
  205. writeonly
  206. yield
  207. `);
  208. var predeclared_enums = qw(`
  209. read write read_write
  210. function private workgroup uniform storage
  211. perspective linear flat
  212. center centroid sample
  213. vertex_index instance_index position front_facing frag_depth
  214. local_invocation_id local_invocation_index
  215. global_invocation_id workgroup_id num_workgroups
  216. sample_index sample_mask
  217. rgba8unorm
  218. rgba8snorm
  219. rgba8uint
  220. rgba8sint
  221. rgba16uint
  222. rgba16sint
  223. rgba16float
  224. r32uint
  225. r32sint
  226. r32float
  227. rg32uint
  228. rg32sint
  229. rg32float
  230. rgba32uint
  231. rgba32sint
  232. rgba32float
  233. bgra8unorm
  234. `);
  235. var predeclared_types = qw(`
  236. bool
  237. f16
  238. f32
  239. i32
  240. sampler sampler_comparison
  241. texture_depth_2d
  242. texture_depth_2d_array
  243. texture_depth_cube
  244. texture_depth_cube_array
  245. texture_depth_multisampled_2d
  246. texture_external
  247. texture_external
  248. u32
  249. `);
  250. var predeclared_type_generators = qw(`
  251. array
  252. atomic
  253. mat2x2
  254. mat2x3
  255. mat2x4
  256. mat3x2
  257. mat3x3
  258. mat3x4
  259. mat4x2
  260. mat4x3
  261. mat4x4
  262. ptr
  263. texture_1d
  264. texture_2d
  265. texture_2d_array
  266. texture_3d
  267. texture_cube
  268. texture_cube_array
  269. texture_multisampled_2d
  270. texture_storage_1d
  271. texture_storage_2d
  272. texture_storage_2d_array
  273. texture_storage_3d
  274. vec2
  275. vec3
  276. vec4
  277. `);
  278. var predeclared_type_aliases = qw(`
  279. vec2i vec3i vec4i
  280. vec2u vec3u vec4u
  281. vec2f vec3f vec4f
  282. vec2h vec3h vec4h
  283. mat2x2f mat2x3f mat2x4f
  284. mat3x2f mat3x3f mat3x4f
  285. mat4x2f mat4x3f mat4x4f
  286. mat2x2h mat2x3h mat2x4h
  287. mat3x2h mat3x3h mat3x4h
  288. mat4x2h mat4x3h mat4x4h
  289. `);
  290. var predeclared_intrinsics = qw(`
  291. bitcast all any select arrayLength abs acos acosh asin asinh atan atanh atan2
  292. ceil clamp cos cosh countLeadingZeros countOneBits countTrailingZeros cross
  293. degrees determinant distance dot exp exp2 extractBits faceForward firstLeadingBit
  294. firstTrailingBit floor fma fract frexp inverseBits inverseSqrt ldexp length
  295. log log2 max min mix modf normalize pow quantizeToF16 radians reflect refract
  296. reverseBits round saturate sign sin sinh smoothstep sqrt step tan tanh transpose
  297. trunc dpdx dpdxCoarse dpdxFine dpdy dpdyCoarse dpdyFine fwidth fwidthCoarse fwidthFine
  298. textureDimensions textureGather textureGatherCompare textureLoad textureNumLayers
  299. textureNumLevels textureNumSamples textureSample textureSampleBias textureSampleCompare
  300. textureSampleCompareLevel textureSampleGrad textureSampleLevel textureSampleBaseClampToEdge
  301. textureStore atomicLoad atomicStore atomicAdd atomicSub atomicMax atomicMin
  302. atomicAnd atomicOr atomicXor atomicExchange atomicCompareExchangeWeak pack4x8snorm
  303. pack4x8unorm pack2x16snorm pack2x16unorm pack2x16float unpack4x8snorm unpack4x8unorm
  304. unpack2x16snorm unpack2x16unorm unpack2x16float storageBarrier workgroupBarrier
  305. workgroupUniformLoad
  306. `);
  307. var operators = qw(`
  308. &
  309. &&
  310. ->
  311. /
  312. =
  313. ==
  314. !=
  315. >
  316. >=
  317. <
  318. <=
  319. %
  320. -
  321. --
  322. +
  323. ++
  324. |
  325. ||
  326. *
  327. <<
  328. >>
  329. +=
  330. -=
  331. *=
  332. /=
  333. %=
  334. &=
  335. |=
  336. ^=
  337. >>=
  338. <<=
  339. `);
  340. var directive_re = /enable|requires|diagnostic/;
  341. var ident_re = /[_\p{XID_Start}]\p{XID_Continue}*/u;
  342. var predefined_token = "variable.predefined";
  343. var language = {
  344. tokenPostfix: ".wgsl",
  345. defaultToken: "invalid",
  346. unicode: true,
  347. atoms,
  348. keywords,
  349. reserved,
  350. predeclared_enums,
  351. predeclared_types,
  352. predeclared_type_generators,
  353. predeclared_type_aliases,
  354. predeclared_intrinsics,
  355. operators,
  356. symbols: /[!%&*+\-\.\/:;<=>^|_~]+/,
  357. tokenizer: {
  358. root: [
  359. [directive_re, "keyword", "@directive"],
  360. [
  361. ident_re,
  362. {
  363. cases: {
  364. "@atoms": predefined_token,
  365. "@keywords": "keyword",
  366. "@reserved": "invalid",
  367. "@predeclared_enums": predefined_token,
  368. "@predeclared_types": predefined_token,
  369. "@predeclared_type_generators": predefined_token,
  370. "@predeclared_type_aliases": predefined_token,
  371. "@predeclared_intrinsics": predefined_token,
  372. "@default": "identifier"
  373. }
  374. }
  375. ],
  376. { include: "@commentOrSpace" },
  377. { include: "@numbers" },
  378. [/;:\./, "delimiter"],
  379. [/,/, "delimiter"],
  380. [/[{}()\[\]]/, "@brackets"],
  381. ["@", "annotation", "@attribute"],
  382. [
  383. /@symbols/,
  384. {
  385. cases: {
  386. "@operators": "operator",
  387. "@default": "delimiter"
  388. }
  389. }
  390. ],
  391. [/./, "invalid"]
  392. ],
  393. commentOrSpace: [
  394. [/\s+/, "white"],
  395. [/\/\*/, "comment", "@blockComment"],
  396. [/\/\/.*$/, "comment"]
  397. ],
  398. blockComment: [
  399. [/[^\/*]+/, "comment"],
  400. [/\/\*/, "comment", "@push"],
  401. [/\*\//, "comment", "@pop"],
  402. [/[\/*]/, "comment"]
  403. ],
  404. attribute: [
  405. { include: "@commentOrSpace" },
  406. [/\w+/, "annotation", "@pop"]
  407. ],
  408. directive: [
  409. { include: "@commentOrSpace" },
  410. [/[()]/, "@brackets"],
  411. [/,/, "delimiter"],
  412. [ident_re, "meta.content"],
  413. [/;/, "delimiter", "@pop"]
  414. ],
  415. numbers: [
  416. [/0[fh]/, "number.float"],
  417. [/[1-9][0-9]*[fh]/, "number.float"],
  418. [/[0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[fh]?/, "number.float"],
  419. [/[0-9]+\.[0-9]*([eE][+-]?[0-9]+)?[fh]?/, "number.float"],
  420. [/[0-9]+[eE][+-]?[0-9]+[fh]?/, "number.float"],
  421. [/0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+(?:[pP][+-]?[0-9]+[fh]?)?/, "number.hex"],
  422. [/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*(?:[pP][+-]?[0-9]+[fh]?)?/, "number.hex"],
  423. [/0[xX][0-9a-fA-F]+[pP][+-]?[0-9]+[fh]?/, "number.hex"],
  424. [/0[xX][0-9a-fA-F]+[iu]?/, "number.hex"],
  425. [/[1-9][0-9]*[iu]?/, "number"],
  426. [/0[iu]?/, "number"]
  427. ]
  428. }
  429. };
  430. export {
  431. conf,
  432. language
  433. };
  434. /*! Bundled license information:
  435. monaco-editor/esm/vs/basic-languages/wgsl/wgsl.js:
  436. (*!-----------------------------------------------------------------------------
  437. * Copyright (c) Microsoft Corporation. All rights reserved.
  438. * Version: 0.38.0(0e330ae453813de4e6cf272460fb79c7117073d0)
  439. * Released under the MIT license
  440. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  441. *-----------------------------------------------------------------------------*)
  442. */
  443. //# sourceMappingURL=wgsl-5RK3VJZI.js.map