Jump to content

Cfg Parsing


TheDoctor
 Share

Recommended Posts

So I'm making my level code generator, and want to make an option that parses level code from the cfg. The thing is, I'm not quite sure how. I can just barely read a simple file with a colon delimiter, but the cfg has large amounts of whitespace. I was wondering how one would do this. I'm making this in Java (I know blargh) by the way.

CURRENT OBJECTIVE: Find a line that has "Levels {" that doesn't have a semicolon anywhere in font of it.

Link to comment
Share on other sites

Addictgamer

Look at ORR's CFG parser. It'll help.

Whitespace and whatnot is ignored with a simple, "bool start_recording".

It'll keep reading the cfg till it finds something other than whitespace, if you did it right.


if(last_read_char != ' ' && last_read_char != '\t' && last_read_char != '\n')

{

          start recording = true;

}

There. That should be enough help. C++ is close enough to Java for you to be able to port that code snippet yourself.

Link to comment
Share on other sites

Look at ORR's CFG parser. It'll help.

Whitespace and whatnot is ignored with a simple, "bool start_recording".

It'll keep reading the cfg till it finds something other than whitespace, if you did it right.


if(last_read_char != ' ' && last_read_char != '\t' && last_read_char != '\n')

{

          start recording = true;

}

There. That should be enough help. C++ is close enough to Java for you to be able to port that code snippet yourself.

Eh, I see what you mean, but I have to use Java Scanners to do this. I have to read up a bit more on some things, but thanks.

Edit: More of the parser code might help.

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.