Parse part of content (ignore/skip ALL until known tokens are found)

View: New views
3 Messages — Rating Filter:   Alert me  

Parse part of content (ignore/skip ALL until known tokens are found)

by ligett :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Good morning!

I'm just a novice in javacc struggling to get some simple stuff running:

I have a file going like that:

...upper random content...
known-content1
...random content...
known-content2
known-content3


(the known-content1,2,3 are optional)

When I define the syntax for "known-content1", it says that "upper random content" is not identified. Also

What I ultimately want to do is to get javacc only parse the _known content_, the one it recognizes. I want it to ignore the rest of content whatever it is.

Could you please tell how that thing is done?

Best Regards!

Re: Parse part of content (ignore/skip ALL until known tokens are found)

by J.Chris Findlay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The way javacc works is that it needs to "understand" everything in the input, so that leaves 2 choices:
 - define in some way the random content, with some switch or other to identify the beginning of the known content, often by defining a token to indicate the start of the part you want to keep, and switching lexical states when it's found, and back when it's done, and another token ~[] to soak up the rest one character at a time.
 - use some other method to extract the known part and hand it off alone to a javacc parser that only needs to understand that.

On Tue, Jun 30, 2009 at 4:00 AM, ligett <ligett@...> wrote:

Good morning!

I'm just a novice in javacc struggling to get some simple stuff running:

I have a file going like that:

...upper random content...
known-content1
...random content...
known-content2
known-content3


(the known-content1,2,3 are optional)

When I define the syntax for "known-content1", it says that "upper random
content" is not identified. Also

What I ultimately want to do is to get javacc only parse the _known
content_, the one it recognizes. I want it to ignore the rest of content
whatever it is.

Could you please tell how that thing is done?

Best Regards!
--
View this message in context: http://www.nabble.com/Parse-part-of-content-%28ignore-skip-ALL-until-known-tokens-are-found%29-tp24256910p24256910.html
Sent from the java.net - javacc users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...




--
- J.Chris Findlay
  (c:

Re: Parse part of content (ignore/skip ALL until known tokens are found)

by ligett :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Chris

Appreciate your response.
That's what I thought.. However I found a work-around - not very graceful and performing I believe but still:

http://www.nabble.com/Newbie-question-td18978334.html#a19008137
and the good resume of this thread here:
http://www.electricsenator.net/2008/08/16/1218875940000.html

Struggling to get this thing work now :)

Regards

J.Chris Findlay wrote:
The way javacc works is that it needs to "understand" everything in the
input, so that leaves 2 choices: - define in some way the random content,
with some switch or other to identify the beginning of the known content,
often by defining a token to indicate the start of the part you want to
keep, and switching lexical states when it's found, and back when it's done,
and another token ~[] to soak up the rest one character at a time.
 - use some other method to extract the known part and hand it off alone to
a javacc parser that only needs to understand that.