prism-wasm.js 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. Prism.languages.wasm = {
  2. 'comment': [
  3. /\(;[\s\S]*?;\)/,
  4. {
  5. pattern: /;;.*/,
  6. greedy: true
  7. }
  8. ],
  9. 'string': {
  10. pattern: /"(?:\\[\s\S]|[^"\\])*"/,
  11. greedy: true
  12. },
  13. 'keyword': [
  14. {
  15. pattern: /\b(?:align|offset)=/,
  16. inside: {
  17. 'operator': /=/
  18. }
  19. },
  20. {
  21. pattern: /\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|neg?|nearest|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|sqrt|store(?:8|16|32)?|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,
  22. inside: {
  23. 'punctuation': /\./
  24. }
  25. },
  26. /\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/
  27. ],
  28. 'variable': /\$[\w!#$%&'*+\-./:<=>?@\\^`|~]+/,
  29. 'number': /[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,
  30. 'punctuation': /[()]/
  31. };