On Wed, Oct 31, 2012 at 5:45 AM, Devin Jeanpierre <jeanpierreda@gmail.com> wrote:
On Wed, Oct 31, 2012 at 8:33 AM, Eli Bendersky <eliben@gmail.com> wrote:
>> Is there a reason the tokenizer can't ignore newlines and
>> indentation/deindentation between with/etc. and the trailing colon?
>> This would solve the problem in general, without ambiguous syntax.
>
> At the expense of making the tokenizer context dependent?

It's already context-dependent in some sense, but this wouldn't make
it any moreso. For example, the tokenizer already ignores
indents/dedents when inside parens/braces/brackets, and handling this
only slightly more complex than that. In particular, the trailing
colon is the one not inside braces or brackets.

Also, I'd avoid the term "context-dependent". It sounds too similar to
"context-sensitive" !

I use the two as rough synonyms. Shouldn't I?
 
Anyway, it looks like this isn't how the tokenizer treats
braces/brackets (it ignores indent/dedent, but not newlines (I guess
the grammar handles those)). What I meant to suggest was, treat "with
... :" similarly to how the OP suggests treating "with (...) :".

If this gets accepted, then, is there a reason to stop at "with"? Why not ignore newlines between "if" and its trailing ":" as well? [playing devil's advocate here]

Eli