From: Harry van Stedum Date: 2007-03-04T22:30:08+09:00 Subject: rex: multiline comment Hi all, does anybody using Rex know how to deal with multline comments (of the kind "/* ... */")? In the Rex-docs I can find this: macro REMIN \/\* REMOUT \*\/ rule {REMIN} { state = :REM ; [:REM_IN, text] } :REM {REMOUT} { state = nil ; [:REM_OUT, text] } :REM (.+)(?={REMOUT}) { [:COMMENT, text] } I changed the rules like this, as I don't want to propagate comments to the parser: rule {REMIN} { state = :REM ; nil } :REM {REMOUT} { state = nil ; nil } :REM (.+)(?={REMOUT}) I have no idea, nor can I find anywhere, the meaning of "?=" in the last line, however it seems to work for 1-line comments; it breaks on multiline comments though. It expands to "(text = ss.scan(/(.+)(?=\* \/)/))" in the generated ruby-code, where ss is a StringScanner object. The "/*" is found/matched, after that the lexer fails with (JavaLexer::ScanError); it seems the (.+) cannot be matched. Thanks, Harry