[antlr-interest] Help on error handling in antlr grammar...

Vamsi Krishna Pendela vamsikp406 at kiwibox.com
Mon Jan 12 20:56:45 PST 2004


Hi,
I'm using ANTLR for validating the user entered commands in command line 
interface (CLI).

One sample of the command is "edit logsettings logid [{emaildest}]".
{} means that it can be an array list seperated with ',' (comma) & [] means that 
the parameter is optional.
'logid' will take any of the digit & 'emaildest' will take an email id as its 
value.

I need to handle the error situations & have to show appropriate error message 
to the user.
Here are the different kind of errors that can be produced as a result of the 
command.

Success Cases:

1. I/P: edit logsettings logid = 123

2. I/P: edit logsettings logid = 123 emaildest = vamsikp406 at kiwibox.com

Failure Cases:

1. I/P: edit logsettings
   O/P: logid parameter missing.

2. I/P: edit logsettings logid = 2a
   O/P: logid value invalid.

3. I/P: edit logsettings abcd logid = 123
   O/P: abcd parameter unknown.

4. I/P: edit logsettings logid = 123 emaildest = _vamsikp at kiwibox.com
   O/P: emaildest value invalid.

5. I/P: edit logsettings logid = 123 emaildest = vamsikp at kiwibox.com logid = 
234
   O/P: logid parameter repeated.


The grammar file that I had written for the command is attached.

With this, I'm getting non-determinism errors due to the last rule (ID). So 
error handling is not complete.
And for some commands, the value of a parameter can contain the white spaces 
also that needs to be taken for value.
Can anyone help me out what could be the better way to handle the above 
mentioned errors. It's very urgent for me.

Thanks in advance.

Regards,
Vamsi.



------------------------------------------------------------
Get your FREE email and win concert tickets at http://www.kiwibox.com
the coolest site for teens by teens!

 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/antlr-interest/

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to:
 http://docs.yahoo.com/info/terms/ 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cli.java
Type: application/octet-stream
Size: 1338 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20040112/a34aae26/cli.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: EditLogsettings.g
Type: application/octet-stream
Size: 4492 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20040112/a34aae26/EditLogsettings.obj


More information about the antlr-interest mailing list