Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Language Improvements:
- fix(yaml) Fix tags to include non-word characters (#2486) [Peter Plantinga][]
- fix(swift) `@objcMembers` was being partially highlighted (#2543) [Nick Randall][]
- enh(dart) Add `late` and `required` keywords, and `Never` built-in type (#2550) [Sam Rawlins][]
- enh(erlang) Add underscore separators to numeric literals (#2554) [Sergey Prokhorov][]

[Josh Goebel]: https://github.com/yyyc514
[Peter Plantinga]: https://github.com/pplantinga
Expand All @@ -42,6 +43,7 @@ Language Improvements:
[Hankun Lin]: https://github.com/Linhk1606
[Nick Randall]: https://github.com/nicked
[Sam Rawlins]: https://github.com/srawlins
[Sergey Prokhorov]: https://github.com/seriyps


## Version 10.0.2
Expand Down
2 changes: 1 addition & 1 deletion src/languages/erlang-repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function(hljs) {
hljs.COMMENT('%', '$'),
{
className: 'number',
begin: '\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)',
begin: '\\b(\\d+(_\\d+)*#[a-fA-F0-9]+(_[a-fA-F0-9]+)*|\\d+(_\\d+)*(\\.\\d+(_\\d+)*)?([eE][-+]?\\d+)?)',
relevance: 0
},
hljs.APOS_STRING_MODE,
Expand Down
2 changes: 1 addition & 1 deletion src/languages/erlang.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function(hljs) {
var COMMENT = hljs.COMMENT('%', '$');
var NUMBER = {
className: 'number',
begin: '\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)',
begin: '\\b(\\d+(_\\d+)*#[a-fA-F0-9]+(_[a-fA-F0-9]+)*|\\d+(_\\d+)*(\\.\\d+(_\\d+)*)?([eE][-+]?\\d+)?)',
relevance: 0
};
var NAMED_FUN = {
Expand Down
14 changes: 14 additions & 0 deletions test/markup/erlang/numbers.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Integer = <span class="hljs-number">1234</span>
BigInteger = <span class="hljs-number">1_234_000</span>
NegInteger = -<span class="hljs-number">20_000</span>
Float = <span class="hljs-number">2.34</span>
BigFloat = <span class="hljs-number">3_333.14159_26535_89793</span>
SciFloat = <span class="hljs-number">2.4e23</span>
PlusSciFloat = <span class="hljs-number">2.4e+23</span>
SmallSciFloat = <span class="hljs-number">2.4e-23</span>
Binary = <span class="hljs-number">2#1010</span>
StrangeBinary = <span class="hljs-number">2#1010_1010_1010</span>
Octal = <span class="hljs-number">8#777</span>
StrangeOctal = <span class="hljs-number">8#777_666_555</span>
Hex = <span class="hljs-number">16#1ABEF</span>
StrangeHex = <span class="hljs-number">16#1234_FACE_987D</span>
14 changes: 14 additions & 0 deletions test/markup/erlang/numbers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Integer = 1234
BigInteger = 1_234_000
NegInteger = -20_000
Float = 2.34
BigFloat = 3_333.14159_26535_89793
SciFloat = 2.4e23
PlusSciFloat = 2.4e+23
SmallSciFloat = 2.4e-23
Binary = 2#1010
StrangeBinary = 2#1010_1010_1010
Octal = 8#777
StrangeOctal = 8#777_666_555
Hex = 16#1ABEF
StrangeHex = 16#1234_FACE_987D