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:


{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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs