{"action":"closed","issue":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/6643","repository_url":"https://api.github.com/repos/crystal-lang/crystal","labels_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6643/labels{/name}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6643/comments","events_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6643/events","html_url":"https://github.com/crystal-lang/crystal/issues/6643","id":356276913,"node_id":"MDU6SXNzdWUzNTYyNzY5MTM=","number":6643,"title":"Verbatim expands macros in invalid way","user":{"login":"vladfaust","id":7955682,"node_id":"MDQ6VXNlcjc5NTU2ODI=","avatar_url":"https://avatars2.githubusercontent.com/u/7955682?v=4","gravatar_id":"","url":"https://api.github.com/users/vladfaust","html_url":"https://github.com/vladfaust","followers_url":"https://api.github.com/users/vladfaust/followers","following_url":"https://api.github.com/users/vladfaust/following{/other_user}","gists_url":"https://api.github.com/users/vladfaust/gists{/gist_id}","starred_url":"https://api.github.com/users/vladfaust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladfaust/subscriptions","organizations_url":"https://api.github.com/users/vladfaust/orgs","repos_url":"https://api.github.com/users/vladfaust/repos","events_url":"https://api.github.com/users/vladfaust/events{/privacy}","received_events_url":"https://api.github.com/users/vladfaust/received_events","type":"User","site_admin":false},"labels":[{"id":20487867,"node_id":"MDU6TGFiZWwyMDQ4Nzg2Nw==","url":"https://api.github.com/repos/crystal-lang/crystal/labels/kind:bug","name":"kind:bug","color":"fc2929","default":false},{"id":253019637,"node_id":"MDU6TGFiZWwyNTMwMTk2Mzc=","url":"https://api.github.com/repos/crystal-lang/crystal/labels/topic:compiler","name":"topic:compiler","color":"fef2c0","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-02T12:05:23Z","updated_at":"2018-09-06T16:33:44Z","closed_at":"2018-09-06T16:33:44Z","author_association":"CONTRIBUTOR","body":"Given this code:\r\n\r\n```crystal\r\n{% verbatim do %}\r\n  {% for a in [1] %}\r\n    {%\r\n      if true\r\n        exp_a = 42\r\n        exp_b = 43\r\n      end\r\n    %}\r\n  {% end %}\r\n{% end %}\r\n\r\n```\r\n\r\nRaises following error:\r\n\r\n```\r\n   1. \r\n   2.   {% for a in [1] %}\r\n   3.     {% if true\r\n   4. exp_a = 42exp_b = 43end %}\r\n   5.   {% end %}\r\n--------------------------------------------------------------------------------\r\nSyntax error in expanded macro: macro_140518939734800:4: unexpected token: xp_b\r\n\r\nexp_a = 42exp_b = 43end %}\r\n           ^\r\n```\r\n\r\nThe compiler forgets to split the lines for some reason in this case. However, if each line is wrapped with `{% %}`, it compiles correctly:\r\n\r\n```crystal\r\n{% verbatim do %}\r\n  {% for a in [1] %}\r\n    {% if true %}\r\n      {% exp_a = 42 %}\r\n      {% exp_b = 43 %}\r\n    {% end %}\r\n  {% end %}\r\n{% end %}\r\n```\r\n\r\nIn my case I have long macros with many if branches and it would be more appropriate not to wrap each line.\r\n\r\nAlso the first example compiles nicely if `{% verbatim %}` is removed."}}
{"actor":{"display_login":"sdogruyol"}}