{"action":"created","comment":{"url":"https://api.github.com/repos/shapesecurity/shift-java/pulls/comments/55440861","id":55440861,"diff_hunk":"@@ -27,9 +27,13 @@\n import org.jetbrains.annotations.Nullable;\n \n import java.util.ArrayList;\n+import java.util.HashMap;\n+import java.util.Map;\n import java.util.function.BiFunction;\n \n public abstract class Parser extends Tokenizer {\n+    public Map<Node, Maybe<SourceSpan>> locations = new HashMap<>();","path":"src/main/java/com/shapesecurity/shift/parser/Parser.java","position":9,"original_position":9,"commit_id":"6c5a35079582749b42db8c454dbfdddf96ea3456","original_commit_id":"6c5a35079582749b42db8c454dbfdddf96ea3456","user":{"login":"michaelficarra","id":218840,"avatar_url":"https://avatars.githubusercontent.com/u/218840?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelficarra","html_url":"https://github.com/michaelficarra","followers_url":"https://api.github.com/users/michaelficarra/followers","following_url":"https://api.github.com/users/michaelficarra/following{/other_user}","gists_url":"https://api.github.com/users/michaelficarra/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelficarra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelficarra/subscriptions","organizations_url":"https://api.github.com/users/michaelficarra/orgs","repos_url":"https://api.github.com/users/michaelficarra/repos","events_url":"https://api.github.com/users/michaelficarra/events{/privacy}","received_events_url":"https://api.github.com/users/michaelficarra/received_events","type":"User","site_admin":false},"body":"We prefer to use the [shape-functional-java library](https://github.com/shapesecurity/shape-functional-java) (com.shapesecurity.functional.*) for these kinds of data structures. Please use the `HashTable<K, V>` from there. Also, you won't need to parameterise it by a `Maybe<SourceSpan>`, just `SourceSpan` because `get` returns a `Maybe<V>`.","created_at":"2016-03-08T22:35:38Z","updated_at":"2016-03-08T22:35:38Z","html_url":"https://github.com/shapesecurity/shift-java/pull/101#discussion_r55440861","pull_request_url":"https://api.github.com/repos/shapesecurity/shift-java/pulls/101","_links":{"self":{"href":"https://api.github.com/repos/shapesecurity/shift-java/pulls/comments/55440861"},"html":{"href":"https://github.com/shapesecurity/shift-java/pull/101#discussion_r55440861"},"pull_request":{"href":"https://api.github.com/repos/shapesecurity/shift-java/pulls/101"}}},"pull_request":{"url":"https://api.github.com/repos/shapesecurity/shift-java/pulls/101","id":62135988,"html_url":"https://github.com/shapesecurity/shift-java/pull/101","diff_url":"https://github.com/shapesecurity/shift-java/pull/101.diff","patch_url":"https://github.com/shapesecurity/shift-java/pull/101.patch","issue_url":"https://api.github.com/repos/shapesecurity/shift-java/issues/101","number":101,"state":"open","locked":false,"title":"SourceLocation bugfix and temporary solution to store","user":{"login":"steindani","id":1426659,"avatar_url":"https://avatars.githubusercontent.com/u/1426659?v=3","gravatar_id":"","url":"https://api.github.com/users/steindani","html_url":"https://github.com/steindani","followers_url":"https://api.github.com/users/steindani/followers","following_url":"https://api.github.com/users/steindani/following{/other_user}","gists_url":"https://api.github.com/users/steindani/gists{/gist_id}","starred_url":"https://api.github.com/users/steindani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steindani/subscriptions","organizations_url":"https://api.github.com/users/steindani/orgs","repos_url":"https://api.github.com/users/steindani/repos","events_url":"https://api.github.com/users/steindani/events{/privacy}","received_events_url":"https://api.github.com/users/steindani/received_events","type":"User","site_admin":false},"body":"`TokenizerState` did not save the `lastLine` and `lastLineStart` values, thus they could not be restored. Also the `Tokenizer` did not update the previously mentioned variables while collecting tokens.\r\n\r\nI've fixed these issues and used them to calculate and store the start and end source locations of the AST nodes. While the `Node` interface can not be easily transformed into an abstract class containing a reference to its `SourceSpan` (see #92), the `Parser` could temporarily keep a map of these, so users may access them. \r\n\r\nUntil a greater refactoring, this solution may be used, and later the introduced `Parser.getLocation(Node)` may just redirect to `Node.getLocation()`.","created_at":"2016-03-08T21:04:39Z","updated_at":"2016-03-08T22:35:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"06ca7235a885bc0a3b81dbf1540ac9662ca55f25","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/shapesecurity/shift-java/pulls/101/commits","review_comments_url":"https://api.github.com/repos/shapesecurity/shift-java/pulls/101/comments","review_comment_url":"https://api.github.com/repos/shapesecurity/shift-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shapesecurity/shift-java/issues/101/comments","statuses_url":"https://api.github.com/repos/shapesecurity/shift-java/statuses/6c5a35079582749b42db8c454dbfdddf96ea3456","head":{"label":"steindani:es6","ref":"es6","sha":"6c5a35079582749b42db8c454dbfdddf96ea3456","user":{"login":"steindani","id":1426659,"avatar_url":"https://avatars.githubusercontent.com/u/1426659?v=3","gravatar_id":"","url":"https://api.github.com/users/steindani","html_url":"https://github.com/steindani","followers_url":"https://api.github.com/users/steindani/followers","following_url":"https://api.github.com/users/steindani/following{/other_user}","gists_url":"https://api.github.com/users/steindani/gists{/gist_id}","starred_url":"https://api.github.com/users/steindani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steindani/subscriptions","organizations_url":"https://api.github.com/users/steindani/orgs","repos_url":"https://api.github.com/users/steindani/repos","events_url":"https://api.github.com/users/steindani/events{/privacy}","received_events_url":"https://api.github.com/users/steindani/received_events","type":"User","site_admin":false},"repo":{"id":52793733,"name":"shift-java","full_name":"steindani/shift-java","owner":{"login":"steindani","id":1426659,"avatar_url":"https://avatars.githubusercontent.com/u/1426659?v=3","gravatar_id":"","url":"https://api.github.com/users/steindani","html_url":"https://github.com/steindani","followers_url":"https://api.github.com/users/steindani/followers","following_url":"https://api.github.com/users/steindani/following{/other_user}","gists_url":"https://api.github.com/users/steindani/gists{/gist_id}","starred_url":"https://api.github.com/users/steindani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steindani/subscriptions","organizations_url":"https://api.github.com/users/steindani/orgs","repos_url":"https://api.github.com/users/steindani/repos","events_url":"https://api.github.com/users/steindani/events{/privacy}","received_events_url":"https://api.github.com/users/steindani/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/steindani/shift-java","description":"Shift format ECMAScript AST tooling","fork":true,"url":"https://api.github.com/repos/steindani/shift-java","forks_url":"https://api.github.com/repos/steindani/shift-java/forks","keys_url":"https://api.github.com/repos/steindani/shift-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/steindani/shift-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/steindani/shift-java/teams","hooks_url":"https://api.github.com/repos/steindani/shift-java/hooks","issue_events_url":"https://api.github.com/repos/steindani/shift-java/issues/events{/number}","events_url":"https://api.github.com/repos/steindani/shift-java/events","assignees_url":"https://api.github.com/repos/steindani/shift-java/assignees{/user}","branches_url":"https://api.github.com/repos/steindani/shift-java/branches{/branch}","tags_url":"https://api.github.com/repos/steindani/shift-java/tags","blobs_url":"https://api.github.com/repos/steindani/shift-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/steindani/shift-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/steindani/shift-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/steindani/shift-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/steindani/shift-java/statuses/{sha}","languages_url":"https://api.github.com/repos/steindani/shift-java/languages","stargazers_url":"https://api.github.com/repos/steindani/shift-java/stargazers","contributors_url":"https://api.github.com/repos/steindani/shift-java/contributors","subscribers_url":"https://api.github.com/repos/steindani/shift-java/subscribers","subscription_url":"https://api.github.com/repos/steindani/shift-java/subscription","commits_url":"https://api.github.com/repos/steindani/shift-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/steindani/shift-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/steindani/shift-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/steindani/shift-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/steindani/shift-java/contents/{+path}","compare_url":"https://api.github.com/repos/steindani/shift-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/steindani/shift-java/merges","archive_url":"https://api.github.com/repos/steindani/shift-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/steindani/shift-java/downloads","issues_url":"https://api.github.com/repos/steindani/shift-java/issues{/number}","pulls_url":"https://api.github.com/repos/steindani/shift-java/pulls{/number}","milestones_url":"https://api.github.com/repos/steindani/shift-java/milestones{/number}","notifications_url":"https://api.github.com/repos/steindani/shift-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/steindani/shift-java/labels{/name}","releases_url":"https://api.github.com/repos/steindani/shift-java/releases{/id}","deployments_url":"https://api.github.com/repos/steindani/shift-java/deployments","created_at":"2016-02-29T13:39:36Z","updated_at":"2016-02-29T13:39:40Z","pushed_at":"2016-03-08T20:43:49Z","git_url":"git://github.com/steindani/shift-java.git","ssh_url":"git@github.com:steindani/shift-java.git","clone_url":"https://github.com/steindani/shift-java.git","svn_url":"https://github.com/steindani/shift-java","homepage":"http://shift-ast.org/","size":12948,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"es6"}},"base":{"label":"shapesecurity:es6","ref":"es6","sha":"3fb6a6e44ecd5850caa667d10fc1ac58bf917f6b","user":{"login":"shapesecurity","id":7728313,"avatar_url":"https://avatars.githubusercontent.com/u/7728313?v=3","gravatar_id":"","url":"https://api.github.com/users/shapesecurity","html_url":"https://github.com/shapesecurity","followers_url":"https://api.github.com/users/shapesecurity/followers","following_url":"https://api.github.com/users/shapesecurity/following{/other_user}","gists_url":"https://api.github.com/users/shapesecurity/gists{/gist_id}","starred_url":"https://api.github.com/users/shapesecurity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shapesecurity/subscriptions","organizations_url":"https://api.github.com/users/shapesecurity/orgs","repos_url":"https://api.github.com/users/shapesecurity/repos","events_url":"https://api.github.com/users/shapesecurity/events{/privacy}","received_events_url":"https://api.github.com/users/shapesecurity/received_events","type":"Organization","site_admin":false},"repo":{"id":27738435,"name":"shift-java","full_name":"shapesecurity/shift-java","owner":{"login":"shapesecurity","id":7728313,"avatar_url":"https://avatars.githubusercontent.com/u/7728313?v=3","gravatar_id":"","url":"https://api.github.com/users/shapesecurity","html_url":"https://github.com/shapesecurity","followers_url":"https://api.github.com/users/shapesecurity/followers","following_url":"https://api.github.com/users/shapesecurity/following{/other_user}","gists_url":"https://api.github.com/users/shapesecurity/gists{/gist_id}","starred_url":"https://api.github.com/users/shapesecurity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shapesecurity/subscriptions","organizations_url":"https://api.github.com/users/shapesecurity/orgs","repos_url":"https://api.github.com/users/shapesecurity/repos","events_url":"https://api.github.com/users/shapesecurity/events{/privacy}","received_events_url":"https://api.github.com/users/shapesecurity/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shapesecurity/shift-java","description":"Shift format ECMAScript AST tooling","fork":false,"url":"https://api.github.com/repos/shapesecurity/shift-java","forks_url":"https://api.github.com/repos/shapesecurity/shift-java/forks","keys_url":"https://api.github.com/repos/shapesecurity/shift-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shapesecurity/shift-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shapesecurity/shift-java/teams","hooks_url":"https://api.github.com/repos/shapesecurity/shift-java/hooks","issue_events_url":"https://api.github.com/repos/shapesecurity/shift-java/issues/events{/number}","events_url":"https://api.github.com/repos/shapesecurity/shift-java/events","assignees_url":"https://api.github.com/repos/shapesecurity/shift-java/assignees{/user}","branches_url":"https://api.github.com/repos/shapesecurity/shift-java/branches{/branch}","tags_url":"https://api.github.com/repos/shapesecurity/shift-java/tags","blobs_url":"https://api.github.com/repos/shapesecurity/shift-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shapesecurity/shift-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shapesecurity/shift-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/shapesecurity/shift-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shapesecurity/shift-java/statuses/{sha}","languages_url":"https://api.github.com/repos/shapesecurity/shift-java/languages","stargazers_url":"https://api.github.com/repos/shapesecurity/shift-java/stargazers","contributors_url":"https://api.github.com/repos/shapesecurity/shift-java/contributors","subscribers_url":"https://api.github.com/repos/shapesecurity/shift-java/subscribers","subscription_url":"https://api.github.com/repos/shapesecurity/shift-java/subscription","commits_url":"https://api.github.com/repos/shapesecurity/shift-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/shapesecurity/shift-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/shapesecurity/shift-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/shapesecurity/shift-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/shapesecurity/shift-java/contents/{+path}","compare_url":"https://api.github.com/repos/shapesecurity/shift-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shapesecurity/shift-java/merges","archive_url":"https://api.github.com/repos/shapesecurity/shift-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shapesecurity/shift-java/downloads","issues_url":"https://api.github.com/repos/shapesecurity/shift-java/issues{/number}","pulls_url":"https://api.github.com/repos/shapesecurity/shift-java/pulls{/number}","milestones_url":"https://api.github.com/repos/shapesecurity/shift-java/milestones{/number}","notifications_url":"https://api.github.com/repos/shapesecurity/shift-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shapesecurity/shift-java/labels{/name}","releases_url":"https://api.github.com/repos/shapesecurity/shift-java/releases{/id}","deployments_url":"https://api.github.com/repos/shapesecurity/shift-java/deployments","created_at":"2014-12-08T22:30:40Z","updated_at":"2016-02-27T19:40:52Z","pushed_at":"2016-03-08T21:04:39Z","git_url":"git://github.com/shapesecurity/shift-java.git","ssh_url":"git@github.com:shapesecurity/shift-java.git","clone_url":"https://github.com/shapesecurity/shift-java.git","svn_url":"https://github.com/shapesecurity/shift-java","homepage":"http://shift-ast.org/","size":31248,"stargazers_count":42,"watchers_count":42,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":9,"forks":14,"open_issues":9,"watchers":42,"default_branch":"es6"}},"_links":{"self":{"href":"https://api.github.com/repos/shapesecurity/shift-java/pulls/101"},"html":{"href":"https://github.com/shapesecurity/shift-java/pull/101"},"issue":{"href":"https://api.github.com/repos/shapesecurity/shift-java/issues/101"},"comments":{"href":"https://api.github.com/repos/shapesecurity/shift-java/issues/101/comments"},"review_comments":{"href":"https://api.github.com/repos/shapesecurity/shift-java/pulls/101/comments"},"review_comment":{"href":"https://api.github.com/repos/shapesecurity/shift-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shapesecurity/shift-java/pulls/101/commits"},"statuses":{"href":"https://api.github.com/repos/shapesecurity/shift-java/statuses/6c5a35079582749b42db8c454dbfdddf96ea3456"}}}}