you are viewing a single comment's thread
view the rest of the comments
[–] 5 points 5 months ago (4 children)

The problem is fairly simple:

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

You are breaking the loop if either the current character is a * or if the next character is a /. In other words, you don't require the full */ token.

Instead, you'll want something like

		while ((Peek() != '*' || PeekAhead() != '/') && !IsAtEnd()) {
  • source
  • hideshow 4 child comments
  • [+] [S] 3 points 5 months ago (2 children)