[Pyparsing] pyparsing bug or operator error with cStyleComment?
Brought to you by:
ptmcg
From: Paul W. <pa...@xe...> - 2009-07-28 03:26:46
|
Hi, I'm trying to build a better working parser for named.conf files, and ran into a strange issue while parsing various kinds of comments. I think the below examples shows what I think is a bug: from pyparsing import * stuff = """ /* comment 1*/ // test // test2 /* test3 indeed */ /* test4 */ """ comment1 = Group(Word("//") + restOfLine) comment2 = Group(Word("#") + restOfLine) comment3 = cStyleComment comment = OneOrMore(comment1 | comment2 | comment3) parser = OneOrMore(comment) res = parser.parseString(stuff,parseAll=True) This gives me: pyparsing.ParseException: Expected end of text (at char 46), (line:7, col:4) I think that "cStyleComment" comments do not correctly work over multiple lines. Paul |