Tom Copeland's Recent Posts

RSS Feeds

« RubyForge Subversion and CVS browsing | Main | Spam on RubyForge trackers »

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83451d3c069e200e5505cd9ac8833

Listed below are links to weblogs that reference Parsing binary data with JavaCC:

Comments

Do you have an example of parsing a text file into objects? Where the text file contains different sections (each section has its own structure). I ask because I can't figure out the "best way" to parse a text file where the sections are seperated as such

~A
~B
~C
~D

thought you might some insight on this.

Hi Jason - Hm, are there always the same four sections, and are the token types the same for all four sections? Can you do something like;

void File() : {} {
A() B() C() D()
}

void A() : {} {
"A" Other() Things() In() Here()
}

The sections are always the same (but the content for each section is different from one section to another) but not always present and not always in the same order except for the last. Example, would be ...

Where ~+[letter] marks the start of the section (also which section it is such as ~V might stand for ~Version but the only required part is ~V) and ~D must always appear last in the file but the other sections may or may not be present.

~V
~A
~P
~D

Hi Jason - Cool, but do all the sections consist of the same tokens? I mean, are they all generally the same sort of data, but with a different structure in each section? Feel free to email me offline at tom@infoether.com....

The comments to this entry are closed.