{"action":"created","comment":{"url":"https://api.github.com/repos/droplet-editor/droplet/pulls/comments/32862756","id":32862756,"diff_hunk":"@@ -607,6 +615,29 @@ JavaScriptParser.drop = (block, context, pred) ->\n \n   return helper.DISCOURAGE\n \n+isStandardForLoop = (node) ->\n+  unless node.init? and node.test? and node.update?\n+    return false\n+\n+  # A standard for loop starts with \"var a =\" or \"a = \"\n+  if node.init.type is 'VariableDeclaration'\n+    variableName = node.init.declarations[0].id.name\n+  else if node.init.type is 'AssignmentExpression' and\n+      node.operator is '=' and\n+      node.left.type is 'Identifier'\n+    variableName = node.left.name\n+  else\n+    return false\n+\n+  return (node.test.type is 'BinaryExpression' and\n+      node.test.operator is '<' and\n+      node.test.left.type is 'Identifier' and\n+      node.test.left.name is variableName and\n+      node.update.type is 'UpdateExpression' and\n+      node.update.operator is '++' and\n+      node.update.argument.type is 'Identifier' and","path":"src/languages/javascript.coffee","position":51,"original_position":51,"commit_id":"aab01761aa38d0636493082bc6fc11ba3503af76","original_commit_id":"aab01761aa38d0636493082bc6fc11ba3503af76","user":{"login":"davidbau","id":3458792,"avatar_url":"https://avatars.githubusercontent.com/u/3458792?v=3","gravatar_id":"","url":"https://api.github.com/users/davidbau","html_url":"https://github.com/davidbau","followers_url":"https://api.github.com/users/davidbau/followers","following_url":"https://api.github.com/users/davidbau/following{/other_user}","gists_url":"https://api.github.com/users/davidbau/gists{/gist_id}","starred_url":"https://api.github.com/users/davidbau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidbau/subscriptions","organizations_url":"https://api.github.com/users/davidbau/orgs","repos_url":"https://api.github.com/users/davidbau/repos","events_url":"https://api.github.com/users/davidbau/events{/privacy}","received_events_url":"https://api.github.com/users/davidbau/received_events","type":"User","site_admin":false},"body":"Does this accept both predecrement and postdecrment?  (If so that's good.  Predecrement is arguably the better canonical form in a loop. http://stackoverflow.com/questions/561588/what-is-more-efficient-i-or-i/561609 )","created_at":"2015-06-19T19:47:48Z","updated_at":"2015-06-19T19:47:48Z","html_url":"https://github.com/droplet-editor/droplet/pull/82#discussion_r32862756","pull_request_url":"https://api.github.com/repos/droplet-editor/droplet/pulls/82","_links":{"self":{"href":"https://api.github.com/repos/droplet-editor/droplet/pulls/comments/32862756"},"html":{"href":"https://github.com/droplet-editor/droplet/pull/82#discussion_r32862756"},"pull_request":{"href":"https://api.github.com/repos/droplet-editor/droplet/pulls/82"}}},"pull_request":{"url":"https://api.github.com/repos/droplet-editor/droplet/pulls/82","id":38134958,"html_url":"https://github.com/droplet-editor/droplet/pull/82","diff_url":"https://github.com/droplet-editor/droplet/pull/82.diff","patch_url":"https://github.com/droplet-editor/droplet/pull/82.patch","issue_url":"https://api.github.com/repos/droplet-editor/droplet/issues/82","number":82,"state":"open","locked":false,"title":"Beginner mode for \"for\" loops","user":{"login":"dabbler0","id":682790,"avatar_url":"https://avatars.githubusercontent.com/u/682790?v=3","gravatar_id":"","url":"https://api.github.com/users/dabbler0","html_url":"https://github.com/dabbler0","followers_url":"https://api.github.com/users/dabbler0/followers","following_url":"https://api.github.com/users/dabbler0/following{/other_user}","gists_url":"https://api.github.com/users/dabbler0/gists{/gist_id}","starred_url":"https://api.github.com/users/dabbler0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dabbler0/subscriptions","organizations_url":"https://api.github.com/users/dabbler0/orgs","repos_url":"https://api.github.com/users/dabbler0/repos","events_url":"https://api.github.com/users/dabbler0/events{/privacy}","received_events_url":"https://api.github.com/users/dabbler0/received_events","type":"User","site_admin":false},"body":"Embedders can now specify beginner mode with a flag in the \"categories\" option:\r\n```javascript\r\n//...\r\nmodeOptions: {\r\n  categories: {\r\n    loops: {\r\n      color: \"green\",\r\n      beginner: true\r\n    }\r\n  }\r\n}\r\n//...\r\n```\r\n\r\nThis will make for loops of this form mark only \"b\":\r\n```javascript\r\nfor (var i = 0; i < b; i++) {\r\n  //...\r\n}\r\n```\r\n\r\nIt is currently very picky about which loops it chooses to do this with; they must be exactly of the form `(/*var*/ a = x; a < b; a++)` and `a` must be the same identifier in all three expressions.","created_at":"2015-06-19T18:32:39Z","updated_at":"2015-06-19T19:47:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1bc2df3415a3165acfa8056b813141661d2ee02d","assignee":{"login":"davidbau","id":3458792,"avatar_url":"https://avatars.githubusercontent.com/u/3458792?v=3","gravatar_id":"","url":"https://api.github.com/users/davidbau","html_url":"https://github.com/davidbau","followers_url":"https://api.github.com/users/davidbau/followers","following_url":"https://api.github.com/users/davidbau/following{/other_user}","gists_url":"https://api.github.com/users/davidbau/gists{/gist_id}","starred_url":"https://api.github.com/users/davidbau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidbau/subscriptions","organizations_url":"https://api.github.com/users/davidbau/orgs","repos_url":"https://api.github.com/users/davidbau/repos","events_url":"https://api.github.com/users/davidbau/events{/privacy}","received_events_url":"https://api.github.com/users/davidbau/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/droplet-editor/droplet/pulls/82/commits","review_comments_url":"https://api.github.com/repos/droplet-editor/droplet/pulls/82/comments","review_comment_url":"https://api.github.com/repos/droplet-editor/droplet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/droplet-editor/droplet/issues/82/comments","statuses_url":"https://api.github.com/repos/droplet-editor/droplet/statuses/aab01761aa38d0636493082bc6fc11ba3503af76","head":{"label":"droplet-editor:beginner-mode","ref":"beginner-mode","sha":"aab01761aa38d0636493082bc6fc11ba3503af76","user":{"login":"droplet-editor","id":12835604,"avatar_url":"https://avatars.githubusercontent.com/u/12835604?v=3","gravatar_id":"","url":"https://api.github.com/users/droplet-editor","html_url":"https://github.com/droplet-editor","followers_url":"https://api.github.com/users/droplet-editor/followers","following_url":"https://api.github.com/users/droplet-editor/following{/other_user}","gists_url":"https://api.github.com/users/droplet-editor/gists{/gist_id}","starred_url":"https://api.github.com/users/droplet-editor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/droplet-editor/subscriptions","organizations_url":"https://api.github.com/users/droplet-editor/orgs","repos_url":"https://api.github.com/users/droplet-editor/repos","events_url":"https://api.github.com/users/droplet-editor/events{/privacy}","received_events_url":"https://api.github.com/users/droplet-editor/received_events","type":"Organization","site_admin":false},"repo":{"id":15754563,"name":"droplet","full_name":"droplet-editor/droplet","owner":{"login":"droplet-editor","id":12835604,"avatar_url":"https://avatars.githubusercontent.com/u/12835604?v=3","gravatar_id":"","url":"https://api.github.com/users/droplet-editor","html_url":"https://github.com/droplet-editor","followers_url":"https://api.github.com/users/droplet-editor/followers","following_url":"https://api.github.com/users/droplet-editor/following{/other_user}","gists_url":"https://api.github.com/users/droplet-editor/gists{/gist_id}","starred_url":"https://api.github.com/users/droplet-editor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/droplet-editor/subscriptions","organizations_url":"https://api.github.com/users/droplet-editor/orgs","repos_url":"https://api.github.com/users/droplet-editor/repos","events_url":"https://api.github.com/users/droplet-editor/events{/privacy}","received_events_url":"https://api.github.com/users/droplet-editor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/droplet-editor/droplet","description":"Block language reenvisioned as a text editor","fork":false,"url":"https://api.github.com/repos/droplet-editor/droplet","forks_url":"https://api.github.com/repos/droplet-editor/droplet/forks","keys_url":"https://api.github.com/repos/droplet-editor/droplet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/droplet-editor/droplet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/droplet-editor/droplet/teams","hooks_url":"https://api.github.com/repos/droplet-editor/droplet/hooks","issue_events_url":"https://api.github.com/repos/droplet-editor/droplet/issues/events{/number}","events_url":"https://api.github.com/repos/droplet-editor/droplet/events","assignees_url":"https://api.github.com/repos/droplet-editor/droplet/assignees{/user}","branches_url":"https://api.github.com/repos/droplet-editor/droplet/branches{/branch}","tags_url":"https://api.github.com/repos/droplet-editor/droplet/tags","blobs_url":"https://api.github.com/repos/droplet-editor/droplet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/droplet-editor/droplet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/droplet-editor/droplet/git/refs{/sha}","trees_url":"https://api.github.com/repos/droplet-editor/droplet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/droplet-editor/droplet/statuses/{sha}","languages_url":"https://api.github.com/repos/droplet-editor/droplet/languages","stargazers_url":"https://api.github.com/repos/droplet-editor/droplet/stargazers","contributors_url":"https://api.github.com/repos/droplet-editor/droplet/contributors","subscribers_url":"https://api.github.com/repos/droplet-editor/droplet/subscribers","subscription_url":"https://api.github.com/repos/droplet-editor/droplet/subscription","commits_url":"https://api.github.com/repos/droplet-editor/droplet/commits{/sha}","git_commits_url":"https://api.github.com/repos/droplet-editor/droplet/git/commits{/sha}","comments_url":"https://api.github.com/repos/droplet-editor/droplet/comments{/number}","issue_comment_url":"https://api.github.com/repos/droplet-editor/droplet/issues/comments{/number}","contents_url":"https://api.github.com/repos/droplet-editor/droplet/contents/{+path}","compare_url":"https://api.github.com/repos/droplet-editor/droplet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/droplet-editor/droplet/merges","archive_url":"https://api.github.com/repos/droplet-editor/droplet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/droplet-editor/droplet/downloads","issues_url":"https://api.github.com/repos/droplet-editor/droplet/issues{/number}","pulls_url":"https://api.github.com/repos/droplet-editor/droplet/pulls{/number}","milestones_url":"https://api.github.com/repos/droplet-editor/droplet/milestones{/number}","notifications_url":"https://api.github.com/repos/droplet-editor/droplet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/droplet-editor/droplet/labels{/name}","releases_url":"https://api.github.com/repos/droplet-editor/droplet/releases{/id}","created_at":"2014-01-09T02:27:23Z","updated_at":"2015-06-18T17:27:57Z","pushed_at":"2015-06-19T19:00:48Z","git_url":"git://github.com/droplet-editor/droplet.git","ssh_url":"git@github.com:droplet-editor/droplet.git","clone_url":"https://github.com/droplet-editor/droplet.git","svn_url":"https://github.com/droplet-editor/droplet","homepage":"experiment.pencilcode.net/anthony/droplet/example/example.html","size":31567,"stargazers_count":73,"watchers_count":73,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":11,"forks":34,"open_issues":11,"watchers":73,"default_branch":"master"}},"base":{"label":"droplet-editor:master","ref":"master","sha":"a7fe15cab36f69c8c01a33eb3541c8241bc84f15","user":{"login":"droplet-editor","id":12835604,"avatar_url":"https://avatars.githubusercontent.com/u/12835604?v=3","gravatar_id":"","url":"https://api.github.com/users/droplet-editor","html_url":"https://github.com/droplet-editor","followers_url":"https://api.github.com/users/droplet-editor/followers","following_url":"https://api.github.com/users/droplet-editor/following{/other_user}","gists_url":"https://api.github.com/users/droplet-editor/gists{/gist_id}","starred_url":"https://api.github.com/users/droplet-editor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/droplet-editor/subscriptions","organizations_url":"https://api.github.com/users/droplet-editor/orgs","repos_url":"https://api.github.com/users/droplet-editor/repos","events_url":"https://api.github.com/users/droplet-editor/events{/privacy}","received_events_url":"https://api.github.com/users/droplet-editor/received_events","type":"Organization","site_admin":false},"repo":{"id":15754563,"name":"droplet","full_name":"droplet-editor/droplet","owner":{"login":"droplet-editor","id":12835604,"avatar_url":"https://avatars.githubusercontent.com/u/12835604?v=3","gravatar_id":"","url":"https://api.github.com/users/droplet-editor","html_url":"https://github.com/droplet-editor","followers_url":"https://api.github.com/users/droplet-editor/followers","following_url":"https://api.github.com/users/droplet-editor/following{/other_user}","gists_url":"https://api.github.com/users/droplet-editor/gists{/gist_id}","starred_url":"https://api.github.com/users/droplet-editor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/droplet-editor/subscriptions","organizations_url":"https://api.github.com/users/droplet-editor/orgs","repos_url":"https://api.github.com/users/droplet-editor/repos","events_url":"https://api.github.com/users/droplet-editor/events{/privacy}","received_events_url":"https://api.github.com/users/droplet-editor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/droplet-editor/droplet","description":"Block language reenvisioned as a text editor","fork":false,"url":"https://api.github.com/repos/droplet-editor/droplet","forks_url":"https://api.github.com/repos/droplet-editor/droplet/forks","keys_url":"https://api.github.com/repos/droplet-editor/droplet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/droplet-editor/droplet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/droplet-editor/droplet/teams","hooks_url":"https://api.github.com/repos/droplet-editor/droplet/hooks","issue_events_url":"https://api.github.com/repos/droplet-editor/droplet/issues/events{/number}","events_url":"https://api.github.com/repos/droplet-editor/droplet/events","assignees_url":"https://api.github.com/repos/droplet-editor/droplet/assignees{/user}","branches_url":"https://api.github.com/repos/droplet-editor/droplet/branches{/branch}","tags_url":"https://api.github.com/repos/droplet-editor/droplet/tags","blobs_url":"https://api.github.com/repos/droplet-editor/droplet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/droplet-editor/droplet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/droplet-editor/droplet/git/refs{/sha}","trees_url":"https://api.github.com/repos/droplet-editor/droplet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/droplet-editor/droplet/statuses/{sha}","languages_url":"https://api.github.com/repos/droplet-editor/droplet/languages","stargazers_url":"https://api.github.com/repos/droplet-editor/droplet/stargazers","contributors_url":"https://api.github.com/repos/droplet-editor/droplet/contributors","subscribers_url":"https://api.github.com/repos/droplet-editor/droplet/subscribers","subscription_url":"https://api.github.com/repos/droplet-editor/droplet/subscription","commits_url":"https://api.github.com/repos/droplet-editor/droplet/commits{/sha}","git_commits_url":"https://api.github.com/repos/droplet-editor/droplet/git/commits{/sha}","comments_url":"https://api.github.com/repos/droplet-editor/droplet/comments{/number}","issue_comment_url":"https://api.github.com/repos/droplet-editor/droplet/issues/comments{/number}","contents_url":"https://api.github.com/repos/droplet-editor/droplet/contents/{+path}","compare_url":"https://api.github.com/repos/droplet-editor/droplet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/droplet-editor/droplet/merges","archive_url":"https://api.github.com/repos/droplet-editor/droplet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/droplet-editor/droplet/downloads","issues_url":"https://api.github.com/repos/droplet-editor/droplet/issues{/number}","pulls_url":"https://api.github.com/repos/droplet-editor/droplet/pulls{/number}","milestones_url":"https://api.github.com/repos/droplet-editor/droplet/milestones{/number}","notifications_url":"https://api.github.com/repos/droplet-editor/droplet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/droplet-editor/droplet/labels{/name}","releases_url":"https://api.github.com/repos/droplet-editor/droplet/releases{/id}","created_at":"2014-01-09T02:27:23Z","updated_at":"2015-06-18T17:27:57Z","pushed_at":"2015-06-19T19:00:48Z","git_url":"git://github.com/droplet-editor/droplet.git","ssh_url":"git@github.com:droplet-editor/droplet.git","clone_url":"https://github.com/droplet-editor/droplet.git","svn_url":"https://github.com/droplet-editor/droplet","homepage":"experiment.pencilcode.net/anthony/droplet/example/example.html","size":31567,"stargazers_count":73,"watchers_count":73,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":11,"forks":34,"open_issues":11,"watchers":73,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/droplet-editor/droplet/pulls/82"},"html":{"href":"https://github.com/droplet-editor/droplet/pull/82"},"issue":{"href":"https://api.github.com/repos/droplet-editor/droplet/issues/82"},"comments":{"href":"https://api.github.com/repos/droplet-editor/droplet/issues/82/comments"},"review_comments":{"href":"https://api.github.com/repos/droplet-editor/droplet/pulls/82/comments"},"review_comment":{"href":"https://api.github.com/repos/droplet-editor/droplet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/droplet-editor/droplet/pulls/82/commits"},"statuses":{"href":"https://api.github.com/repos/droplet-editor/droplet/statuses/aab01761aa38d0636493082bc6fc11ba3503af76"}}}}