editor/pybricksMicroPython: improve operator highlighting

This handles newer things like the := operator better.
This commit is contained in:
David Lechner
2022-12-27 17:35:11 -06:00
committed by David Lechner
parent 1db0c48844
commit 5bef7e2637
2 changed files with 12 additions and 8 deletions
+11 -7
View File
@@ -180,13 +180,12 @@ export const language = <monaco.languages.IMonarchLanguage>{
{ include: '@whitespace' },
{ include: '@numbers' },
{ include: '@strings' },
{ include: '@operators' },
[/[,:;]/, 'delimiter'],
[/[{}[\]()]/, '@brackets'],
[/@[a-zA-Z_]\w*/, 'tag'],
[/\.\.\./, 'keyword'],
[/->/, 'delimiter'],
{ include: '@operators' },
[/[,:.;=]/, 'delimiter'],
[/[{}[\]()]/, '@brackets'],
[
/[a-zA-Z_]\w*/,
{
@@ -249,7 +248,12 @@ export const language = <monaco.languages.IMonarchLanguage>{
[/\\$/, 'string'],
],
operators: [[/[=+\-*/%@&|<>!~^]/, 'keyword.operator']],
operators: [
[
/(\*\*|\/\/|<<|>>|:=|<=|>=|==|!=|\+=|-=|\*-|\/=|\.\.=|%=|@=|&=|\|=|\^=|>>=|<<=|\*\*=|[+\-*/%@&|^~<>])/,
'keyword.operator',
],
],
attributes: [
[/\b/, '@pop'],