[PATCH] D22431: clang-format: [JS] nested and tagged template strings.

Martin Probst via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 22 06:29:47 PDT 2016


mprobst added inline comments.

================
Comment at: lib/Format/FormatTokenLexer.cpp:259
@@ -241,1 +258,3 @@
       ++Offset; // Skip the escaped character.
+    if (Offset + 1 < Lex->getBuffer().end() && Offset[0] == '$' &&
+        Offset[1] == '{') {
----------------
Question by @ygao in the other diff:

> What happens if the '${' is immediately after a backslash (the if statement above), should the '${' get escaped?

A template like `foo\${bar}` is the literal string `'foo\${bar}'`, i.e. the `\` acts as an escape for the `'$'` sign. I've added a test to validate that.


https://reviews.llvm.org/D22431





More information about the cfe-commits mailing list