Skip to content

Commit 5748210

Browse files
authored
Support 1_000.toString(); fixes #5427 (#5429)
Support calling methods on numbers with separators.
1 parent 1dfa23b commit 5748210

File tree

9 files changed

+9
-7
lines changed

9 files changed

+9
-7
lines changed

docs/v2/annotated-source/nodes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10237,7 +10237,7 @@ <h2 id="constants">Constants</h2>
1023710237

1023810238
<div class="content"><div class='highlight'><pre>TAB = <span class="hljs-string">&#x27; &#x27;</span>
1023910239

10240-
SIMPLENUM = <span class="hljs-regexp">/^[+-]?\d+$/</span>
10240+
SIMPLENUM = <span class="hljs-regexp">/^[+-]?(?:\d(?:_?\d)*)+$/</span>
1024110241
SIMPLE_STRING_OMIT = <span class="hljs-regexp">/\s*\n\s*/g</span>
1024210242
LEADING_BLANK_LINE = <span class="hljs-regexp">/^[^\n\S]*\n/</span>
1024310243
TRAILING_BLANK_LINE = <span class="hljs-regexp">/\n[^\n\S]*$/</span>

docs/v2/browser-compiler-legacy/coffeescript.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/v2/browser-compiler-modern/coffeescript.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/v2/test.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29307,6 +29307,7 @@ <h2>Another heading</h2>
2930729307
test "call methods directly on numbers", ->
2930829308
eq 4, 4.valueOf()
2930929309
eq '11', 4.toString 3
29310+
eq '1000', 1_000.toString()
2931029311

2931129312
eq -1, 3 -4
2931229313

lib/coffeescript-browser-compiler-legacy/coffeescript.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/coffeescript-browser-compiler-modern/coffeescript.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/coffeescript/nodes.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/nodes.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5772,7 +5772,7 @@ LEVEL_ACCESS = 6 # ...[0]
57725772
# Tabs are two spaces for pretty printing.
57735773
TAB = ' '
57745774

5775-
SIMPLENUM = /^[+-]?\d+$/
5775+
SIMPLENUM = /^[+-]?(?:\d(?:_?\d)*)+$/
57765776
SIMPLE_STRING_OMIT = /\s*\n\s*/g
57775777
LEADING_BLANK_LINE = /^[^\n\S]*\n/
57785778
TRAILING_BLANK_LINE = /\n[^\n\S]*$/

test/numbers.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ test "Parser recognises binary numbers", ->
2121
test "call methods directly on numbers", ->
2222
eq 4, 4.valueOf()
2323
eq '11', 4.toString 3
24+
eq '1000', 1_000.toString()
2425

2526
eq -1, 3 -4
2627

0 commit comments

Comments
 (0)