{"action":"created","issue":{"url":"https://api.github.com/repos/rgrinberg/ocaml-mustache/issues/21","repository_url":"https://api.github.com/repos/rgrinberg/ocaml-mustache","labels_url":"https://api.github.com/repos/rgrinberg/ocaml-mustache/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/rgrinberg/ocaml-mustache/issues/21/comments","events_url":"https://api.github.com/repos/rgrinberg/ocaml-mustache/issues/21/events","html_url":"https://github.com/rgrinberg/ocaml-mustache/pull/21","id":171255580,"number":21,"title":"Keep track of locations in the AST (WIP)","user":{"login":"Armael","id":315125,"avatar_url":"https://avatars.githubusercontent.com/u/315125?v=3","gravatar_id":"","url":"https://api.github.com/users/Armael","html_url":"https://github.com/Armael","followers_url":"https://api.github.com/users/Armael/followers","following_url":"https://api.github.com/users/Armael/following{/other_user}","gists_url":"https://api.github.com/users/Armael/gists{/gist_id}","starred_url":"https://api.github.com/users/Armael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Armael/subscriptions","organizations_url":"https://api.github.com/users/Armael/orgs","repos_url":"https://api.github.com/users/Armael/repos","events_url":"https://api.github.com/users/Armael/events{/privacy}","received_events_url":"https://api.github.com/users/Armael/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-15T20:35:01Z","updated_at":"2016-08-19T03:12:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rgrinberg/ocaml-mustache/pulls/21","html_url":"https://github.com/rgrinberg/ocaml-mustache/pull/21","diff_url":"https://github.com/rgrinberg/ocaml-mustache/pull/21.diff","patch_url":"https://github.com/rgrinberg/ocaml-mustache/pull/21.patch"},"body":"This is WIP for keeping track of locations in the AST.\r\nThe motivation for this is https://github.com/ocsigen/tyxml/pull/128 .\r\n\r\nThe core feature itself is implemented, namely producing an AST whose nodes are annotated by locations. What remains is polishing the API & tooling, and for that I thought I'd ask before implementing something potentially unsatisfactory.\r\n\r\nRemarks/questions:\r\n\r\n- This changes the lexer behavior a bit; RAW tokens now split at newlines. Considering that RAW tokens can already be split by '}'/'{', only because of an implementation detail (as far as I can tell), I thought it wouldn't be a problem;\r\n- I export the `Mustache.t` type; I guess #18 should be merged first, then this PR rebased on top of it;\r\n- At the moment all the helper functions in the `Mustache` module ignore locations, and put a dummy value when one is needed. I'm not sure what would be a nicer API for these (which would probably be incompatible with the current one);\r\n- I did not fix the tests yet, they currently fail as the helper functions from `Mustache` insert dummy locations, which do not match the actual locations provided by the parser. One solution I see would be to directly hand-write the AST (tedious), or improve these helper functions (equally or less tedious depending on how they are improved, I guess)."},"comment":{"url":"https://api.github.com/repos/rgrinberg/ocaml-mustache/issues/comments/240916962","html_url":"https://github.com/rgrinberg/ocaml-mustache/pull/21#issuecomment-240916962","issue_url":"https://api.github.com/repos/rgrinberg/ocaml-mustache/issues/21","id":240916962,"user":{"login":"rgrinberg","id":139003,"avatar_url":"https://avatars.githubusercontent.com/u/139003?v=3","gravatar_id":"","url":"https://api.github.com/users/rgrinberg","html_url":"https://github.com/rgrinberg","followers_url":"https://api.github.com/users/rgrinberg/followers","following_url":"https://api.github.com/users/rgrinberg/following{/other_user}","gists_url":"https://api.github.com/users/rgrinberg/gists{/gist_id}","starred_url":"https://api.github.com/users/rgrinberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgrinberg/subscriptions","organizations_url":"https://api.github.com/users/rgrinberg/orgs","repos_url":"https://api.github.com/users/rgrinberg/repos","events_url":"https://api.github.com/users/rgrinberg/events{/privacy}","received_events_url":"https://api.github.com/users/rgrinberg/received_events","type":"User","site_admin":false},"created_at":"2016-08-19T03:12:35Z","updated_at":"2016-08-19T03:12:35Z","body":"Thanks for reminding me about #18. I've merged it so you can now rebase.\r\n\r\nAt first glance, your patch looks alright but the way you've added locs looks a bit clumsy to me. Why not have a type like `type 'a loc = 'a * Loc.t` and we can keep our old clean mustache type for uses where the loc info isn't needed.\r\n\r\n@Drup you're a loc expert, could you please comment about the above?"}}
{"actor":{"display_login":"rgrinberg"}}