summaryrefslogtreecommitdiffstats
path: root/public/prism/prism-powershell.min.js
blob: 386c3fbe1fff2632fda7d9dea18cb2d0f3f44efd (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
!(function (e) {
  var i = (Prism.languages.powershell = {
    comment: [
      { pattern: /(^|[^`])<#[\s\S]*?#>/, lookbehind: !0 },
      { pattern: /(^|[^`])#.*/, lookbehind: !0 },
    ],
    string: [
      { pattern: /"(?:`[\s\S]|[^`"])*"/, greedy: !0, inside: null },
      { pattern: /'(?:[^']|'')*'/, greedy: !0 },
    ],
    namespace: /\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,
    boolean: /\$(?:false|true)\b/i,
    variable: /\$\w+\b/,
    function: [
      /\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,
      /\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i,
    ],
    keyword:
      /\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,
    operator: {
      pattern:
        /(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,
      lookbehind: !0,
    },
    punctuation: /[|{}[\];(),.]/,
  });
  i.string[0].inside = {
    function: {
      pattern: /(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,
      lookbehind: !0,
      inside: i,
    },
    boolean: i.boolean,
    variable: i.variable,
  };
})();
bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
(function (Prism) {
  var operators = [
    // query and projection
    '$eq',
    '$gt',
    '$gte',
    '$in',
    '$lt',
    '$lte',
    '$ne',
    '$nin',
    '$and',
    '$not',
    '$nor',
    '$or',
    '$exists',
    '$type',
    '$expr',
    '$jsonSchema',
    '$mod',
    '$regex',
    '$text',
    '$where',
    '$geoIntersects',
    '$geoWithin',
    '$near',
    '$nearSphere',
    '$all',
    '$elemMatch',
    '$size',
    '$bitsAllClear',
    '$bitsAllSet',
    '$bitsAnyClear',
    '$bitsAnySet',
    '$comment',
    '$elemMatch',
    '$meta',
    '$slice',

    // update
    '$currentDate',
    '$inc',
    '$min',
    '$max',
    '$mul',
    '$rename',
    '$set',
    '$setOnInsert',
    '$unset',
    '$addToSet',
    '$pop',
    '$pull',
    '$push',
    '$pullAll',
    '$each',
    '$position',
    '$slice',
    '$sort',
    '$bit',

    // aggregation pipeline stages
    '$addFields',
    '$bucket',
    '$bucketAuto',
    '$collStats',
    '$count',
    '$currentOp',
    '$facet',
    '$geoNear',
    '$graphLookup',
    '$group',
    '$indexStats',
    '$limit',
    '$listLocalSessions',
    '$listSessions',
    '$lookup',
    '$match',
    '$merge',
    '$out',
    '$planCacheStats',
    '$project',
    '$redact',
    '$replaceRoot',
    '$replaceWith',
    '$sample',
    '$set',
    '$skip',
    '$sort',
    '$sortByCount',
    '$unionWith',
    '$unset',
    '$unwind',

    // aggregation pipeline operators
    '$abs',
    '$accumulator',
    '$acos',
    '$acosh',
    '$add',
    '$addToSet',
    '$allElementsTrue',
    '$and',
    '$anyElementTrue',
    '$arrayElemAt',
    '$arrayToObject',
    '$asin',
    '$asinh',
    '$atan',
    '$atan2',
    '$atanh',
    '$avg',
    '$binarySize',
    '$bsonSize',
    '$ceil',
    '$cmp',
    '$concat',
    '$concatArrays',
    '$cond',
    '$convert',
    '$cos',
    '$dateFromParts',
    '$dateToParts',
    '$dateFromString',
    '$dateToString',
    '$dayOfMonth',
    '$dayOfWeek',
    '$dayOfYear',
    '$degreesToRadians',
    '$divide',
    '$eq',
    '$exp',
    '$filter',
    '$first',
    '$floor',
    '$function',
    '$gt',
    '$gte',
    '$hour',
    '$ifNull',
    '$in',
    '$indexOfArray',
    '$indexOfBytes',
    '$indexOfCP',
    '$isArray',
    '$isNumber',
    '$isoDayOfWeek',
    '$isoWeek',
    '$isoWeekYear',
    '$last',
    '$last',
    '$let',
    '$literal',
    '$ln',
    '$log',
    '$log10',
    '$lt',
    '$lte',
    '$ltrim',
    '$map',
    '$max',
    '$mergeObjects',
    '$meta',
    '$min',
    '$millisecond',
    '$minute',
    '$mod',
    '$month',
    '$multiply',
    '$ne',
    '$not',
    '$objectToArray',
    '$or',
    '$pow',
    '$push',
    '$radiansToDegrees',
    '$range',
    '$reduce',
    '$regexFind',
    '$regexFindAll',
    '$regexMatch',
    '$replaceOne',
    '$replaceAll',
    '$reverseArray',
    '$round',
    '$rtrim',
    '$second',
    '$setDifference',
    '$setEquals',
    '$setIntersection',
    '$setIsSubset',
    '$setUnion',
    '$size',
    '$sin',
    '$slice',
    '$split',
    '$sqrt',
    '$stdDevPop',
    '$stdDevSamp',
    '$strcasecmp',
    '$strLenBytes',
    '$strLenCP',
    '$substr',
    '$substrBytes',
    '$substrCP',
    '$subtract',
    '$sum',
    '$switch',
    '$tan',
    '$toBool',
    '$toDate',
    '$toDecimal',
    '$toDouble',
    '$toInt',
    '$toLong',
    '$toObjectId',
    '$toString',
    '$toLower',
    '$toUpper',
    '$trim',
    '$trunc',
    '$type',
    '$week',
    '$year',
    '$zip',

    // aggregation pipeline query modifiers
    '$comment',
    '$explain',
    '$hint',
    '$max',
    '$maxTimeMS',
    '$min',
    '$orderby',
    '$query',
    '$returnKey',
    '$showDiskLoc',
    '$natural',
  ];

  var builtinFunctions = [
    'ObjectId',
    'Code',
    'BinData',
    'DBRef',
    'Timestamp',
    'NumberLong',
    'NumberDecimal',
    'MaxKey',
    'MinKey',
    'RegExp',
    'ISODate',
    'UUID',
  ];

  operators = operators.map(function (operator) {
    return operator.replace('$', '\\$');
  });

  var operatorsSource = '(?:' + operators.join('|') + ')\\b';

  Prism.languages.mongodb = Prism.languages.extend('javascript', {});

  Prism.languages.insertBefore('mongodb', 'string', {
    property: {
      pattern:
        /(?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)(?=\s*:)/,
      greedy: true,
      inside: {
        keyword: RegExp('^([\'"])?' + operatorsSource + '(?:\\1)?$'),
      },
    },
  });

  Prism.languages.mongodb.string.inside = {
    url: {
      // url pattern
      pattern:
        /https?:\/\/[-\w@:%.+~#=]{1,256}\.[a-z0-9()]{1,6}\b[-\w()@:%+.~#?&/=]*/i,
      greedy: true,
    },
    entity: {
      // ipv4
      pattern:
        /\b(?:(?:[01]?\d\d?|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d\d?|2[0-4]\d|25[0-5])\b/,
      greedy: true,
    },
  };

  Prism.languages.insertBefore('mongodb', 'constant', {
    builtin: {
      pattern: RegExp('\\b(?:' + builtinFunctions.join('|') + ')\\b'),
      alias: 'keyword',
    },
  });
})(Prism);