"Khoa Nguyen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] <snip> > Thanks for your reply. This looks promising, but I have a few more questions: > 1. If f(i) is non-terminal (e.g f(i) is another grammar expression), > how would I adapt your idea to a more generic way? > 2. The field delimiter is not always ',' in my case. So I guess I'll > have to use delimtedList instead? > > Thanks again, > Khoa
Khoa, Yes, it sounds like delimitedList is the way to go. Note that the delimiter for delimitedList can also be an expression, it does not have to be a literal string, or terminal. Also, do not bother using delimitedList if your delimiter is just whitespace - pyparsing breaks up tokens on whitespace by default, that is: OneOrMore(Word(alphas)) will correctly parse "This is a sentence made up of alphabetic words", giving: ['This', 'is', 'a', 'sentence', 'made', 'up', 'of', 'alphabetic', 'words'] without having to represent the delimiting whitespace in the grammar. -- Paul -- http://mail.python.org/mailman/listinfo/python-list