Bug 385422

Summary: Support underscores in numeric literals (Python 3.6)
Product: [Frameworks and Libraries] frameworks-syntax-highlighting Reporter: Diego Gangl <dnicolas>
Component: syntaxAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: simonandric5
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Diego Gangl 2017-10-06 01:22:51 UTC
Python 3.6 includes the option to use underscores as numeric separators to make numbers more readable. (PEP 515 -> https://www.python.org/dev/peps/pep-0515/)
This isn't supported yet and the syntax highlighting breaks after the first underscore.

example:
num = 1_000_000
Comment 1 Dominik Haumann 2017-10-18 20:06:37 UTC
Could you please provide a patch by extending python.xml accordingly?
Comment 2 Diego Gangl 2017-10-20 00:20:53 UTC
I gave it a shot here:
https://phabricator.kde.org/D8371
Comment 3 Dominik Haumann 2018-02-01 19:48:37 UTC
Git commit 0abe7dab204fc28d9ec9db43d22b684ce364d008 by Dominik Haumann.
Committed on 01/02/2018 at 19:48.
Pushed by dhaumann into branch 'master'.

Support for underscores in numeric literals (Python 3.6)

Summary:
This patch adds support for underscores in numeric literals for Python 3.6 (from [[ https://www.python.org/dev/peps/pep-0515/ | PEP 515 ]])

Test Plan:
Test different numbers with underscore in the code editor sample.

an_int = 100_000_000
a_float = 100_0000_000.0
some_hex = 0xEAD2_DF24_3D

Reviewers: #kate, dhaumann

Reviewed By: #kate, dhaumann

Subscribers: dhaumann, cullmann, #frameworks

Tags: #framework_syntax_highlighting, #frameworks

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

M  +5    -1    autotests/folding/test.py.fold
M  +5    -1    autotests/html/test.py.html
M  +5    -1    autotests/input/test.py
M  +5    -1    autotests/reference/test.py.ref
M  +5    -1    data/syntax/python.xml

https://commits.kde.org/syntax-highlighting/0abe7dab204fc28d9ec9db43d22b684ce364d008