aboutsummaryrefslogtreecommitdiffstats
path: root/public/prism/prism-magma.min.js
blob: 39c0d27e6172905822506b0d1d258b5e23d16678 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Prism.languages.magma = {
  output: {
    pattern:
      /^(>.*(?:\r(?:\n|(?!\n))|\n))(?!>)(?:.+|(?:\r(?:\n|(?!\n))|\n)(?!>).*)(?:(?:\r(?:\n|(?!\n))|\n)(?!>).*)*/m,
    lookbehind: !0,
    greedy: !0,
  },
  comment: { pattern: /\/\/.*|\/\*[\s\S]*?\*\//, greedy: !0 },
  string: {
    pattern: /(^|[^\\"])"(?:[^\r\n\\"]|\\.)*"/,
    lookbehind: !0,
    greedy: !0,
  },
  keyword:
    /\b(?:_|adj|and|assert|assert2|assert3|assigned|break|by|case|cat|catch|clear|cmpeq|cmpne|continue|declare|default|delete|diff|div|do|elif|else|end|eq|error|eval|exists|exit|for|forall|forward|fprintf|freeze|function|ge|gt|if|iload|import|in|intrinsic|is|join|le|load|local|lt|meet|mod|ne|not|notadj|notin|notsubset|or|print|printf|procedure|quit|random|read|readi|repeat|require|requirege|requirerange|restore|return|save|sdiff|select|subset|then|time|to|try|until|vprint|vprintf|vtime|when|where|while|xor)\b/,
  boolean: /\b(?:false|true)\b/,
  generator: { pattern: /\b[a-z_]\w*(?=\s*<)/i, alias: 'class-name' },
  function: /\b[a-z_]\w*(?=\s*\()/i,
  number: {
    pattern:
      /(^|[^\w.]|\.\.)(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?:_[a-z]?)?(?=$|[^\w.]|\.\.)/,
    lookbehind: !0,
  },
  operator: /->|[-+*/^~!|#=]|:=|\.\./,
  punctuation: /[()[\]{}<>,;.:]/,
};
ss="p">; }) .replace(/<SPREAD>/g, function () { return e; })), RegExp(t, n) ); } (e = n(e).source), (o.languages.jsx = o.languages.extend('markup', t)), (o.languages.jsx.tag.pattern = n( '</?(?:[\\w.:-]+(?:<S>+(?:[\\w.:$-]+(?:=(?:"(?:\\\\[^]|[^\\\\"])*"|\'(?:\\\\[^]|[^\\\\\'])*\'|[^\\s{\'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*/?)?>' )), (o.languages.jsx.tag.inside.tag.pattern = /^<\/?[^\s>\/]*/), (o.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/), (o.languages.jsx.tag.inside.tag.inside['class-name'] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/), (o.languages.jsx.tag.inside.comment = t.comment), o.languages.insertBefore( 'inside', 'attr-name', { spread: { pattern: n('<SPREAD>'), inside: o.languages.jsx } }, o.languages.jsx.tag ), o.languages.insertBefore( 'inside', 'special-attr', { script: { pattern: n('=<BRACES>'), alias: 'language-javascript', inside: { 'script-punctuation': { pattern: /^=(?=\{)/, alias: 'punctuation' }, rest: o.languages.jsx, }, }, }, o.languages.jsx.tag ); var i = function (t) { return t ? 'string' == typeof t ? t : 'string' == typeof t.content ? t.content : t.content.map(i).join('') : ''; }, r = function (t) { for (var n = [], e = 0; e < t.length; e++) { var a = t[e], s = !1; if ( ('string' != typeof a && ('tag' === a.type && a.content[0] && 'tag' === a.content[0].type ? '</' === a.content[0].content[0].content ? 0 < n.length && n[n.length - 1].tagName === i(a.content[0].content[1]) && n.pop() : '/>' === a.content[a.content.length - 1].content || n.push({ tagName: i(a.content[0].content[1]), openedBraces: 0, }) : 0 < n.length && 'punctuation' === a.type && '{' === a.content ? n[n.length - 1].openedBraces++ : 0 < n.length && 0 < n[n.length - 1].openedBraces && 'punctuation' === a.type && '}' === a.content ? n[n.length - 1].openedBraces-- : (s = !0)), (s || 'string' == typeof a) && 0 < n.length && 0 === n[n.length - 1].openedBraces) ) { var g = i(a); e < t.length - 1 && ('string' == typeof t[e + 1] || 'plain-text' === t[e + 1].type) && ((g += i(t[e + 1])), t.splice(e + 1, 1)), 0 < e && ('string' == typeof t[e - 1] || 'plain-text' === t[e - 1].type) && ((g = i(t[e - 1]) + g), t.splice(e - 1, 1), e--), (t[e] = new o.Token('plain-text', g, null, g)); } a.content && 'string' != typeof a.content && r(a.content); } }; o.hooks.add('after-tokenize', function (t) { ('jsx' !== t.language && 'tsx' !== t.language) || r(t.tokens); }); })(Prism);