C
Catalin Tilimpea
Im interested in parsing a text file that has a very specific, yet
somewhat complicated (for me) format. Sample attached. Looks something
like this:
BeanCounterDB = {
["settings"] = {
["profile.Default"] = {
["columnsortcurSort"] = 12,
["util.beancounter.mailrecolor"] = "both",
["columnsortcurDir"] = -1,
["configator.left"] = 282.666712026266,
["configator.top"] = 651.6666718914553,
},
The file contains a hierarchy of keys and values. Keys look like
"["string"]". Values are assigned by "=". Values can be "{}" or
"<string>", or <number> or lists of keys/values assignments separated by
"," and enclosed by "{" and "}" respectively.
This is all very much like xml, just that not sufficiently alike to just
make search and replace and then use an xml parser.
Anyone has any suggestions/pointers what I should do or where I should
look to be able to obtain some sort of datastructure (array of objects,
lists etc.) representing the data in such a file?
Thanks!
NOTE: Attachment contains more data than I put in the post, but still
not a full file, as the only such full file I have is rather large.
Attachments:
http://www.ruby-forum.com/attachment/3865/bcnt.txt
somewhat complicated (for me) format. Sample attached. Looks something
like this:
BeanCounterDB = {
["settings"] = {
["profile.Default"] = {
["columnsortcurSort"] = 12,
["util.beancounter.mailrecolor"] = "both",
["columnsortcurDir"] = -1,
["configator.left"] = 282.666712026266,
["configator.top"] = 651.6666718914553,
},
The file contains a hierarchy of keys and values. Keys look like
"["string"]". Values are assigned by "=". Values can be "{}" or
"<string>", or <number> or lists of keys/values assignments separated by
"," and enclosed by "{" and "}" respectively.
This is all very much like xml, just that not sufficiently alike to just
make search and replace and then use an xml parser.
Anyone has any suggestions/pointers what I should do or where I should
look to be able to obtain some sort of datastructure (array of objects,
lists etc.) representing the data in such a file?
Thanks!
NOTE: Attachment contains more data than I put in the post, but still
not a full file, as the only such full file I have is rather large.
Attachments:
http://www.ruby-forum.com/attachment/3865/bcnt.txt