|
|
@ -250,10 +250,20 @@ export const language = <languages.IMonarchLanguage>{
|
|
|
|
// Recognize strings, including those broken across lines with \ (but not without)
|
|
|
|
// Recognize strings, including those broken across lines with \ (but not without)
|
|
|
|
strings: [
|
|
|
|
strings: [
|
|
|
|
[/'$/, 'string.escape', '@popall'],
|
|
|
|
[/'$/, 'string.escape', '@popall'],
|
|
|
|
|
|
|
|
[/f'{1,3}/, 'string.escape', '@fStringBody'],
|
|
|
|
[/'/, 'string.escape', '@stringBody'],
|
|
|
|
[/'/, 'string.escape', '@stringBody'],
|
|
|
|
[/"$/, 'string.escape', '@popall'],
|
|
|
|
[/"$/, 'string.escape', '@popall'],
|
|
|
|
|
|
|
|
[/f"{1,3}/, 'string.escape', '@fDblStringBody'],
|
|
|
|
[/"/, 'string.escape', '@dblStringBody']
|
|
|
|
[/"/, 'string.escape', '@dblStringBody']
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
fStringBody: [
|
|
|
|
|
|
|
|
[/[^\\'\{\}]+$/, 'string', '@popall'],
|
|
|
|
|
|
|
|
[/[^\\'\{\}]+/, 'string'],
|
|
|
|
|
|
|
|
[/\{[^\}':!=]+/, 'identifier', '@fStringDetail'],
|
|
|
|
|
|
|
|
[/\\./, 'string'],
|
|
|
|
|
|
|
|
[/'/, 'string.escape', '@popall'],
|
|
|
|
|
|
|
|
[/\\$/, 'string']
|
|
|
|
|
|
|
|
],
|
|
|
|
stringBody: [
|
|
|
|
stringBody: [
|
|
|
|
[/[^\\']+$/, 'string', '@popall'],
|
|
|
|
[/[^\\']+$/, 'string', '@popall'],
|
|
|
|
[/[^\\']+/, 'string'],
|
|
|
|
[/[^\\']+/, 'string'],
|
|
|
@ -261,12 +271,26 @@ export const language = <languages.IMonarchLanguage>{
|
|
|
|
[/'/, 'string.escape', '@popall'],
|
|
|
|
[/'/, 'string.escape', '@popall'],
|
|
|
|
[/\\$/, 'string']
|
|
|
|
[/\\$/, 'string']
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
fDblStringBody: [
|
|
|
|
|
|
|
|
[/[^\\"\{\}]+$/, 'string', '@popall'],
|
|
|
|
|
|
|
|
[/[^\\"\{\}]+/, 'string'],
|
|
|
|
|
|
|
|
[/\{[^\}':!=]+/, 'identifier', '@fStringDetail'],
|
|
|
|
|
|
|
|
[/\\./, 'string'],
|
|
|
|
|
|
|
|
[/"/, 'string.escape', '@popall'],
|
|
|
|
|
|
|
|
[/\\$/, 'string']
|
|
|
|
|
|
|
|
],
|
|
|
|
dblStringBody: [
|
|
|
|
dblStringBody: [
|
|
|
|
[/[^\\"]+$/, 'string', '@popall'],
|
|
|
|
[/[^\\"]+$/, 'string', '@popall'],
|
|
|
|
[/[^\\"]+/, 'string'],
|
|
|
|
[/[^\\"]+/, 'string'],
|
|
|
|
[/\\./, 'string'],
|
|
|
|
[/\\./, 'string'],
|
|
|
|
[/"/, 'string.escape', '@popall'],
|
|
|
|
[/"/, 'string.escape', '@popall'],
|
|
|
|
[/\\$/, 'string']
|
|
|
|
[/\\$/, 'string']
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
fStringDetail: [
|
|
|
|
|
|
|
|
[/[:][^}]+/, 'string'],
|
|
|
|
|
|
|
|
[/[!][ars]/, 'string'], // only !a, !r, !s are supported by f-strings: https://docs.python.org/3/tutorial/inputoutput.html#formatted-string-literals
|
|
|
|
|
|
|
|
[/=/, 'string'],
|
|
|
|
|
|
|
|
[/\}/, 'identifier', '@pop']
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|