mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 13:55:41 +01:00
Separate constructors and constants from keywords
This commit is contained in:
parent
985b1bdc11
commit
b261c99d53
2 changed files with 56 additions and 9 deletions
|
|
@ -185,7 +185,7 @@ testTokenization('powerquery', [
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
// keywords and identifiers
|
// built-in keywords/identifiers
|
||||||
[{
|
[{
|
||||||
line: 'And as Each each _',
|
line: 'And as Each each _',
|
||||||
tokens: [
|
tokens: [
|
||||||
|
|
@ -205,7 +205,7 @@ testTokenization('powerquery', [
|
||||||
line: ' #table({})',
|
line: ' #table({})',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: 'white.pq' },
|
{ startIndex: 0, type: 'white.pq' },
|
||||||
{ startIndex: 2, type: 'keyword.pq' },
|
{ startIndex: 2, type: 'constructor.pq' },
|
||||||
{ startIndex: 8, type: "delimiter.parenthesis.pq" },
|
{ startIndex: 8, type: "delimiter.parenthesis.pq" },
|
||||||
{ startIndex: 9, type: "delimiter.brackets.pq" },
|
{ startIndex: 9, type: "delimiter.brackets.pq" },
|
||||||
{ startIndex: 11, type: "delimiter.parenthesis.pq" }
|
{ startIndex: 11, type: "delimiter.parenthesis.pq" }
|
||||||
|
|
@ -219,7 +219,39 @@ testTokenization('powerquery', [
|
||||||
{ startIndex: 5, type: 'white.pq' },
|
{ startIndex: 5, type: 'white.pq' },
|
||||||
{ startIndex: 6, type: 'keyword.pq' },
|
{ startIndex: 6, type: 'keyword.pq' },
|
||||||
{ startIndex: 8, type: 'white.pq' },
|
{ startIndex: 8, type: 'white.pq' },
|
||||||
{ startIndex: 9, type: 'keyword.type.pq' }
|
{ startIndex: 9, type: 'type.pq' }
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
|
||||||
|
[{
|
||||||
|
line: 'type table',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'keyword.pq' },
|
||||||
|
{ startIndex: 4, type: 'white.pq' },
|
||||||
|
{ startIndex: 5, type: 'type.pq' }
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
|
||||||
|
[{
|
||||||
|
line: 'if (a = #nan) then null else a',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: "keyword.pq" },
|
||||||
|
{ startIndex: 2, type: "white.pq" },
|
||||||
|
{ startIndex: 3, type: "delimiter.parenthesis.pq"},
|
||||||
|
{ startIndex: 4, type: "identifier.pq" },
|
||||||
|
{ startIndex: 5, type: "white.pq" },
|
||||||
|
{ startIndex: 6, type: "operator.pq" },
|
||||||
|
{ startIndex: 7, type: "white.pq" },
|
||||||
|
{ startIndex: 8, type: "constant.pq" },
|
||||||
|
{ startIndex: 12, type: "delimiter.parenthesis.pq"},
|
||||||
|
{ startIndex: 13, type: "white.pq" },
|
||||||
|
{ startIndex: 14, type: "keyword.pq" },
|
||||||
|
{ startIndex: 18, type: "white.pq" },
|
||||||
|
{ startIndex: 19, type: "type.pq" },
|
||||||
|
{ startIndex: 23, type: "white.pq" },
|
||||||
|
{ startIndex: 24, type: "keyword.pq" },
|
||||||
|
{ startIndex: 28, type: "white.pq" },
|
||||||
|
{ startIndex: 29, type: "identifier.pq" },
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,24 @@ export const language = <ILanguage>{
|
||||||
"is", "let", "meta", "not",
|
"is", "let", "meta", "not",
|
||||||
"otherwise", "or", "section",
|
"otherwise", "or", "section",
|
||||||
"shared", "then", "true",
|
"shared", "then", "true",
|
||||||
"try", "type", "#binary",
|
"try", "type"
|
||||||
"#date", "#datetime",
|
],
|
||||||
"#datetimezone", "#duration",
|
|
||||||
"#infinity", "#nan", "#sections",
|
constructors: [
|
||||||
"#shared", "#table", "#time"
|
"#binary",
|
||||||
|
"#date",
|
||||||
|
"#datetime",
|
||||||
|
"#datetimezone",
|
||||||
|
"#duration",
|
||||||
|
"#table",
|
||||||
|
"#time"
|
||||||
|
],
|
||||||
|
|
||||||
|
constants: [
|
||||||
|
"#infinity",
|
||||||
|
"#nan",
|
||||||
|
"#sections",
|
||||||
|
"#shared"
|
||||||
],
|
],
|
||||||
|
|
||||||
typeKeywords: [
|
typeKeywords: [
|
||||||
|
|
@ -81,8 +94,10 @@ export const language = <ILanguage>{
|
||||||
[/(#?[a-z]+)/,
|
[/(#?[a-z]+)/,
|
||||||
{
|
{
|
||||||
cases: {
|
cases: {
|
||||||
"@typeKeywords": "keyword.type",
|
"@typeKeywords": "type",
|
||||||
"@keywords": "keyword",
|
"@keywords": "keyword",
|
||||||
|
"@constants": "constant",
|
||||||
|
"@constructors": "constructor",
|
||||||
"@default": "identifier"
|
"@default": "identifier"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue