1 |
|
2 |
|
3 | Prism.languages.powerquery = {
|
4 | 'comment': {
|
5 | pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
|
6 | lookbehind: true,
|
7 | greedy: true
|
8 | },
|
9 | 'quoted-identifier': {
|
10 | pattern: /#"(?:[^"\r\n]|"")*"(?!")/,
|
11 | greedy: true
|
12 | },
|
13 | 'string': {
|
14 | pattern: /(?:#!)?"(?:[^"\r\n]|"")*"(?!")/,
|
15 | greedy: true
|
16 | },
|
17 | 'constant': [
|
18 | /\bDay\.(?:Friday|Monday|Saturday|Sunday|Thursday|Tuesday|Wednesday)\b/,
|
19 | /\bTraceLevel\.(?:Critical|Error|Information|Verbose|Warning)\b/,
|
20 | /\bOccurrence\.(?:All|First|Last)\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\.(?:FullOuter|Inner|LeftAnti|LeftOuter|RightAnti|RightOuter)\b/,
|
26 | /\bGroupKind\.(?:Global|Local)\b/,
|
27 | /\bExtraValues\.(?:Error|Ignore|List)\b/,
|
28 | /\bJoinAlgorithm\.(?:Dynamic|LeftHash|LeftIndex|PairwiseHash|RightHash|RightIndex|SortMerge)\b/,
|
29 | /\bJoinSide\.(?:Left|Right)\b/,
|
30 | /\bPrecision\.(?:Decimal|Double)\b/,
|
31 | /\bRelativePosition\.From(?:End|Start)\b/,
|
32 | /\bTextEncoding\.(?:Ascii|BigEndianUnicode|Unicode|Utf16|Utf8|Windows)\b/,
|
33 | /\b(?:Any|Binary|Date|DateTime|DateTimeZone|Duration|Function|Int16|Int32|Int64|Int8|List|Logical|None|Number|Record|Table|Text|Time)\.Type\b/,
|
34 | /\bnull\b/
|
35 | ],
|
36 | 'boolean': /\b(?:false|true)\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.])[a-z_][\w.]*(?=\s*\()/i,
|
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)\b/,
|
44 | alias: 'class-name'
|
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 |
|
54 | Prism.languages.pq = Prism.languages['powerquery'];
|
55 | Prism.languages.mscript = Prism.languages['powerquery'];
|