[jsinterp] Strip /* comments */ when parsing

* NB: _separate() is looking creaky
This commit is contained in:
dirkf 2024-12-12 04:21:53 +00:00
parent 60835ca16c
commit f487b4a02a
2 changed files with 27 additions and 3 deletions

View file

@ -160,7 +160,6 @@ class TestJSInterpreter(unittest.TestCase):
self._test('function f(){var x = 20; x += 30 + 1; return x;}', 51)
self._test('function f(){var x = 20; x -= 30 + 1; return x;}', -11)
@unittest.skip('Not yet fully implemented')
def test_comments(self):
self._test('''
function f() {
@ -179,6 +178,15 @@ class TestJSInterpreter(unittest.TestCase):
}
''', 3)
self._test('''
function f() {
var x = ( /* 1 + */ 2 +
/* 30 * 40 */
50);
return x;
}
''', 52)
def test_precedence(self):
self._test('''
function f() {