Mailing List Archive

An OT question for someone with javacc experience
I've asked the following question on the javacc mailing list, but it
appears as if the activity on that list has completely stopped as they are
open sourcing the code...

Since lucene uses javacc is there anyone here that understands javacc? I'm
starting to 'get' it, but I'm still having some problems. My question is
pasted below, but I'd like to talk over email individually since it
doesn't exactly apply to lucene (although I could see using my grammar for
analyzing and indexing the email messages, so it could apply...)

thanks,
rob

****

I'm very new to javacc. I'm modifying the faq.jj/digest.jj examples for my
own use.

I want to be able to get field out of the body of the email message. So
far I've been pretty succesful, but I'm having trouble in making the
transition from the MAILBODY to the next mail message.

The end of a mail message is marked with a "\u001f". When it hits that it
should inform my code and then go to the next message.

Here are the problems:
1. When it's done processing the last email message I get an error:
ParseException: Encountered "<EOF>" at line 212, column 1.
Was expecting one of:
<SUBJECT> ...
<FROM> ...
<DATE> ...
<NAME> ...
<END> ...

This makes sense, because it's the last message in the rmail file, and so
it hits eof without hitting a newline. How can I define things so that
this error doesn't come up?

2. More general than this, there has got to be a better way to lexical
specification so that when it hits the "\u001f" character it sets of the
END token (and calls my code), and then immediately goes to the DEFAULT
mode...

Sorry for the very basic questions but I'm completely new to this!


in my code:
void MailMessage() :
...
{
...
<END> { _delegate.endEmailMessage(); }
...
}

<MAILBODY>
SKIP:
{
"\u001f" : MAILBODYEND
|
"Name: " : MAILBODYNAME
|
<~[]>
}

<MAILBODYEND>
TOKEN:
{
<END: ( <NOT_EOL> )>
}
<MAILBODYEND>
SKIP:
{
<_EOL5: <EOL>> : DEFAULT
}



--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>