z7zmey / php-parser

PHP parser written in Go

Home Page:https://php-parser.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

line comment immediately inside block comment

imuli opened this issue · comments

I'm finding some files with things like this:

/*// comment
  commented_out_source()
 */

The scanner checks the previous rune for '*' and then the current for '/', but starts with the current rune immediately after the /* - so it closes the comment immediately.

I suspect that adding in a c = l.Next() before the loop in scanner/scanner.l:297 would fix this, but I'm not sure this is the best solution and also not certain how to go about generating scanner.go from that - go generate doesn't seem to work.

Thanks for the pull request.
I fixed /**/ comment termination and the test case for this type of comment.
Also, I added a test for /*/*/.

If it still actual, I am using make compile command to recompile all .l and .y files.
I only recently learned that I could use the go generate for this purpose