Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:19
erlang
2661-Allow-underscores-in-numeric-literals.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2661-Allow-underscores-in-numeric-literals.patch of Package erlang
From 23bc42a53bd46984bdca6962b368ce703ce1e45b Mon Sep 17 00:00:00 2001 From: Sergey Prokhorov <seriy.pr@gmail.com> Date: Thu, 18 Jul 2019 00:22:03 +0200 Subject: [PATCH 1/8] Allow underscores in numeric literals To make long integer literals more readable. Examples: * 123_456_789 * 123_456.789_123 * 16#123_ABC --- lib/stdlib/src/erl_scan.erl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/stdlib/src/erl_scan.erl b/lib/stdlib/src/erl_scan.erl index 4774c4bf19..4e5a51ae07 100644 --- a/lib/stdlib/src/erl_scan.erl +++ b/lib/stdlib/src/erl_scan.erl @@ -940,6 +940,8 @@ escape_char(C) -> C. scan_number([C|Cs], St, Line, Col, Toks, Ncs) when ?DIGIT(C) -> scan_number(Cs, St, Line, Col, Toks, [C|Ncs]); +scan_number([$_|Cs], St, Line, Col, Toks, Ncs) -> + scan_number(Cs, St, Line, Col, Toks, Ncs); scan_number([$.,C|Cs], St, Line, Col, Toks, Ncs) when ?DIGIT(C) -> scan_fraction(Cs, St, Line, Col, Toks, [C,$.|Ncs]); scan_number([$.]=Cs, _St, Line, Col, Toks, Ncs) -> @@ -975,6 +977,8 @@ scan_based_int([C|Cs], St, Line, Col, Toks, {B,Ncs,Bcs}) scan_based_int([C|Cs], St, Line, Col, Toks, {B,Ncs,Bcs}) when C >= $a, B > 10, C < $a+B-10 -> scan_based_int(Cs, St, Line, Col, Toks, {B,[C|Ncs],Bcs}); +scan_based_int([$_|Cs], St, Line, Col, Toks, {B,Ncs,Bcs}) -> + scan_based_int(Cs, St, Line, Col, Toks, {B,Ncs,Bcs}); scan_based_int([]=Cs, _St, Line, Col, Toks, State) -> {more,{Cs,Col,Toks,Line,State,fun scan_based_int/6}}; scan_based_int(Cs, St, Line, Col, Toks, {B,Ncs0,Bcs}) -> @@ -990,6 +994,8 @@ scan_based_int(Cs, St, Line, Col, Toks, {B,Ncs0,Bcs}) -> scan_fraction([C|Cs], St, Line, Col, Toks, Ncs) when ?DIGIT(C) -> scan_fraction(Cs, St, Line, Col, Toks, [C|Ncs]); +scan_fraction([$_|Cs], St, Line, Col, Toks, Ncs) -> + scan_fraction(Cs, St, Line, Col, Toks, Ncs); scan_fraction([E|Cs], St, Line, Col, Toks, Ncs) when E =:= $e; E =:= $E -> scan_exponent_sign(Cs, St, Line, Col, Toks, [E|Ncs]); scan_fraction([]=Cs, _St, Line, Col, Toks, Ncs) -> @@ -1006,6 +1012,8 @@ scan_exponent_sign(Cs, St, Line, Col, Toks, Ncs) -> scan_exponent([C|Cs], St, Line, Col, Toks, Ncs) when ?DIGIT(C) -> scan_exponent(Cs, St, Line, Col, Toks, [C|Ncs]); +scan_exponent([$_|Cs], St, Line, Col, Toks, Ncs) -> + scan_exponent(Cs, St, Line, Col, Toks, Ncs); scan_exponent([]=Cs, _St, Line, Col, Toks, Ncs) -> {more,{Cs,Col,Toks,Line,Ncs,fun scan_exponent/6}}; scan_exponent(Cs, St, Line, Col, Toks, Ncs) -> -- 2.16.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor