[antlr-interest] What's missing......?
Meena Vinod
spprtmail09 at yahoo.com
Thu Jan 29 01:32:13 PST 2009
Hello,
Here is my test grammar file:
----------------------------------------------------------------------------------------------------------------
grammar Test;
options
{
output = AST;
ASTLabelType = CommonTree;
}
tokens
{
T_COMMAND;
T_ACTION;
T_OPT;
}
validate_cmd: command EOF -> ^(T_COMMAND command);
command: action1 | action2;
action1: action1_name (action1_opt)* ;
action2: action2_name (action2_opt)* ;
action1_name: ACTION1 -> ^(T_ACTION ACTION1) ;
action2_name: ACTION2 -> ^(T_ACTION ACTION2) ;
action1_opt: tsep action1_tree -> ^(T_OPT action1_tree);
action1_tree: (common_options | wait_option)+;
action2_opt: tsep action2_tree -> ^(T_OPT action2_tree);
action2_tree: (common_options)+;
common_options: version_option | help_option ;
wait_option: WAIT;
version_option: VERSION_OPTION;
help_option: HELP_OPTION;
ACTION1 : 'copy';
ACTION2 : 'cut';
VERSION_OPTION: '-v'('ersion')?;
HELP_OPTION: '-h'('elp')?;
WAIT : '-w'('ait')?;
SEMI: ';' ;
DIGIT : ('0'..'9')*;
tsep : WSP;
WSP : ('\u0009' | ' ')+;
-----------------------------------------------------------------------------------------------------------------------
An input of type "copy -v -h" will work fine.
An input like "junk" comes back with an indeterminate state. The ANTLRWorks interpreter does not show an error.
There is no exception thrown. The debugger times out saying, "Time-out waiting to connect to the remote parser".
Infact, the EOF is around for every command.
Am I missing something here?
Many thanks in advance,
Ambica
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090129/a858965f/attachment.html
More information about the antlr-interest
mailing list