ignore cstylecomment issues

jchumnanvech at gmail.com jchumnanvech at gmail.com
Fri Oct 20 00:27:49 CEST 2006


from pyparsing import Word, printables,ZeroOrMore,cStyleComment
expr = ZeroOrMore(Word(printables))
expr.ignore(cStyleComment)
for line in expr.parseString('#include <iostream>\n\nint
main()\n{/*interesintg\ncomment*/\nstd::cout << "hello world";\n}'):
    print line

outputs

#include
<iostream>
int
main()
{/*interesintg
comment*/
std::cout
<<
"hello
world";
}

if i put a space between { and /* then it works properly

any help plz




More information about the Python-list mailing list