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
+1 -1
View File
@@ -5,7 +5,7 @@
## [Unreleased]
### Changed
- Improved syntax highlighting for numeric literals.
- Improved syntax highlighting for operators and numeric literals.
## [2.1.0-beta.2] - 2022-12-26
+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'],