{"action":"created","issue":{"url":"https://api.github.com/repos/lampepfl/dotty/issues/1151","repository_url":"https://api.github.com/repos/lampepfl/dotty","labels_url":"https://api.github.com/repos/lampepfl/dotty/issues/1151/labels{/name}","comments_url":"https://api.github.com/repos/lampepfl/dotty/issues/1151/comments","events_url":"https://api.github.com/repos/lampepfl/dotty/issues/1151/events","html_url":"https://github.com/lampepfl/dotty/pull/1151","id":139008590,"number":1151,"title":"[WIP] Add initial support for raw docstrings in ASTs","user":{"login":"felixmulder","id":1530049,"avatar_url":"https://avatars.githubusercontent.com/u/1530049?v=3","gravatar_id":"","url":"https://api.github.com/users/felixmulder","html_url":"https://github.com/felixmulder","followers_url":"https://api.github.com/users/felixmulder/followers","following_url":"https://api.github.com/users/felixmulder/following{/other_user}","gists_url":"https://api.github.com/users/felixmulder/gists{/gist_id}","starred_url":"https://api.github.com/users/felixmulder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixmulder/subscriptions","organizations_url":"https://api.github.com/users/felixmulder/orgs","repos_url":"https://api.github.com/users/felixmulder/repos","events_url":"https://api.github.com/users/felixmulder/events{/privacy}","received_events_url":"https://api.github.com/users/felixmulder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-03-07T15:34:24Z","updated_at":"2016-03-08T20:25:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/lampepfl/dotty/pulls/1151","html_url":"https://github.com/lampepfl/dotty/pull/1151","diff_url":"https://github.com/lampepfl/dotty/pull/1151.diff","patch_url":"https://github.com/lampepfl/dotty/pull/1151.patch"},"body":"Hello, as some of you might know (@heathermiller, @odersky) - I'm coming to EPFL in a couple of weeks to help out on **dottydoc** :tada:\r\n\r\nAs such, I wanted to get a head start on the implementation. I've perused the code and started an implementation for docstring parsing.\r\n\r\nIn this PR the scanner has been modified to save the docstrings according to the following heuristic:\r\n\r\n* In the scanner, parse all comments\r\n* If the comment is a docstring, save it in a `closestDocString: Option[Comment]` var, replacing the old value\r\n* If `keepComments` is set to true also save it to `revComments` (not sure if this is necessary, but didn't want to ruin someone else's possibly ongoing implementation)\r\n* In the parser, put the saved docstring into the `MemberDef` tree if applicable\r\n\r\nI'm not sure if this is the optimal implementation, but it seems to eliminate the need for positional checking and instead follows \"if the docstring is the closest docstring to an entity, it is the entity's docstring.\" The `closestDocString` var would in this approach, however, have to be emptied at the end of parsing bodies (not done yet).\r\n\r\nThere are two questions I'm looking to have answered:\r\n\r\n1. Am I on the right track, or is there a better way to go about this?\r\n2. I want to add tests that check the resulting AST using some example code - where should I place these? Do we have similar tests somewhere I can have a look at?\r\n\r\n**Sidenote:** in a separate branch I've also started the implementation of a dottydoc tool which uses only the `FrontEnd` phase to get an AST. As such, finding the correct solution to adding comments to the AST will be a requirement for moving forward with said branch."},"comment":{"url":"https://api.github.com/repos/lampepfl/dotty/issues/comments/193954131","html_url":"https://github.com/lampepfl/dotty/pull/1151#issuecomment-193954131","issue_url":"https://api.github.com/repos/lampepfl/dotty/issues/1151","id":193954131,"user":{"login":"felixmulder","id":1530049,"avatar_url":"https://avatars.githubusercontent.com/u/1530049?v=3","gravatar_id":"","url":"https://api.github.com/users/felixmulder","html_url":"https://github.com/felixmulder","followers_url":"https://api.github.com/users/felixmulder/followers","following_url":"https://api.github.com/users/felixmulder/following{/other_user}","gists_url":"https://api.github.com/users/felixmulder/gists{/gist_id}","starred_url":"https://api.github.com/users/felixmulder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixmulder/subscriptions","organizations_url":"https://api.github.com/users/felixmulder/orgs","repos_url":"https://api.github.com/users/felixmulder/repos","events_url":"https://api.github.com/users/felixmulder/events{/privacy}","received_events_url":"https://api.github.com/users/felixmulder/received_events","type":"User","site_admin":false},"created_at":"2016-03-08T20:25:37Z","updated_at":"2016-03-08T20:25:37Z","body":"Traits without a body caused the structure of only keeping one docstring to fail (since the parser would gobble them up before finding out that the trait had no body). So the docstrings are now saved in a queue. Maybe that's what the `revComments` list was for."}}