krasimir added inline comments.
================
Comment at: lib/Format/TokenAnnotator.cpp:665
       }
+      if ((Style.Language == FormatStyle::LK_Proto ||
+           Style.Language == FormatStyle::LK_TextProto) &&
----------------
sammccall wrote:
> I don't really understand what this is doing.
> It seems to be detecting some particular sequence of invalid tokens 
> `}:`,`]:`,`>:`. Why are these special? 
> 
> What's the contract of consumeToken()? It's hard to see from the callsites.
Thank you very much! I guess I got carried away. These don't make sense. I'll 
update it to only keep dangling `:` as in `key:`.

Returning false from consumeToken has the desired effect that (eventually) 
marks the line as incomplete here:
https://github.com/llvm-mirror/clang/blob/master/lib/Format/TokenAnnotator.cpp#L1055


================
Comment at: lib/Format/TokenAnnotator.cpp:773
     case tok::r_brace:
-      // Lines can start with '}'.
-      if (Tok->Previous)
+      // Lines can start with '}' except in text protos.
+      if (Tok->Previous || Style.Language == FormatStyle::LK_TextProto)
----------------
sammccall wrote:
> In what sense of "line" is this true?
This is the UnwrappedLine concept of clang-format: roughly a maximal sequence 
of tokens that we could have put on the same line if there was no column limit.


Repository:
  rC Clang

https://reviews.llvm.org/D44203



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to