[Pyparsing] Multiline expressions
Brought to you by:
ptmcg
From: Roberto A. <ra...@kd...> - 2006-10-02 17:54:32
|
Hello, I am a newbie to pyparsing (and parsers in general) and things are= =20 going good, except... How can I parse something like this if (expression) { command command command } else { command command } My problem is that apparently all expressions match only in a single line. =46or example: >>> from pyparsing import * >>> w=3DWord(alphanums) >>> lines=3DdelimitedList(w,"\n") >>> lines.parseString("""111111 =2E.. 222222 =2E.. 333333 =2E.. """ =2E.. ) (['111111'], {}) >>> Rather than the three items I expected. So, I can't match for a block like "{"+whatever+"}" I must be missing something very obvious here :-) =2D-=20 =A0("\''/").__..-''"`-. . =A0 =A0 =A0 =A0 Roberto Alsina =A0`9_ 9 =A0) =A0 `-. ( =A0 =A0).`-._.`) =A0r...@kd... =A0(_Y_.)' ._ =A0 ) `._`. =A0" -.-' =A0 KDE Developer (MFCH) =A0 _..`-'_..-_/ /-'_.' (l)-'' ((i).' ((!.' =A0 Buenos Aires - Argentina =46eynman's problem solving algorithm: write down the problem-> think very hard -> write down the answer. |