In most languages, this is not ambiguous: the first slash and asterix are consumed to create the "start of a multi-line comment" token. It is followed by a slash, which is the “content” in the comment, and finally, the last two characters are the token “end of a multiline comment”.
Since the first 2 characters are consumed, the first asterix also cannot be used to create the end of the comment token. I just noted that it can create a second “start of comment” token ... oops, this can be a problem, depending on the amount of context available to the parser.
I am talking about tokens here, suggesting parser-based comment processing. But the same thing applies to the lexer, according to which the main rule starts with '/*' , and then does not stop until '*/' is found. In fact, lexical processing of the entire commentary will not be confused by the second “commentary beginning”.
source share