Hi Jim and Dave , 
 
Thanx a lot !!! 
It works after adding EOF as the last element of my start rule !! 
 
Regards
Bharath R 

HUAWEI TECHNOLOGIES CO.,LTD. huawei_logo 


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!

 

  _____  

From: Jim Idle [mailto:j...@temporal-wave.com] 
Sent: Wednesday, June 17, 2009 6:40 PM
To: r.bhar...@huawei.com
Cc: antlr-interest
Subject: Re: [antlr-interest] AntLR 3 is not validating the LAST character.


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

Jim

On Jun 16, 2009, at 11:20 PM, Bharath R <r.bhar...@huawei.com> 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>
http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
<http://www.antlr.org/mailman/options/antlr-interest/your-email-address>
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 il-antlr-interest@googlegroups.com
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

<<attachment: atteb4d3.jpg>>

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