Issue #1836 added underscore to binary number_pattern regex plus tests

in s/src/javascript/tokenizer.js and test/data/javascript/tests.js

	modified:   js/src/javascript/tokenizer.js
	modified:   js/test/generated/beautify-javascript-tests.js
	modified:   python/jsbeautifier/tests/generated/tests.py
	modified:   test/data/javascript/tests.js
This commit is contained in:
Matt Monroe 2020-10-03 02:09:24 -04:00
parent 97caa30849
commit 03cbea26f3
4 changed files with 8 additions and 2 deletions

View File

@ -66,7 +66,7 @@ var TOKEN = {
var directives_core = new Directives(/\/\*/, /\*\//);
var number_pattern = /0[xX][0123456789abcdefABCDEF]*|0[oO][01234567]*|0[bB][01]*|\d+n|(?:\.\d+|\d+\.?\d*)(?:[eE][+-]?\d+)?/;
var number_pattern = /0[xX][0123456789abcdefABCDEF]*|0[oO][01234567]*|0[bB][01_]*|\d+n|(?:\.\d+|\d+\.?\d*)(?:[eE][+-]?\d+)?/;
var digit = /[0-9]/;

View File

@ -7170,6 +7170,8 @@ function run_javascript_tests(test_obj, Urlencoded, js_beautify, html_beautify,
bt('a = 0b010011;');
bt('a = 0B010011;');
bt('a = 0b01001100001111;');
bt('a = 0B010_0_11;');
bt('a = 0b01_0011_0000_1111;');
bt('a=0b10e-5', 'a = 0b10 e - 5');
bt('a=0b10+4', 'a = 0b10 + 4');
bt('a=0B11+4', 'a = 0B11 + 4');

View File

@ -6879,6 +6879,8 @@ class TestJSBeautifier(unittest.TestCase):
bt('a = 0b010011;')
bt('a = 0B010011;')
bt('a = 0b01001100001111;')
bt('a = 0B010_0_11;')
bt('a = 0b01_0011_0000_1111;')
bt('a=0b10e-5', 'a = 0b10 e - 5')
bt('a=0b10+4', 'a = 0b10 + 4')
bt('a=0B11+4', 'a = 0B11 + 4')

View File

@ -3981,6 +3981,8 @@ exports.test_data = {
},
{ unchanged: 'a = 0B010011;' },
{ unchanged: 'a = 0b01001100001111;' },
{ unchanged: 'a = 0B010_0_11;' },
{ unchanged: 'a = 0b01_0011_0000_1111;' },
{ input: 'a=0b10e-5', output: 'a = 0b10 e - 5' },
{ input: 'a=0b10+4', output: 'a = 0b10 + 4' },
{ input: 'a=0B11+4', output: 'a = 0B11 + 4' },
@ -4803,7 +4805,7 @@ exports.test_data = {
]
}
]
}, {
},{
// =======================================================
// New tests groups should be added above this line.
// Everything below is a work in progress - converting