(function (Prism) { Prism.languages.puppet = { heredoc: [ // Matches the content of a quoted heredoc string (subject to interpolation) { pattern: /(@\("([^"\r\n\/):]+)"(?:\/[nrts$uL]*)?\).*(?:\r?\n|\r))(?:.*(?:\r?\n|\r(?!\n)))*?[ \t]*(?:\|[ \t]*)?(?:-[ \t]*)?\2/, lookbehind: true, alias: 'string', inside: { // Matches the end tag punctuation: /(?=\S).*\S(?= *$)/, // See interpolation below }, }, // Matches the content of an unquoted heredoc string (no interpolation) { pattern: /(@\(([^"\r\n\/):]+)(?:\/[nrts$uL]*)?\).*(?:\r?\n|\r))(?:.*(?:\r?\n|\r(?!\n)))*?[ \t]*(?:\|[ \t]*)?(?:-[ \t]*)?\2/, lookbehind: true, greedy: true, alias: 'string', inside: { // Matches the end tag punctuation: /(?=\S).*\S(?= *$)/, }, }, // Matches the start tag of heredoc strings { pattern: /@\("?(?:[^"\r\n\/):]+)"?(?:\/[nrts$uL]*)?\)/, alias: 'string', inside: { punctuation: { pattern: /(\().+?(?=\))/, lookbehind: true, }, }, }, ], 'multiline-comment': { pattern: /(^|[^\\])\/\*[\s\S]*?\*\//, lookbehind: true, greedy: true, alias: 'comment', }, regex: { // Must be prefixed with the keyword "node" or a non-word char pattern: /((?:\bnode\s+|[~=\(\[\{,]\s*|[=+]>\s*|^\s*))\/(?:[^\/\\]|\\[\s\S])+\/(?:[imx]+\b|\B)/, lookbehind: true, greedy: true, inside: { // Extended regexes must have the x flag. They can contain single-line comments. 'extended-regex': { pattern: /^\/(?:[^\/\\]|\\[\s\S])+\/[im]*x[im]*$/, inside: { comment: /#.*/, }, }, }, }, comment: { pattern: /(^|[^\\])#.*/, lookbehind: true, greedy: true, }, string: { // Allow for one nested level of double quotes inside interpolation pattern: /(["'])(?:\$\{(?:[^'"}]|(["'])(?:(?!\2)[^\\]|\\[\s\S])*\2)+\}|\$(?!\{)|(?!\1)[^\\$]|\\[\s\S])*\1/, greedy: true, inside: { 'double-quoted': { pattern: /^"[\s\S]*"$/, inside: { // See interpolation below }, }, }, }, variable: { pattern: /\$(?:::)?\w+(?:::\w+)*/, inside: { punctuation: /::/, }, }, 'attr-name': /(?:\b\w+|\*)(?=\s*=>)/, function: [ { pattern: /(\.)(?!\d)\w+/, lookbehind: true, }, /\b(?:contain|debug|err|fail|include|info|notice|realize|require|tag|warning)\b|\b(?!\d)\w+(?=\()/, ], number: /\b(?:0x[a-f\d]+|\d+(?:\.\d+)?(?:e-?\d+)?)\b/i, boolean: /\b(?:false|true)\b/, // Includes words reserved for future use keyword: /\b(?:application|attr|case|class|consumes|default|define|else|elsif|function|if|import|inherits|node|private|produces|type|undef|unless)\b/, datatype: { pattern: /\b(?:Any|Array|Boolean|Callable|Catalogentry|Class|Collection|Data|Default|Enum|Float|Hash|Integer|NotUndef|Numeric|Optional|Pattern|Regexp|Resource|Runtime|Scalar|String|Struct|Tuple|Type|Undef|Variant)\b/, alias: 'symbol', }, operator: /=[=~>]?|![=~]?|<(?:<\|?|[=~|-])?|>[>=]?|->?|~>|\|>?>?|[*\/%+?]|\b(?:and|in|or)\b/, punctuation: /[\[\]{}().,;]|:+/, }; var interpolation = [ { // Allow for one nested level of braces inside interpolation pattern: /(^|[^\\])\$\{(?:[^'"{}]|\{[^}]*\}|(["'])(?:(?!\2)[^\\]|\\[\s\S])*\2)+\}/, lookbehind: true, inside: { 'short-variable': { // Negative look-ahead prevent wrong highlighting of functions pattern: /(^\$\{)(?!\w+\()(?:::)?\w+(?:::\w+)*/, lookbehind: true, alias: 'variable', inside: { punctuation: /::/, }, }, delimiter: { pattern: /^\$/, alias: 'variable', }, rest: Prism.languages.puppet, }, }, { pattern: /(^|[^\\])\$(?:::)?\w+(?:::\w+)*/, lookbehind: true, alias: 'variable', inside: { punctuation: /::/, }, }, ]; Prism.languages.puppet['heredoc'][0].inside.interpolation = interpolation; Prism.languages.puppet['string'].inside[ 'double-quoted' ].inside.interpolation = interpolation; })(Prism); 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
Prism.languages.fsharp = Prism.languages.extend('clike', {
  comment: [
    {
      pattern: /(^|[^\\])\(\*(?!\))[\s\S]*?\*\)/,
      lookbehind: true,
      greedy: true,
    },
    {
      pattern: /(^|[^\\:])\/\/.*/,
      lookbehind: true,
      greedy: true,
    },
  ],
  string: {
    pattern: /(?:"""[\s\S]*?"""|@"(?:""|[^"])*"|"(?:\\[\s\S]|[^\\"])*")B?/,
    greedy: true,
  },
  'class-name': {
    pattern:
      /(\b(?:exception|inherit|interface|new|of|type)\s+|\w\s*:\s*|\s:\??>\s*)[.\w]+\b(?:\s*(?:->|\*)\s*[.\w]+\b)*(?!\s*[:.])/,
    lookbehind: true,
    inside: {
      operator: /->|\*/,
      punctuation: /\./,
    },
  },
  keyword:
    /\b(?:let|return|use|yield)(?:!\B|\b)|\b(?:abstract|and|as|asr|assert|atomic|base|begin|break|checked|class|component|const|constraint|constructor|continue|default|delegate|do|done|downcast|downto|eager|elif|else|end|event|exception|extern|external|false|finally|fixed|for|fun|function|functor|global|if|in|include|inherit|inline|interface|internal|land|lazy|lor|lsl|lsr|lxor|match|member|method|mixin|mod|module|mutable|namespace|new|not|null|object|of|open|or|override|parallel|private|process|protected|public|pure|rec|sealed|select|sig|static|struct|tailcall|then|to|trait|true|try|type|upcast|val|virtual|void|volatile|when|while|with)\b/,
  number: [
    /\b0x[\da-fA-F]+(?:LF|lf|un)?\b/,
    /\b0b[01]+(?:uy|y)?\b/,
    /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[fm]|e[+-]?\d+)?\b/i,
    /\b\d+(?:[IlLsy]|UL|u[lsy]?)?\b/,
  ],
  operator:
    /([<>~&^])\1\1|([*.:<>&])\2|<-|->|[!=:]=|<?\|{1,3}>?|\??(?:<=|>=|<>|[-+*/%=<>])\??|[!?^&]|~[+~-]|:>|:\?>?/,
});
Prism.languages.insertBefore('fsharp', 'keyword', {
  preprocessor: {
    pattern: /(^[\t ]*)#.*/m,
    lookbehind: true,
    alias: 'property',
    inside: {
      directive: {
        pattern: /(^#)\b(?:else|endif|if|light|line|nowarn)\b/,
        lookbehind: true,
        alias: 'keyword',
      },
    },
  },
});
Prism.languages.insertBefore('fsharp', 'punctuation', {
  'computation-expression': {
    pattern: /\b[_a-z]\w*(?=\s*\{)/i,
    alias: 'keyword',
  },
});
Prism.languages.insertBefore('fsharp', 'string', {
  annotation: {
    pattern: /\[<.+?>\]/,
    greedy: true,
    inside: {
      punctuation: /^\[<|>\]$/,
      'class-name': {
        pattern: /^\w+$|(^|;\s*)[A-Z]\w*(?=\()/,
        lookbehind: true,
      },
      'annotation-content': {
        pattern: /[\s\S]+/,
        inside: Prism.languages.fsharp,
      },
    },
  },
  char: {
    pattern:
      /'(?:[^\\']|\\(?:.|\d{3}|x[a-fA-F\d]{2}|u[a-fA-F\d]{4}|U[a-fA-F\d]{8}))'B?/,
    greedy: true,
  },
});