Index: tools/gn/tokenizer.cc |
diff --git a/tools/gn/tokenizer.cc b/tools/gn/tokenizer.cc |
index bc0b6384df0f1ef517275e6348ddde8d52903ea9..b33e29a66391f1e39ad9b6169139f0dcfacff0bf 100644 |
--- a/tools/gn/tokenizer.cc |
+++ b/tools/gn/tokenizer.cc |
@@ -128,6 +128,18 @@ std::vector<Token> Tokenizer::Run() { |
location.line_number() || |
tokens_.back().location().char_offset() != location.char_offset())) { |
type = Token::LINE_COMMENT; |
+ Advance(); // The current \n. |
+ // If this comment is separated from the next syntax element, then we |
+ // want to tag it as a block comment. This will become a standalone |
+ // statement at the parser level to keep this comment separate, rather |
+ // than attached to the subsequent statement. |
+ while (!at_end() && IsCurrentWhitespace()) { |
+ if (IsCurrentNewline()) { |
+ type = Token::BLOCK_COMMENT; |
+ break; |
+ } |
+ Advance(); |
+ } |
} else { |
type = Token::SUFFIX_COMMENT; |
} |