in reply to PRD parser problem: How to skip C comments when parsing
Assuming you don't allow comment nesting or /*/, a C comment is
qr{ /\* .*? \*/ }sx
You said C, but your example also shows a C++ comment. A C++ comment is
qr{ // [^\n]* }x
The default definition of whitespace in PRD is
qr{ \s* }x
So if we combine them all, we get
Para: <skip:qr{ (?> \s | /\* .*? \*/ | // [^\n]* )* }sx> List(s) /\Z/
<skip> is dynamically scoped, so List and everything called by it will be affected.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: PRD parser problem: How to skip C comments when parsing
by Hanken (Acolyte) on Jun 10, 2008 at 07:46 UTC | |
by ikegami (Patriarch) on Jun 10, 2008 at 08:01 UTC | |
by Hanken (Acolyte) on Jun 10, 2008 at 08:40 UTC | |
by ikegami (Patriarch) on Jun 10, 2008 at 09:49 UTC |