Hiya,

Just looking for some tips on reading formatted config files. The config 
file is pretty strictly formatted.. here's an example:

# this is a comment. any text on a line after a # should be ignored
section "section1" {
     option "value";
     option-array {
         "value 1";
         1234; # numerical value
         anothervalue; # text without quotes
     };
     option-array-on-one-line { value1; "value 2"; 46; };
};

That's kind of a worst-case scenario. Most sections will only have 1-2 
options, and not contain subsections, etc.. but some do contain it, so 
is why I constructed this. I'm not looking for actual code, exactly.. 
more or less tips on where to start. Should I come up with a magical 
regexp that can sift through the data, or some kind of recursive 
function that reads values and returns arrays with the values..

Values are always terminated by a ; character, unless of course that ; 
character lies within quotes. Pretty standard stuff, but it's my first 
attempt at parsing something this complex.

Any kind of help on this is appreciated.

Mike
-- 
Most burning issues generate far more heat than light.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to