While the code above works fine in most cases it fails at codes like this:
1 2 3 4 5 6 7 8 9
#include <iostream>
constchar c = "/*" ;
int main( )
{
std::cout << "Will I still be here?" ;
return 0;
}
1 2 3 4
// this is a single line comment, but it ends with an escape char: \
this line is also considered part of the comment \
as is this one (even if the forum syntax highlighting doesn't show it)
this_is_not_a_comment();
So basically I got the problem that my code isnt recognizing that the sign "//" or "/*" "*/" is part of a namedeclaration or string. I think that the solution should be somehow via if or switch in order to verify if // is a real comment or not, but I got no clue how to do this properly.
Could anyone help me?