On Thu, Nov 14, 2019, at 16:23, MRAB wrote:
> On 2019-11-14 19:51, Andrew Barnert via Python-ideas wrote:
> > And that raises a point: the if keyword can appear in other places besides 
> > the start of a compound statement. Does tokenize.py have enough info to 
> > handle that properly? I don’t know, and the answer to that might be a good 
> > proxy to the question of whether it can be done in the real compiler 
> > without making parsing complicated, even if it won’t prove the answer 
> > either way.

Well, in principle, you could also allow NL within inline conditionals [i.e. in 
the part bracketed by if and else] as well. This probably isn't very desirable 
though, I was kind of assuming that the parser knew when it was at the start of 
a line.

> Keywords (reserved words) are special everywhere except in strings and 
> comments.

I don't think that's directly relevant to Andrew's question, it's could still 
be the "same kind of special", whereas the tokenizer needs to treat it 
differently in each context and therefore differentiate between the contexts.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/6XH2VATLNRN6EY3CY4C4ZWQEKX3H5YHZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to