{"action":"created","comment":{"url":"https://api.github.com/repos/jashkenas/coffeescript/pulls/comments/187823631","pull_request_review_id":119678726,"id":187823631,"diff_hunk":"@@ -50,22 +50,34 @@ run = (args, callback) ->\n \n \n # Build the CoffeeScript language from source.\n-buildParser = ->\n+buildParser = ({toTmpDir} = {}) ->\n   helpers.extend global, require 'util'\n   require 'jison'\n   # We don't need `moduleMain`, since the parser is unlikely to be run standalone.\n   parser = require('./lib/coffeescript/grammar').parser.generate(moduleMain: ->)\n-  fs.writeFileSync 'lib/coffeescript/parser.js', parser\n+  fs.mkdirSync 'lib/coffeescript/tmp' if toTmpDir and not fs.existsSync 'lib/coffeescript/tmp'\n+  fs.writeFileSync \"lib/coffeescript/#{if toTmpDir then 'tmp/' else ''}parser.js\", parser\n \n-buildExceptParser = (callback) ->\n+buildExceptParser = (callback, {match} = {}) ->\n   files = fs.readdirSync 'src'\n-  files = ('src/' + file for file in files when file.match(/\\.(lit)?coffee$/))\n+  files = ('src/' + file for file in files when file.match(/\\.(lit)?coffee$/) and if match then file.match(match) else true)\n   run ['-c', '-o', 'lib/coffeescript'].concat(files), callback\n \n build = (callback) ->\n   buildParser()\n   buildExceptParser callback\n \n+buildWithUpdatedGrammar = (callback) ->","path":"Cakefile","position":25,"original_position":25,"commit_id":"493972401775bf8414df029babaeef8b78e8b665","original_commit_id":"e495a313f17aad79cab44dc8158eac892c27e663","user":{"login":"GeoffreyBooth","id":456802,"avatar_url":"https://avatars2.githubusercontent.com/u/456802?v=4","gravatar_id":"","url":"https://api.github.com/users/GeoffreyBooth","html_url":"https://github.com/GeoffreyBooth","followers_url":"https://api.github.com/users/GeoffreyBooth/followers","following_url":"https://api.github.com/users/GeoffreyBooth/following{/other_user}","gists_url":"https://api.github.com/users/GeoffreyBooth/gists{/gist_id}","starred_url":"https://api.github.com/users/GeoffreyBooth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeoffreyBooth/subscriptions","organizations_url":"https://api.github.com/users/GeoffreyBooth/orgs","repos_url":"https://api.github.com/users/GeoffreyBooth/repos","events_url":"https://api.github.com/users/GeoffreyBooth/events{/privacy}","received_events_url":"https://api.github.com/users/GeoffreyBooth/received_events","type":"User","site_admin":false},"body":"I solved the problem through a Gulp task that watches my files as they change, and runs the relevant `build` command based on which ones have changed (e.g. including the parser or not):\r\nhttps://github.com/GeoffreyBooth/coffeescript-gulp/blob/master/gulpfile.coffee\r\n\r\nIt’s not a great solution, though, and I would be open to a solution that’s built into CoffeeScript/the `Cakefile` itself. This should probably be its own PR, though.","created_at":"2018-05-14T02:06:08Z","updated_at":"2018-05-14T02:06:08Z","html_url":"https://github.com/jashkenas/coffeescript/pull/5057#discussion_r187823631","pull_request_url":"https://api.github.com/repos/jashkenas/coffeescript/pulls/5057","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/jashkenas/coffeescript/pulls/comments/187823631"},"html":{"href":"https://github.com/jashkenas/coffeescript/pull/5057#discussion_r187823631"},"pull_request":{"href":"https://api.github.com/repos/jashkenas/coffeescript/pulls/5057"}},"in_reply_to_id":187818673},"pull_request":{"url":"https://api.github.com/repos/jashkenas/coffeescript/pulls/5057","id":186234413,"html_url":"https://github.com/jashkenas/coffeescript/pull/5057","diff_url":"https://github.com/jashkenas/coffeescript/pull/5057.diff","patch_url":"https://github.com/jashkenas/coffeescript/pull/5057.patch","issue_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/5057","number":5057,"state":"open","locked":false,"title":"WIP: Preserve original string literal","user":{"login":"helixbass","id":440230,"avatar_url":"https://avatars2.githubusercontent.com/u/440230?v=4","gravatar_id":"","url":"https://api.github.com/users/helixbass","html_url":"https://github.com/helixbass","followers_url":"https://api.github.com/users/helixbass/followers","following_url":"https://api.github.com/users/helixbass/following{/other_user}","gists_url":"https://api.github.com/users/helixbass/gists{/gist_id}","starred_url":"https://api.github.com/users/helixbass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helixbass/subscriptions","organizations_url":"https://api.github.com/users/helixbass/orgs","repos_url":"https://api.github.com/users/helixbass/repos","events_url":"https://api.github.com/users/helixbass/events{/privacy}","received_events_url":"https://api.github.com/users/helixbass/received_events","type":"User","site_admin":false},"body":"@GeoffreyBooth @zdenko I started on being able to preserve original string formatting into the nodes tree (eg for passing to Prettier). Haven't handled preserving heregex formatting yet but this should currently be preserving relevant string/heredoc info and all existing tests are passing (had to modify some since now a `STRING` token doesn't include the quotes etc)\r\n\r\nThe basic approach I took to getting the extra data through the grammar was similar to how we expose `generated` to the grammar for object braces: wrap a token-value string (`token[1]`) in a `new String()` object, at which point you can set arbitrary additional properties that will be visible on the token that the grammar sees (eg `$1`)\r\n\r\nSo far haven't tried to emit (via AST)/generate (via Prettier) the original quote eg `'''`/`\"\"\"` (or get it to shift the heredoc indentation level along with the surrounding indentation level, which should be fun), but I have made it so that for a `StringLiteral` that contains a newline, it generates a `TemplateLiteral` AST with the original string value which Prettier then reprints with original spacing/linebreaks intact (on my `prettier` branch/`prettier-plugin-coffeescript` repo)","created_at":"2018-05-07T00:16:58Z","updated_at":"2018-05-14T02:06:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"24deab07d8f857459018feef3952774895b52844","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/jashkenas/coffeescript/pulls/5057/commits","review_comments_url":"https://api.github.com/repos/jashkenas/coffeescript/pulls/5057/comments","review_comment_url":"https://api.github.com/repos/jashkenas/coffeescript/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/5057/comments","statuses_url":"https://api.github.com/repos/jashkenas/coffeescript/statuses/493972401775bf8414df029babaeef8b78e8b665","head":{"label":"helixbass:preserve-string-literal","ref":"preserve-string-literal","sha":"493972401775bf8414df029babaeef8b78e8b665","user":{"login":"helixbass","id":440230,"avatar_url":"https://avatars2.githubusercontent.com/u/440230?v=4","gravatar_id":"","url":"https://api.github.com/users/helixbass","html_url":"https://github.com/helixbass","followers_url":"https://api.github.com/users/helixbass/followers","following_url":"https://api.github.com/users/helixbass/following{/other_user}","gists_url":"https://api.github.com/users/helixbass/gists{/gist_id}","starred_url":"https://api.github.com/users/helixbass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helixbass/subscriptions","organizations_url":"https://api.github.com/users/helixbass/orgs","repos_url":"https://api.github.com/users/helixbass/repos","events_url":"https://api.github.com/users/helixbass/events{/privacy}","received_events_url":"https://api.github.com/users/helixbass/received_events","type":"User","site_admin":false},"repo":{"id":33657555,"name":"copheescript","full_name":"helixbass/copheescript","owner":{"login":"helixbass","id":440230,"avatar_url":"https://avatars2.githubusercontent.com/u/440230?v=4","gravatar_id":"","url":"https://api.github.com/users/helixbass","html_url":"https://github.com/helixbass","followers_url":"https://api.github.com/users/helixbass/followers","following_url":"https://api.github.com/users/helixbass/following{/other_user}","gists_url":"https://api.github.com/users/helixbass/gists{/gist_id}","starred_url":"https://api.github.com/users/helixbass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helixbass/subscriptions","organizations_url":"https://api.github.com/users/helixbass/orgs","repos_url":"https://api.github.com/users/helixbass/repos","events_url":"https://api.github.com/users/helixbass/events{/privacy}","received_events_url":"https://api.github.com/users/helixbass/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/helixbass/copheescript","description":"Unfancy JavaScript","fork":true,"url":"https://api.github.com/repos/helixbass/copheescript","forks_url":"https://api.github.com/repos/helixbass/copheescript/forks","keys_url":"https://api.github.com/repos/helixbass/copheescript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/helixbass/copheescript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/helixbass/copheescript/teams","hooks_url":"https://api.github.com/repos/helixbass/copheescript/hooks","issue_events_url":"https://api.github.com/repos/helixbass/copheescript/issues/events{/number}","events_url":"https://api.github.com/repos/helixbass/copheescript/events","assignees_url":"https://api.github.com/repos/helixbass/copheescript/assignees{/user}","branches_url":"https://api.github.com/repos/helixbass/copheescript/branches{/branch}","tags_url":"https://api.github.com/repos/helixbass/copheescript/tags","blobs_url":"https://api.github.com/repos/helixbass/copheescript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/helixbass/copheescript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/helixbass/copheescript/git/refs{/sha}","trees_url":"https://api.github.com/repos/helixbass/copheescript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/helixbass/copheescript/statuses/{sha}","languages_url":"https://api.github.com/repos/helixbass/copheescript/languages","stargazers_url":"https://api.github.com/repos/helixbass/copheescript/stargazers","contributors_url":"https://api.github.com/repos/helixbass/copheescript/contributors","subscribers_url":"https://api.github.com/repos/helixbass/copheescript/subscribers","subscription_url":"https://api.github.com/repos/helixbass/copheescript/subscription","commits_url":"https://api.github.com/repos/helixbass/copheescript/commits{/sha}","git_commits_url":"https://api.github.com/repos/helixbass/copheescript/git/commits{/sha}","comments_url":"https://api.github.com/repos/helixbass/copheescript/comments{/number}","issue_comment_url":"https://api.github.com/repos/helixbass/copheescript/issues/comments{/number}","contents_url":"https://api.github.com/repos/helixbass/copheescript/contents/{+path}","compare_url":"https://api.github.com/repos/helixbass/copheescript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/helixbass/copheescript/merges","archive_url":"https://api.github.com/repos/helixbass/copheescript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/helixbass/copheescript/downloads","issues_url":"https://api.github.com/repos/helixbass/copheescript/issues{/number}","pulls_url":"https://api.github.com/repos/helixbass/copheescript/pulls{/number}","milestones_url":"https://api.github.com/repos/helixbass/copheescript/milestones{/number}","notifications_url":"https://api.github.com/repos/helixbass/copheescript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/helixbass/copheescript/labels{/name}","releases_url":"https://api.github.com/repos/helixbass/copheescript/releases{/id}","deployments_url":"https://api.github.com/repos/helixbass/copheescript/deployments","created_at":"2015-04-09T08:28:47Z","updated_at":"2016-08-10T16:03:24Z","pushed_at":"2018-05-14T00:50:11Z","git_url":"git://github.com/helixbass/copheescript.git","ssh_url":"git@github.com:helixbass/copheescript.git","clone_url":"https://github.com/helixbass/copheescript.git","svn_url":"https://github.com/helixbass/copheescript","homepage":"http://coffeescript.org/","size":29107,"stargazers_count":2,"watchers_count":2,"language":"CoffeeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":7,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":7,"watchers":2,"default_branch":"master"}},"base":{"label":"jashkenas:master","ref":"master","sha":"7cf739e2b6da654dc5e2782a0ab860ca04f4c4e1","user":{"login":"jashkenas","id":4732,"avatar_url":"https://avatars3.githubusercontent.com/u/4732?v=4","gravatar_id":"","url":"https://api.github.com/users/jashkenas","html_url":"https://github.com/jashkenas","followers_url":"https://api.github.com/users/jashkenas/followers","following_url":"https://api.github.com/users/jashkenas/following{/other_user}","gists_url":"https://api.github.com/users/jashkenas/gists{/gist_id}","starred_url":"https://api.github.com/users/jashkenas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jashkenas/subscriptions","organizations_url":"https://api.github.com/users/jashkenas/orgs","repos_url":"https://api.github.com/users/jashkenas/repos","events_url":"https://api.github.com/users/jashkenas/events{/privacy}","received_events_url":"https://api.github.com/users/jashkenas/received_events","type":"User","site_admin":false},"repo":{"id":441269,"name":"coffeescript","full_name":"jashkenas/coffeescript","owner":{"login":"jashkenas","id":4732,"avatar_url":"https://avatars3.githubusercontent.com/u/4732?v=4","gravatar_id":"","url":"https://api.github.com/users/jashkenas","html_url":"https://github.com/jashkenas","followers_url":"https://api.github.com/users/jashkenas/followers","following_url":"https://api.github.com/users/jashkenas/following{/other_user}","gists_url":"https://api.github.com/users/jashkenas/gists{/gist_id}","starred_url":"https://api.github.com/users/jashkenas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jashkenas/subscriptions","organizations_url":"https://api.github.com/users/jashkenas/orgs","repos_url":"https://api.github.com/users/jashkenas/repos","events_url":"https://api.github.com/users/jashkenas/events{/privacy}","received_events_url":"https://api.github.com/users/jashkenas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jashkenas/coffeescript","description":"Unfancy JavaScript","fork":false,"url":"https://api.github.com/repos/jashkenas/coffeescript","forks_url":"https://api.github.com/repos/jashkenas/coffeescript/forks","keys_url":"https://api.github.com/repos/jashkenas/coffeescript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jashkenas/coffeescript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jashkenas/coffeescript/teams","hooks_url":"https://api.github.com/repos/jashkenas/coffeescript/hooks","issue_events_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/events{/number}","events_url":"https://api.github.com/repos/jashkenas/coffeescript/events","assignees_url":"https://api.github.com/repos/jashkenas/coffeescript/assignees{/user}","branches_url":"https://api.github.com/repos/jashkenas/coffeescript/branches{/branch}","tags_url":"https://api.github.com/repos/jashkenas/coffeescript/tags","blobs_url":"https://api.github.com/repos/jashkenas/coffeescript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jashkenas/coffeescript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jashkenas/coffeescript/git/refs{/sha}","trees_url":"https://api.github.com/repos/jashkenas/coffeescript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jashkenas/coffeescript/statuses/{sha}","languages_url":"https://api.github.com/repos/jashkenas/coffeescript/languages","stargazers_url":"https://api.github.com/repos/jashkenas/coffeescript/stargazers","contributors_url":"https://api.github.com/repos/jashkenas/coffeescript/contributors","subscribers_url":"https://api.github.com/repos/jashkenas/coffeescript/subscribers","subscription_url":"https://api.github.com/repos/jashkenas/coffeescript/subscription","commits_url":"https://api.github.com/repos/jashkenas/coffeescript/commits{/sha}","git_commits_url":"https://api.github.com/repos/jashkenas/coffeescript/git/commits{/sha}","comments_url":"https://api.github.com/repos/jashkenas/coffeescript/comments{/number}","issue_comment_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/comments{/number}","contents_url":"https://api.github.com/repos/jashkenas/coffeescript/contents/{+path}","compare_url":"https://api.github.com/repos/jashkenas/coffeescript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jashkenas/coffeescript/merges","archive_url":"https://api.github.com/repos/jashkenas/coffeescript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jashkenas/coffeescript/downloads","issues_url":"https://api.github.com/repos/jashkenas/coffeescript/issues{/number}","pulls_url":"https://api.github.com/repos/jashkenas/coffeescript/pulls{/number}","milestones_url":"https://api.github.com/repos/jashkenas/coffeescript/milestones{/number}","notifications_url":"https://api.github.com/repos/jashkenas/coffeescript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jashkenas/coffeescript/labels{/name}","releases_url":"https://api.github.com/repos/jashkenas/coffeescript/releases{/id}","deployments_url":"https://api.github.com/repos/jashkenas/coffeescript/deployments","created_at":"2009-12-18T01:39:53Z","updated_at":"2018-05-13T23:58:49Z","pushed_at":"2018-05-14T00:50:13Z","git_url":"git://github.com/jashkenas/coffeescript.git","ssh_url":"git@github.com:jashkenas/coffeescript.git","clone_url":"https://github.com/jashkenas/coffeescript.git","svn_url":"https://github.com/jashkenas/coffeescript","homepage":"http://coffeescript.org/","size":25223,"stargazers_count":14721,"watchers_count":14721,"language":"CoffeeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1971,"mirror_url":null,"archived":false,"open_issues_count":30,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1971,"open_issues":30,"watchers":14721,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jashkenas/coffeescript/pulls/5057"},"html":{"href":"https://github.com/jashkenas/coffeescript/pull/5057"},"issue":{"href":"https://api.github.com/repos/jashkenas/coffeescript/issues/5057"},"comments":{"href":"https://api.github.com/repos/jashkenas/coffeescript/issues/5057/comments"},"review_comments":{"href":"https://api.github.com/repos/jashkenas/coffeescript/pulls/5057/comments"},"review_comment":{"href":"https://api.github.com/repos/jashkenas/coffeescript/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jashkenas/coffeescript/pulls/5057/commits"},"statuses":{"href":"https://api.github.com/repos/jashkenas/coffeescript/statuses/493972401775bf8414df029babaeef8b78e8b665"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"GeoffreyBooth"}}