Re: Pyparsing: Grammar Suggestion. 2nd thought

2006-05-17 Thread Khoa Nguyen
for tokens,start,end in commaSeparatedList.scanString(data): print tokens This returns: ['f1', 'f2', 'f3', 'f4', 'f5', 'f6'] ['f1', 'f2'] ['f1', 'f2', '', 'f4', '', 'f6'] Thanks for your reply. This looks promising, but I have a few more questions: 1. If f(i) is non-terminal (e.g

Re: Pyparsing: Grammar Suggestion. 2nd thought

2006-05-17 Thread Heiko Wundram
Am Mittwoch 17 Mai 2006 20:05 schrieb Khoa Nguyen: On 2nd thought, I don't think this will check for the correct order of the fields. For example, the following would be incorrectly accepted: f1,f5,f2 END_RECORD Thanks, Khoa If I'm not completely mistaken, parsers written using

Re: Pyparsing: Grammar Suggestion. 2nd thought

2006-05-17 Thread Heiko Wundram
Am Mittwoch 17 Mai 2006 20:24 schrieb Heiko Wundram: If I'm not completely mistaken, parsers written using PyParsing can accept a small superset of all languages that an N/DFA can accept, snip... Okay, forget what I said about PyParsing here; using Forward(), you can create recursion, but it

Re: Pyparsing: Grammar Suggestion. 2nd thought

2006-05-17 Thread Paul McGuire
Khoa Nguyen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] for tokens,start,end in commaSeparatedList.scanString(data): print tokens This returns: ['f1', 'f2', 'f3', 'f4', 'f5', 'f6'] ['f1', 'f2'] ['f1', 'f2', '', 'f4', '', 'f6'] snip On 2nd thought, I don't think