mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 22:02:55 +01:00
This commit is contained in:
parent
70f12687bb
commit
9961f06110
2 changed files with 71 additions and 7 deletions
|
|
@ -92,6 +92,69 @@ testTokenization('python', [
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
// https://github.com/Microsoft/monaco-editor/issues/1170
|
||||||
|
[{
|
||||||
|
line: 'def f():',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'keyword.python' },
|
||||||
|
{ startIndex: 3, type: 'white.python' },
|
||||||
|
{ startIndex: 4, type: 'identifier.python' },
|
||||||
|
{ startIndex: 5, type: 'delimiter.parenthesis.python' },
|
||||||
|
{ startIndex: 7, type: 'delimiter.python' },
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
line: ' """multi',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'white.python' },
|
||||||
|
{ startIndex: 3, type: 'string.python' },
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
line: ' line',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'string.python' },
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
line: ' comment',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'string.python' },
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
line: ' """ + """',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'string.python' },
|
||||||
|
{ startIndex: 6, type: 'white.python' },
|
||||||
|
{ startIndex: 7, type: '' },
|
||||||
|
{ startIndex: 8, type: 'white.python' },
|
||||||
|
{ startIndex: 9, type: 'string.python' },
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
line: ' another',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'string.python' },
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
line: ' multi',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'string.python' },
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
line: ' line',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'string.python' },
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
line: ' comment"""',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'string.python' },
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
line: ' code',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'white.python' },
|
||||||
|
{ startIndex: 3, type: 'identifier.python' },
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
|
||||||
// Numbers
|
// Numbers
|
||||||
[{
|
[{
|
||||||
line: '0xAcBFd',
|
line: '0xAcBFd',
|
||||||
|
|
|
||||||
|
|
@ -215,19 +215,20 @@ export const language = <ILanguage>{
|
||||||
whitespace: [
|
whitespace: [
|
||||||
[/\s+/, 'white'],
|
[/\s+/, 'white'],
|
||||||
[/(^#.*$)/, 'comment'],
|
[/(^#.*$)/, 'comment'],
|
||||||
[/('''.*''')|(""".*""")/, 'string'],
|
[/'''/, 'string', '@endDocString'],
|
||||||
[/'''.*$/, 'string', '@endDocString'],
|
[/"""/, 'string', '@endDblDocString']
|
||||||
[/""".*$/, 'string', '@endDblDocString']
|
|
||||||
],
|
],
|
||||||
endDocString: [
|
endDocString: [
|
||||||
|
[/[^']+/, 'string'],
|
||||||
[/\\'/, 'string'],
|
[/\\'/, 'string'],
|
||||||
[/.*'''/, 'string', '@popall'],
|
[/'''/, 'string', '@popall'],
|
||||||
[/.*$/, 'string']
|
[/'/, 'string']
|
||||||
],
|
],
|
||||||
endDblDocString: [
|
endDblDocString: [
|
||||||
|
[/[^"]+/, 'string'],
|
||||||
[/\\"/, 'string'],
|
[/\\"/, 'string'],
|
||||||
[/.*"""/, 'string', '@popall'],
|
[/"""/, 'string', '@popall'],
|
||||||
[/.*$/, 'string']
|
[/"/, 'string']
|
||||||
],
|
],
|
||||||
|
|
||||||
// Recognize hex, negatives, decimals, imaginaries, longs, and scientific notation
|
// Recognize hex, negatives, decimals, imaginaries, longs, and scientific notation
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue