{"action":"closed","issue":{"url":"https://api.github.com/repos/PhilippeSigaud/Pegged/issues/201","repository_url":"https://api.github.com/repos/PhilippeSigaud/Pegged","labels_url":"https://api.github.com/repos/PhilippeSigaud/Pegged/issues/201/labels{/name}","comments_url":"https://api.github.com/repos/PhilippeSigaud/Pegged/issues/201/comments","events_url":"https://api.github.com/repos/PhilippeSigaud/Pegged/issues/201/events","html_url":"https://github.com/PhilippeSigaud/Pegged/issues/201","id":142188905,"number":201,"title":"How to parse newlines correctly?","user":{"login":"skocznymroczny","id":2880836,"avatar_url":"https://avatars.githubusercontent.com/u/2880836?v=3","gravatar_id":"","url":"https://api.github.com/users/skocznymroczny","html_url":"https://github.com/skocznymroczny","followers_url":"https://api.github.com/users/skocznymroczny/followers","following_url":"https://api.github.com/users/skocznymroczny/following{/other_user}","gists_url":"https://api.github.com/users/skocznymroczny/gists{/gist_id}","starred_url":"https://api.github.com/users/skocznymroczny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skocznymroczny/subscriptions","organizations_url":"https://api.github.com/users/skocznymroczny/orgs","repos_url":"https://api.github.com/users/skocznymroczny/repos","events_url":"https://api.github.com/users/skocznymroczny/events{/privacy}","received_events_url":"https://api.github.com/users/skocznymroczny/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-20T18:24:03Z","updated_at":"2016-03-21T21:52:47Z","closed_at":"2016-03-21T21:52:47Z","body":"I'm playing around with the idea of writing an interpreter for a toy programming language, but I can't get over a simple issue with parsing using pegged library.\r\n\r\nMy input file looks like this:\r\n\r\n```\r\n\\n\r\n\\n\r\na <- xxx\\n\r\n\\n\r\n\\n\r\nb <- yyy\\n\r\n```\r\n\r\n(I replaced newlines with \\n here in this example to make the newlines visible).\r\n\r\nI am using this grammar to parse it:\r\n\r\n```\r\nmixin(grammar(`\r\nSampleLang:\r\n\tFile\t\t\t\t\t<- Line+\r\n\tLine\t\t\t\t\t<- EmptyLine / Statement\r\n\tStatement\t\t\t\t<- Declaration endOfLine\r\n\tEmptyLine\t\t\t\t<- endOfLine\r\n\tDeclaration             < identifier \"<-\" identifier\r\n`));\r\n```\r\n\r\nI expect the output to be something like:\r\nfile -> emptyline -> emptyline -> statement -> declaration -> emptyline -> emptyline -> statement -> declaration\r\n\r\nmeanwhile all I get is:\r\n```\r\nSampleLang [0, 4][\"\\n\", \"\\n\"]\r\n +-SampleLang.File [0, 4][\"\\n\", \"\\n\"]\r\n    +-SampleLang.Line [0, 2][\"\\n\"]\r\n    |  +-SampleLang.EmptyLine [0, 2][\"\\n\"]\r\n    +-SampleLang.Line [2, 4][\"\\n\"]\r\n       +-SampleLang.EmptyLine [2, 4][\"\\n\"]\r\n```\r\n\r\nWhat's wrong with this grammar? It looks OK in my opinion."}}