On 24/12/01 21:14 +0200, Oren Ben-Kiki wrote:
> Brian Ingerson [mailto:ingy@...] wrote:
> > Proposal: \
> > An INDENT directive should be added to allow indentation widths other
> > than one space. For example, INDENT:8 would mean 8 space indent.
> > Rationale: \
> > After converting the httpd.conf file to YAML it became
> > apparent that it
> > is easy to get lost in single space indentation. Especially in the
> > presence of many comment lines.
> > Notes:
> > - Single space will remain the default.
> > - This proposal does *not* allow for TABs in indentation.
> > ...
> I guess that non-1-space indentation would be something we'll just have to
> handle eventually. I'd like to revisit the reason we can't do generic
> (Python-like) indent. The reason is multi-line folded scalars:
> this case: |
> <indent> <-leading space
> Alternative we discussed was to specify the indentation somehow:
> by number: \4
> indented 4 spaces
> default: \
> next line can't have leading spaces.
> further lines can.
> If we accepted this the problem would be dead forever. Anyone would be able
> to use what he wants, period.
But I think we can do better than that for syntax. Let's see...
Well, we need at least one space of indentation for multi-lines. I think
we agree on that. How about we limit indentation of multi-lines to
exactly one space? The need for more indentation doesn't really apply
that much to multi-lines.
Another option is to use a visual indicator.
> This is
>Two space indenting
One space indent is the default.
This has an edge case, but I'm sure Oren can figure out how to
deal with it :)
> It would also make YAX#6.2 almost not a
> special case, and allow other formatting improvements (see below).
> Speaking of YAC#6.2, it only makes sense if we have fixed 1-space
> indentation, OR some generic indentation scheme. It makes no sense at all to
> double-indent for fixed 4-space indentation. So if we go for any scheme that
> used a *fixed* non-1-space indentation, YAC#6.2 goes out the door.
I realized this. I think it's one of the reasons that 6.2 is a hack. I
haven't been that in favor of it. I guess flexible indentation could make it
> As far as whether 1 space indentation works... I wrote a Makefile generator
> for my Java project, using Makefile.yaml as input and using Brian's
> yaml-0.23 (thanks Brian! it works nicely for me!). I found out that one
> space indentation isn't enough to latch on to, visually. I also found out it
> looks much better to write:
> - entry
> - entry
> than that:
> - entry
> - entry
> This can be done in any fixed indentation scheme (making the indent for the
> '-' be 0). In a generic indentation scheme it means the minimal indentation
> for '-' is zero rather than 1.
# so is this:
# or this:
I think this is not a good idea. Even if you can find the rules to make it
work out, it's confusing.
> BTW, this got me thinking that in a generic indentation scheme we should
> specify the productions with 'n' being not the indent level, but the actual
> number of spaces to indent. This way one could easily say
> thing(n) ::= ( indent(n) something(n+k) line_break )*
> simple(n) ::= <indicator> <k>? line_break <simple_line>(n+<k>)*
> This way the fact the same indent level is used for all entries in a branch
> is explicit in the BNF, and it is easy to specify how it is explicitly given
> for leaf formats... It all works so nicely together.
> Summary: I think we should go for broke and allow generic indentation rather
> than use an INDENT directive.
> I think the *minimal* indentation for the '-'
> for a series should be zero.