mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 23:59:49 +00:00
LibJS: Force the lexer to parse a regex when expecting a statement
This commit is contained in:
parent
05444103e3
commit
106f9e30d7
Notes:
sideshowbarker
2024-07-18 05:37:03 +09:00
Author: https://github.com/davidot
Commit: 106f9e30d7
Pull-request: https://github.com/SerenityOS/serenity/pull/9085
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/linusg ✅
Reviewed-by: https://github.com/trflynn89
4 changed files with 103 additions and 21 deletions
|
@ -3,4 +3,22 @@ test("slash token resolution in lexer", () => {
|
|||
expect("``/foo/").not.toEval();
|
||||
expect("1/foo/").not.toEval();
|
||||
expect("1/foo").toEval();
|
||||
|
||||
expect("{} /foo/").toEval();
|
||||
expect("{} /=/").toEval();
|
||||
expect("{} /=a/").toEval();
|
||||
expect("{} /* */ /=a/").toEval();
|
||||
expect("{} /* /a/ */ /=a/").toEval();
|
||||
|
||||
expect("(function () {} / 1)").toEval();
|
||||
expect("(function () {} / 1)").toEval();
|
||||
|
||||
expect("+a++ / 1").toEval();
|
||||
expect("+a-- / 1").toEval();
|
||||
expect("a.in / b").toEval();
|
||||
expect("a.instanceof / b").toEval();
|
||||
|
||||
// FIXME: Even more 'reserved' words are valid however the cases below do still need to pass.
|
||||
//expect("a.void / b").toEval();
|
||||
expect("void / b/").toEval();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue