-
Notifications
You must be signed in to change notification settings - Fork 677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement ECMA262 RegExp builtin object and RegExp engine #169
Conversation
The RegExp engine is not feature complete, but the core features are working. The patch is huge, so we can start the review process now. The RegExp engine is blocking a few string builtin function, so we need this patch with the core features and we can add the unimplemented things in a separate PR. |
@egavrin, please review |
ECMA_TRY_CATCH (obj_this, ecma_op_to_object (this_arg), ret_value); | ||
|
||
ecma_object_t *obj_p = ecma_get_object_from_value (obj_this); | ||
ecma_property_t *bytecode_prop = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if there is no bytecode on the this object?
For example:
var re = new RegExp("a")
re.exec.call({}, "a")
I've updated the PR. |
string_desc_p->is_stack_var = false; | ||
string_desc_p->container = ECMA_STRING_CONTAINER_HEAP_CHUNKS; | ||
string_desc_p->hash = ecma_chars_buffer_calc_hash_last_chars (string_p, length); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra new line.
for (uint32_t i = 0; i < re_ctx.num_of_captures; i += 2) | ||
{ | ||
ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 (i / 2); | ||
if (re_ctx.saved_p[i] && re_ctx.saved_p[i + 1] && re_ctx.saved_p[i + 1] >= re_ctx.saved_p[i]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing empty line
@LaszloLango we're leaving too many things for "unicode integration". General coding style, including comments provided by reviewers can be fixed within 3-4 hours. And the whole PR would be really OK. I clearly understand the fact that not all components of the engine follow the common style, but we definitely should fix this. So, I have no intention to increase technical debt of the project. Please, fix all issues in the pull request carefully. |
I wouldn't mind creating a single patch from the work, but creating 7 requires too much work. At least another week. This is just slowing us down unnecessarily, especially with such a tight deadlines. Regex is required for full conformance, and the success of Jerry project. Working on this forever would jeopardize our aims! |
727b54f
to
a59cd65
Compare
@egavrin, I've updated the PR. Please check |
@egavrin, I've updated the PR. Please check |
* @return unsigned integer | ||
*/ | ||
uint32_t | ||
ecma_char_hex_to_int (char hex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you removed this function from lexer.cpp
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan [email protected] JerryScript-DCO-1.0-Signed-off-by: László Langó [email protected]
JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan [email protected] JerryScript-DCO-1.0-Signed-off-by: László Langó [email protected]
…ber of characters, instead of zero-terminated string. JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan [email protected] JerryScript-DCO-1.0-Signed-off-by: László Langó [email protected]
…ion, ECMA-262 v5, 15.10.2.6); move hex_to_int from lexer to jerry-core/ecma/base/ecma-helpers-char.cpp, renaming it to ecma_char_hex_to_int. JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan [email protected] JerryScript-DCO-1.0-Signed-off-by: László Langó [email protected]
JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan [email protected] JerryScript-DCO-1.0-Signed-off-by: László Langó [email protected]
…, RegExp and RegExp.prototype built-in objects. JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan [email protected] JerryScript-DCO-1.0-Signed-off-by: László Langó [email protected]
- add regular expressions support to JS parser and interpreter; - add tests for regular expressions. JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan [email protected] JerryScript-DCO-1.0-Signed-off-by: László Langó [email protected]
JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan [email protected]
JerryScript-DCO-1.0-Signed-off-by: László Langó [email protected]