you are viewing a single comment's thread
view the rest of the comments
[–] 2 points 5 months ago (1 child)
while (Peek() != '*' && PeekAhead() != '/' && !IsAtEnd()) {

Probably this guy.

If you encounter an asterisk or a slash, then it stops. You want to stop when you encounter an asterisk and a slash, so:

while (!(Peek() == '*' && PeekAhead() == '/') && !IsAtEnd()) {

I also find your detection of when to remove the comment a bit scary, but that might be because you haven't shown the Match method.

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (1 reply)