You need to add EOF token as last element of your start rule.

Jim

On Jun 16, 2009, at 11:20 PM, Bharath R <[email protected]> wrote:

> Hi All
>
> I am facing an issue while parsing the last character of my input.
>
> Even if i give an invalid character at the last the parser is not  
> throwing the exception.
>
> The below is my grammar :-
>
> // ***************************
> grammar test;
>
> globalnumber : phonedigit (NEWLINE)* ;
>
> phonedigit : (DIGIT)* ;
>
> NEWLINE : '\n' ;
>
> DIGIT : (0-9)
>
> ALPHA : ('a'-'z') | ('A'-'Z');
>
> // ***************************
>
> Here if we notice that the NEWLINE is an optional rule. , when I  
> give the input as " 12345a " for the rule "globalnumber" then the  
> parser is not throwing
> any exception. i checked the parser code its just consuming those  
> tokens .  :-(
>
> When I make the NEWLINE as mandatory then its working fine. but i  
> dont want that to be a mandatory RULE.
>
> Thanx a lot for reading this query expecting your response.
>
> Regards
> Bharath R
> HUAWEI TECHNOLOGIES CO.,LTD. <outlook_huawei_logo_en.jpg>
>
> Address: Huawei Industrial Base
> Bantian Longgang
> Shenzhen 518129, P.R.China
> www.huawei.com
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> ----------------------------------------------------------------------
> This e-mail and its attachments contain confidential information  
> from HUAWEI, which
> is intended only for the person or entity whose address is listed  
> above. Any use of the
> information contained herein in any way (including, but not limited  
> to, total or partial
> disclosure, reproduction, or dissemination) by persons other than  
> the intended
> recipient(s) is prohibited. If you receive this e-mail in error,  
> please notify the sender by
> phone or email immediately and delete it!
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--~--~---------~--~----~------------~-------~--~----~
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/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to