{"action":"created","comment":{"url":"https://api.github.com/repos/haskell/hsc2hs/pulls/comments/244870237","pull_request_review_id":188848480,"id":244870237,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0NDg3MDIzNw==","diff_hunk":"@@ -166,7 +166,11 @@ text = do\n                     text\n         '\\\"':_        -> do anyChar_; hsString '\\\"'; text\n         -- See Note [Single Quotes]\n-        '\\'':'\\\\':_ -> do any2Chars_; hsString '\\''; text -- Case 1\n+        '\\'':'\\\\':_ -> do -- Case 1\n+          any3Chars_\n+          manySatisfyC_ (/= '\\'')","path":"HSCParser.hs","position":7,"original_position":7,"commit_id":"8eef3aefc99ae63d97c6e928d80497188f943466","original_commit_id":"8eef3aefc99ae63d97c6e928d80497188f943466","user":{"login":"RyanGlScott","id":2364661,"node_id":"MDQ6VXNlcjIzNjQ2NjE=","avatar_url":"https://avatars2.githubusercontent.com/u/2364661?v=4","gravatar_id":"","url":"https://api.github.com/users/RyanGlScott","html_url":"https://github.com/RyanGlScott","followers_url":"https://api.github.com/users/RyanGlScott/followers","following_url":"https://api.github.com/users/RyanGlScott/following{/other_user}","gists_url":"https://api.github.com/users/RyanGlScott/gists{/gist_id}","starred_url":"https://api.github.com/users/RyanGlScott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RyanGlScott/subscriptions","organizations_url":"https://api.github.com/users/RyanGlScott/orgs","repos_url":"https://api.github.com/users/RyanGlScott/repos","events_url":"https://api.github.com/users/RyanGlScott/events{/privacy}","received_events_url":"https://api.github.com/users/RyanGlScott/received_events","type":"User","site_admin":false},"body":"> The specific cause of #16 was the presence of `'\\''` in source code.\r\n\r\nAh, I see. I was confused since the code in https://github.com/haskell/hsc2hs/issues/16#issue-395312581 didn't feature any single quotes (but now that I open the [full code](https://github.com/haskell/directory/blob/19d6dc0d33366a8920bf8acc7a0fd3ef533d39c3/System/Directory/Internal/Windows.hsc), I can spot them).\r\n\r\n> What was happening was that\r\n> \r\n> ```\r\n> do any2Chars_; hsString '\\''; text\r\n> ```\r\n> \r\n> Is applied to the token stream quote-backslash-quote-quote. Of course, this misses the last quote since it interprets the one before it as the closing quote. I used `any3Chars_` to ensure that we go ahead and match the first character of the potentially multi-character escape sequence.\r\n\r\nI still feel like I'm missing something. Isn't it possible that this case could be reached if the remaining input is only two characters long? If so, wouldn't using `any3Chars_` cause problems?\r\n\r\n> Alternatively, we could do:\r\n>\r\n> ```\r\n> '\\'':'\\\\':_ -> do anyChar_; hsString '\\''; text\r\n> ```\r\n>\r\n> This works, but `hsString` seems to handle multi-character escape sequences correctly either by accident or as clever trick that was never documented. So I thought I would avoid it. But if you prefer this version, I don't mind doing this instead.\r\n\r\nHm. I'm certainly not versed enough in this code to say whether I find one approach better than the other. There are other parts of the code that appear to use this `manySatisfy{C}_; text` idiom without issue, so if you find this approach cleaner, I'm happy with it.","created_at":"2019-01-02T22:12:48Z","updated_at":"2019-01-02T22:12:48Z","html_url":"https://github.com/haskell/hsc2hs/pull/17#discussion_r244870237","pull_request_url":"https://api.github.com/repos/haskell/hsc2hs/pulls/17","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/haskell/hsc2hs/pulls/comments/244870237"},"html":{"href":"https://github.com/haskell/hsc2hs/pull/17#discussion_r244870237"},"pull_request":{"href":"https://api.github.com/repos/haskell/hsc2hs/pulls/17"}},"in_reply_to_id":244842453},"pull_request":{"url":"https://api.github.com/repos/haskell/hsc2hs/pulls/17","id":241824684,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQxODI0Njg0","html_url":"https://github.com/haskell/hsc2hs/pull/17","diff_url":"https://github.com/haskell/hsc2hs/pull/17.diff","patch_url":"https://github.com/haskell/hsc2hs/pull/17.patch","issue_url":"https://api.github.com/repos/haskell/hsc2hs/issues/17","number":17,"state":"open","locked":false,"title":"fix the problem where the single quote character literal was not handled correctly","user":{"login":"andrewthad","id":5332484,"node_id":"MDQ6VXNlcjUzMzI0ODQ=","avatar_url":"https://avatars0.githubusercontent.com/u/5332484?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewthad","html_url":"https://github.com/andrewthad","followers_url":"https://api.github.com/users/andrewthad/followers","following_url":"https://api.github.com/users/andrewthad/following{/other_user}","gists_url":"https://api.github.com/users/andrewthad/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewthad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewthad/subscriptions","organizations_url":"https://api.github.com/users/andrewthad/orgs","repos_url":"https://api.github.com/users/andrewthad/repos","events_url":"https://api.github.com/users/andrewthad/events{/privacy}","received_events_url":"https://api.github.com/users/andrewthad/received_events","type":"User","site_admin":false},"body":"Resolves https://github.com/haskell/hsc2hs/issues/16","created_at":"2019-01-02T19:17:28Z","updated_at":"2019-01-02T22:12:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b3ead804f8f4d9da6ef3dcb232650e5d70bab9ae","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/haskell/hsc2hs/pulls/17/commits","review_comments_url":"https://api.github.com/repos/haskell/hsc2hs/pulls/17/comments","review_comment_url":"https://api.github.com/repos/haskell/hsc2hs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/haskell/hsc2hs/issues/17/comments","statuses_url":"https://api.github.com/repos/haskell/hsc2hs/statuses/8eef3aefc99ae63d97c6e928d80497188f943466","head":{"label":"andrewthad:escaped_single_quote","ref":"escaped_single_quote","sha":"8eef3aefc99ae63d97c6e928d80497188f943466","user":{"login":"andrewthad","id":5332484,"node_id":"MDQ6VXNlcjUzMzI0ODQ=","avatar_url":"https://avatars0.githubusercontent.com/u/5332484?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewthad","html_url":"https://github.com/andrewthad","followers_url":"https://api.github.com/users/andrewthad/followers","following_url":"https://api.github.com/users/andrewthad/following{/other_user}","gists_url":"https://api.github.com/users/andrewthad/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewthad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewthad/subscriptions","organizations_url":"https://api.github.com/users/andrewthad/orgs","repos_url":"https://api.github.com/users/andrewthad/repos","events_url":"https://api.github.com/users/andrewthad/events{/privacy}","received_events_url":"https://api.github.com/users/andrewthad/received_events","type":"User","site_admin":false},"repo":{"id":161686202,"node_id":"MDEwOlJlcG9zaXRvcnkxNjE2ODYyMDI=","name":"hsc2hs","full_name":"andrewthad/hsc2hs","private":false,"owner":{"login":"andrewthad","id":5332484,"node_id":"MDQ6VXNlcjUzMzI0ODQ=","avatar_url":"https://avatars0.githubusercontent.com/u/5332484?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewthad","html_url":"https://github.com/andrewthad","followers_url":"https://api.github.com/users/andrewthad/followers","following_url":"https://api.github.com/users/andrewthad/following{/other_user}","gists_url":"https://api.github.com/users/andrewthad/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewthad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewthad/subscriptions","organizations_url":"https://api.github.com/users/andrewthad/orgs","repos_url":"https://api.github.com/users/andrewthad/repos","events_url":"https://api.github.com/users/andrewthad/events{/privacy}","received_events_url":"https://api.github.com/users/andrewthad/received_events","type":"User","site_admin":false},"html_url":"https://github.com/andrewthad/hsc2hs","description":"Pre-processor for .hsc files","fork":true,"url":"https://api.github.com/repos/andrewthad/hsc2hs","forks_url":"https://api.github.com/repos/andrewthad/hsc2hs/forks","keys_url":"https://api.github.com/repos/andrewthad/hsc2hs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andrewthad/hsc2hs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andrewthad/hsc2hs/teams","hooks_url":"https://api.github.com/repos/andrewthad/hsc2hs/hooks","issue_events_url":"https://api.github.com/repos/andrewthad/hsc2hs/issues/events{/number}","events_url":"https://api.github.com/repos/andrewthad/hsc2hs/events","assignees_url":"https://api.github.com/repos/andrewthad/hsc2hs/assignees{/user}","branches_url":"https://api.github.com/repos/andrewthad/hsc2hs/branches{/branch}","tags_url":"https://api.github.com/repos/andrewthad/hsc2hs/tags","blobs_url":"https://api.github.com/repos/andrewthad/hsc2hs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andrewthad/hsc2hs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andrewthad/hsc2hs/git/refs{/sha}","trees_url":"https://api.github.com/repos/andrewthad/hsc2hs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andrewthad/hsc2hs/statuses/{sha}","languages_url":"https://api.github.com/repos/andrewthad/hsc2hs/languages","stargazers_url":"https://api.github.com/repos/andrewthad/hsc2hs/stargazers","contributors_url":"https://api.github.com/repos/andrewthad/hsc2hs/contributors","subscribers_url":"https://api.github.com/repos/andrewthad/hsc2hs/subscribers","subscription_url":"https://api.github.com/repos/andrewthad/hsc2hs/subscription","commits_url":"https://api.github.com/repos/andrewthad/hsc2hs/commits{/sha}","git_commits_url":"https://api.github.com/repos/andrewthad/hsc2hs/git/commits{/sha}","comments_url":"https://api.github.com/repos/andrewthad/hsc2hs/comments{/number}","issue_comment_url":"https://api.github.com/repos/andrewthad/hsc2hs/issues/comments{/number}","contents_url":"https://api.github.com/repos/andrewthad/hsc2hs/contents/{+path}","compare_url":"https://api.github.com/repos/andrewthad/hsc2hs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andrewthad/hsc2hs/merges","archive_url":"https://api.github.com/repos/andrewthad/hsc2hs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andrewthad/hsc2hs/downloads","issues_url":"https://api.github.com/repos/andrewthad/hsc2hs/issues{/number}","pulls_url":"https://api.github.com/repos/andrewthad/hsc2hs/pulls{/number}","milestones_url":"https://api.github.com/repos/andrewthad/hsc2hs/milestones{/number}","notifications_url":"https://api.github.com/repos/andrewthad/hsc2hs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andrewthad/hsc2hs/labels{/name}","releases_url":"https://api.github.com/repos/andrewthad/hsc2hs/releases{/id}","deployments_url":"https://api.github.com/repos/andrewthad/hsc2hs/deployments","created_at":"2018-12-13T19:34:42Z","updated_at":"2018-12-13T19:34:44Z","pushed_at":"2019-01-02T19:16:50Z","git_url":"git://github.com/andrewthad/hsc2hs.git","ssh_url":"git@github.com:andrewthad/hsc2hs.git","clone_url":"https://github.com/andrewthad/hsc2hs.git","svn_url":"https://github.com/andrewthad/hsc2hs","homepage":"http://hackage.haskell.org/package/hsc2hs","size":235,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"haskell:master","ref":"master","sha":"ff3ed88dae4da213485cd035ee8aac036b83f09c","user":{"login":"haskell","id":450574,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1MDU3NA==","avatar_url":"https://avatars1.githubusercontent.com/u/450574?v=4","gravatar_id":"","url":"https://api.github.com/users/haskell","html_url":"https://github.com/haskell","followers_url":"https://api.github.com/users/haskell/followers","following_url":"https://api.github.com/users/haskell/following{/other_user}","gists_url":"https://api.github.com/users/haskell/gists{/gist_id}","starred_url":"https://api.github.com/users/haskell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haskell/subscriptions","organizations_url":"https://api.github.com/users/haskell/orgs","repos_url":"https://api.github.com/users/haskell/repos","events_url":"https://api.github.com/users/haskell/events{/privacy}","received_events_url":"https://api.github.com/users/haskell/received_events","type":"Organization","site_admin":false},"repo":{"id":107773130,"node_id":"MDEwOlJlcG9zaXRvcnkxMDc3NzMxMzA=","name":"hsc2hs","full_name":"haskell/hsc2hs","private":false,"owner":{"login":"haskell","id":450574,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1MDU3NA==","avatar_url":"https://avatars1.githubusercontent.com/u/450574?v=4","gravatar_id":"","url":"https://api.github.com/users/haskell","html_url":"https://github.com/haskell","followers_url":"https://api.github.com/users/haskell/followers","following_url":"https://api.github.com/users/haskell/following{/other_user}","gists_url":"https://api.github.com/users/haskell/gists{/gist_id}","starred_url":"https://api.github.com/users/haskell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haskell/subscriptions","organizations_url":"https://api.github.com/users/haskell/orgs","repos_url":"https://api.github.com/users/haskell/repos","events_url":"https://api.github.com/users/haskell/events{/privacy}","received_events_url":"https://api.github.com/users/haskell/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/haskell/hsc2hs","description":"Pre-processor for .hsc files","fork":false,"url":"https://api.github.com/repos/haskell/hsc2hs","forks_url":"https://api.github.com/repos/haskell/hsc2hs/forks","keys_url":"https://api.github.com/repos/haskell/hsc2hs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haskell/hsc2hs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haskell/hsc2hs/teams","hooks_url":"https://api.github.com/repos/haskell/hsc2hs/hooks","issue_events_url":"https://api.github.com/repos/haskell/hsc2hs/issues/events{/number}","events_url":"https://api.github.com/repos/haskell/hsc2hs/events","assignees_url":"https://api.github.com/repos/haskell/hsc2hs/assignees{/user}","branches_url":"https://api.github.com/repos/haskell/hsc2hs/branches{/branch}","tags_url":"https://api.github.com/repos/haskell/hsc2hs/tags","blobs_url":"https://api.github.com/repos/haskell/hsc2hs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haskell/hsc2hs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haskell/hsc2hs/git/refs{/sha}","trees_url":"https://api.github.com/repos/haskell/hsc2hs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haskell/hsc2hs/statuses/{sha}","languages_url":"https://api.github.com/repos/haskell/hsc2hs/languages","stargazers_url":"https://api.github.com/repos/haskell/hsc2hs/stargazers","contributors_url":"https://api.github.com/repos/haskell/hsc2hs/contributors","subscribers_url":"https://api.github.com/repos/haskell/hsc2hs/subscribers","subscription_url":"https://api.github.com/repos/haskell/hsc2hs/subscription","commits_url":"https://api.github.com/repos/haskell/hsc2hs/commits{/sha}","git_commits_url":"https://api.github.com/repos/haskell/hsc2hs/git/commits{/sha}","comments_url":"https://api.github.com/repos/haskell/hsc2hs/comments{/number}","issue_comment_url":"https://api.github.com/repos/haskell/hsc2hs/issues/comments{/number}","contents_url":"https://api.github.com/repos/haskell/hsc2hs/contents/{+path}","compare_url":"https://api.github.com/repos/haskell/hsc2hs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haskell/hsc2hs/merges","archive_url":"https://api.github.com/repos/haskell/hsc2hs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haskell/hsc2hs/downloads","issues_url":"https://api.github.com/repos/haskell/hsc2hs/issues{/number}","pulls_url":"https://api.github.com/repos/haskell/hsc2hs/pulls{/number}","milestones_url":"https://api.github.com/repos/haskell/hsc2hs/milestones{/number}","notifications_url":"https://api.github.com/repos/haskell/hsc2hs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haskell/hsc2hs/labels{/name}","releases_url":"https://api.github.com/repos/haskell/hsc2hs/releases{/id}","deployments_url":"https://api.github.com/repos/haskell/hsc2hs/deployments","created_at":"2017-10-21T11:01:22Z","updated_at":"2018-12-28T16:08:19Z","pushed_at":"2019-01-02T19:17:29Z","git_url":"git://github.com/haskell/hsc2hs.git","ssh_url":"git@github.com:haskell/hsc2hs.git","clone_url":"https://github.com/haskell/hsc2hs.git","svn_url":"https://github.com/haskell/hsc2hs","homepage":"http://hackage.haskell.org/package/hsc2hs","size":231,"stargazers_count":12,"watchers_count":12,"language":"Haskell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":6,"open_issues":5,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/haskell/hsc2hs/pulls/17"},"html":{"href":"https://github.com/haskell/hsc2hs/pull/17"},"issue":{"href":"https://api.github.com/repos/haskell/hsc2hs/issues/17"},"comments":{"href":"https://api.github.com/repos/haskell/hsc2hs/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/haskell/hsc2hs/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/haskell/hsc2hs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/haskell/hsc2hs/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/haskell/hsc2hs/statuses/8eef3aefc99ae63d97c6e928d80497188f943466"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"RyanGlScott"}}