--000e0cd1a5c2c2f43c046a5e18f9 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Wed, May 20, 2009 at 2:30 PM, J Haas <Myrdred / gmail.com> wrote: > You keep on saying this, yet I have not seen one example of code that > demonstrates that using dedent couldn't work. Basically, we're looking > for some code which, if you removed the all ends, a script following > simple deterministic rules would not be able to unambigiously decide > where to put them back. I agree that "put an end wherever you see a > dedent" is naive and wouldn't work... but "put an end wherever you see > a dedent which isn't followed by a keyword which extends the current > expression, such as elsif or rescue or ensure" might. > Okay, you just want an example I guess. Code speaks louder than words! Here is an example Ruby program: foo 1,2,3] x oo.map do |n| n + n * end result ase x when Array x.map! do |n| n * n + end when NilClass x end result f result.size > 10 result[0..2] else result end p result The output of this program is: [16, 22, 28] Show me how you would parse the equivalent program in an indentation-sensitive Ruby, e.g.: foo 1,2,3] x oo.map do |n| n + n * result ase x when Array x.map! do |n| n * n + when NilClass x result f result.size > 10 result[0..2] else result puts result I'd be particularly interested in solutions which can be parsed with a LALR, LL*, or PEG parser. The approach you're describing does not sound like it could be expressed as a CFG, not that there isn't a CFG solution for this, just that the one you're proposing is not. -- Tony Arcieri medioh.com --000e0cd1a5c2c2f43c046a5e18f9--