@@ -697,32 +697,23 @@ void Lexer::lexOperatorIdentifier() {
697
697
break ;
698
698
} while (advanceIfValidContinuationOfOperator (CurPtr, BufferEnd));
699
699
700
+ if (CurPtr-TokStart > 2 ) {
701
+ // If there is a "//" or "/*" in the middle of an identifier token,
702
+ // it starts a comment.
703
+ for (auto Ptr = TokStart+1 ; Ptr != CurPtr-1 ; ++Ptr) {
704
+ if (Ptr[0 ] == ' /' && (Ptr[1 ] == ' /' || Ptr[1 ] == ' *' )) {
705
+ CurPtr = Ptr;
706
+ break ;
707
+ }
708
+ }
709
+ }
710
+
700
711
// Decide between the binary, prefix, and postfix cases.
701
712
// It's binary if either both sides are bound or both sides are not bound.
702
713
// Otherwise, it's postfix if left-bound and prefix if right-bound.
703
714
bool leftBound = isLeftBound (TokStart, BufferStart);
704
715
bool rightBound = isRightBound (CurPtr, leftBound, CodeCompletionPtr);
705
716
706
- if (CurPtr-TokStart > 2 ) {
707
- // If there is a "//" in the middle of an identifier token, it starts
708
- // a single-line comment.
709
- auto Pos = StringRef (TokStart, CurPtr-TokStart).find (" //" );
710
- if (Pos != StringRef::npos) {
711
- CurPtr = TokStart+Pos;
712
- // Next token is a comment, which counts as whitespace.
713
- rightBound = false ;
714
- }
715
-
716
- // If there is a "/*" in the middle of an identifier token, it starts
717
- // a multi-line comment.
718
- Pos = StringRef (TokStart, CurPtr-TokStart).find (" /*" );
719
- if (Pos != StringRef::npos) {
720
- CurPtr = TokStart+Pos;
721
- // Next token is a comment, which counts as whitespace.
722
- rightBound = false ;
723
- }
724
- }
725
-
726
717
// Match various reserved words.
727
718
if (CurPtr-TokStart == 1 ) {
728
719
switch (TokStart[0 ]) {
0 commit comments