djasper closed this revision.
djasper added a comment.
Submitted as r250648.
http://reviews.llvm.org/D13765
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
mprobst updated this revision to Diff 37695.
mprobst marked 3 inline comments as done.
mprobst added a comment.
- add test
- review comments, fix unary handling.
- Extract canPrecedeRegexLiteral function.
http://reviews.llvm.org/D13765
Files:
lib/Format/Format.cpp
mprobst added inline comments.
Comment at: lib/Format/Format.cpp:860
@@ +859,3 @@
+}
+if (Prev) {
+ if (Prev->isOneOf(tok::plusplus, tok::minusminus)) {
djasper wrote:
> I understand and I actually find that hard to understand. I think a better
>
djasper added inline comments.
Comment at: lib/Format/Format.cpp:828
@@ +827,3 @@
+ // Returns \c true if \p Tok can only be followed by an operand in
JavaScript.
+ bool PrecedesOperand(FormatToken *Tok) {
+// NB: This is not entirely correct, as an r_paren can introduce
mprobst added inline comments.
Comment at: lib/Format/Format.cpp:858
@@ +857,3 @@
+}
+if (Prev) {
+ if (Prev->isOneOf(tok::plus, tok::plusplus, tok::minus,
djasper wrote:
> I'd probably put this into the other two conditions to reduce indentation.
>
djasper added inline comments.
Comment at: lib/Format/Format.cpp:755
@@ -754,3 +754,1 @@
- if (tryMergeEscapeSequence())
-return;
if (tryMergeTemplateString())
I wonder if escape sequences are also relevant to template strings. If yes, we
are
mprobst updated this revision to Diff 37654.
mprobst marked 3 inline comments as done.
mprobst added a comment.
- add test for if (...) /re/;
- address minor review comments
- fix unary handling.
http://reviews.llvm.org/D13765
Files:
lib/Format/Format.cpp
unittests/Format/FormatTestJS.cpp
mprobst added inline comments.
Comment at: lib/Format/Format.cpp:757
@@ -756,3 +756,1 @@
- if (tryMergeEscapeSequence())
-return;
if (tryMergeTemplateString())
You cannot actually escape in a template string - backslashes in them are
literal
mprobst updated this revision to Diff 37447.
mprobst added a comment.
Simplified escape handling.
http://reviews.llvm.org/D13765
Files:
lib/Format/Format.cpp
unittests/Format/FormatTestJS.cpp
Index: unittests/Format/FormatTestJS.cpp
mprobst created this revision.
mprobst added a reviewer: djasper.
mprobst added subscribers: klimek, cfe-commits.
If a RegExp contains a character group with a quote (`/["]/`), the
trailing end of it is first tokenized as a string literal, which leads
to the merging code seeing an unbalanced
10 matches
Mail list logo