Skip to content

JSON: small optimization on number regex

Jonathan Poelen requested to merge jpoelen/syntax-highlighting:json into master
  • Shared context (JsonValue) to speed up monoline file opening with Qt5 (json of 1.9M: 45s -> 24s) (more detail: https://bugs.kde.org/show_bug.cgi?id=460578)
  • A number cannot start with more than one 0, but each 0 was considered as Style_Decimal. Therefore, the regex was rewritten to allow multiple 0.
  • remove insensitive="false" (default behavior)

Behaviour change (on an invalid format):

Before:

[000.10]
 | |
 Style_Decimal
   |
   Style_Float

After:

[000.10]
 |
 Style_Float

Merge request reports