pyparsing: how to negate a grammar

Paul McGuire ptmcg at austin.rr._bogus_.com
Sun Jan 9 03:18:31 EST 2005


<knguyen at megisto.com> wrote in message
news:1105229039.136595.180640 at c13g2000cwb.googlegroups.com...
> Hi,
>
> I want to define a rule for a line that does NOT start with a given
> Literal. How do I do that? I try the following and my program just hang
> there:
>
> BodyLine = ~Literal("HTTP/1.1") + restOfLine
>
> Thanks,
> Khoa
>
Khoa -

pyparsing can be run in several modes, one of which tokenizes and extracts
data according to a given grammar, one of which scans for pattern matches,
and one which translates matched patterns into other patterns.  Its not
clear from your e-mail what you are trying to do.  There is nothing in your
statement that would cause Python to "just hang there", what else is your
program doing?

-- Paul






More information about the Python-list mailing list