Jan David Mol added the comment:
Attached a program which shows the relevant behaviour:
import shlex
tests = [ "foo#bar", "foo #bar" ]
for t in tests:
print "%s -> %s" % (t,[x for x in shlex.shlex(t,posix=True)])
results in
$ python lexer_test.py
foo
New submission from Jan David Mol :
The shlex parser parses "foo#bar" as "foo", discarding the rest as a
comment. This is actually one of the test cases, even in POSIX mode.
However, POSIX (see below) only allows comments to start at the
beginning of a token, so "fo
Jan David Mol added the comment:
As there seems to be some interest, I've continued working on patching
this issue.
Attached is an improved version of the patch, including additions to
test_shlex.py. Improved in the sense that newlines after a comment are
not considered to be actually pa
Changes by Jan David Mol :
--
components: +Library (Lib)
___
Python tracker
<http://bugs.python.org/issue7089>
___
___
Python-bugs-list mailing list
Unsubscribe:
Jan David Mol added the comment:
Attached is a patch which fixes this for me. It basically does a
fall-through using '\n' when encountering a comment. So that may be a
bit of a hack (who says '\n' is the only newline char in there, and not
'\r'?) but I'll le
New submission from Jan David Mol :
The shlex module does not function as expected in the presence of
comments when newlines are not whitespace. An example (attached):
>>> from shlex import shlex
>>>
>>> lexer = shlex("a \n b")
>>> print ",&q