[PATCH] D13765: clang-format: [JS] Handle string literals spanning character classes.

Martin Probst via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 14 22:42:26 PDT 2015


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 bracket.

This change parses regex literals from the left hand side. That
simplifies the parsing code and also allows correctly handling escapes
and character classes, hopefully correctly parsing all regex literals.

http://reviews.llvm.org/D13765

Files:
  lib/Format/Format.cpp
  unittests/Format/FormatTestJS.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13765.37446.patch
Type: text/x-patch
Size: 9567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151015/a3347f34/attachment-0001.bin>


More information about the cfe-commits mailing list