From: Clark C . E. <cc...@cl...> - 2001-05-19 06:46:32
|
Brian Ingerson wrote: | This is correct: | | text: | |this is my | |multiline? | | this is not: | | text: | |this is my | |multiline? And he wrote... | > key4 @ | > * id | > : value | > % | > key : value | Why switch indent width? | > @ | > : value Ok. Here are the indenting rules as I understand them (and have demonstrated through example, but as of yet have not laid out as a spec). Call the whitespace leading up to the first printable character of a node it's "indent" For one node c to be considered a child of another node p it must: 1. The child must be indented further than it's parent. Specifically... Node c must have an indent i formed from the concatination of the indent for p plus at least one additional whitespace character. 2. There are not any intermediate nodes in the hierarchy. Specifically... There does not exist another node b, such that b occurs after p and b occurs before c and the indent for p occurs in the indent for b and the indent for b occurs in the indent for c and the indent of b and c are not equal and the indent for p and b are not equal. 3. Indents compare literally. An indent with a tab in position n can only be equivalent to another indent with a tab in position n. 4. The indentation is consistent among siblings. If a and b are both children of p, then the indent for a is equal to the indent for b. So to your question "why switch indent with" I answer: "beacuse you can as long as it is consistent". And to your correct/incorrect item above... I don't understand. Both are legal. In particular you want to allow more than one indentation style so that fragments can be concatinated as needed and/or indented. I hope this makes sence. Based on my experiences, this is the Python method. Best, Clark |