mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:18:11 +00:00
LibJS: Lex and parse regex literals, add RegExp objects
This adds regex parsing/lexing, as well as a relatively empty RegExpObject. The purpose of this patch is to allow the engine to not get hung up on parsing regexes. This will aid in finding new syntax errors (say, from google or twitter) without having to replace all of their regexes first!
This commit is contained in:
parent
984a6ff97b
commit
61ac1d3ffa
20 changed files with 424 additions and 5 deletions
|
@ -39,6 +39,7 @@
|
|||
#include <LibJS/Runtime/NativeFunction.h>
|
||||
#include <LibJS/Runtime/PrimitiveString.h>
|
||||
#include <LibJS/Runtime/Reference.h>
|
||||
#include <LibJS/Runtime/RegExpObject.h>
|
||||
#include <LibJS/Runtime/ScriptFunction.h>
|
||||
#include <LibJS/Runtime/Shape.h>
|
||||
#include <LibJS/Runtime/StringObject.h>
|
||||
|
@ -1429,6 +1430,17 @@ Value NullLiteral::execute(Interpreter&) const
|
|||
return js_null();
|
||||
}
|
||||
|
||||
void RegExpLiteral::dump(int indent) const
|
||||
{
|
||||
print_indent(indent);
|
||||
printf("%s (/%s/%s)\n", class_name(), content().characters(), flags().characters());
|
||||
}
|
||||
|
||||
Value RegExpLiteral::execute(Interpreter& interpreter) const
|
||||
{
|
||||
return RegExpObject::create(interpreter.global_object(), content(), flags());
|
||||
}
|
||||
|
||||
void ArrayExpression::dump(int indent) const
|
||||
{
|
||||
ASTNode::dump(indent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue