On Thu, Sep 08, 2005 at 07:57:43PM -0400, Collin Winter wrote: : On 9/8/05, Larry Wall <[EMAIL PROTECTED]> wrote: : > It seems to me you need a stack of levels so you know how many : > indentation levels to pop off. Otherwise you can't parse this: : > : > if foo1 : > bar1 : > if foo2 : > bar2 : > if foo3 : > bar3 : > else : > baz2 : : Sure you can. Since each item on the stack would just mean "add : another indentation level", you could use the same pop-triggering : logic to decrement a simple counter.
Okay, how do you tell the difference between if foo1 bar1 if foo2 bar2 if foo3 bar3 else baz2 and if foo1 bar1 if foo2 bar2 if foo3 bar3 else baz2 unless you remember the exact columns that "if foo1" and "if foo2" were at? We're counting spaces here, not tabs. Sure, you could throw in extra indent/outdent tokens for every column, but that's just silly--you'd have to do massive tree rewriting when you find an unattached "else", and you'd get zillions of useless "blocks". (And don't even begin to think about allowing Unicode space characters. It's bad enough when people remap their tabs to something other than multiples of 8 and don't tell you...) Larry