{"action":"created","issue":{"url":"https://api.github.com/repos/SAP/chevrotain/issues/691","repository_url":"https://api.github.com/repos/SAP/chevrotain","labels_url":"https://api.github.com/repos/SAP/chevrotain/issues/691/labels{/name}","comments_url":"https://api.github.com/repos/SAP/chevrotain/issues/691/comments","events_url":"https://api.github.com/repos/SAP/chevrotain/issues/691/events","html_url":"https://github.com/SAP/chevrotain/issues/691","id":308261336,"number":691,"title":"Is a Bug?","user":{"login":"imegamaximus","id":37433887,"avatar_url":"https://avatars1.githubusercontent.com/u/37433887?v=4","gravatar_id":"","url":"https://api.github.com/users/imegamaximus","html_url":"https://github.com/imegamaximus","followers_url":"https://api.github.com/users/imegamaximus/followers","following_url":"https://api.github.com/users/imegamaximus/following{/other_user}","gists_url":"https://api.github.com/users/imegamaximus/gists{/gist_id}","starred_url":"https://api.github.com/users/imegamaximus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imegamaximus/subscriptions","organizations_url":"https://api.github.com/users/imegamaximus/orgs","repos_url":"https://api.github.com/users/imegamaximus/repos","events_url":"https://api.github.com/users/imegamaximus/events{/privacy}","received_events_url":"https://api.github.com/users/imegamaximus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-24T13:13:41Z","updated_at":"2018-03-24T17:35:25Z","closed_at":null,"author_association":"NONE","body":"I have code: `\"<div></div>\"`\r\n\r\nI have parser:\r\n\r\n```coffeescript\r\n\tOpenTag: ->\r\n\t\t@CONSUME(@BracketL)\r\n\t\t@CONSUME(@Word)\r\n\t\t@CONSUME(@BracketR)\r\n\r\n\r\n\tCloseTag: ->\r\n\t\t@CONSUME(@BracketL)\r\n\t\t@CONSUME(@Slash)\r\n\t\t@CONSUME(@Word)\r\n\t\t@CONSUME(@BracketR)\r\n\r\n\r\n\tElement: ->\r\n\t\t@SUBRULE(@OpenTag)\r\n\t\t@MANY => @SUBRULE(@Element)\r\n\t\t@SUBRULE(@CloseTag)\r\n```\r\n\r\nThis works correct.\r\n\r\nBut if I try to move the `@MANY => @SUBRULE(@Element)` to the separate `ElementsList` rule:\r\n\r\n```coffeescript\r\n\tOpenTag: ->\r\n\t\t@CONSUME(@BracketL)\r\n\t\t@CONSUME(@Word)\r\n\t\t@CONSUME(@BracketR)\r\n\r\n\r\n\tCloseTag: ->\r\n\t\t@CONSUME(@BracketL)\r\n\t\t@CONSUME(@Slash)\r\n\t\t@CONSUME(@Word)\r\n\t\t@CONSUME(@BracketR)\r\n\r\n\r\n\tElement: ->\r\n\t\t@SUBRULE(@OpenTag)\r\n\t\t@SUBRULE(@ElementList) # it must return ampty array\r\n\t\t@SUBRULE(@CloseTag)\r\n\r\n\t\t\r\n\tElementList: ->\r\n\t\t@MANY => @SUBRULE(@Element)\r\n```\r\n\r\nI get Parse error:\r\n\r\n```coffeescript\r\nname: \"MismatchedTokenException\"\r\nmessage: \"Expecting token of type --> Word <-- but found --> '/' <--\"\r\nruleStack: [\"Element\", \"ElementList\", \"Element\", \"OpenTag\"]\r\n```\r\n\r\nIt can not find the child element, and throws an error. Although allowed **0 AND MORE** repetitions. In this case, it simply needs to return an empty array. This is what happens in the first case. But when I take the MANY operator  into a separate \"ElementList\" rule, the parser throws an error, from the fact that he has not found a single match. The rule \"ElementList\" must return either an array of elements or an empty array. Instead it generate an error.\r\n\r\nDo you need a more complete code? Or do you manage to reproduce the error manually?\r\n\r\n\r\n\r\nP.S. My tokens:\r\n\r\n```coffeescript\r\nWhiteSpace: {pattern: /\\s+/, group: Lexer.SKIPPED, line_breaks: yes}\r\n\r\nBracketL: /</\r\nBracketR: />/\r\nWord    : /\\w+/\r\nSlash   : /\\//\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/SAP/chevrotain/issues/comments/375910748","html_url":"https://github.com/SAP/chevrotain/issues/691#issuecomment-375910748","issue_url":"https://api.github.com/repos/SAP/chevrotain/issues/691","id":375910748,"user":{"login":"bd82","id":4233843,"avatar_url":"https://avatars3.githubusercontent.com/u/4233843?v=4","gravatar_id":"","url":"https://api.github.com/users/bd82","html_url":"https://github.com/bd82","followers_url":"https://api.github.com/users/bd82/followers","following_url":"https://api.github.com/users/bd82/following{/other_user}","gists_url":"https://api.github.com/users/bd82/gists{/gist_id}","starred_url":"https://api.github.com/users/bd82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bd82/subscriptions","organizations_url":"https://api.github.com/users/bd82/orgs","repos_url":"https://api.github.com/users/bd82/repos","events_url":"https://api.github.com/users/bd82/events{/privacy}","received_events_url":"https://api.github.com/users/bd82/received_events","type":"User","site_admin":false},"created_at":"2018-03-24T17:35:25Z","updated_at":"2018-03-24T17:35:25Z","author_association":"MEMBER","body":"I'd like to at least automatically detect this and warn the user with a link to some doc page\r\nexplaining how to resolve this.\r\n\r\nand maybe even support smarter predication modes so it would \"magically\" work without any user involvement.\r\n* https://github.com/SAP/chevrotain/issues/623\r\n\r\nIt boils down to a question of time resources available... \r\nYou recent feedback in several issues combined with me seeing certain issues/feature requests\r\npop up again and again made me consider focusing on quality of life improvements in the next major version.\r\n\r\nDepending on how fluent you are with JavaScript/TypeScript some of the solutions could come\r\nin the form of direct contributions 😄\r\n\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"bd82"}}