« Return to Thread: Parse part of content (ignore/skip ALL until known tokens are found)

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

by J.Chris Findlay :: Rate this Message:

Reply to Author | View in Thread

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:

 « Return to Thread: Parse part of content (ignore/skip ALL until known tokens are found)