[–] 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
  • context
  • [–] 3 points 5 months ago (5 children)
    private char Advance() {
       	return source[current++];
       }
    

    This is wrong. At least as I would expect advance to behave. While you do advance, you are returning the old value, not the new one. ++current would return the new value.

    Also, it would help if you said what the wrong behaviour was.

  • source
  • [–] 9 points 5 months ago

    Yes, it's always best when you have a wildly popular property, to completely disregard everything that made it popular to get a fresh perspective. This is the basis of many a success, just like... Uh... Anyway, this time it will be great!

  • source
  • parent
  • context
  • view more: ‹ prev next ›