mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-29 10:02:14 +00:00
implement String.prototype.match, parseInt
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
8eeef7b4cb
commit
c22735e9b3
9 changed files with 276 additions and 22 deletions
|
|
@ -293,4 +293,22 @@ ArrayObject* RegExpObject::createRegExpMatchedArray(ExecutionState& state, const
|
|||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
void RegExpObject::pushBackToRegExpMatchedArray(ExecutionState& state, ArrayObject* array, size_t& index, const size_t limit, const RegexMatchResult& result, String* str)
|
||||
{
|
||||
for (unsigned i = 0; i < result.m_matchResults.size(); i++) {
|
||||
for (unsigned j = 0; j < result.m_matchResults[i].size(); j++) {
|
||||
if (i == 0 && j == 0)
|
||||
continue;
|
||||
|
||||
if (std::numeric_limits<unsigned>::max() == result.m_matchResults[i][j].m_start) {
|
||||
array->defineOwnPropertyThrowsException(state, ObjectPropertyName(state, Value(index++)), ObjectPropertyDescriptorForDefineOwnProperty(Value(), ObjectPropertyDescriptorForDefineOwnProperty::AllPresent));
|
||||
} else {
|
||||
array->defineOwnPropertyThrowsException(state, ObjectPropertyName(state, Value(index++)), ObjectPropertyDescriptorForDefineOwnProperty(str->subString(result.m_matchResults[i][j].m_start, result.m_matchResults[i][j].m_end), ObjectPropertyDescriptorForDefineOwnProperty::AllPresent));
|
||||
}
|
||||
if (index == limit)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue