Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: tools/gn/tokenizer.cc

Issue 591373002: gn: start of format command (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-more-comment-stuff
Patch Set: change 'copyright header block' to 'standard header block' for android_webview/tools/check_licenses… Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/token.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « tools/gn/token.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698