Bug 462178 - [toml] Hex, octal, binary integers and nan, inf
Summary: [toml] Hex, octal, binary integers and nan, inf
Status: RESOLVED FIXED
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (other bugs)
Version First Reported In: unspecified
Platform: unspecified All
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-23 16:41 UTC by Timofey
Modified: 2022-11-27 19:43 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Timofey 2022-11-23 16:41:10 UTC
SUMMARY
0x (hex), 0o (octal), 0b (binary) integers in TOML are not highlighted. `nan` (not a number) and `inf` are also treated as errors, even though they are allowed.

STEPS TO REPRODUCE
Paste the following TOML file:

binary_int = 0b11010110
octal_int = 0o755
hex_int = 0xdead_beef
infinity = inf
neg_infinity = -inf
not_a_number = nan

OBSERVED RESULT
All of the values are underlined as errors in the input.

EXPECTED RESULT
They are parsed correctly.

ADDITIONAL INFORMATION
* TOML website (see more examples below): https://toml.io/en/
* TOML spec: https://toml.io/en/v1.0.0
Comment 1 Bug Janitor Service 2022-11-27 17:57:27 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/394
Comment 2 Christoph Cullmann 2022-11-27 19:43:30 UTC
Git commit 33358ad24ae67c49febcaa20b4558520f639f8c8 by Christoph Cullmann, on behalf of Jonathan Poelen.
Committed on 27/11/2022 at 19:31.
Pushed by cullmann into branch 'master'.

TOML: add number prefix, inf, nan and more datetime format ; fix multi-strings closing

- Remove Normal Text style (not used)
- add 0x, 0o and 0o number prefix
- add more datetime format
- fix multi-string closing with """"", """", ''''' and ''''
- several consecutive values are not considered as 2 values

before:

```toml
a = 001
    ^ Int
a = 12.12+123
    ^ Float
         ^ Int
a = "abc""abc"
    ^ String
```

after:

```toml
a = 001
    ^ Int
     ^ Key
a = 12.12+123
    ^ Float
         ^ Error
          ^ Key
a = "abc""abc"
    ^ String
         ^ Key
```

Highlighting in Key visually gives a problem.

M  +126  -124  autotests/folding/highlight.toml.fold
M  +127  -125  autotests/html/highlight.toml.dark.html
M  +127  -125  autotests/html/highlight.toml.html
M  +126  -124  autotests/input/highlight.toml
M  +127  -125  autotests/reference/highlight.toml.ref
M  +82   -54   data/syntax/toml.xml

https://invent.kde.org/frameworks/syntax-highlighting/commit/33358ad24ae67c49febcaa20b4558520f639f8c8