On 15/01/02 07:34 -0000, Oren Ben-Kiki wrote:
> Brian Ingerson [mailto:ingy@...] wrote:
> > 1) It *is* possible to comment out lines on top level
> > scalars...
> This requires the following:
> > 2) There is a seeming off-by-one error for top level indentation. The
> > trick to understanding it is to consider the base indentation to be
> > -1 (Where the first column offset is 0) Then it all works in a very
> > consistent manner. Since the default indentation means adding 1 to
> > the previous indentation, adding 1 to -1 gives 0 offset.
> First, there's no longer a "default indentation" of 1. Indentation is always
> auto-detected (or specified).
Bad wording on my part.
> Now, as to what you propose... It seems you suggest that the top-level node
> wouldn't be required to be indented at level 0, instead it would be allowed
> to be indented at any level. For example:
> this: would be valid.
> and: so would this.
> --- ^
> and this.
That's how I've implemented it. It works very nicely. No special cases for
the top level. Basically I have two variables: a 'level' which starts at 0.
'level' is an index into an array of column 'offsets'. I initialize
offsets to -1. Level zero isn't usable, it's just the base. Level 1 is the
top YAML level.
> There is some sense in that - if indentation is flexible, why shouldn't that
> apply to top-level? And as you point out it allows comments inside top-level
> leaf values. So I'll go with it. Clark?
I don't even see this as a YAC, just an interesting clarification.
> > 3) '^' as an indicator kinda blows. It seems a little confusing. I'd
> > like to YAC about switching it to '>'. This still has the 'folded'
> > connotations of '^' but it points forward instead of up.
> I dislike it because it would make '>' be an indicator. Besides, a
> standalone '>' shouts "greater than" to everyone, while '^' says "magic" -
> in different contexts it stands for "power", "control", "start of line"...
> Giving it a specific magical meaning in YAML is better than subverting '>'.
What's wrong with '>' as an indicator? How else would you use it? Examples
At this point, I'll stick with '>' and '^' as my top choices. (I've already
> On the other hand I agree ^ takes getting used to:
> > 4) I'm writing my YAML.pm change log in YAML now. This has
> > prompted yet
> > another YAC. Let's make '-' mean chomp for all multilines,
> > and let's have
> > chomp strip off *all* trailing newlines, even if they are in
> > the stream. That
> > way we can put extra blank lines after multilines for
> > spacing, and not have
> > them be part of the content.
> I like the thought... but I disagree about "if they are in the stream". For
> this: `\-
> does have one trailing newline.\n
> # but the above empty line is chomped.
> I'd just phrase it as "*all* trailing newlines", period. The difference
> would be between:
Good point. +1
> nested_leaf ::= indicators line_break leaf_value
> leaf_value ::= ( indent line_data line_break )*
> chomped_leaf ::= indicators line_break chomped_value line_break+
> chomped_value ::= indent line_data ( line_break indent line_data )*
> I've already started transitioning the productions to make this
> distinction... Clark, is that OK with you?
> > If you guys really like the '>' over '^' thing, let me know
> > right away.
> > Then I can change it before I ship version 0.27 to CPAN tommorrow, and
> > teach this stuff to a big group of Perl hackers.
> I'm sorry I didn't send you an updated spec so far. Work is slow because it
> means re-writing the whole leaf section, and that's *after* I wrestled the
> productions into a reasonable form (according to the concept above, plus
> handling the comments issue, etc.). Plus I didn't have all the time I
> planned on having. It will be done this weekend, I hope...
> If you YAC The ^ <=> ` change and update the indentation YAC to cover the
> top-level, I'll include that as well. Of course Clark would have to OK them
I'm not a fan of `. (Yet :)