mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 17:25:39 +01:00
Merge pull request #74 from spahnke/nullish-coalesce
[JS/TS] Add support for the nullish-coalesce operator
This commit is contained in:
commit
4370bf50c7
3 changed files with 55 additions and 1 deletions
|
|
@ -725,6 +725,33 @@ testTokenization('javascript', [
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
||||||
|
[{
|
||||||
|
line: 'test ? 1 : 2',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'identifier.js' },
|
||||||
|
{ startIndex: 4, type: '' },
|
||||||
|
{ startIndex: 5, type: 'delimiter.js' },
|
||||||
|
{ startIndex: 6, type: '' },
|
||||||
|
{ startIndex: 7, type: 'number.js' },
|
||||||
|
{ startIndex: 8, type: '' },
|
||||||
|
{ startIndex: 9, type: 'delimiter.js' },
|
||||||
|
{ startIndex: 10, type: '' },
|
||||||
|
{ startIndex: 11, type: 'number.js' },
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
|
||||||
|
[{
|
||||||
|
line: 'couldBeNullish ?? 1',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'identifier.js' },
|
||||||
|
{ startIndex: 14, type: '' },
|
||||||
|
{ startIndex: 15, type: 'delimiter.js' },
|
||||||
|
{ startIndex: 17, type: '' },
|
||||||
|
{ startIndex: 18, type: 'number.js' }
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
|
||||||
|
|
||||||
[{
|
[{
|
||||||
line: '`${5 + \'x\' + 3}a${4}`',
|
line: '`${5 + \'x\' + 3}a${4}`',
|
||||||
tokens: [
|
tokens: [
|
||||||
|
|
|
||||||
|
|
@ -745,6 +745,33 @@ testTokenization('typescript', [
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
||||||
|
[{
|
||||||
|
line: 'test ? 1 : 2',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'identifier.ts' },
|
||||||
|
{ startIndex: 4, type: '' },
|
||||||
|
{ startIndex: 5, type: 'delimiter.ts' },
|
||||||
|
{ startIndex: 6, type: '' },
|
||||||
|
{ startIndex: 7, type: 'number.ts' },
|
||||||
|
{ startIndex: 8, type: '' },
|
||||||
|
{ startIndex: 9, type: 'delimiter.ts' },
|
||||||
|
{ startIndex: 10, type: '' },
|
||||||
|
{ startIndex: 11, type: 'number.ts' },
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
|
||||||
|
[{
|
||||||
|
line: 'couldBeNullish ?? 1',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'identifier.ts' },
|
||||||
|
{ startIndex: 14, type: '' },
|
||||||
|
{ startIndex: 15, type: 'delimiter.ts' },
|
||||||
|
{ startIndex: 17, type: '' },
|
||||||
|
{ startIndex: 18, type: 'number.ts' }
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
|
||||||
|
|
||||||
[{
|
[{
|
||||||
line: '`${5 + \'x\' + (<any>)3}a${4}`',
|
line: '`${5 + \'x\' + (<any>)3}a${4}`',
|
||||||
tokens: [
|
tokens: [
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ export const language = {
|
||||||
operators: [
|
operators: [
|
||||||
'<=', '>=', '==', '!=', '===', '!==', '=>', '+', '-', '**',
|
'<=', '>=', '==', '!=', '===', '!==', '=>', '+', '-', '**',
|
||||||
'*', '/', '%', '++', '--', '<<', '</', '>>', '>>>', '&',
|
'*', '/', '%', '++', '--', '<<', '</', '>>', '>>>', '&',
|
||||||
'|', '^', '!', '~', '&&', '||', '?', ':', '=', '+=', '-=',
|
'|', '^', '!', '~', '&&', '||', '??', '?', ':', '=', '+=', '-=',
|
||||||
'*=', '**=', '/=', '%=', '<<=', '>>=', '>>>=', '&=', '|=',
|
'*=', '**=', '/=', '%=', '<<=', '>>=', '>>>=', '&=', '|=',
|
||||||
'^=', '@',
|
'^=', '@',
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue