Guido van Rossum added the comment:

Call PyTokenizer_Get until the line number is > 2?

On 10/15/07, Christian Heimes <[EMAIL PROTECTED]> wrote:
>
> Christian Heimes added the comment:
>
> > Try harder. :-) Look at the code that accomplishes this feat in the
> > regular parser...
>
> I've already found the methods that find the encoding in
> Parser/tokenizer.c: check_coding_spec() and friends.
>
> But it seems like a waste of time to use PyTokenizer_FromFile() just to
> find the encoding. *reading* Mmh ... It's not a waste of time if I can
> stop the tokenizer. I think it may be possible to use the tokenizer to
> get the encoding efficiently. I could read until
> tok_state->read_coding_spec or tok_state->indent != 0.
>
> Do you know a better way to stop the tokenizer when the line isn't a
> special comment line "# -*-"?
>
> Christian
>
> __________________________________
> Tracker <[EMAIL PROTECTED]>
> <http://bugs.python.org/issue1278>
> __________________________________
>

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1278>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to