Carsten Klein added the comment:

Please see the attached patch that will resolve the issue. It also includes a 
test case in test_ast.py.

What the patch does is as follows:

- tok_state is extended by two fields, namely first_lineno
  and multi_line_start

- first_lineno will be set by tok_get as soon as the beginning
  of a STRING is detected and it will be set to the current line
  tok->lineno.

- multi_line_start is the beginning of the first line of a string

- in parsetok we now distinguish between STRING nodes and other
  nodes. in case of STRING nodes, we will use the values of the
  above fields for determining the actual lineno and the col_offset,
  otherwise tok->col_offset and tok->lineno will be used when
  creating the token.

The included test case ensures that the col_offset and lineno of
multi line strings is calculated correctly.

----------
keywords: +patch
Added file: http://bugs.python.org/file28477/issue1680.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16806>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to