UNPKG

2.47 kBJavaScriptView Raw
1// https://docs.microsoft.com/en-us/powerquery-m/power-query-m-language-specification
2
3Prism.languages.powerquery = {
4 'comment': {
5 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:\/\/).*)/,
6 lookbehind: true
7 },
8 'quoted-identifier': {
9 pattern: /#"(?:[^"\r\n]|"")*"(?!")/,
10 greedy: true,
11 alias: 'variable'
12 },
13 'string': {
14 pattern: /"(?:[^"\r\n]|"")*"(?!")/,
15 greedy: true
16 },
17 'constant': [
18 /\bDay\.(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)\b/,
19 /\bTraceLevel\.(?:Critical|Error|Information|Verbose|Warning)\b/,
20 /\bOccurrence\.(?:First|Last|All)\b/,
21 /\bOrder\.(?:Ascending|Descending)\b/,
22 /\bRoundingMode\.(?:AwayFromZero|Down|ToEven|TowardZero|Up)\b/,
23 /\bMissingField\.(?:Error|Ignore|UseNull)\b/,
24 /\bQuoteStyle\.(?:Csv|None)\b/,
25 /\bJoinKind\.(?:Inner|LeftOuter|RightOuter|FullOuter|LeftAnti|RightAnti)\b/,
26 /\bGroupKind\.(?:Global|Local)\b/,
27 /\bExtraValues\.(?:List|Ignore|Error)\b/,
28 /\bJoinAlgorithm\.(?:Dynamic|PairwiseHash|SortMerge|LeftHash|RightHash|LeftIndex|RightIndex)\b/,
29 /\bJoinSide\.(?:Left|Right)\b/,
30 /\bPrecision\.(?:Double|Decimal)\b/,
31 /\bRelativePosition\.From(?:End|Start)\b/,
32 /\bTextEncoding\.(?:Ascii|BigEndianUnicode|Unicode|Utf8|Utf16|Windows)\b/,
33 /\b(?:Any|Binary|Date|DateTime|DateTimeZone|Duration|Int8|Int16|Int32|Int64|Function|List|Logical|None|Number|Record|Table|Text|Time)\.Type\b/,
34 /\bnull\b/
35 ],
36 'boolean': /\b(?:true|false)\b/,
37 'keyword': /\b(?:and|as|each|else|error|if|in|is|let|meta|not|nullable|optional|or|otherwise|section|shared|then|try|type)\b|#(?:binary|date|datetime|datetimezone|duration|infinity|nan|sections|shared|table|time)\b/,
38 'function': {
39 pattern: /(^|[^#\w.])(?!\d)[\w.]+(?=\s*\()/,
40 lookbehind: true
41 },
42 'data-type': {
43 pattern: /\b(?:any|anynonnull|binary|date|datetime|datetimezone|duration|function|list|logical|none|number|record|table|text|time|type)\b/,
44 alias: 'variable'
45 },
46 'number': {
47 pattern: /\b0x[\da-f]+\b|(?:[+-]?(?:\b\d+\.)?\b\d+|[+-]\.\d+|(^|[^.])\B\.\d+)(?:e[+-]?\d+)?\b/i,
48 lookbehind: true
49 },
50 'operator': /[-+*\/&?@^]|<(?:=>?|>)?|>=?|=>?|\.\.\.?/,
51 'punctuation': /[,;\[\](){}]/
52};
53
54Prism.languages.pq = Prism.languages['powerquery'];
55Prism.languages.mscript = Prism.languages['powerquery']
\No newline at end of file