Strange, it found an actual error in the grammar that was not found when the EOF was omitted. I was referencing a terminal that did not exist.
On Thu, Nov 6, 2008 at 10:42 AM, Vitaliy <[EMAIL PROTECTED]> wrote: > Did you try: > > > > superProgram > > : > > program > > EOF > > ; > > > > program : > statement_list -> statement_list PROGRAM > | > expression -> expression PROGRAM > ; > > > > *From:* [EMAIL PROTECTED] [mailto: > [EMAIL PROTECTED] *On Behalf Of *Dejas Ninethousand > *Sent:* Thursday, November 06, 2008 18:36 > *To:* Vitaliy > *Cc:* [EMAIL PROTECTED] > *Subject:* Re: [antlr-interest] ANTLR not reporting error for malformed > program > > > > How do I express EOF in ANTLR? When I add "EOF" to the production I can't > pass grammar check anymore: > > program : > statement_list EOF -> statement_list PROGRAM > | > expression EOF -> expression PROGRAM > ; > > -- Matt > > On Thu, Nov 6, 2008 at 10:28 AM, Vitaliy <[EMAIL PROTECTED]> wrote: > > Hi Matt, > > > > Had exactly the same problem. > > What you need to do is > > "Add EOF to the end of your top-level parser rule.", > > As Gavin had told me. > > > > Gavin – thanks again! > > > > Enjoy, > > Vitaliy > > > > *From:* [EMAIL PROTECTED] [mailto: > [EMAIL PROTECTED] *On Behalf Of *Dejas Ninethousand > *Sent:* Thursday, November 06, 2008 18:21 > *To:* antlr-interest Interest > *Subject:* [antlr-interest] ANTLR not reporting error for malformed > program > > > > I know I saw something about this on the ANTLR web site a while back, but I > can't find it now for the life of me. I have some program text that does > not conform to my grammar. If thought of as a long string, about the first > half of the string conforms to the cfg but then does something blatantly > wrong from a grammar standpoint. When ANTLR processes the program it > consumes and parses the valid part of the program and then stops as if only > the first half of the program string was the entire program string. I do > not see tokens pass by for the 2nd half of the malformed program (and as > consiquence, no error is generated). Can someone point me to the part of > the web site that discusses this issue? > > Thanks, > Matt > > > > __________ Information from ESET NOD32 Antivirus, version of virus > signature database 3591 (20081106) __________ > > > > The message was checked by ESET NOD32 Antivirus. > > > > http://www.eset.com > > > > __________ Information from ESET NOD32 Antivirus, version of virus > signature database 3591 (20081106) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > > > > > __________ Information from ESET NOD32 Antivirus, version of virus > signature database 3591 (20081106) __________ > > > > The message was checked by ESET NOD32 Antivirus. > > > > http://www.eset.com > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
