aboutsummaryrefslogtreecommitdiffstats
path: root/public/prism/prism-scss.min.js
blob: 21dae5c79433ed7b46685be51c4203e5dbf1ac19 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(Prism.languages.scss = Prism.languages.extend('css', {
  comment: { pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, lookbehind: !0 },
  atrule: {
    pattern: /@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,
    inside: { rule: /@[\w-]+/ },
  },
  url: /(?:[-a-z]+-)?url(?=\()/i,
  selector: {
    pattern:
      /(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,
    inside: {
      parent: { pattern: /&/, alias: 'important' },
      placeholder: /%[-\w]+/,
      variable: /\$[-\w]+|#\{\$[-\w]+\}/,
    },
  },
  property: {
    pattern: /(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,
    inside: { variable: /\$[-\w]+|#\{\$[-\w]+\}/ },
  },
})),
  Prism.languages.insertBefore('scss', 'atrule', {
    keyword: [
      /@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,
      { pattern: /( )(?:from|through)(?= )/, lookbehind: !0 },
    ],
  }),
  Prism.languages.insertBefore('scss', 'important', {
    variable: /\$[-\w]+|#\{\$[-\w]+\}/,
  }),
  Prism.languages.insertBefore('scss', 'function', {
    'module-modifier': {
      pattern: /\b(?:as|hide|show|with)\b/i,
      alias: 'keyword',
    },
    placeholder: { pattern: /%[-\w]+/, alias: 'selector' },
    statement: { pattern: /\B!(?:default|optional)\b/i, alias: 'keyword' },
    boolean: /\b(?:false|true)\b/,
    null: { pattern: /\bnull\b/, alias: 'keyword' },
    operator: {
      pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,
      lookbehind: !0,
    },
  }),
  (Prism.languages.scss.atrule.inside.rest = Prism.languages.scss);
class="nx">lookbehind: true, }, operator: { pattern: /((?:^|[^'`#])[(\[])(?:[-+*%/]|[<>]=?|=>?)(?=[()\[\]\s]|$)/, lookbehind: true, }, number: { // The number pattern from [the R7RS spec](https://small.r7rs.org/attachment/r7rs.pdf). // // <number> := <num 2>|<num 8>|<num 10>|<num 16> // <num R> := <prefix R><complex R> // <complex R> := <real R>(?:@<real R>|<imaginary R>)?|<imaginary R> // <imaginary R> := [+-](?:<ureal R>|(?:inf|nan)\.0)?i // <real R> := [+-]?<ureal R>|[+-](?:inf|nan)\.0 // <ureal R> := <uint R>(?:\/<uint R>)? // | <decimal R> // // <decimal 10> := (?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)? // <uint R> := <digit R>+ // <prefix R> := <radix R>(?:#[ei])?|(?:#[ei])?<radix R> // <radix 2> := #b // <radix 8> := #o // <radix 10> := (?:#d)? // <radix 16> := #x // <digit 2> := [01] // <digit 8> := [0-7] // <digit 10> := \d // <digit 16> := [0-9a-f] // // The problem with this grammar is that the resulting regex is way to complex, so we simplify by grouping all // non-decimal bases together. This results in a decimal (dec) and combined binary, octal, and hexadecimal (box) // pattern: pattern: RegExp( SortedBNF({ '<ureal dec>': /\d+(?:\/\d+)|(?:\d+(?:\.\d*)?|\.\d+)(?:[esfdl][+-]?\d+)?/.source, '<real dec>': /[+-]?<ureal dec>|[+-](?:inf|nan)\.0/.source, '<imaginary dec>': /[+-](?:<ureal dec>|(?:inf|nan)\.0)?i/.source, '<complex dec>': /<real dec>(?:@<real dec>|<imaginary dec>)?|<imaginary dec>/.source, '<num dec>': /(?:#d(?:#[ei])?|#[ei](?:#d)?)?<complex dec>/.source, '<ureal box>': /[0-9a-f]+(?:\/[0-9a-f]+)?/.source, '<real box>': /[+-]?<ureal box>|[+-](?:inf|nan)\.0/.source, '<imaginary box>': /[+-](?:<ureal box>|(?:inf|nan)\.0)?i/.source, '<complex box>': /<real box>(?:@<real box>|<imaginary box>)?|<imaginary box>/.source, '<num box>': /#[box](?:#[ei])?|(?:#[ei])?#[box]<complex box>/.source, '<number>': /(^|[()\[\]\s])(?:<num dec>|<num box>)(?=[()\[\]\s]|$)/ .source, }), 'i' ), lookbehind: true, }, boolean: { pattern: /(^|[()\[\]\s])#(?:[ft]|false|true)(?=[()\[\]\s]|$)/, lookbehind: true, }, function: { pattern: /((?:^|[^'`#])[(\[])(?:[^|()\[\]'\s]+|\|(?:[^\\|]|\\.)*\|)(?=[()\[\]\s]|$)/, lookbehind: true, }, identifier: { pattern: /(^|[()\[\]\s])\|(?:[^\\|]|\\.)*\|(?=[()\[\]\s]|$)/, lookbehind: true, greedy: true, }, punctuation: /[()\[\]']/, }; /** * Given a topologically sorted BNF grammar, this will return the RegExp source of last rule of the grammar. * * @param {Record<string, string>} grammar * @returns {string} */ function SortedBNF(grammar) { for (var key in grammar) { grammar[key] = grammar[key].replace(/<[\w\s]+>/g, function (key) { return '(?:' + grammar[key].trim() + ')'; }); } // return the last item return grammar[key]; } })(Prism);