pyparsing.line has an off by one bug when location is 0 and the text begins with a newline. Instead of returning an empty string, the function returns the entire text, as shown:
Python 2.6.4 (r264:75706, Feb 10 2010, 15:02:54)
[GCC 4.3.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyparsing
>>> pyparsing.line( 0, '\ntest\n' )
A one character change in pyparsing.line fixes the problem for me. A patch is attached for pyparsing 1.5.2.
Log in to post a comment.