{"action":"created","issue":{"url":"https://api.github.com/repos/antlr/antlr4/issues/1113","repository_url":"https://api.github.com/repos/antlr/antlr4","labels_url":"https://api.github.com/repos/antlr/antlr4/issues/1113/labels{/name}","comments_url":"https://api.github.com/repos/antlr/antlr4/issues/1113/comments","events_url":"https://api.github.com/repos/antlr/antlr4/issues/1113/events","html_url":"https://github.com/antlr/antlr4/issues/1113","id":133291495,"number":1113,"title":"Presence of unused rule causes parse to fail.","user":{"login":"SimonSntPeter","id":16326873,"avatar_url":"https://avatars.githubusercontent.com/u/16326873?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonSntPeter","html_url":"https://github.com/SimonSntPeter","followers_url":"https://api.github.com/users/SimonSntPeter/followers","following_url":"https://api.github.com/users/SimonSntPeter/following{/other_user}","gists_url":"https://api.github.com/users/SimonSntPeter/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonSntPeter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonSntPeter/subscriptions","organizations_url":"https://api.github.com/users/SimonSntPeter/orgs","repos_url":"https://api.github.com/users/SimonSntPeter/repos","events_url":"https://api.github.com/users/SimonSntPeter/events{/privacy}","received_events_url":"https://api.github.com/users/SimonSntPeter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-02-12T16:57:31Z","updated_at":"2016-04-22T12:48:11Z","closed_at":null,"body":"(looks like markup is messing up quoted text a little below)\r\n\r\nCode to reproduce\r\n\r\n```\r\ngrammar MSSQL;\r\n\r\nsql_items :\r\n                (\r\n                        opt_sql_separators\r\n                        sql_item\r\n                ) *\r\n                opt_sql_separators\r\n                EOF\r\n        ;\r\n\r\nbegin_end_block :\r\n                BEGIN\r\n                        // comment out just sql_items rule\r\n                        // below to eliminate bug\r\n                       sql_items   // <--- this\r\n                END\r\n        ;\r\n\r\nBEGIN : 'begin' ;\r\nEND : 'end' ;\r\n\r\nopt_sql_separators : ( SEMICOLON * ) ;\r\n\r\nSEMICOLON : ';' ;\r\n\r\nsql_item : 'iamtesting' ;\r\n\r\nSKIPWS : [ \\t\\r\\n]+ -> skip ;\r\n\r\n```\r\n\r\nStart rule is `sql_items` (ie. I do java org.antlr.v4.gui.TestRig MSSQL sql_items -gui -trace -tokens). Input is \r\n\r\n> iamtesting\r\n\r\nTrace shows this, note \"line 2:0 no viable alternative at input '<EOF>'\" although it has parsed all input successfully (line \"consume [@0,0:9='iamtesting',<1>,1:0] rule sql_item\").\r\n\r\n> iamtesting\r\n> ^Z\r\n> [@0,0:9='iamtesting',<1>,1:0]\r\n> [@1,12:11='<EOF>',<-1>,2:0]\r\n> enter   sql_items, LT(1)=iamtesting\r\n> enter   opt_sql_separators, LT(1)=iamtesting\r\n> exit    opt_sql_separators, LT(1)=iamtesting\r\n> enter   sql_item, LT(1)=iamtesting\r\n> consume [@0,0:9='iamtesting',<1>,1:0] rule sql_item\r\n> exit    sql_item, LT(1)=<EOF>\r\n> line 2:0 no viable alternative at input '<EOF>'\r\n> exit    sql_items, LT(1)=<EOF>\r\n\r\nTo cause bug to go away comment out line indicated in the code in parse rule `begin_end_block`. Trace of now-successful parse\r\n\r\n> iamtesting\r\n> ^Z\r\n> [@0,0:9='iamtesting',<1>,1:0]\r\n> [@1,12:11='<EOF>',<-1>,2:0]\r\n> enter   sql_items, LT(1)=iamtesting\r\n> enter   opt_sql_separators, LT(1)=iamtesting\r\n> exit    opt_sql_separators, LT(1)=iamtesting\r\n> enter   sql_item, LT(1)=iamtesting\r\n> consume [@0,0:9='iamtesting',<1>,1:0] rule sql_item\r\n> exit    sql_item, LT(1)=<EOF>\r\n> enter   opt_sql_separators, LT(1)=<EOF>\r\n> exit    opt_sql_separators, LT(1)=<EOF>\r\n> consume [@1,12:11='<EOF>',<-1>,2:0] rule sql_items\r\n> exit    sql_items, LT(1)=<EOF>\r\n\r\nNote that `begin_end_block` is used nowhere.\r\n"},"comment":{"url":"https://api.github.com/repos/antlr/antlr4/issues/comments/213413814","html_url":"https://github.com/antlr/antlr4/issues/1113#issuecomment-213413814","issue_url":"https://api.github.com/repos/antlr/antlr4/issues/1113","id":213413814,"user":{"login":"SimonStPeter","id":10116861,"avatar_url":"https://avatars.githubusercontent.com/u/10116861?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonStPeter","html_url":"https://github.com/SimonStPeter","followers_url":"https://api.github.com/users/SimonStPeter/followers","following_url":"https://api.github.com/users/SimonStPeter/following{/other_user}","gists_url":"https://api.github.com/users/SimonStPeter/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonStPeter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonStPeter/subscriptions","organizations_url":"https://api.github.com/users/SimonStPeter/orgs","repos_url":"https://api.github.com/users/SimonStPeter/repos","events_url":"https://api.github.com/users/SimonStPeter/events{/privacy}","received_events_url":"https://api.github.com/users/SimonStPeter/received_events","type":"User","site_admin":false},"created_at":"2016-04-22T12:48:11Z","updated_at":"2016-04-22T12:48:11Z","body":"@jimidle you're quite right about the EOF being in the wrong place. That's blatantly wrong and just an foolish oversight by me. \r\nThe literals were just there for this grammar - I took 200k and stripped it down to the core then fed lex tokens back in until it compiled just for reporting this. My main grammar, per your suggestion months ago, has all literals given as lex rules and in a separate file.\r\nI agree about warning about it. I'll close this and open another issue mentioning warning on it.\r\nThanks. "}}