From: Oren Ben-K. <or...@ri...> - 2002-12-05 09:24:30
|
Michael G Schwern wrote: > I've hit an edge case while working on the POY parser: > > foo: 42 > bar: 23 > > should this be valid or invalid? Invalid. A plain scalar may not contain ': '. > Another edge case is this one which I think I saw Steven just use: > > foo: > 42 > > again, I can't think of any ambiguity. We've been over this so many times... It looks innocent enough, but in the past we've run into edge cases trying to distinguish between this and collections (especially mapping collections). The thing is, I can't come up with a case off the top of my head. Let me see... I think that now that mapping keys are limited to a single line, there might be no ambiguity. Either the next line starts with '- ', or contains a ': ', or it is a plain scalar. Clark, Brian? > foo: > 42 > > If valid, technically it would > be this: > > foo: ' 42' # leading newline translates to space > > but it would be better if it DWIM > > foo: '42' > > ie. all leading whitespace before the first non-whitespace character > would be stripped. That's already the case for plain scalars anyway... including empty trailing lines. So there shouldn't be a problem with leading empty lines either. Thanks for bringing this up. We'll need to think about it some more. Have fun, Oren Ben-Kiki |