Skip to content

Commit

Permalink
parser: implement Unicode keys parsing
Browse files Browse the repository at this point in the history
Add two possible options to use when checking whether the code
point is an identifier.
  • Loading branch information
belochub committed Jun 6, 2017
1 parent ee68f3e commit 8942748
Show file tree
Hide file tree
Showing 5 changed files with 795 additions and 669 deletions.
5 changes: 2 additions & 3 deletions src/jsrs_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ using jstp::unicode_utils::IsWhiteSpaceCharacter;
using jstp::unicode_utils::IsLineTerminatorSequence;
using jstp::unicode_utils::Utf8ToCodePoint;
using jstp::unicode_utils::IsIdStartCodePoint;
using jstp::unicode_utils::IsIdContinueCodePoint;
using jstp::unicode_utils::IsIdPartCodePoint;

namespace jstp {

Expand Down Expand Up @@ -619,13 +619,12 @@ MaybeLocal<String> ParseKeyInObject(Isolate* isolate,
}
} else {
size_t current_length = 0;

size_t cp_size;
uint32_t cp;
while (current_length < *size) {
cp = Utf8ToCodePoint(begin + current_length, &cp_size);
if (current_length == 0 ? IsIdStartCodePoint(cp) :
IsIdContinueCodePoint(cp)) {
IsIdPartCodePoint(cp)) {
current_length += cp_size;
} else {
if (current_length != 0) {
Expand Down
Loading

0 comments on commit 8942748

Please sign in to comment.