{"action":"created","comment":{"url":"https://api.github.com/repos/jerryscript-project/jerryscript/pulls/comments/100508694","pull_request_review_id":21218093,"id":100508694,"diff_hunk":"@@ -458,6 +462,207 @@ lit_char_is_word_char (ecma_char_t c) /**< code unit */\n           || c == LIT_CHAR_UNDERSCORE);\n } /* lit_char_is_word_char */\n \n+#ifndef CONFIG_DISABLE_UNICODE_CASE_CONVERSION\n+\n+/**\n+ * Check if the specified character is part of the jerry_character_case_ranges table.\n+ *\n+ * @return the mapped character sequence of an ecma character, if it's in the table.\n+ *         0 - otherwise.\n+ */\n+static ecma_length_t\n+search_in_character_case_ranges (ecma_char_t character,        /**< code unit */\n+                                 ecma_char_t *output_buffer_p, /**< [out] buffer for the result characters */\n+                                 bool is_lowercase)            /**< is lowercase conversion */\n+{\n+  int num_of_two_ranges = NUM_OF_ELEMENTS (jerry_character_case_ranges);\n+\n+  int conv_counter = 0;\n+\n+  for (int i = 0; i < num_of_two_ranges; i++)\n+  {\n+    if (i % 2 == 0 && i > 0)\n+    {\n+      conv_counter++;\n+    }\n+\n+    int range_length = jerry_character_case_range_lengths[conv_counter];\n+    ecma_char_t start_point = jerry_character_case_ranges[i];\n+\n+    if (start_point > character || character >= start_point + range_length)\n+    {\n+      continue;\n+    }\n+\n+    int char_dist = character - start_point;\n+\n+    if (i % 2 == 0)\n+    {\n+      output_buffer_p[0] = is_lowercase ? (ecma_char_t) (jerry_character_case_ranges[i + 1] + char_dist) : character;\n+    }\n+    else\n+    {\n+      output_buffer_p[0] = is_lowercase ? character : (ecma_char_t) (jerry_character_case_ranges[i - 1] + char_dist);\n+    }\n+\n+    return 1;\n+  }\n+\n+  return 0;\n+} /* search_in_character_case_ranges */\n+\n+/**\n+ * Check if the specified character is part of the character_pair_ranges table.\n+ *\n+ * @return the mapped character sequence of an ecma character, if it's in the table.\n+ *         0 - otherwise.\n+ */\n+static ecma_length_t\n+search_in_character_pair_ranges (ecma_char_t character,        /**< code unit */\n+                                 ecma_char_t *output_buffer_p, /**< [out] buffer for the result characters */\n+                                 bool is_lowercase)            /**< is lowercase conversion */\n+{\n+  int bottom = 0;\n+  int top = NUM_OF_ELEMENTS (jerry_character_pair_ranges) - 1;\n+\n+  while (bottom <= top)\n+  {\n+    int middle = (bottom + top) / 2;\n+    ecma_char_t current_sp = jerry_character_pair_ranges[middle];\n+\n+    if (current_sp <= character && character < current_sp + jerry_character_pair_range_lengths[middle])\n+    {\n+      int char_dist = character - current_sp;\n+\n+      if ((character - current_sp) % 2 == 0)\n+      {\n+        output_buffer_p[0] = is_lowercase ? (ecma_char_t) (current_sp + char_dist + 1) : character;\n+      }\n+      else\n+      {\n+        output_buffer_p[0] = is_lowercase ? character : (ecma_char_t) (current_sp + char_dist - 1);\n+      }\n+\n+      return 1;\n+    }\n+\n+    if (character > current_sp)\n+    {\n+      bottom = middle + 1;\n+    }\n+    else\n+    {\n+      top = middle - 1;\n+    }\n+  }\n+\n+  return 0;\n+} /* search_in_character_pair_ranges */\n+\n+/**\n+ * Check if the specified character is part of the character_pairs table.\n+ *\n+ * @return the mapped character sequence of an ecma character, if it's in the table.\n+ *         0 - otherwise.\n+ */\n+static ecma_length_t\n+search_in_character_pairs (ecma_char_t character,        /**< code unit */\n+                           ecma_char_t *output_buffer_p, /**< [out] buffer for the result characters */\n+                           bool is_lowercase)            /**< is lowercase conversion */\n+{\n+  int num_of_character_pairs = NUM_OF_ELEMENTS (jerry_character_pairs);\n+\n+  for (int i = 0; i < num_of_character_pairs; i++)\n+  {\n+    if (character != jerry_character_pairs[i])\n+    {\n+      continue;\n+    }\n+\n+    if (i % 2 == 0)\n+    {\n+      output_buffer_p[0] = is_lowercase ? jerry_character_pairs[i + 1] : character;\n+    }\n+    else\n+    {\n+      output_buffer_p[0] = is_lowercase ? character : jerry_character_pairs[i - 1];\n+    }\n+\n+    return 1;\n+  }\n+\n+  return 0;\n+} /* search_in_character_pairs */\n+\n+/**\n+ * Check if the specified character is in the given conversion table.\n+ *\n+ * @return the mapped character sequence of an ecma character, if it's in the table.\n+ *         0 - otherwise.\n+ */\n+static ecma_length_t\n+search_in_conversion_table (ecma_char_t character,        /**< code unit */\n+                            ecma_char_t *output_buffer_p, /**< [out] buffer for the result characters */\n+                            const ecma_char_t *array,     /**< array */\n+                            const uint8_t *counters)      /**< case_values counter */\n+{\n+  int end_point = 0;\n+  for (int i = 0; i < 3; i++)\n+  {\n+    int start_point = end_point;\n+    int size_of_case_value = i + 1;\n+    end_point += (counters[i] * (size_of_case_value + 1));\n+\n+    int bottom = start_point;\n+    int top = end_point - size_of_case_value;\n+\n+    while (bottom <= top)\n+    {\n+      int middle = (bottom + top) / 2;\n+\n+      middle -= ((middle - bottom) % (size_of_case_value + 1));\n+\n+      ecma_char_t current = array[middle];\n+\n+      if (current == character)\n+      {\n+        if (size_of_case_value == 1)\n+        {\n+          output_buffer_p[0] = array[middle + 1];\n+          return 1;\n+        }\n+        else if (size_of_case_value == 2)\n+        {\n+          output_buffer_p[0] = array[middle + 1];\n+          output_buffer_p[1] = array[middle + 2];\n+          return 2;\n+        }\n+        else\n+        {\n+          JERRY_ASSERT (size_of_case_value == 3);\n+          output_buffer_p[0] = array[middle + 1];\n+          output_buffer_p[1] = array[middle + 2];\n+          output_buffer_p[2] = array[middle + 3];\n+\n+          return 3;\n+        }","path":"jerry-core/lit/lit-char-helpers.c","position":198,"original_position":198,"commit_id":"1e1566e629db7f0db8043517f39a9101ac07a2ee","original_commit_id":"1e1566e629db7f0db8043517f39a9101ac07a2ee","user":{"login":"zherczeg","id":2270193,"avatar_url":"https://avatars.githubusercontent.com/u/2270193?v=3","gravatar_id":"","url":"https://api.github.com/users/zherczeg","html_url":"https://github.com/zherczeg","followers_url":"https://api.github.com/users/zherczeg/followers","following_url":"https://api.github.com/users/zherczeg/following{/other_user}","gists_url":"https://api.github.com/users/zherczeg/gists{/gist_id}","starred_url":"https://api.github.com/users/zherczeg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zherczeg/subscriptions","organizations_url":"https://api.github.com/users/zherczeg/orgs","repos_url":"https://api.github.com/users/zherczeg/repos","events_url":"https://api.github.com/users/zherczeg/events{/privacy}","received_events_url":"https://api.github.com/users/zherczeg/received_events","type":"User","site_admin":false},"body":"You could use a switch here with \"fallthrough\":\r\n\r\n    switch(size_of_case_value)\r\n    {\r\n      case 3:\r\n        ...\r\n        /* FALLTHRU */\r\n      case 2:\r\n        ...\r\n        /* FALLTHRU */\r\n      default:\r\n        ...\r\n    }","created_at":"2017-02-10T10:33:07Z","updated_at":"2017-02-10T10:33:07Z","html_url":"https://github.com/jerryscript-project/jerryscript/pull/1575#discussion_r100508694","pull_request_url":"https://api.github.com/repos/jerryscript-project/jerryscript/pulls/1575","_links":{"self":{"href":"https://api.github.com/repos/jerryscript-project/jerryscript/pulls/comments/100508694"},"html":{"href":"https://github.com/jerryscript-project/jerryscript/pull/1575#discussion_r100508694"},"pull_request":{"href":"https://api.github.com/repos/jerryscript-project/jerryscript/pulls/1575"}}},"pull_request":{"url":"https://api.github.com/repos/jerryscript-project/jerryscript/pulls/1575","id":105596103,"html_url":"https://github.com/jerryscript-project/jerryscript/pull/1575","diff_url":"https://github.com/jerryscript-project/jerryscript/pull/1575.diff","patch_url":"https://github.com/jerryscript-project/jerryscript/pull/1575.patch","issue_url":"https://api.github.com/repos/jerryscript-project/jerryscript/issues/1575","number":1575,"state":"open","locked":false,"title":"Improve `toLowerCase` and `toUpperCase` functions.","user":{"login":"robertsipka","id":4920564,"avatar_url":"https://avatars.githubusercontent.com/u/4920564?v=3","gravatar_id":"","url":"https://api.github.com/users/robertsipka","html_url":"https://github.com/robertsipka","followers_url":"https://api.github.com/users/robertsipka/followers","following_url":"https://api.github.com/users/robertsipka/following{/other_user}","gists_url":"https://api.github.com/users/robertsipka/gists{/gist_id}","starred_url":"https://api.github.com/users/robertsipka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertsipka/subscriptions","organizations_url":"https://api.github.com/users/robertsipka/orgs","repos_url":"https://api.github.com/users/robertsipka/repos","events_url":"https://api.github.com/users/robertsipka/events{/privacy}","received_events_url":"https://api.github.com/users/robertsipka/received_events","type":"User","site_admin":false},"body":"Language-sensitive mappings are not processed now.\r\nBinary size: 136160\t -> 137684\r\n\"Fixes #323\" ","created_at":"2017-02-10T09:52:01Z","updated_at":"2017-02-10T10:33:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ccbf5ca1506fc65d01d8aa117f4da77e9c926ff8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/jerryscript-project/jerryscript/pulls/1575/commits","review_comments_url":"https://api.github.com/repos/jerryscript-project/jerryscript/pulls/1575/comments","review_comment_url":"https://api.github.com/repos/jerryscript-project/jerryscript/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jerryscript-project/jerryscript/issues/1575/comments","statuses_url":"https://api.github.com/repos/jerryscript-project/jerryscript/statuses/1e1566e629db7f0db8043517f39a9101ac07a2ee","head":{"label":"robertsipka:case_conversion","ref":"case_conversion","sha":"1e1566e629db7f0db8043517f39a9101ac07a2ee","user":{"login":"robertsipka","id":4920564,"avatar_url":"https://avatars.githubusercontent.com/u/4920564?v=3","gravatar_id":"","url":"https://api.github.com/users/robertsipka","html_url":"https://github.com/robertsipka","followers_url":"https://api.github.com/users/robertsipka/followers","following_url":"https://api.github.com/users/robertsipka/following{/other_user}","gists_url":"https://api.github.com/users/robertsipka/gists{/gist_id}","starred_url":"https://api.github.com/users/robertsipka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertsipka/subscriptions","organizations_url":"https://api.github.com/users/robertsipka/orgs","repos_url":"https://api.github.com/users/robertsipka/repos","events_url":"https://api.github.com/users/robertsipka/events{/privacy}","received_events_url":"https://api.github.com/users/robertsipka/received_events","type":"User","site_admin":false},"repo":{"id":51063380,"name":"jerryscript","full_name":"robertsipka/jerryscript","owner":{"login":"robertsipka","id":4920564,"avatar_url":"https://avatars.githubusercontent.com/u/4920564?v=3","gravatar_id":"","url":"https://api.github.com/users/robertsipka","html_url":"https://github.com/robertsipka","followers_url":"https://api.github.com/users/robertsipka/followers","following_url":"https://api.github.com/users/robertsipka/following{/other_user}","gists_url":"https://api.github.com/users/robertsipka/gists{/gist_id}","starred_url":"https://api.github.com/users/robertsipka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertsipka/subscriptions","organizations_url":"https://api.github.com/users/robertsipka/orgs","repos_url":"https://api.github.com/users/robertsipka/repos","events_url":"https://api.github.com/users/robertsipka/events{/privacy}","received_events_url":"https://api.github.com/users/robertsipka/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/robertsipka/jerryscript","description":"Ultra-lightweight JavaScript engine for Internet of Things. http://www.jerryscript.net","fork":true,"url":"https://api.github.com/repos/robertsipka/jerryscript","forks_url":"https://api.github.com/repos/robertsipka/jerryscript/forks","keys_url":"https://api.github.com/repos/robertsipka/jerryscript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robertsipka/jerryscript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robertsipka/jerryscript/teams","hooks_url":"https://api.github.com/repos/robertsipka/jerryscript/hooks","issue_events_url":"https://api.github.com/repos/robertsipka/jerryscript/issues/events{/number}","events_url":"https://api.github.com/repos/robertsipka/jerryscript/events","assignees_url":"https://api.github.com/repos/robertsipka/jerryscript/assignees{/user}","branches_url":"https://api.github.com/repos/robertsipka/jerryscript/branches{/branch}","tags_url":"https://api.github.com/repos/robertsipka/jerryscript/tags","blobs_url":"https://api.github.com/repos/robertsipka/jerryscript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robertsipka/jerryscript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robertsipka/jerryscript/git/refs{/sha}","trees_url":"https://api.github.com/repos/robertsipka/jerryscript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robertsipka/jerryscript/statuses/{sha}","languages_url":"https://api.github.com/repos/robertsipka/jerryscript/languages","stargazers_url":"https://api.github.com/repos/robertsipka/jerryscript/stargazers","contributors_url":"https://api.github.com/repos/robertsipka/jerryscript/contributors","subscribers_url":"https://api.github.com/repos/robertsipka/jerryscript/subscribers","subscription_url":"https://api.github.com/repos/robertsipka/jerryscript/subscription","commits_url":"https://api.github.com/repos/robertsipka/jerryscript/commits{/sha}","git_commits_url":"https://api.github.com/repos/robertsipka/jerryscript/git/commits{/sha}","comments_url":"https://api.github.com/repos/robertsipka/jerryscript/comments{/number}","issue_comment_url":"https://api.github.com/repos/robertsipka/jerryscript/issues/comments{/number}","contents_url":"https://api.github.com/repos/robertsipka/jerryscript/contents/{+path}","compare_url":"https://api.github.com/repos/robertsipka/jerryscript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robertsipka/jerryscript/merges","archive_url":"https://api.github.com/repos/robertsipka/jerryscript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robertsipka/jerryscript/downloads","issues_url":"https://api.github.com/repos/robertsipka/jerryscript/issues{/number}","pulls_url":"https://api.github.com/repos/robertsipka/jerryscript/pulls{/number}","milestones_url":"https://api.github.com/repos/robertsipka/jerryscript/milestones{/number}","notifications_url":"https://api.github.com/repos/robertsipka/jerryscript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robertsipka/jerryscript/labels{/name}","releases_url":"https://api.github.com/repos/robertsipka/jerryscript/releases{/id}","deployments_url":"https://api.github.com/repos/robertsipka/jerryscript/deployments","created_at":"2016-02-04T08:49:02Z","updated_at":"2016-07-20T12:24:57Z","pushed_at":"2017-02-10T09:55:21Z","git_url":"git://github.com/robertsipka/jerryscript.git","ssh_url":"git@github.com:robertsipka/jerryscript.git","clone_url":"https://github.com/robertsipka/jerryscript.git","svn_url":"https://github.com/robertsipka/jerryscript","homepage":"","size":13397,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jerryscript-project:master","ref":"master","sha":"bfc5bee39419f12757fd4fe4213eaeaaec68e2d6","user":{"login":"jerryscript-project","id":23194380,"avatar_url":"https://avatars.githubusercontent.com/u/23194380?v=3","gravatar_id":"","url":"https://api.github.com/users/jerryscript-project","html_url":"https://github.com/jerryscript-project","followers_url":"https://api.github.com/users/jerryscript-project/followers","following_url":"https://api.github.com/users/jerryscript-project/following{/other_user}","gists_url":"https://api.github.com/users/jerryscript-project/gists{/gist_id}","starred_url":"https://api.github.com/users/jerryscript-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerryscript-project/subscriptions","organizations_url":"https://api.github.com/users/jerryscript-project/orgs","repos_url":"https://api.github.com/users/jerryscript-project/repos","events_url":"https://api.github.com/users/jerryscript-project/events{/privacy}","received_events_url":"https://api.github.com/users/jerryscript-project/received_events","type":"Organization","site_admin":false},"repo":{"id":33339660,"name":"jerryscript","full_name":"jerryscript-project/jerryscript","owner":{"login":"jerryscript-project","id":23194380,"avatar_url":"https://avatars.githubusercontent.com/u/23194380?v=3","gravatar_id":"","url":"https://api.github.com/users/jerryscript-project","html_url":"https://github.com/jerryscript-project","followers_url":"https://api.github.com/users/jerryscript-project/followers","following_url":"https://api.github.com/users/jerryscript-project/following{/other_user}","gists_url":"https://api.github.com/users/jerryscript-project/gists{/gist_id}","starred_url":"https://api.github.com/users/jerryscript-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerryscript-project/subscriptions","organizations_url":"https://api.github.com/users/jerryscript-project/orgs","repos_url":"https://api.github.com/users/jerryscript-project/repos","events_url":"https://api.github.com/users/jerryscript-project/events{/privacy}","received_events_url":"https://api.github.com/users/jerryscript-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jerryscript-project/jerryscript","description":"Ultra-lightweight JavaScript engine for the Internet of Things.","fork":false,"url":"https://api.github.com/repos/jerryscript-project/jerryscript","forks_url":"https://api.github.com/repos/jerryscript-project/jerryscript/forks","keys_url":"https://api.github.com/repos/jerryscript-project/jerryscript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jerryscript-project/jerryscript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jerryscript-project/jerryscript/teams","hooks_url":"https://api.github.com/repos/jerryscript-project/jerryscript/hooks","issue_events_url":"https://api.github.com/repos/jerryscript-project/jerryscript/issues/events{/number}","events_url":"https://api.github.com/repos/jerryscript-project/jerryscript/events","assignees_url":"https://api.github.com/repos/jerryscript-project/jerryscript/assignees{/user}","branches_url":"https://api.github.com/repos/jerryscript-project/jerryscript/branches{/branch}","tags_url":"https://api.github.com/repos/jerryscript-project/jerryscript/tags","blobs_url":"https://api.github.com/repos/jerryscript-project/jerryscript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jerryscript-project/jerryscript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jerryscript-project/jerryscript/git/refs{/sha}","trees_url":"https://api.github.com/repos/jerryscript-project/jerryscript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jerryscript-project/jerryscript/statuses/{sha}","languages_url":"https://api.github.com/repos/jerryscript-project/jerryscript/languages","stargazers_url":"https://api.github.com/repos/jerryscript-project/jerryscript/stargazers","contributors_url":"https://api.github.com/repos/jerryscript-project/jerryscript/contributors","subscribers_url":"https://api.github.com/repos/jerryscript-project/jerryscript/subscribers","subscription_url":"https://api.github.com/repos/jerryscript-project/jerryscript/subscription","commits_url":"https://api.github.com/repos/jerryscript-project/jerryscript/commits{/sha}","git_commits_url":"https://api.github.com/repos/jerryscript-project/jerryscript/git/commits{/sha}","comments_url":"https://api.github.com/repos/jerryscript-project/jerryscript/comments{/number}","issue_comment_url":"https://api.github.com/repos/jerryscript-project/jerryscript/issues/comments{/number}","contents_url":"https://api.github.com/repos/jerryscript-project/jerryscript/contents/{+path}","compare_url":"https://api.github.com/repos/jerryscript-project/jerryscript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jerryscript-project/jerryscript/merges","archive_url":"https://api.github.com/repos/jerryscript-project/jerryscript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jerryscript-project/jerryscript/downloads","issues_url":"https://api.github.com/repos/jerryscript-project/jerryscript/issues{/number}","pulls_url":"https://api.github.com/repos/jerryscript-project/jerryscript/pulls{/number}","milestones_url":"https://api.github.com/repos/jerryscript-project/jerryscript/milestones{/number}","notifications_url":"https://api.github.com/repos/jerryscript-project/jerryscript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jerryscript-project/jerryscript/labels{/name}","releases_url":"https://api.github.com/repos/jerryscript-project/jerryscript/releases{/id}","deployments_url":"https://api.github.com/repos/jerryscript-project/jerryscript/deployments","created_at":"2015-04-03T01:10:31Z","updated_at":"2017-02-10T05:28:14Z","pushed_at":"2017-02-10T10:05:27Z","git_url":"git://github.com/jerryscript-project/jerryscript.git","ssh_url":"git@github.com:jerryscript-project/jerryscript.git","clone_url":"https://github.com/jerryscript-project/jerryscript.git","svn_url":"https://github.com/jerryscript-project/jerryscript","homepage":"http://jerryscript.net","size":27998,"stargazers_count":2143,"watchers_count":2143,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":237,"mirror_url":null,"open_issues_count":22,"forks":237,"open_issues":22,"watchers":2143,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jerryscript-project/jerryscript/pulls/1575"},"html":{"href":"https://github.com/jerryscript-project/jerryscript/pull/1575"},"issue":{"href":"https://api.github.com/repos/jerryscript-project/jerryscript/issues/1575"},"comments":{"href":"https://api.github.com/repos/jerryscript-project/jerryscript/issues/1575/comments"},"review_comments":{"href":"https://api.github.com/repos/jerryscript-project/jerryscript/pulls/1575/comments"},"review_comment":{"href":"https://api.github.com/repos/jerryscript-project/jerryscript/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jerryscript-project/jerryscript/pulls/1575/commits"},"statuses":{"href":"https://api.github.com/repos/jerryscript-project/jerryscript/statuses/1e1566e629db7f0db8043517f39a9101ac07a2ee"}}}}
{"actor":{"display_login":"zherczeg"}}