Re: Tokenizer inconsistency wrt to new lines in comments

2008-04-04 Thread George Sakkis
On Apr 4, 4:38 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > >> If it was a bug it has to violate a functional requirement. I can't > >> see which one. > > > Perhaps it's not a functional requirement but it came up as a real > > problem on a source colorizer I use. I count o

Re: Tokenizer inconsistency wrt to new lines in comments

2008-04-04 Thread Fredrik Lundh
George Sakkis wrote: >> If it was a bug it has to violate a functional requirement. I can't >> see which one. > > Perhaps it's not a functional requirement but it came up as a real > problem on a source colorizer I use. I count on newlines generating > token.NEWLINE or tokenize.NL tokens in order

Re: Tokenizer inconsistency wrt to new lines in comments

2008-04-04 Thread George Sakkis
On Apr 4, 3:18 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > I guess it's just an artifact of handling line continuations within > expressions where a different rule is applied. For compilation > purposes both the newlines within expressions as well as the comments > are irrelevant. There are even

Re: Tokenizer inconsistency wrt to new lines in comments

2008-04-04 Thread Kay Schluehr
On 4 Apr., 18:22, George Sakkis <[EMAIL PROTECTED]> wrote: > The tokenize.generate_tokens function seems to handle in a context- > sensitive manner the new line after a comment: > > >>> from StringIO import StringIO > >>> from tokenize import generate_tokens > > >>> text = ''' > > ... # hello world

Tokenizer inconsistency wrt to new lines in comments

2008-04-04 Thread George Sakkis
The tokenize.generate_tokens function seems to handle in a context- sensitive manner the new line after a comment: >>> from StringIO import StringIO >>> from tokenize import generate_tokens >>> >>> text = ''' ... # hello world ... x = ( ... # hello world ... ) ... ''' >>> >>> for t in generate_tok