From: Clark C . E. <cc...@cl...> - 2001-06-19 16:14:09
|
On Tue, Jun 19, 2001 at 11:59:01AM -0400, Clark C . Evans wrote: | | week: 2001-W25-2 # June 18-24 2001 | link: *303 # Lone Ranger Video | | We could modify the "simple" production to | exclude the pound sign... and thus the above | would be equivalent to... | | week: % | =: 2001-W25-2 | #: June 18-24 2001 | link: % | =: *303 | #: Lone Ranger Video I think I just fell in love with this short-hand mechanism. Sorry to be so wishy-washy. | date: 2001-JAN-02 ! org.yaml.Date # Today | | equivalent to... | | date: % | =: 2001-JAN-02 | !: org.yaml.Date | #: Today Hmm. value: !org.my.class # multi-line scalar to follow This is a multi-line scalar value it begins indented. value: % !: org.my.class #: multi-line scalar to follow =: This is a mult-line scalar value it begins indented. I think for this to work, the parser will have to have built-in options to "strip class" and "strip comment" colors. Ahh. parse( ... , char *strip[] ) /* built-in global constants */ const char *yaml_strip_comment[] = "#\0"; const char *yaml_strip_class[] = "!\0"; const char *yaml_strip_class_and_comment[] = "#\0!\0"; /* custom stripper, removes comments, map pairs with "key" for the key. This stripper leaves in classes. */ const char *custom_strip[] = "#\0key\0"; Thoughts? If, after stripping, a map has a single entry, "=", then it can be replaced with the value of =. Thus... key: % =: value becomes... key: value and key: % =: @ 1 2 becomes... key: @ 1 2 Just thinking... this might be dangerous... but then again, it is a filter operation, so it can be enabled and disabled. Really, this is moving into "yaml tree" operations. Where each of these operations may be implementable as a filter and will have particular properties. Kinda interesting, hmm. ;) Clark |