Pyparsing Question

Ant antroy at gmail.com
Fri May 16 11:45:16 EDT 2008


Hi Paul,

> LineStart *really* wants to be parsed at the beginning of a line.
> Your textline reads up to but not including the LineEnd.  Try making
> these changes.
> 
> 1. Change textline to:
> 
>      textline = pp.Combine(
>         pp.Group(pp.Word(pp.alphas, pp.printables) + pp.restOfLine)) +
> \
>         pp.LineEnd().suppress()

Ah - so restOfLine excludes the actual line ending does it?

> 2. Change comb to:
> 
>     comb = head + parser

Yes - I'd got this originally. I added the garbage to try to fix the 
problem and forgot to take it back out! Thanks for the advice - it works 
  fine now, and will provide a base for extending the list format.

Thanks,

Ant...



More information about the Python-list mailing list