Bug 393129 - Red underline in kdevelop+kwrite on valid numerical constants (with invalid octal substrings)
Summary: Red underline in kdevelop+kwrite on valid numerical constants (with invalid o...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (show other bugs)
Version: 5.45.0
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 388091 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-04-14 12:14 UTC by Cyp
Modified: 2018-08-13 14:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cyp 2018-04-14 12:14:23 UTC
If typing "-1.09" (without the quotes), the "09" appears red and underlined.

Seems as if anything matching /[-+][0-9]+/ causes number parsing to stop at the end of the pattern.

Red/underlined after the black dot:
-0.09
-1.08
-1.09
+1.09
-1.012345678
Anything matching /[-+][0-9]+\.0[0-7]*[89]/

Red/underlined before the black dot:
-09.0
+09.0

Entire number red, except dot is black if present:
-08.08
-1e3
+1e3
-1e1f
1f (invalid)

Not red/underlined, but dot is black:
-1.90
+1.90
-1.01234567
-1.09e1
-3.١٤١٥٩e1 (invalid)

Not red/underlined, and dot is yellowish orange-brown like the rest of the number:
1.09
- 1.09
-.09
09.0
08.08
1e3
1e1f
3.١٤١٥٩e1 (invalid)
٣.١٤١٥٩ (invalid)
Comment 1 Dominik Haumann 2018-05-29 20:54:58 UTC
Indeed. The problem is that it seems the Octal rule matches due to the leading 0, and 9 is not part of the Octal system. Usually, the <Float ...> rule should match earlier, but this does not seem to work properly. Needs further investigation.
Comment 2 Dominik Haumann 2018-05-29 20:56:31 UTC
Git commit db2cbfd50c22da2e0dd633b6ae8f9dfd7babee11 by Dominik Haumann.
Committed on 29/05/2018 at 20:56.
Pushed by dhaumann into branch 'master'.

Add unit test for C++ Octal number misdetection

M  +2    -0    autotests/folding/highlight.cpp.fold
M  +3    -1    autotests/html/highlight.cpp.html
M  +2    -0    autotests/input/highlight.cpp
M  +3    -1    autotests/reference/highlight.cpp.ref

https://commits.kde.org/syntax-highlighting/db2cbfd50c22da2e0dd633b6ae8f9dfd7babee11
Comment 3 Dominik Haumann 2018-05-29 21:03:45 UTC
*** Bug 388091 has been marked as a duplicate of this bug. ***
Comment 4 Dominik Haumann 2018-05-29 21:04:11 UTC
What also does not work:
const float min = -0.5f;
Comment 5 Dominik Haumann 2018-08-13 14:33:34 UTC
This is fixed for KDE Frameworks 5.49.