mirror of
https://github.com/ccxvii/mujs.git
synced 2026-02-06 01:41:37 +08:00
Strip backslash from escaped / when lexing regular expressions.
This commit is contained in:
14
jslex.c
14
jslex.c
@@ -464,11 +464,15 @@ static int lexregexp(js_State *J)
|
||||
if (PEEK == 0 || PEEK == '\n') {
|
||||
jsY_error(J, "regular expression not terminated");
|
||||
} else if (ACCEPT('\\')) {
|
||||
textpush(J, '\\');
|
||||
if (PEEK == 0 || PEEK == '\n')
|
||||
jsY_error(J, "regular expression not terminated");
|
||||
textpush(J, PEEK);
|
||||
NEXT();
|
||||
if (ACCEPT('/')) {
|
||||
textpush(J, '/');
|
||||
} else {
|
||||
textpush(J, '\\');
|
||||
if (PEEK == 0 || PEEK == '\n')
|
||||
jsY_error(J, "regular expression not terminated");
|
||||
textpush(J, PEEK);
|
||||
NEXT();
|
||||
}
|
||||
} else {
|
||||
textpush(J, PEEK);
|
||||
NEXT();
|
||||
|
||||
Reference in New Issue
Block a user