Speedy37 / vscode-ascii-property-list

VSCode syntax extension for ASCII Property List
MIT License
1 stars 1 forks source link

.dict files should default to extended plists #1

Closed lilyball closed 5 years ago

lilyball commented 5 years ago

The only usage of .dict files I know of offhand is DefaultKeyBinding.dict, and this is definitely an extended ASCII property list.

lilyball commented 5 years ago

Well, more generally, this is a plist that supports comments. I'm actually not sure what the other things in your "extended" plist format are.

In fact, maybe comments should just be supported by the regular ASCII property list syntax instead. Certainly plutil -p happily accepts ASCII property list input with comments (and strips them out when printing the parsed results).

Speedy37 commented 5 years ago

plist extended is a format I use that extend plist with some capabilities. So there is no reason for it to be the default.

standard plist support comments ? // and / / ?

lilyball commented 5 years ago

It certainly appears as though the standard OpenSTEP ASCII Property List format supports comments. At the very least, the CoreFoundation routines for reading property lists understands (and strips) said comments, as evidenced by plutil -p handling it correctly.

> echo '{ /* foo */ a = 3; }' | plutil -p -
{
  "a" => "3"
}

And of course DefaultKeyBindings.dict definitely supports comments, given that my years-old DefaultKeyBindings.dict file that that I just opened up VSCode had a bunch of comments in it.

Speedy37 commented 5 years ago

Do you have a document with the latest plist (non xml) spec? I did base the current syntax on a very old (1999) implementation of plist. Anyway I will add block comments to the std plist syntax

lilyball commented 5 years ago

AFAIK the documentation you linked to in the README is the only actual official documentation on the ASCII property list format. This format was obsoleted a very long time ago and the only real canonical documentation is the actual CoreFoundation parsing behavior. https://opensource.apple.com/source/CF/CF-1153.18/CFOldStylePList.c.auto.html is the parsing implementation for the old-style plist, and in that file the function advanceToNonSpace() skips // and /* … */ comments. This file's copyright begins in 1999 and AFAIK the format is the same as it was back then.

I also went back and checked the oldest version of CoreFoundation available, which is the version from macOS 10.3, and its advanceToNonSpace function is the same (skipping comments), so we have proof that as early as 2004 the format was skipping comments, though again I have to assume it was skipping comments in 1999 as well, and presumably was skipping comments back when it was first implemented for OpenStep.