Support `1_000.toString()`; fixes #5427 (#5429)

Support calling methods on numbers with separators.
This commit is contained in:
Daniel X Moore 2022-10-14 10:06:28 -07:00 committed by GitHub
parent 1dfa23b049
commit 5748210ea8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 9 additions and 7 deletions

View File

@ -10237,7 +10237,7 @@ LEVEL_ACCESS = <span class="hljs-number">6</span> <span class="hljs-comment">#
<div class="content"><div class='highlight'><pre>TAB = <span class="hljs-string">&#x27; &#x27;</span>
SIMPLENUM = <span class="hljs-regexp">/^[+-]?\d+$/</span>
SIMPLENUM = <span class="hljs-regexp">/^[+-]?(?:\d(?:_?\d)*)+$/</span>
SIMPLE_STRING_OMIT = <span class="hljs-regexp">/\s*\n\s*/g</span>
LEADING_BLANK_LINE = <span class="hljs-regexp">/^[^\n\S]*\n/</span>
TRAILING_BLANK_LINE = <span class="hljs-regexp">/\n[^\n\S]*$/</span>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -29307,6 +29307,7 @@ test "Parser recognises binary numbers", ->
test "call methods directly on numbers", ->
eq 4, 4.valueOf()
eq '11', 4.toString 3
eq '1000', 1_000.toString()
eq -1, 3 -4

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8758,7 +8758,7 @@
// Tabs are two spaces for pretty printing.
TAB = ' ';
SIMPLENUM = /^[+-]?\d+$/;
SIMPLENUM = /^[+-]?(?:\d(?:_?\d)*)+$/;
SIMPLE_STRING_OMIT = /\s*\n\s*/g;

View File

@ -5772,7 +5772,7 @@ LEVEL_ACCESS = 6 # ...[0]
# Tabs are two spaces for pretty printing.
TAB = ' '
SIMPLENUM = /^[+-]?\d+$/
SIMPLENUM = /^[+-]?(?:\d(?:_?\d)*)+$/
SIMPLE_STRING_OMIT = /\s*\n\s*/g
LEADING_BLANK_LINE = /^[^\n\S]*\n/
TRAILING_BLANK_LINE = /\n[^\n\S]*$/

View File

@ -21,6 +21,7 @@ test "Parser recognises binary numbers", ->
test "call methods directly on numbers", ->
eq 4, 4.valueOf()
eq '11', 4.toString 3
eq '1000', 1_000.toString()
eq -1, 3 -4