Bug 385422 - Support underscores in numeric literals (Python 3.6)
Summary: Support underscores in numeric literals (Python 3.6)
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
Depends on:
Reported: 2017-10-06 01:22 UTC by Diego Gangl
Modified: 2018-02-01 19:48 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
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.

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:
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)

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