{"action":"closed","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":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-02-12T16:57:31Z","updated_at":"2016-04-22T12:57:44Z","closed_at":"2016-04-22T12:57:44Z","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"}}