Bug 414996

Summary: Python HL does not highlight octal numbers
Product: [Frameworks and Libraries] frameworks-syntax-highlighting Reporter: Matthew Woehlke <mwoehlke.floss>
Component: syntaxAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: nibgonz
Priority: NOR    
Version First Reported In: 5.64.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 5.66.0
Sentry Crash Report:

Description Matthew Woehlke 2019-12-09 19:40:29 UTC
SUMMARY
Python HL does not correctly highlight octal numbers.

STEPS TO REPRODUCE
1. Enter some text with an octal number, e.g. 'x = 0o07'
2. Execute the command 'set-highlight Python'

OBSERVED RESULT
Everything after the initial '0' is mis-highlighted.

EXPECTED RESULT
Octal number should be highlighted like a hexadecimal number.

SOFTWARE/OS VERSIONS
Katepart: 5.64.0
HL: 2.22

ADDITIONAL INFORMATION
My initial reaction was to fix this in the HL, but I see that is just using HlCOct. I wonder if it makes more sense to fix (or add an option to?) that instead?
Comment 1 Nibaldo G. 2019-12-11 05:37:26 UTC
The HlCOct rule is equivalent to "\b0[0-7]+".
I corrected the numbers in: https://phabricator.kde.org/D25869
Comment 2 Nibaldo G. 2019-12-13 02:23:07 UTC
Git commit 8ca7064781a328b33b2cd79668e876719f1cc762 by Nibaldo González.
Committed on 13/12/2019 at 02:22.
Pushed by ngonzalez into branch 'master'.

Python: improve numbers, add octals, binaries and "breakpoint" keyword

Summary:
FIXED-IN: 5.66.0

**Changes:**
* Improve number detection with underscores. Add binaries and octales. (I took the regular expressions from the TypeScript highlighting file and adapted them to Python).

  See: https://www.python.org/dev/peps/pep-0515/

* Add keyword "breakpoint" introduced in Python 3.7: https://www.python.org/dev/peps/pep-0553/

Reviewers: #framework_syntax_highlighting, dhaumann, cullmann

Reviewed By: #framework_syntax_highlighting, dhaumann

Subscribers: kwrite-devel, kde-frameworks-devel

Tags: #kate, #frameworks

Differential Revision: https://phabricator.kde.org/D25869

M  +32   -0    autotests/folding/test.py.fold
M  +36   -4    autotests/html/test.py.html
M  +32   -0    autotests/input/test.py
M  +36   -4    autotests/reference/test.py.ref
M  +21   -16   data/syntax/python.xml

https://commits.kde.org/syntax-highlighting/8ca7064781a328b33b2cd79668e876719f1cc762