{"action":"created","issue":{"url":"https://api.github.com/repos/eclipse/xtext-core/issues/721","repository_url":"https://api.github.com/repos/eclipse/xtext-core","labels_url":"https://api.github.com/repos/eclipse/xtext-core/issues/721/labels{/name}","comments_url":"https://api.github.com/repos/eclipse/xtext-core/issues/721/comments","events_url":"https://api.github.com/repos/eclipse/xtext-core/issues/721/events","html_url":"https://github.com/eclipse/xtext-core/issues/721","id":318309427,"number":721,"title":"Allow NodeModelBuilder to replace subtree","user":{"login":"knutwannheden","id":408765,"avatar_url":"https://avatars3.githubusercontent.com/u/408765?v=4","gravatar_id":"","url":"https://api.github.com/users/knutwannheden","html_url":"https://github.com/knutwannheden","followers_url":"https://api.github.com/users/knutwannheden/followers","following_url":"https://api.github.com/users/knutwannheden/following{/other_user}","gists_url":"https://api.github.com/users/knutwannheden/gists{/gist_id}","starred_url":"https://api.github.com/users/knutwannheden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knutwannheden/subscriptions","organizations_url":"https://api.github.com/users/knutwannheden/orgs","repos_url":"https://api.github.com/users/knutwannheden/repos","events_url":"https://api.github.com/users/knutwannheden/events{/privacy}","received_events_url":"https://api.github.com/users/knutwannheden/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-27T07:43:36Z","updated_at":"2018-05-02T21:50:48Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I have the following use case: I have a DSL \"A\" in which some terminal tokens are parsed by the parser of another DSL \"B\". I cannot easily have A.xtext extend B.xtext since they have conflicting terminal rules, so what I do instead is to have a value converter for A which invokes the parser of B. To be able to leverage Xtext as much as possible I don't only want to populate the AST but also merge the node model of B back into that of A. Basically the node representing the terminal token gets replaced by the composite node produced by B's parser.\r\n\r\nTo do this I want to use `NodeModelBuilder#replaceAndTransferLookAhead()`. This basically already works now except for the \"offset\" which will begin at 0 (see line 349 below) rather than at whatever offset the original terminal token had.\r\n\r\nhttps://github.com/eclipse/xtext-core/blob/3dbf100102accdc426684d6bb274eb06b32dbc70/org.eclipse.xtext/src/org/eclipse/xtext/nodemodel/impl/NodeModelBuilder.java#L340-L357\r\n\r\nAFAICT the offset could be initialized with `oldNode.getTotalOffset()` rather than `0` and it would work. Alternatively a separate method could be added."},"comment":{"url":"https://api.github.com/repos/eclipse/xtext-core/issues/comments/386132773","html_url":"https://github.com/eclipse/xtext-core/issues/721#issuecomment-386132773","issue_url":"https://api.github.com/repos/eclipse/xtext-core/issues/721","id":386132773,"user":{"login":"szarnekow","id":375492,"avatar_url":"https://avatars2.githubusercontent.com/u/375492?v=4","gravatar_id":"","url":"https://api.github.com/users/szarnekow","html_url":"https://github.com/szarnekow","followers_url":"https://api.github.com/users/szarnekow/followers","following_url":"https://api.github.com/users/szarnekow/following{/other_user}","gists_url":"https://api.github.com/users/szarnekow/gists{/gist_id}","starred_url":"https://api.github.com/users/szarnekow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szarnekow/subscriptions","organizations_url":"https://api.github.com/users/szarnekow/orgs","repos_url":"https://api.github.com/users/szarnekow/repos","events_url":"https://api.github.com/users/szarnekow/events{/privacy}","received_events_url":"https://api.github.com/users/szarnekow/received_events","type":"User","site_admin":false},"created_at":"2018-05-02T21:50:48Z","updated_at":"2018-05-02T21:50:48Z","author_association":"CONTRIBUTOR","body":"Could you please submit a patch?"}}
{"actor":{"display_login":"szarnekow"}}