[TxMt] properties parser?

Allan Odgaard allan at macromates.com
Tue Jan 4 21:04:02 UTC 2005


On Jan 4, 2005, at 21:39, Xavier Noria wrote:

>> Which language do you want to write it in?
> In Perl or Python preferably. The XML solution via plutil looks like 
> the easiest, but for curiosity how would you deal with the structure 
> in memory without an intermediate XML file? If there was something in 
> Cocoa to deal directly with that format maybe I could play a bit with 
> PyObjC maybe.

There is, NSDictionary (which is a hash/associative array) can load its 
values using the dictionaryWithContentsOfFile: selector/method.

So in Objective-C that would be:
  id dict = [NSDictionary dictionaryWithContentsOfFile:syntaxFile];

And now dict is an associative array representing the contents of the 
syntaxFile. E.g. you'd access patterns, which is an array and each 
element is again a dictionary (which may have patterns again)...




More information about the textmate mailing list