#45 CharsNotIn does not skip leading whitespace

closed-rejected
nobody
None
5
2012-06-16
2011-09-12
No

EXAMPLE:

>>> from pyparsing import CharsNotIn
>>> CharsNotIn(" ").parseString(" hello")
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
CharsNotIn(" ").parseString(" hello")
File "D:\Documents\work\wordbase\src\pyparsing.py", line 969, in parseString
raise exc
File "D:\Documents\work\wordbase\src\pyparsing.py", line 959, in parseString
loc, tokens = self._parse( instring, 0 )
File "D:\Documents\work\wordbase\src\pyparsing.py", line 837, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "D:\Documents\work\wordbase\src\pyparsing.py", line 1855, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected !W:( ) (at char 0), (line:1, col:1)

Discussion

  • Paul McGuire

    Paul McGuire - 2012-06-16
    • status: open --> closed-rejected
     
  • Paul McGuire

    Paul McGuire - 2012-06-16

    This is correct, the CharsNotIn expression does not skip whitespace. If you need this behavior, precede your CharsNotIn expression with an Empty() expression, which *does* skip whitespace, but otherwise does not consume any input text.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks