Fixes #433.
R=rsc
CC=golang-dev
https://golang.org/cl/179072
}
}
- // reset position
+ // reset position to where it was upon calling findNewline
S.pos = pos
S.offset = pos.Offset + 1
- S.ch = '/'
+ S.next()
return newline
}
if S.ch == '/' || S.ch == '*' {
// comment
if S.insertSemi && S.findNewline(pos) {
+ // reset position to the beginning of the comment
+ S.pos = pos
+ S.offset = pos.Offset + 1
+ S.ch = '/'
S.insertSemi = false // newline consumed
return pos, token.SEMICOLON, semicolon
}
"foo $/*comment*/ \n",
"foo $/*0*/ /*1*/ /*2*/ \n",
"foo $/**/ /*-------------*/ /*----\n*/bar $/* \n*/baa",
+
+ "package main$\n\nfunc main() {\n\tif {\n\t\treturn /* */ }$\n}$\n",
}