{"action":"closed","number":465,"pull_request":{"url":"https://api.github.com/repos/mozilla/sweet.js/pulls/465","id":31987964,"html_url":"https://github.com/mozilla/sweet.js/pull/465","diff_url":"https://github.com/mozilla/sweet.js/pull/465.diff","patch_url":"https://github.com/mozilla/sweet.js/pull/465.patch","issue_url":"https://api.github.com/repos/mozilla/sweet.js/issues/465","number":465,"state":"closed","locked":false,"title":"Automatic Macro Refactoring (Macrofication)","user":{"login":"levjj","id":479238,"avatar_url":"https://avatars.githubusercontent.com/u/479238?v=3","gravatar_id":"","url":"https://api.github.com/users/levjj","html_url":"https://github.com/levjj","followers_url":"https://api.github.com/users/levjj/followers","following_url":"https://api.github.com/users/levjj/following{/other_user}","gists_url":"https://api.github.com/users/levjj/gists{/gist_id}","starred_url":"https://api.github.com/users/levjj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/levjj/subscriptions","organizations_url":"https://api.github.com/users/levjj/orgs","repos_url":"https://api.github.com/users/levjj/repos","events_url":"https://api.github.com/users/levjj/events{/privacy}","received_events_url":"https://api.github.com/users/levjj/received_events","type":"User","site_admin":false},"body":"For rule macros, it is possible to automatically refactor code with macros by using the template (body of the rule macro) to match syntax and replace it with the corresponding macro invocation based on the pattern.  This pull request adds support for this type of \"macrofication\" refactoring.  In order to use this features, I added a command line flag (-r) and integrated the refactoring into the sweet.js editor.  Using the editor is definitely the preferred way of refactoring as it highlights the code and let's you chose which code to replace by a macro:\r\n\r\n![letall](https://cloud.githubusercontent.com/assets/479238/6840293/95e60808-d332-11e4-9e5f-af3d592c6a84.png)\r\n\r\nThe macrofication option in the editor is off by default but seems to work pretty good.  Limitations are some special kind of \"expr\" pattern classes and locally scoped macro definitions.  Also, the highlighting is mutually exclusive with the expansion highlighting due to a limitation in CodeMirror.  The only way around this problem would be to write some extension to CodeMirror that supports multiple syntax highlighters at the same time.\r\n\r\nThis pull request is based on the patch for supporting repeated variables: [#540](https://github.com/mozilla/sweet.js/pull/450).","created_at":"2015-03-26T04:06:06Z","updated_at":"2015-07-28T20:56:25Z","closed_at":"2015-07-28T20:56:25Z","merged_at":"2015-07-28T20:56:25Z","merge_commit_sha":"4382cbbd0c978511528fd3ff5a2ffb28d30639c1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/sweet.js/pulls/465/commits","review_comments_url":"https://api.github.com/repos/mozilla/sweet.js/pulls/465/comments","review_comment_url":"https://api.github.com/repos/mozilla/sweet.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/sweet.js/issues/465/comments","statuses_url":"https://api.github.com/repos/mozilla/sweet.js/statuses/0d86f131c4f033546d233f6e8b575d1063bc51ef","head":{"label":"levjj:reverse-matching","ref":"reverse-matching","sha":"0d86f131c4f033546d233f6e8b575d1063bc51ef","user":{"login":"levjj","id":479238,"avatar_url":"https://avatars.githubusercontent.com/u/479238?v=3","gravatar_id":"","url":"https://api.github.com/users/levjj","html_url":"https://github.com/levjj","followers_url":"https://api.github.com/users/levjj/followers","following_url":"https://api.github.com/users/levjj/following{/other_user}","gists_url":"https://api.github.com/users/levjj/gists{/gist_id}","starred_url":"https://api.github.com/users/levjj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/levjj/subscriptions","organizations_url":"https://api.github.com/users/levjj/orgs","repos_url":"https://api.github.com/users/levjj/repos","events_url":"https://api.github.com/users/levjj/events{/privacy}","received_events_url":"https://api.github.com/users/levjj/received_events","type":"User","site_admin":false},"repo":{"id":28825161,"name":"sweet.js","full_name":"levjj/sweet.js","owner":{"login":"levjj","id":479238,"avatar_url":"https://avatars.githubusercontent.com/u/479238?v=3","gravatar_id":"","url":"https://api.github.com/users/levjj","html_url":"https://github.com/levjj","followers_url":"https://api.github.com/users/levjj/followers","following_url":"https://api.github.com/users/levjj/following{/other_user}","gists_url":"https://api.github.com/users/levjj/gists{/gist_id}","starred_url":"https://api.github.com/users/levjj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/levjj/subscriptions","organizations_url":"https://api.github.com/users/levjj/orgs","repos_url":"https://api.github.com/users/levjj/repos","events_url":"https://api.github.com/users/levjj/events{/privacy}","received_events_url":"https://api.github.com/users/levjj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/levjj/sweet.js","description":"Sweeten your JavaScript.","fork":true,"url":"https://api.github.com/repos/levjj/sweet.js","forks_url":"https://api.github.com/repos/levjj/sweet.js/forks","keys_url":"https://api.github.com/repos/levjj/sweet.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/levjj/sweet.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/levjj/sweet.js/teams","hooks_url":"https://api.github.com/repos/levjj/sweet.js/hooks","issue_events_url":"https://api.github.com/repos/levjj/sweet.js/issues/events{/number}","events_url":"https://api.github.com/repos/levjj/sweet.js/events","assignees_url":"https://api.github.com/repos/levjj/sweet.js/assignees{/user}","branches_url":"https://api.github.com/repos/levjj/sweet.js/branches{/branch}","tags_url":"https://api.github.com/repos/levjj/sweet.js/tags","blobs_url":"https://api.github.com/repos/levjj/sweet.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/levjj/sweet.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/levjj/sweet.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/levjj/sweet.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/levjj/sweet.js/statuses/{sha}","languages_url":"https://api.github.com/repos/levjj/sweet.js/languages","stargazers_url":"https://api.github.com/repos/levjj/sweet.js/stargazers","contributors_url":"https://api.github.com/repos/levjj/sweet.js/contributors","subscribers_url":"https://api.github.com/repos/levjj/sweet.js/subscribers","subscription_url":"https://api.github.com/repos/levjj/sweet.js/subscription","commits_url":"https://api.github.com/repos/levjj/sweet.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/levjj/sweet.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/levjj/sweet.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/levjj/sweet.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/levjj/sweet.js/contents/{+path}","compare_url":"https://api.github.com/repos/levjj/sweet.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/levjj/sweet.js/merges","archive_url":"https://api.github.com/repos/levjj/sweet.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/levjj/sweet.js/downloads","issues_url":"https://api.github.com/repos/levjj/sweet.js/issues{/number}","pulls_url":"https://api.github.com/repos/levjj/sweet.js/pulls{/number}","milestones_url":"https://api.github.com/repos/levjj/sweet.js/milestones{/number}","notifications_url":"https://api.github.com/repos/levjj/sweet.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/levjj/sweet.js/labels{/name}","releases_url":"https://api.github.com/repos/levjj/sweet.js/releases{/id}","created_at":"2015-01-05T18:16:03Z","updated_at":"2015-01-05T18:18:14Z","pushed_at":"2015-05-08T01:09:06Z","git_url":"git://github.com/levjj/sweet.js.git","ssh_url":"git@github.com:levjj/sweet.js.git","clone_url":"https://github.com/levjj/sweet.js.git","svn_url":"https://github.com/levjj/sweet.js","homepage":"http://sweetjs.org","size":15769,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"bbe0375f8be2347fbab03c14f3ccc6edeadb0328","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":5263633,"name":"sweet.js","full_name":"mozilla/sweet.js","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/sweet.js","description":"Sweeten your JavaScript.","fork":false,"url":"https://api.github.com/repos/mozilla/sweet.js","forks_url":"https://api.github.com/repos/mozilla/sweet.js/forks","keys_url":"https://api.github.com/repos/mozilla/sweet.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/sweet.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/sweet.js/teams","hooks_url":"https://api.github.com/repos/mozilla/sweet.js/hooks","issue_events_url":"https://api.github.com/repos/mozilla/sweet.js/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/sweet.js/events","assignees_url":"https://api.github.com/repos/mozilla/sweet.js/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/sweet.js/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/sweet.js/tags","blobs_url":"https://api.github.com/repos/mozilla/sweet.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/sweet.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/sweet.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/sweet.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/sweet.js/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/sweet.js/languages","stargazers_url":"https://api.github.com/repos/mozilla/sweet.js/stargazers","contributors_url":"https://api.github.com/repos/mozilla/sweet.js/contributors","subscribers_url":"https://api.github.com/repos/mozilla/sweet.js/subscribers","subscription_url":"https://api.github.com/repos/mozilla/sweet.js/subscription","commits_url":"https://api.github.com/repos/mozilla/sweet.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/sweet.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/sweet.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/sweet.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/sweet.js/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/sweet.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/sweet.js/merges","archive_url":"https://api.github.com/repos/mozilla/sweet.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/sweet.js/downloads","issues_url":"https://api.github.com/repos/mozilla/sweet.js/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/sweet.js/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/sweet.js/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/sweet.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/sweet.js/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/sweet.js/releases{/id}","created_at":"2012-08-01T19:26:02Z","updated_at":"2015-07-28T20:22:07Z","pushed_at":"2015-07-28T20:56:23Z","git_url":"git://github.com/mozilla/sweet.js.git","ssh_url":"git@github.com:mozilla/sweet.js.git","clone_url":"https://github.com/mozilla/sweet.js.git","svn_url":"https://github.com/mozilla/sweet.js","homepage":"http://sweetjs.org","size":19890,"stargazers_count":3107,"watchers_count":3107,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":168,"mirror_url":null,"open_issues_count":103,"forks":168,"open_issues":103,"watchers":3107,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/sweet.js/pulls/465"},"html":{"href":"https://github.com/mozilla/sweet.js/pull/465"},"issue":{"href":"https://api.github.com/repos/mozilla/sweet.js/issues/465"},"comments":{"href":"https://api.github.com/repos/mozilla/sweet.js/issues/465/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/sweet.js/pulls/465/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/sweet.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/sweet.js/pulls/465/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/sweet.js/statuses/0d86f131c4f033546d233f6e8b575d1063bc51ef"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"disnet","id":2362,"avatar_url":"https://avatars.githubusercontent.com/u/2362?v=3","gravatar_id":"","url":"https://api.github.com/users/disnet","html_url":"https://github.com/disnet","followers_url":"https://api.github.com/users/disnet/followers","following_url":"https://api.github.com/users/disnet/following{/other_user}","gists_url":"https://api.github.com/users/disnet/gists{/gist_id}","starred_url":"https://api.github.com/users/disnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/disnet/subscriptions","organizations_url":"https://api.github.com/users/disnet/orgs","repos_url":"https://api.github.com/users/disnet/repos","events_url":"https://api.github.com/users/disnet/events{/privacy}","received_events_url":"https://api.github.com/users/disnet/received_events","type":"User","site_admin":false},"comments":0,"review_comments":2,"commits":16,"additions":1290,"deletions":103,"changed_files":18}}