GitHub PullRequestReviewCommentEvent at 2014-02-20 23:24:27
Repository: ios-strings-parser
Actor: jugyo
Payload: {"comment":{"url":"https://api.github.com/repos/camertron/ios-strings-parser/pulls/comments/9930111","id":9930111,"diff_hunk":"@@ -0,0 +1,47 @@\n+module IosStringsParser\n+  class RegexParser\n+    IosString = Struct.new(:meta_key, :key, :comment)\n+\n+    REGEX = /\n+      \\/\\*[\\s\\n]*(?<comment>.*?)[\\s\\n]*\\*\\/ # multi line comment\n+      |\n+      \\/\\/\\s*(?<comment>.*?)\\s*\\n # single line comment\n+      |\n+      [\"'](?<meta_key>.*?)[\"']\\s*=\\s*[\"'](?<key>.*?)[\"']\\s*; # string","path":"lib/ios-strings-parser/regex_parser.rb","position":10,"original_position":10,"commit_id":"b52db5ef56a91b848e2032c5ff95513d5d7c412a","original_commit_id":"b52db5ef56a91b848e2032c5ff95513d5d7c412a","user":{"login":"jugyo","id":7354,"avatar_url":"https://gravatar.com/avatar/142f56fa109167d398a312e968485087?d=https%3A%2F%2Fidenticons.github.com%2F547b85f3fafdf30856386753dc21c4e1.png&r=x","gravatar_id":"142f56fa109167d398a312e968485087","url":"https://api.github.com/users/jugyo","html_url":"https://github.com/jugyo","followers_url":"https://api.github.com/users/jugyo/followers","following_url":"https://api.github.com/users/jugyo/following{/other_user}","gists_url":"https://api.github.com/users/jugyo/gists{/gist_id}","starred_url":"https://api.github.com/users/jugyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jugyo/subscriptions","organizations_url":"https://api.github.com/users/jugyo/orgs","repos_url":"https://api.github.com/users/jugyo/repos","events_url":"https://api.github.com/users/jugyo/events{/privacy}","received_events_url":"https://api.github.com/users/jugyo/received_events","type":"User","site_admin":false},"body":"Hi @jakl,\r\n\r\n1) I'm using such regex for single comments because I'd like to ignore spaces after \\n.\r\ni.e.\r\n```\r\nirb> \"aaaa  \\n  aaaa\".match(/\\w+\\s*/)\r\n=> #<MatchData \"aaaa  \\n  \">\r\nirb> \"aaaa  \\n  aaaa\".match(/\\w+\\s*\\n/)\r\n=> #<MatchData \"aaaa  \\n\">\r\nirb> \r\n```\r\n2) I'll use .+? for meta_key and key. Good catch!\r\n3) As you say, only double quotes are supported, but actually we can use single quote as well, somehow.\r\n4) As you say, if meta_key has `\\\" = ` parsing will fail. Yeah, ideally I need a good parser. I'll try to fix it.\r\n","created_at":"2014-02-20T23:24:27Z","updated_at":"2014-02-20T23:24:27Z","html_url":"https://github.com/camertron/ios-strings-parser/pull/1#discussion_r9930111","pull_request_url":"https://api.github.com/repos/camertron/ios-strings-parser/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/camertron/ios-strings-parser/pulls/comments/9930111"},"html":{"href":"https://github.com/camertron/ios-strings-parser/pull/1#discussion_r9930111"},"pull_request":{"href":"https://api.github.com/repos/camertron/ios-strings-parser/pulls/1"}}}}