From: Oren Ben-K. <or...@ri...> - 2002-07-05 15:11:52
|
Clark C . Evans wrote: > | | - foo: 1 > | | bar: 2 > | | > | | Possibilities: > | | > | | {'foo': '1 bar: 2'} Can't be (': ' in plain value) > | | {'foo': '1', ' bar': '2'} # how i parsed it before Can't be (leading spaces in plain value). > | | "Error, ' bar' must be enclosed in quotes" Put alternatively: "invalid indentation of 'bar'.". If one views it as the same problem as the following: this: "value" and: "value" But I don't think this is the message you'll get - because you are dealing with plain (rather than quoted) values. > | Error: Key/Value separator ": " found within plain scalar. Yes! The parser sees '- foo: 1' and says "OK, map_in_seq". Then the next line is more indented, so it thinks "OK, wrapped plain value". Then it sees a ': ' in it - an error. So that's the correct response. Side note: How is indentation of map_in_seq being determined? The above reasoning only holds if it is determined by the key immediately following the '-'. The spec is silent on this point, and I don't recall it ever being discussed. In view of the example above, it seems like the only reasonable choice. This deserves explicit mention in the spec. Good catch, Steve! Have fun, Oren Ben-Kiki |