mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 11:35:40 +01:00
Fixes microsoft/monaco-editor#1607: Add support for nested comments
This commit is contained in:
parent
c6b50fc678
commit
c50642f89b
2 changed files with 16 additions and 11 deletions
|
|
@ -62,16 +62,6 @@ testTokenization('kotlin', [
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
// Broken nested tokens due to invalid comment tokenization
|
|
||||||
[{
|
|
||||||
line: '/* //*/ a',
|
|
||||||
tokens: [
|
|
||||||
{ startIndex: 0, type: 'comment.kt' },
|
|
||||||
{ startIndex: 7, type: '' },
|
|
||||||
{ startIndex: 8, type: 'identifier.kt' }
|
|
||||||
]
|
|
||||||
}],
|
|
||||||
|
|
||||||
[{
|
[{
|
||||||
line: '// a comment',
|
line: '// a comment',
|
||||||
tokens: [
|
tokens: [
|
||||||
|
|
@ -666,6 +656,20 @@ testTokenization('kotlin', [
|
||||||
{ startIndex: 28, type: '' },
|
{ startIndex: 28, type: '' },
|
||||||
{ startIndex: 29, type: 'keyword.private.kt' }
|
{ startIndex: 29, type: 'keyword.private.kt' }
|
||||||
]
|
]
|
||||||
|
}],
|
||||||
|
|
||||||
|
[{
|
||||||
|
line: 'fun /* /* */ */ main() {',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'keyword.fun.kt' },
|
||||||
|
{ startIndex: 3, type: '' },
|
||||||
|
{ startIndex: 4, type: 'comment.kt' },
|
||||||
|
{ startIndex: 15, type: '' },
|
||||||
|
{ startIndex: 16, type: 'identifier.kt' },
|
||||||
|
{ startIndex: 20, type: 'delimiter.parenthesis.kt' },
|
||||||
|
{ startIndex: 22, type: '' },
|
||||||
|
{ startIndex: 23, type: 'delimiter.curly.kt' },
|
||||||
|
]
|
||||||
}]
|
}]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,13 +136,14 @@ export const language = <ILanguage>{
|
||||||
|
|
||||||
comment: [
|
comment: [
|
||||||
[/[^\/*]+/, 'comment'],
|
[/[^\/*]+/, 'comment'],
|
||||||
|
[/\/\*/, 'comment', '@comment'],
|
||||||
[/\*\//, 'comment', '@pop'],
|
[/\*\//, 'comment', '@pop'],
|
||||||
[/[\/*]/, 'comment']
|
[/[\/*]/, 'comment']
|
||||||
],
|
],
|
||||||
//Identical copy of comment above, except for the addition of .doc
|
//Identical copy of comment above, except for the addition of .doc
|
||||||
javadoc: [
|
javadoc: [
|
||||||
[/[^\/*]+/, 'comment.doc'],
|
[/[^\/*]+/, 'comment.doc'],
|
||||||
// [/\/\*/, 'comment.doc', '@push' ], // nested comment not allowed :-(
|
[/\/\*/, 'comment.doc', '@push' ],
|
||||||
[/\/\*/, 'comment.doc.invalid'],
|
[/\/\*/, 'comment.doc.invalid'],
|
||||||
[/\*\//, 'comment.doc', '@pop'],
|
[/\*\//, 'comment.doc', '@pop'],
|
||||||
[/[\/*]/, 'comment.doc']
|
[/[\/*]/, 'comment.doc']
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue