Forum: Ruby rex: multiline comment

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Harry van Stedum (Guest)
on 2007-03-04 15:30
(Received via mailing list)
Hi all,
does anybody using Rex know how to deal with multline comments (of the
kind "/* ... */")?
In the Rex-docs I can find this:

   REMIN         \/\*
   REMOUT      \*\/

            {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:

            {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

The "/*" is found/matched, after that the lexer fails with
(JavaLexer::ScanError); it seems the (.+) cannot be matched.

Thanks, Harry
This topic is locked and can not be replied to.