Re: [Pyparsing] C++ Comments and a Backslash at the End of the Line.
Brought to you by:
ptmcg
From: Paul M. <pa...@al...> - 2006-10-04 03:57:36
|
Does this look better? cppStyleComment = Regex(r"(\/\*[\s\S]*?\*\/)|(\/\/(\\\n|.)*)").setName("C++ style comment") It seems to test out okay. I'll put it in the next update. -- Paul > -----Original Message----- > From: pyp...@li... > [mailto:pyp...@li...] On > Behalf Of Ralph Corderoy > Sent: Tuesday, October 03, 2006 2:14 PM > To: pyp...@li... > Subject: [Pyparsing] C++ Comments and a Backslash at the End > of the Line. > > > Hi, > > Just looking at pyparsing-1.4.3's source and > > cppStyleComment = > Regex(r"(\/\*[\s\S]*?\*\/)|(\/\/.*)").setName("C++ style comment") > > seems wrong. AIUI the // style of comment is terminated by > the end of a line that is not preceeded with a backslash: > > $ cat x.c++ > int a; \\ abc\ > int b; \\ ghi > $ g++ -E x.c++ > # 1 "x.c++" > # 1 "<built-in>" > # 1 "<command line>" > # 1 "x.c++" > int a; \\ abcint b; \\ ghi > $ > > I don't know about Java: > > javaStyleComment = cppStyleComment > > Cheers, > > > Ralph. > > > > -------------------------------------------------------------- > ----------- > Take Surveys. Earn Cash. Influence the Future of IT Join > SourceForge.net's Techsay panel and you'll get the chance to > share your opinions on IT & business topics through brief > surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge &CID=DEVDEV > _______________________________________________ > Pyparsing-users mailing list > Pyp...@li... > https://lists.sourceforge.net/lists/listinfo/pyparsing-users > > |