ANTLR

Andrew Oliver <[email protected]>
Newsgroups gmane.org.user-groups.trijug.juglist
Message-ID <[email protected]>
Anyone here a big ANTLR guy/gal?

I'm still wrapping my head around it.  I have this grammar (for IMAP):

http://fisheye.labs.jboss.com/viewrep/~raw,r=1.1/JBoss/jboss-mail/src/java/org/jboss/mail/imap4/parser/grammer.g
"6 uid SEARCH UNDELETED HEADER Message-ID 44317CD1.8000407@localhost"

I think that the problem lies here:

search [boolean isUID]
	{
		SearchCommand cmd = new SearchCommand(isUID);
     AndSearchPart part = new AndSearchPart();
     SearchPart oPart;
	}:
	SEARCH SPACE oPart =search_group[isUID] {part.addArgument(oPart);}
                 (SPACE oPart=search_group[isUID] 
{part.addArgument(oPart);})*
	{
     cmd.setPart(part);
		command = cmd;
	}
   ;

search_part [boolean isUID] returns [SearchPart part]
   {
      part = null;
   }
   :
  (part=search_part_no_arg
   |
   part=search_part_str_arg
   |
   part=search_part_num_arg
   |
   part=search_part_date_arg
   |
   part=search_part_other[isUID])
   ;

there is no search part that includes BOTH the UNDELETED (noarg) and the 
HEADER (with arg).

Am I wrong?

-Andy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.