mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 17:45:22 +00:00
editor/pybricksMicroPython: improve numeric literal highlighting
- Drop Python 2.x "L" suffix. - Add support for underscores. - Drop including leading minus sign. - Add support for binary. - Add support for octal.
This commit is contained in:
committed by
David Lechner
parent
ac2d06204c
commit
1db0c48844
@@ -4,6 +4,9 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
- Improved syntax highlighting for numeric literals.
|
||||
|
||||
## [2.1.0-beta.2] - 2022-12-26
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -219,10 +219,12 @@ export const language = <monaco.languages.IMonarchLanguage>{
|
||||
[/"/, 'string'],
|
||||
],
|
||||
|
||||
// Recognize hex, negatives, decimals, imaginaries, longs, and scientific notation
|
||||
// Recognize binary, octal, hex, decimals, imaginary, and scientific notation
|
||||
numbers: [
|
||||
[/-?0x([abcdef]|[ABCDEF]|\d)+[lL]?/, 'constant.numeric.hex'],
|
||||
[/-?(\d*\.)?\d+([eE][+-]?\d+)?[jJ]?[lL]?/, 'constant.numeric'],
|
||||
[/\b0[bB](0|1|_)+/, 'constant.numeric.bin'],
|
||||
[/\b0[oO]([0-7]|_)+/, 'constant.numeric.oct'],
|
||||
[/\b0[xX]([abcdef]|[ABCDEF]|\d|_)+/, 'constant.numeric.hex'],
|
||||
[/\b([\d_]*\.)?[\d_]+([eE][+-]?[\d_]+)?[jJ]?/, 'constant.numeric'],
|
||||
],
|
||||
|
||||
// Recognize strings, including those broken across lines with \ (but not without)
|
||||
|
||||
Reference in New Issue
Block a user