| Summary: | C++ and ISO C++ highlighting incorrectly highlight some numbers as errors | ||
|---|---|---|---|
| Product: | [Frameworks and Libraries] frameworks-syntax-highlighting | Reporter: | Patrick Roye <patrick.roye> |
| Component: | syntax | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | CC: | i.zaufi, ilmari.lauhakangas, jonathan.poelen |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | All | ||
| URL: | https://phabricator.kde.org/D14283 | ||
| Latest Commit: | https://cgit.kde.org/syntax-highlighting.git/commit/?id=7a2ae6be229b9df45807b134db9cd0c24c3da671 | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
|
Description
Patrick Roye
2016-05-18 14:58:37 UTC
Reproduced. Arch Linux 64-bit Kate 16.04.2 KDE Frameworks 5.23.0 Qt 5.7 xcb wm @Alex: Do you want to look into this? Sounds like a very prominent missing features (iirc that was once working correctly). (In reply to Dominik Haumann from comment #2) > @Alex: Do you want to look into this? Sounds like a very prominent missing > features (iirc that was once working correctly). Dominic, I'm still using Kate from KDE 4 (unfortunately PyKF5 is not available and I can't port Pate to it) and it looks almost fine in here... except `f` char in last two numbers. So, probably bug was introduced later (after porting syntax files to KF5). Unfortunately, I can't fix it cuz simple do not kate latest `kate` :( [patch]
> simple do not kate latest `kate` :(
simple do not have latest `kate ;(
I've reviewed the C++ standard and fixed a typo in my KDE4 version so all numbers are look correct. Where is a repo w/ syntax files nowadays? (want to check the floating point regex in it) Ok, I've got the repo... and checking the C++ ISO file I see it uses "built-in" <Float> element which is far from being correct for C++. It was so, since KDE4! It is why "my" version of C++ syntax didn't use it! Instead, I've built a <RegEx> according to modern C++ standard to match floating point literals. Here is a bunch of test numbers to check the C++ FP highlighter:
1f; -1F; // integer w/ floating suffix
0.1; -0.1; // fractional constant
.1; -.1; // fractional constant w/o leading digit seq
1.; -1.; // ... same, but omit trailing digit seq
1.f; -1.F; // ... same w/ floating suffix
1.l; -1.L; // ... same w/ long double suffix
1e1; -1e1; 1e-1; -1e-1; // digit w/ exponent part
1e1f; -1e1F; 1e-1F; -1e-1f; // ... same w/ floating suffix
1e1l; -1e1L; 1e-1L; -1e-1l;
1.0e1; -1.0e1; // fractional constant w/ exponent
1.0e1f; -1.0e1F; 1.0e-1l; -1.0e-1L; // ... same w/ floating suffix
1.0e1f; -1.0e1F; 1.0e-1l; -1.0e-1L;
1e1_udl; 1e-1_udl; 1.0e1_udl; 1.0e-1_udl; // w/ user defined literal suffix
// std::complex suffixes
1i; 1if; 1il;
1.i; 1.if; 1.il;
1e1i; 1e-1i; 1.0e1i; 1.0e-1i;
1e1if; 1e-1if; 1.0e1if; 1.0e-1if;
1e1il; 1e-1il; 1.0e1il; 1.0e-1il;
The syntax highlighting files moved to the kde:syntax-highlighting framework, a standalone implementation of Kate's syntax highlighting. Please upstream your changes, this is rather important, since it doesn't help anyone if you just fix this in your local repository. The syntax-highlighting framework depends on qt-gui only, so you should be able to build it even if you still are on KDE 4. In order to fix this properly: 1. Please adapt the isocpp.xml and related files 2. Add examples to the unit tests in autotest/input/highlight.cpp (and/or related files). 3. run make test 4. look at the failing tests (i.e. compare the HTML output in your browser) 5. If all looks good, call in your build folder ./autotests/update-reference-data.sh 6. Make a review request on phabricator.kde.org (look for Create Diff at the right pane) This would be very very helpful! :-) @Jonathan: Is this fixed with your recent changes? @dhaumann yes, I close the ticket |