Merge "Remove pcrecpp."
am: 067e0a2f37

Change-Id: Iac859b5de2fcfd05a81c9f45b2f6d39be66b27ff
diff --git a/Android.bp b/Android.bp
index 6661cbe..01029e4 100644
--- a/Android.bp
+++ b/Android.bp
@@ -71,33 +71,3 @@
         },
     },
 }
-
-
-//
-// Google's C++ wrapper.
-//
-
-cc_library_shared {
-    name: "libpcrecpp",
-    cflags: [
-        "-Wall",
-        "-Werror",
-        "-Wno-unused-parameter",
-        "-Wno-unused-variable",
-    ],
-    tidy_checks: [
-        "-google-build-using-namespace",
-        "-google-global-names-in-headers",
-    ],
-    local_include_dirs: ["pcrecpp/include"],
-    shared_libs: ["libpcre2"],
-    export_include_dirs: [
-        "pcrecpp/include",
-        "include",
-    ],
-    srcs: [
-        "pcrecpp/pcrecpp.cc",
-        "pcrecpp/pcre_scanner.cc",
-        "pcrecpp/pcre_stringpiece.cc",
-    ],
-}
diff --git a/pcrecpp/include/pcre_scanner.h b/pcrecpp/include/pcre_scanner.h
deleted file mode 100644
index b2bfabe..0000000
--- a/pcrecpp/include/pcre_scanner.h
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright (c) 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Sanjay Ghemawat
-//
-// Regular-expression based scanner for parsing an input stream.
-//
-// Example 1: parse a sequence of "var = number" entries from input:
-//
-//      Scanner scanner(input);
-//      string var;
-//      int number;
-//      scanner.SetSkipExpression("\\s+"); // Skip any white space we encounter
-//      while (scanner.Consume("(\\w+) = (\\d+)", &var, &number)) {
-//        ...;
-//      }
-
-#ifndef _PCRE_SCANNER_H
-#define _PCRE_SCANNER_H
-
-#include <assert.h>
-#include <string>
-#include <vector>
-
-#include <pcrecpp.h>
-#include <pcre_stringpiece.h>
-
-namespace pcrecpp {
-
-class Scanner {
- public:
-  Scanner();
-  explicit Scanner(const std::string& input);
-  ~Scanner();
-
-  // Return current line number.  The returned line-number is
-  // one-based.  I.e. it returns 1 + the number of consumed newlines.
-  //
-  // Note: this method may be slow.  It may take time proportional to
-  // the size of the input.
-  int LineNumber() const;
-
-  // Return the byte-offset that the scanner is looking in the
-  // input data;
-  int Offset() const;
-
-  // Return true iff the start of the remaining input matches "re"
-  bool LookingAt(const RE& re) const;
-
-  // Return true iff all of the following are true
-  //    a. the start of the remaining input matches "re",
-  //    b. if any arguments are supplied, matched sub-patterns can be
-  //       parsed and stored into the arguments.
-  // If it returns true, it skips over the matched input and any
-  // following input that matches the "skip" regular expression.
-  template<typename ... ARGS>
-  bool Consume(const RE& re, ARGS && ... args) {
-    const bool result = re.Consume(&input_, args...);
-    if (result && should_skip_)
-      ConsumeSkip();
-    return result;
-  }
-
-  // Set the "skip" regular expression.  If after consuming some data,
-  // a prefix of the input matches this RE, it is automatically
-  // skipped.  For example, a programming language scanner would use
-  // a skip RE that matches white space and comments.
-  //
-  //    scanner.SetSkipExpression("\\s+|//.*|/[*](.|\n)*?[*]/");
-  //
-  // Skipping repeats as long as it succeeds.  We used to let people do
-  // this by writing "(...)*" in the regular expression, but that added
-  // up to lots of recursive calls within the pcre library, so now we
-  // control repetition explicitly via the function call API.
-  //
-  // You can pass NULL for "re" if you do not want any data to be skipped.
-  void Skip(const char* re);   // DEPRECATED; does *not* repeat
-  void SetSkipExpression(const char* re);
-
-  // Temporarily pause "skip"ing. This
-  //   Skip("Foo"); code ; DisableSkip(); code; EnableSkip()
-  // is similar to
-  //   Skip("Foo"); code ; Skip(NULL); code ; Skip("Foo");
-  // but avoids creating/deleting new RE objects.
-  void DisableSkip();
-
-  // Reenable previously paused skipping.  Any prefix of the input
-  // that matches the skip pattern is immediately dropped.
-  void EnableSkip();
-
-  /***** Special wrappers around SetSkip() for some common idioms *****/
-
-  // Arranges to skip whitespace, C comments, C++ comments.
-  // The overall RE is a disjunction of the following REs:
-  //    \\s                     whitespace
-  //    //.*\n                  C++ comment
-  //    /[*](.|\n)*?[*]/        C comment (x*? means minimal repetitions of x)
-  // We get repetition via the semantics of SetSkipExpression, not by using *
-  void SkipCXXComments() {
-    SetSkipExpression("\\s|//.*\n|/[*](?:\n|.)*?[*]/");
-  }
-
-  void set_save_comments(bool comments) {
-    save_comments_ = comments;
-  }
-
-  bool save_comments() {
-    return save_comments_;
-  }
-
-  // Append to vector ranges the comments found in the
-  // byte range [start,end] (inclusive) of the input data.
-  // Only comments that were extracted entirely within that
-  // range are returned: no range splitting of atomically-extracted
-  // comments is performed.
-  void GetComments(int start, int end, std::vector<StringPiece> *ranges);
-
-  // Append to vector ranges the comments added
-  // since the last time this was called. This
-  // functionality is provided for efficiency when
-  // interleaving scanning with parsing.
-  void GetNextComments(std::vector<StringPiece> *ranges);
-
- private:
-  std::string   data_;          // All the input data
-  StringPiece   input_;         // Unprocessed input
-  RE*           skip_;          // If non-NULL, RE for skipping input
-  bool          should_skip_;   // If true, use skip_
-  bool          skip_repeat_;   // If true, repeat skip_ as long as it works
-  bool          save_comments_; // If true, aggregate the skip expression
-
-  // the skipped comments
-  // TODO: later consider requiring that the StringPieces be added
-  // in order by their start position
-  std::vector<StringPiece> *comments_;
-
-  // the offset into comments_ that has been returned by GetNextComments
-  int           comments_offset_;
-
-  // helper function to consume *skip_ and honour
-  // save_comments_
-  void ConsumeSkip();
-};
-
-}   // namespace pcrecpp
-
-#endif /* _PCRE_SCANNER_H */
diff --git a/pcrecpp/include/pcre_stringpiece.h b/pcrecpp/include/pcre_stringpiece.h
deleted file mode 100644
index 51b9812..0000000
--- a/pcrecpp/include/pcre_stringpiece.h
+++ /dev/null
@@ -1,180 +0,0 @@
-// Copyright (c) 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Sanjay Ghemawat
-//
-// A string like object that points into another piece of memory.
-// Useful for providing an interface that allows clients to easily
-// pass in either a "const char*" or a "string".
-//
-// Arghh!  I wish C++ literals were automatically of type "string".
-
-#ifndef _PCRE_STRINGPIECE_H
-#define _PCRE_STRINGPIECE_H
-
-#include <cstring>
-#include <string>
-#include <iosfwd>    // for ostream forward-declaration
-
-#if 0
-#define HAVE_TYPE_TRAITS
-#include <type_traits.h>
-#elif 0
-#define HAVE_TYPE_TRAITS
-#include <bits/type_traits.h>
-#endif
-
-#include <pcre2.h>
-
-using std::memcmp;
-using std::strlen;
-using std::string;
-
-namespace pcrecpp {
-
-class StringPiece {
- private:
-  const char*   ptr_;
-  int           length_;
-
- public:
-  // We provide non-explicit singleton constructors so users can pass
-  // in a "const char*" or a "string" wherever a "StringPiece" is
-  // expected.
-  StringPiece()
-    : ptr_(NULL), length_(0) { }
-  StringPiece(const char* str)
-    : ptr_(str), length_(static_cast<int>(strlen(ptr_))) { }
-  StringPiece(const unsigned char* str)
-    : ptr_(reinterpret_cast<const char*>(str)),
-      length_(static_cast<int>(strlen(ptr_))) { }
-  StringPiece(const string& str)
-    : ptr_(str.data()), length_(static_cast<int>(str.size())) { }
-  StringPiece(const char* offset, int len)
-    : ptr_(offset), length_(len) { }
-
-  // data() may return a pointer to a buffer with embedded NULs, and the
-  // returned buffer may or may not be null terminated.  Therefore it is
-  // typically a mistake to pass data() to a routine that expects a NUL
-  // terminated string.  Use "as_string().c_str()" if you really need to do
-  // this.  Or better yet, change your routine so it does not rely on NUL
-  // termination.
-  const char* data() const { return ptr_; }
-  int size() const { return length_; }
-  bool empty() const { return length_ == 0; }
-
-  void clear() { ptr_ = NULL; length_ = 0; }
-  void set(const char* buffer, int len) { ptr_ = buffer; length_ = len; }
-  void set(const char* str) {
-    ptr_ = str;
-    length_ = static_cast<int>(strlen(str));
-  }
-  void set(const void* buffer, int len) {
-    ptr_ = reinterpret_cast<const char*>(buffer);
-    length_ = len;
-  }
-
-  char operator[](int i) const { return ptr_[i]; }
-
-  void remove_prefix(int n) {
-    ptr_ += n;
-    length_ -= n;
-  }
-
-  void remove_suffix(int n) {
-    length_ -= n;
-  }
-
-  bool operator==(const StringPiece& x) const {
-    return ((length_ == x.length_) &&
-            (memcmp(ptr_, x.ptr_, length_) == 0));
-  }
-  bool operator!=(const StringPiece& x) const {
-    return !(*this == x);
-  }
-
-#define STRINGPIECE_BINARY_PREDICATE(cmp,auxcmp)                             \
-  bool operator cmp (const StringPiece& x) const {                           \
-    int r = memcmp(ptr_, x.ptr_, length_ < x.length_ ? length_ : x.length_); \
-    return ((r auxcmp 0) || ((r == 0) && (length_ cmp x.length_)));          \
-  }
-  STRINGPIECE_BINARY_PREDICATE(<,  <);
-  STRINGPIECE_BINARY_PREDICATE(<=, <);
-  STRINGPIECE_BINARY_PREDICATE(>=, >);
-  STRINGPIECE_BINARY_PREDICATE(>,  >);
-#undef STRINGPIECE_BINARY_PREDICATE
-
-  int compare(const StringPiece& x) const {
-    int r = memcmp(ptr_, x.ptr_, length_ < x.length_ ? length_ : x.length_);
-    if (r == 0) {
-      if (length_ < x.length_) r = -1;
-      else if (length_ > x.length_) r = +1;
-    }
-    return r;
-  }
-
-  string as_string() const {
-    return string(data(), size());
-  }
-
-  void CopyToString(string* target) const {
-    target->assign(ptr_, length_);
-  }
-
-  // Does "this" start with "x"
-  bool starts_with(const StringPiece& x) const {
-    return ((length_ >= x.length_) && (memcmp(ptr_, x.ptr_, x.length_) == 0));
-  }
-};
-
-}   // namespace pcrecpp
-
-// ------------------------------------------------------------------
-// Functions used to create STL containers that use StringPiece
-//  Remember that a StringPiece's lifetime had better be less than
-//  that of the underlying string or char*.  If it is not, then you
-//  cannot safely store a StringPiece into an STL container
-// ------------------------------------------------------------------
-
-#ifdef HAVE_TYPE_TRAITS
-// This makes vector<StringPiece> really fast for some STL implementations
-template<> struct __type_traits<pcrecpp::StringPiece> {
-  typedef __true_type    has_trivial_default_constructor;
-  typedef __true_type    has_trivial_copy_constructor;
-  typedef __true_type    has_trivial_assignment_operator;
-  typedef __true_type    has_trivial_destructor;
-  typedef __true_type    is_POD_type;
-};
-#endif
-
-// allow StringPiece to be logged
-extern std::ostream& operator<<(std::ostream& o,
-                                          const pcrecpp::StringPiece& piece);
-
-#endif /* _PCRE_STRINGPIECE_H */
diff --git a/pcrecpp/include/pcrecpp.h b/pcrecpp/include/pcrecpp.h
deleted file mode 100644
index 0c216b2..0000000
--- a/pcrecpp/include/pcrecpp.h
+++ /dev/null
@@ -1,697 +0,0 @@
-// Copyright (c) 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Sanjay Ghemawat
-// Support for PCRE_XXX modifiers added by Giuseppe Maxia, July 2005
-
-#ifndef _PCRECPP_H
-#define _PCRECPP_H
-
-// C++ interface to the pcre regular-expression library.  RE supports
-// Perl-style regular expressions (with extensions like \d, \w, \s,
-// ...).
-//
-// -----------------------------------------------------------------------
-// REGEXP SYNTAX:
-//
-// This module is part of the pcre library and hence supports its syntax
-// for regular expressions.
-//
-// The syntax is pretty similar to Perl's.  For those not familiar
-// with Perl's regular expressions, here are some examples of the most
-// commonly used extensions:
-//
-//   "hello (\\w+) world"  -- \w matches a "word" character
-//   "version (\\d+)"      -- \d matches a digit
-//   "hello\\s+world"      -- \s matches any whitespace character
-//   "\\b(\\w+)\\b"        -- \b matches empty string at a word boundary
-//   "(?i)hello"           -- (?i) turns on case-insensitive matching
-//   "/\\*(.*?)\\*/"       -- .*? matches . minimum no. of times possible
-//
-// -----------------------------------------------------------------------
-// MATCHING INTERFACE:
-//
-// The "FullMatch" operation checks that supplied text matches a
-// supplied pattern exactly.
-//
-// Example: successful match
-//    pcrecpp::RE re("h.*o");
-//    re.FullMatch("hello");
-//
-// Example: unsuccessful match (requires full match):
-//    pcrecpp::RE re("e");
-//    !re.FullMatch("hello");
-//
-// Example: creating a temporary RE object:
-//    pcrecpp::RE("h.*o").FullMatch("hello");
-//
-// You can pass in a "const char*" or a "string" for "text".  The
-// examples below tend to use a const char*.
-//
-// You can, as in the different examples above, store the RE object
-// explicitly in a variable or use a temporary RE object.  The
-// examples below use one mode or the other arbitrarily.  Either
-// could correctly be used for any of these examples.
-//
-// -----------------------------------------------------------------------
-// MATCHING WITH SUB-STRING EXTRACTION:
-//
-// You can supply extra pointer arguments to extract matched subpieces.
-//
-// Example: extracts "ruby" into "s" and 1234 into "i"
-//    int i;
-//    string s;
-//    pcrecpp::RE re("(\\w+):(\\d+)");
-//    re.FullMatch("ruby:1234", &s, &i);
-//
-// Example: does not try to extract any extra sub-patterns
-//    re.FullMatch("ruby:1234", &s);
-//
-// Example: does not try to extract into NULL
-//    re.FullMatch("ruby:1234", NULL, &i);
-//
-// Example: integer overflow causes failure
-//    !re.FullMatch("ruby:1234567891234", NULL, &i);
-//
-// Example: fails because there aren't enough sub-patterns:
-//    !pcrecpp::RE("\\w+:\\d+").FullMatch("ruby:1234", &s);
-//
-// Example: fails because string cannot be stored in integer
-//    !pcrecpp::RE("(.*)").FullMatch("ruby", &i);
-//
-// The provided pointer arguments can be pointers to any scalar numeric
-// type, or one of
-//    string        (matched piece is copied to string)
-//    StringPiece   (StringPiece is mutated to point to matched piece)
-//    T             (where "bool T::ParseFrom(const char*, int)" exists)
-//    NULL          (the corresponding matched sub-pattern is not copied)
-//
-// CAVEAT: An optional sub-pattern that does not exist in the matched
-// string is assigned the empty string.  Therefore, the following will
-// return false (because the empty string is not a valid number):
-//    int number;
-//    pcrecpp::RE::FullMatch("abc", "[a-z]+(\\d+)?", &number);
-//
-// -----------------------------------------------------------------------
-// DO_MATCH
-//
-// The matching interface supports at most 16 arguments per call.
-// If you need more, consider using the more general interface
-// pcrecpp::RE::DoMatch().  See pcrecpp.h for the signature for DoMatch.
-//
-// -----------------------------------------------------------------------
-// PARTIAL MATCHES
-//
-// You can use the "PartialMatch" operation when you want the pattern
-// to match any substring of the text.
-//
-// Example: simple search for a string:
-//    pcrecpp::RE("ell").PartialMatch("hello");
-//
-// Example: find first number in a string:
-//    int number;
-//    pcrecpp::RE re("(\\d+)");
-//    re.PartialMatch("x*100 + 20", &number);
-//    assert(number == 100);
-//
-// -----------------------------------------------------------------------
-// UTF-8 AND THE MATCHING INTERFACE:
-//
-// By default, pattern and text are plain text, one byte per character.
-// The UTF8 flag, passed to the constructor, causes both pattern
-// and string to be treated as UTF-8 text, still a byte stream but
-// potentially multiple bytes per character. In practice, the text
-// is likelier to be UTF-8 than the pattern, but the match returned
-// may depend on the UTF8 flag, so always use it when matching
-// UTF8 text.  E.g., "." will match one byte normally but with UTF8
-// set may match up to three bytes of a multi-byte character.
-//
-// Example:
-//    pcrecpp::RE_Options options;
-//    options.set_utf8();
-//    pcrecpp::RE re(utf8_pattern, options);
-//    re.FullMatch(utf8_string);
-//
-// Example: using the convenience function UTF8():
-//    pcrecpp::RE re(utf8_pattern, pcrecpp::UTF8());
-//    re.FullMatch(utf8_string);
-//
-// NOTE: The UTF8 option is ignored if pcre was not configured with the
-//       --enable-utf8 flag.
-//
-// -----------------------------------------------------------------------
-// PASSING MODIFIERS TO THE REGULAR EXPRESSION ENGINE
-//
-// PCRE defines some modifiers to change the behavior of the regular
-// expression engine.
-// The C++ wrapper defines an auxiliary class, RE_Options, as a vehicle
-// to pass such modifiers to a RE class.
-//
-// Currently, the following modifiers are supported
-//
-//    modifier              description               Perl corresponding
-//
-//    PCRE_CASELESS         case insensitive match    /i
-//    PCRE_MULTILINE        multiple lines match      /m
-//    PCRE_DOTALL           dot matches newlines      /s
-//    PCRE_DOLLAR_ENDONLY   $ matches only at end     N/A
-//    PCRE_EXTRA            strict escape parsing     N/A
-//    PCRE_EXTENDED         ignore whitespaces        /x
-//    PCRE_UTF8             handles UTF8 chars        built-in
-//    PCRE_UNGREEDY         reverses * and *?         N/A
-//    PCRE_NO_AUTO_CAPTURE  disables matching parens  N/A (*)
-//
-// (For a full account on how each modifier works, please check the
-// PCRE API reference manual).
-//
-// (*) Both Perl and PCRE allow non matching parentheses by means of the
-// "?:" modifier within the pattern itself. e.g. (?:ab|cd) does not
-// capture, while (ab|cd) does.
-//
-// For each modifier, there are two member functions whose name is made
-// out of the modifier in lowercase, without the "PCRE_" prefix. For
-// instance, PCRE_CASELESS is handled by
-//    bool caseless(),
-// which returns true if the modifier is set, and
-//    RE_Options & set_caseless(bool),
-// which sets or unsets the modifier.
-//
-// Moreover, PCRE_EXTRA_MATCH_LIMIT can be accessed through the
-// set_match_limit() and match_limit() member functions.
-// Setting match_limit to a non-zero value will limit the executation of
-// pcre to keep it from doing bad things like blowing the stack or taking
-// an eternity to return a result.  A value of 5000 is good enough to stop
-// stack blowup in a 2MB thread stack.  Setting match_limit to zero will
-// disable match limiting.  Alternately, you can set match_limit_recursion()
-// which uses PCRE_EXTRA_MATCH_LIMIT_RECURSION to limit how much pcre
-// recurses.  match_limit() caps the number of matches pcre does;
-// match_limit_recrusion() caps the depth of recursion.
-//
-// Normally, to pass one or more modifiers to a RE class, you declare
-// a RE_Options object, set the appropriate options, and pass this
-// object to a RE constructor. Example:
-//
-//    RE_options opt;
-//    opt.set_caseless(true);
-//
-//    if (RE("HELLO", opt).PartialMatch("hello world")) ...
-//
-// RE_options has two constructors. The default constructor takes no
-// arguments and creates a set of flags that are off by default.
-//
-// The optional parameter 'option_flags' is to facilitate transfer
-// of legacy code from C programs.  This lets you do
-//    RE(pattern, RE_Options(PCRE_CASELESS|PCRE_MULTILINE)).PartialMatch(str);
-//
-// But new code is better off doing
-//    RE(pattern,
-//      RE_Options().set_caseless(true).set_multiline(true)).PartialMatch(str);
-// (See below)
-//
-// If you are going to pass one of the most used modifiers, there are some
-// convenience functions that return a RE_Options class with the
-// appropriate modifier already set:
-// CASELESS(), UTF8(), MULTILINE(), DOTALL(), EXTENDED()
-//
-// If you need to set several options at once, and you don't want to go
-// through the pains of declaring a RE_Options object and setting several
-// options, there is a parallel method that give you such ability on the
-// fly. You can concatenate several set_xxxxx member functions, since each
-// of them returns a reference to its class object.  e.g.: to pass
-// PCRE_CASELESS, PCRE_EXTENDED, and PCRE_MULTILINE to a RE with one
-// statement, you may write
-//
-//    RE(" ^ xyz \\s+ .* blah$", RE_Options()
-//                            .set_caseless(true)
-//                            .set_extended(true)
-//                            .set_multiline(true)).PartialMatch(sometext);
-//
-// -----------------------------------------------------------------------
-// SCANNING TEXT INCREMENTALLY
-//
-// The "Consume" operation may be useful if you want to repeatedly
-// match regular expressions at the front of a string and skip over
-// them as they match.  This requires use of the "StringPiece" type,
-// which represents a sub-range of a real string.  Like RE, StringPiece
-// is defined in the pcrecpp namespace.
-//
-// Example: read lines of the form "var = value" from a string.
-//    string contents = ...;                 // Fill string somehow
-//    pcrecpp::StringPiece input(contents);  // Wrap in a StringPiece
-//
-//    string var;
-//    int value;
-//    pcrecpp::RE re("(\\w+) = (\\d+)\n");
-//    while (re.Consume(&input, &var, &value)) {
-//      ...;
-//    }
-//
-// Each successful call to "Consume" will set "var/value", and also
-// advance "input" so it points past the matched text.
-//
-// The "FindAndConsume" operation is similar to "Consume" but does not
-// anchor your match at the beginning of the string.  For example, you
-// could extract all words from a string by repeatedly calling
-//     pcrecpp::RE("(\\w+)").FindAndConsume(&input, &word)
-//
-// -----------------------------------------------------------------------
-// PARSING HEX/OCTAL/C-RADIX NUMBERS
-//
-// By default, if you pass a pointer to a numeric value, the
-// corresponding text is interpreted as a base-10 number.  You can
-// instead wrap the pointer with a call to one of the operators Hex(),
-// Octal(), or CRadix() to interpret the text in another base.  The
-// CRadix operator interprets C-style "0" (base-8) and "0x" (base-16)
-// prefixes, but defaults to base-10.
-//
-// Example:
-//   int a, b, c, d;
-//   pcrecpp::RE re("(.*) (.*) (.*) (.*)");
-//   re.FullMatch("100 40 0100 0x40",
-//                pcrecpp::Octal(&a), pcrecpp::Hex(&b),
-//                pcrecpp::CRadix(&c), pcrecpp::CRadix(&d));
-// will leave 64 in a, b, c, and d.
-//
-// -----------------------------------------------------------------------
-// REPLACING PARTS OF STRINGS
-//
-// You can replace the first match of "pattern" in "str" with
-// "rewrite".  Within "rewrite", backslash-escaped digits (\1 to \9)
-// can be used to insert text matching corresponding parenthesized
-// group from the pattern.  \0 in "rewrite" refers to the entire
-// matching text.  E.g.,
-//
-//   string s = "yabba dabba doo";
-//   pcrecpp::RE("b+").Replace("d", &s);
-//
-// will leave "s" containing "yada dabba doo".  The result is true if
-// the pattern matches and a replacement occurs, or false otherwise.
-//
-// GlobalReplace() is like Replace(), except that it replaces all
-// occurrences of the pattern in the string with the rewrite.
-// Replacements are not subject to re-matching.  E.g.,
-//
-//   string s = "yabba dabba doo";
-//   pcrecpp::RE("b+").GlobalReplace("d", &s);
-//
-// will leave "s" containing "yada dada doo".  It returns the number
-// of replacements made.
-//
-// Extract() is like Replace(), except that if the pattern matches,
-// "rewrite" is copied into "out" (an additional argument) with
-// substitutions.  The non-matching portions of "text" are ignored.
-// Returns true iff a match occurred and the extraction happened
-// successfully.  If no match occurs, the string is left unaffected.
-
-
-#include <string>
-#include <pcre2.h>
-#include <pcrecpparg.h>   // defines the Arg class
-// This isn't technically needed here, but we include it
-// anyway so folks who include pcrecpp.h don't have to.
-#include <pcre_stringpiece.h>
-#include <memory>
-
-namespace pcrecpp {
-
-#define PCRE_SET_OR_CLEAR(b, o) \
-    if (b) all_options_ |= (o); else all_options_ &= ~(o); \
-    return *this
-
-#define PCRE_IS_SET(o)  \
-        (all_options_ & o) == o
-
-typedef std::shared_ptr<pcre2_match_data> pcre2_match_data_ptr;
-
-/***** Compiling regular expressions: the RE class *****/
-
-// RE_Options allow you to set options to be passed along to pcre,
-// along with other options we put on top of pcre.
-// Only 9 modifiers, plus match_limit and match_limit_recursion,
-// are supported now.
-class RE_Options {
- public:
-  // constructor
-  RE_Options()
-      : newline_mode_(0),
-        match_limit_(0),
-        match_limit_recursion_(0),
-        all_options_(0) {
-  }
-
-  // alternative constructor.
-  // To facilitate transfer of legacy code from C programs
-  //
-  // This lets you do
-  //    RE(pattern, RE_Options(PCRE_CASELESS|PCRE_MULTILINE)).PartialMatch(str);
-  // But new code is better off doing
-  //    RE(pattern,
-  //      RE_Options().set_caseless(true).set_multiline(true)).PartialMatch(str);
-  RE_Options(int option_flags)
-      : newline_mode_(0),
-        match_limit_(0),
-        match_limit_recursion_(0),
-        all_options_(option_flags) {
-  }
-  // we're fine with the default destructor, copy constructor, etc.
-
-  // accessors and mutators
-  int match_limit() const { return match_limit_; };
-  RE_Options &set_match_limit(int limit) {
-    match_limit_ = limit;
-    return *this;
-  }
-
-  int match_limit_recursion() const { return match_limit_recursion_; };
-  RE_Options &set_match_limit_recursion(int limit) {
-    match_limit_recursion_ = limit;
-    return *this;
-  }
-
-  bool caseless() const {
-    return PCRE_IS_SET(PCRE2_CASELESS);
-  }
-  RE_Options &set_caseless(bool x) {
-    PCRE_SET_OR_CLEAR(x, PCRE2_CASELESS);
-  }
-
-  bool multiline() const {
-    return PCRE_IS_SET(PCRE2_MULTILINE);
-  }
-  RE_Options &set_multiline(bool x) {
-    PCRE_SET_OR_CLEAR(x, PCRE2_MULTILINE);
-  }
-
-  int newline_mode() const {
-    if(newline_mode_)
-      return newline_mode_;
-    else {
-      // if newline_mode_ is 0 return the global configuration default
-      int value;
-      pcre2_config_8(PCRE2_CONFIG_NEWLINE, &value);
-      return value;
-    }
-  }
-  RE_Options & set_newline_mode(int newline_mode) {
-    newline_mode_ = newline_mode;
-    return *this;
-  }
-
-  bool dotall() const {
-    return PCRE_IS_SET(PCRE2_DOTALL);
-  }
-  RE_Options &set_dotall(bool x) {
-    PCRE_SET_OR_CLEAR(x, PCRE2_DOTALL);
-  }
-
-  bool extended() const {
-    return PCRE_IS_SET(PCRE2_EXTENDED);
-  }
-  RE_Options &set_extended(bool x) {
-    PCRE_SET_OR_CLEAR(x, PCRE2_EXTENDED);
-  }
-
-  bool dollar_endonly() const {
-    return PCRE_IS_SET(PCRE2_DOLLAR_ENDONLY);
-  }
-  RE_Options &set_dollar_endonly(bool x) {
-    PCRE_SET_OR_CLEAR(x, PCRE2_DOLLAR_ENDONLY);
-  }
-
-  bool ungreedy() const {
-    return PCRE_IS_SET(PCRE2_UNGREEDY);
-  }
-  RE_Options &set_ungreedy(bool x) {
-    PCRE_SET_OR_CLEAR(x, PCRE2_UNGREEDY);
-  }
-
-  bool utf() const {
-    return PCRE_IS_SET(PCRE2_UTF);
-  }
-  RE_Options &set_utf(bool x) {
-    PCRE_SET_OR_CLEAR(x, PCRE2_UTF);
-  }
-
-  bool no_auto_capture() const {
-    return PCRE_IS_SET(PCRE2_NO_AUTO_CAPTURE);
-  }
-  RE_Options &set_no_auto_capture(bool x) {
-    PCRE_SET_OR_CLEAR(x, PCRE2_NO_AUTO_CAPTURE);
-  }
-
-  RE_Options &set_all_options(int opt) {
-    all_options_ = opt;
-    return *this;
-  }
-  int all_options() const {
-    return all_options_ ;
-  }
-
-  // TODO: add other pcre flags
-
- private:
-  int newline_mode_;
-  int match_limit_;
-  int match_limit_recursion_;
-  int all_options_;
-};
-
-// These functions return some common RE_Options
-static inline RE_Options UTF() {
-  return RE_Options().set_utf(true);
-}
-
-static inline RE_Options CASELESS() {
-  return RE_Options().set_caseless(true);
-}
-static inline RE_Options MULTILINE() {
-  return RE_Options().set_multiline(true);
-}
-
-static inline RE_Options DOTALL() {
-  return RE_Options().set_dotall(true);
-}
-
-static inline RE_Options EXTENDED() {
-  return RE_Options().set_extended(true);
-}
-
-// Interface for regular expression matching.  Also corresponds to a
-// pre-compiled regular expression.  An "RE" object is safe for
-// concurrent use by multiple threads.
-class RE {
- public:
-  // We provide implicit conversions from strings so that users can
-  // pass in a string or a "const char*" wherever an "RE" is expected.
-  RE(const string& pat) { Init(pat, NULL); }
-  RE(const string& pat, const RE_Options& option) { Init(pat, &option); }
-  RE(const char* pat) { Init(pat, NULL); }
-  RE(const char* pat, const RE_Options& option) { Init(pat, &option); }
-  RE(const unsigned char* pat) {
-    Init(reinterpret_cast<const char*>(pat), NULL);
-  }
-  RE(const unsigned char* pat, const RE_Options& option) {
-    Init(reinterpret_cast<const char*>(pat), &option);
-  }
-
-  // Copy constructor & assignment - note that these are expensive
-  // because they recompile the expression.
-  RE(const RE& re) { Init(re.pattern_, &re.options_); }
-  const RE& operator=(const RE& re) {
-    if (this != &re) {
-      Cleanup();
-
-      // This is the code that originally came from Google
-      // Init(re.pattern_.c_str(), &re.options_);
-
-      // This is the replacement from Ari Pollak
-      Init(re.pattern_, &re.options_);
-    }
-    return *this;
-  }
-
-
-  ~RE();
-
-  // The string specification for this RE.  E.g.
-  //   RE re("ab*c?d+");
-  //   re.pattern();    // "ab*c?d+"
-  const string& pattern() const { return pattern_; }
-
-  // If RE could not be created properly, returns an error string.
-  // Else returns the empty string.
-  const string& error() const { return error_; }
-
-  /***** The useful part: the matching interface *****/
-
-  // This is provided so one can do pattern.ReplaceAll() just as
-  // easily as ReplaceAll(pattern-text, ....)
-
-  template<typename ... ARGS>
-  bool FullMatch(const StringPiece & text, ARGS && ...a) const {
-    // create an array with the size of the number of arguments given
-    Arg args[Args<ARGS...>::count()];
-    // initialize the array with the arguments given
-    Args<ARGS...>::arrayify(args, a...);
-
-    return DoMatchImpl(text, ANCHOR_BOTH, NULL, args, Args<ARGS...>::count());
-  }
-
-  template<typename ... ARGS>
-  bool PartialMatch(const StringPiece& text, ARGS && ...a) const {
-    // create an array with the size of the number of arguments given
-    Arg args[Args<ARGS...>::count()];
-    // initialize the array with the arguments given
-    Args<ARGS...>::arrayify(args, a...);
-
-    return DoMatchImpl(text, UNANCHORED, NULL, args, Args<ARGS...>::count());
-  }
-
-  template<typename ... ARGS>
-  bool Consume(StringPiece* input, ARGS && ...a) const {
-    // create an array with the size of the number of arguments given
-    Arg args[Args<ARGS...>::count()];
-    // initialize the array with the arguments given
-    Args<ARGS...>::arrayify(args, a...);
-
-    int consumed;
-    if (DoMatchImpl(*input, ANCHOR_START, &consumed, args,
-                    Args<ARGS...>::count())) {
-      input->remove_prefix(consumed);
-      return true;
-    } else {
-      return false;
-    }
-  }
-
-  template<typename ... ARGS>
-  bool FindAndConsume(StringPiece* input, ARGS && ...a) const {
-    Arg args[Args<ARGS...>::count()];
-    Args<ARGS...>::arrayify(args, a...);
-    int consumed;
-    if (DoMatchImpl(*input, UNANCHORED, &consumed, args,
-                    Args<ARGS...>::count())) {
-      input->remove_prefix(consumed);
-      return true;
-    } else {
-      return false;
-    }
-  }
-
-  bool Replace(const StringPiece& rewrite,
-               string *str) const;
-
-  int GlobalReplace(const StringPiece& rewrite,
-                    string *str) const;
-
-  bool Extract(const StringPiece &rewrite,
-               const StringPiece &text,
-               string *out) const;
-
-  // Escapes all potentially meaningful regexp characters in
-  // 'unquoted'.  The returned string, used as a regular expression,
-  // will exactly match the original string.  For example,
-  //           1.5-2.0?
-  // may become:
-  //           1\.5\-2\.0\?
-  // Note QuoteMeta behaves the same as perl's QuoteMeta function,
-  // *except* that it escapes the NUL character (\0) as backslash + 0,
-  // rather than backslash + NUL.
-  static string QuoteMeta(const StringPiece& unquoted);
-
-
-  /***** Generic matching interface *****/
-
-  // Type of match (TODO: Should be restructured as part of RE_Options)
-  enum Anchor {
-    UNANCHORED,         // No anchoring
-    ANCHOR_START,       // Anchor at start only
-    ANCHOR_BOTH         // Anchor at start and end
-  };
-
-  // General matching routine.  Stores the length of the match in
-  // "*consumed" if successful.
-  bool DoMatch(const StringPiece& text,
-               Anchor anchor,
-               int* consumed,
-               Arg const argsp[], int n) const;
-
-  // Return the number of capturing subpatterns, or -1 if the
-  // regexp wasn't valid on construction.
-  int NumberOfCapturingGroups() const;
-
- private:
-
-  void Init(const string& pattern, const RE_Options* options);
-  void Cleanup();
-
-  // Match against "text", filling in "vec" (up to "vecsize" * 2/3) with
-  // pairs of integers for the beginning and end positions of matched
-  // text.  The first pair corresponds to the entire matched text;
-  // subsequent pairs correspond, in order, to parentheses-captured
-  // matches.  Returns the number of pairs (one more than the number of
-  // the last subpattern with a match) if matching was successful
-  // and zero if the match failed.
-  // I.e. for RE("(foo)|(bar)|(baz)") it will return 2, 3, and 4 when matching
-  // against "foo", "bar", and "baz" respectively.
-  // When matching RE("(foo)|hello") against "hello", it will return 1.
-  // But the values for all subpattern are filled in into "vec".
-  int TryMatch(const StringPiece& text,
-               int startpos,
-               Anchor anchor,
-               bool empty_ok,
-               pcre2_match_data_ptr & match_data) const;
-
-  // Append the "rewrite" string, with backslash subsitutions from "text"
-  // and "vec", to string "out".
-  bool Rewrite(string *out,
-               const StringPiece& rewrite,
-               const StringPiece& text,
-               pcre2_match_data_ptr const & match_data) const;
-
-  // internal implementation for DoMatch
-  bool DoMatchImpl(const StringPiece& text,
-                   Anchor anchor,
-                   int* consumed,
-                   const Arg args[],
-                   int n) const;
-
-  // Compile the regexp for the specified anchoring mode
-  pcre2_code * Compile(Anchor anchor);
-
-  string        pattern_;
-  RE_Options    options_;
-  pcre2_code*   re_full_;       // For full matches
-  pcre2_code*   re_partial_;    // For partial matches
-  string        error_;         // Error indicator
-};
-
-}   // namespace pcrecpp
-
-#endif /* _PCRECPP_H */
diff --git a/pcrecpp/include/pcrecpparg.h b/pcrecpp/include/pcrecpparg.h
deleted file mode 100644
index 0a1713f..0000000
--- a/pcrecpp/include/pcrecpparg.h
+++ /dev/null
@@ -1,208 +0,0 @@
-// Copyright (c) 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Sanjay Ghemawat
-
-#ifndef _PCRECPPARG_H
-#define _PCRECPPARG_H
-
-#include <stdlib.h>    // for NULL
-#include <string>
-
-#include <pcre2.h>
-
-namespace pcrecpp {
-
-class StringPiece;
-
-// Hex/Octal/Binary?
-
-// Special class for parsing into objects that define a ParseFrom() method
-template <class T>
-class _RE_MatchObject {
- public:
-  static inline bool Parse(const char* str, int n, void* dest) {
-    if (dest == NULL) return true;
-    T* object = reinterpret_cast<T*>(dest);
-    return object->ParseFrom(str, n);
-  }
-};
-
-class Arg {
- public:
-  // Empty constructor so we can declare arrays of Arg
-  Arg();
-
-  // Constructor specially designed for NULL arguments
-  Arg(void*);
-
-  typedef bool (*Parser)(const char* str, int n, void* dest);
-
-// Type-specific parsers
-#define PCRE_MAKE_PARSER(type,name)                             \
-  Arg(type* p) : arg_(p), parser_(name) { }                     \
-  Arg(type* p, Parser parser) : arg_(p), parser_(parser) { }
-
-
-  PCRE_MAKE_PARSER(char,               parse_char);
-  PCRE_MAKE_PARSER(unsigned char,      parse_uchar);
-  PCRE_MAKE_PARSER(short,              parse_short);
-  PCRE_MAKE_PARSER(unsigned short,     parse_ushort);
-  PCRE_MAKE_PARSER(int,                parse_int);
-  PCRE_MAKE_PARSER(unsigned int,       parse_uint);
-  PCRE_MAKE_PARSER(long,               parse_long);
-  PCRE_MAKE_PARSER(unsigned long,      parse_ulong);
-#if 1
-  PCRE_MAKE_PARSER(long long,          parse_longlong);
-#endif
-#if 1
-  PCRE_MAKE_PARSER(unsigned long long, parse_ulonglong);
-#endif
-  PCRE_MAKE_PARSER(float,              parse_float);
-  PCRE_MAKE_PARSER(double,             parse_double);
-  PCRE_MAKE_PARSER(std::string,        parse_string);
-  PCRE_MAKE_PARSER(StringPiece,        parse_stringpiece);
-
-#undef PCRE_MAKE_PARSER
-
-  // Generic constructor
-  template <class T> Arg(T*, Parser parser);
-  // Generic constructor template
-  template <class T> Arg(T* p)
-    : arg_(p), parser_(_RE_MatchObject<T>::Parse) {
-  }
-
-  // Parse the data
-  bool Parse(const char* str, int n) const;
-
- private:
-  void*         arg_;
-  Parser        parser_;
-
-  static bool parse_null          (const char* str, int n, void* dest);
-  static bool parse_char          (const char* str, int n, void* dest);
-  static bool parse_uchar         (const char* str, int n, void* dest);
-  static bool parse_float         (const char* str, int n, void* dest);
-  static bool parse_double        (const char* str, int n, void* dest);
-  static bool parse_string        (const char* str, int n, void* dest);
-  static bool parse_stringpiece   (const char* str, int n, void* dest);
-
-#define PCRE_DECLARE_INTEGER_PARSER(name)                                   \
- private:                                                                   \
-  static bool parse_ ## name(const char* str, int n, void* dest);           \
-  static bool parse_ ## name ## _radix(                                     \
-    const char* str, int n, void* dest, int radix);                         \
- public:                                                                    \
-  static bool parse_ ## name ## _hex(const char* str, int n, void* dest);   \
-  static bool parse_ ## name ## _octal(const char* str, int n, void* dest); \
-  static bool parse_ ## name ## _cradix(const char* str, int n, void* dest)
-
-  PCRE_DECLARE_INTEGER_PARSER(short);
-  PCRE_DECLARE_INTEGER_PARSER(ushort);
-  PCRE_DECLARE_INTEGER_PARSER(int);
-  PCRE_DECLARE_INTEGER_PARSER(uint);
-  PCRE_DECLARE_INTEGER_PARSER(long);
-  PCRE_DECLARE_INTEGER_PARSER(ulong);
-  PCRE_DECLARE_INTEGER_PARSER(longlong);
-  PCRE_DECLARE_INTEGER_PARSER(ulonglong);
-
-#undef PCRE_DECLARE_INTEGER_PARSER
-};
-
-inline Arg::Arg() : arg_(NULL), parser_(parse_null) { }
-inline Arg::Arg(void* p) : arg_(p), parser_(parse_null) { }
-
-inline bool Arg::Parse(const char* str, int n) const {
-  return (*parser_)(str, n, arg_);
-}
-
-// This part of the parser, appropriate only for ints, deals with bases
-#define MAKE_INTEGER_PARSER(type, name) \
-  inline Arg Hex(type* ptr) { \
-    return Arg(ptr, Arg::parse_ ## name ## _hex); } \
-  inline Arg Octal(type* ptr) { \
-    return Arg(ptr, Arg::parse_ ## name ## _octal); } \
-  inline Arg CRadix(type* ptr) { \
-    return Arg(ptr, Arg::parse_ ## name ## _cradix); }
-
-MAKE_INTEGER_PARSER(short,              short)     /*                        */
-MAKE_INTEGER_PARSER(unsigned short,     ushort)    /*                        */
-MAKE_INTEGER_PARSER(int,                int)       /* Don't use semicolons   */
-MAKE_INTEGER_PARSER(unsigned int,       uint)      /* after these statement  */
-MAKE_INTEGER_PARSER(long,               long)      /* because they can cause */
-MAKE_INTEGER_PARSER(unsigned long,      ulong)     /* compiler warnings if   */
-#if 1                          /* the checking level is  */
-MAKE_INTEGER_PARSER(long long,          longlong)  /* turned up high enough. */
-#endif                                             /*                        */
-#if 1                         /*                        */
-MAKE_INTEGER_PARSER(unsigned long long, ulonglong) /*                        */
-#endif
-
-#undef PCRE_IS_SET
-#undef PCRE_SET_OR_CLEAR
-#undef MAKE_INTEGER_PARSER
-
-template<typename ARG>
-inline Arg wrap_arg(ARG && any) {
-  return Arg(any);
-}
-
-inline Arg const & wrap_arg(Arg const & arg) {
-  return arg;
-}
-
-template<typename ... ARGS>
-struct Args;
-
-template<typename HEAD, typename ... TAIL>
-struct Args<HEAD, TAIL...> {
-  typedef Args<TAIL...> next;
-  constexpr static unsigned count() {
-    return 1 + next::count();
-  }
-  template<typename _HEAD, typename ... _TAIL>
-  inline static void arrayify(Arg * ptr, _HEAD && head, _TAIL && ... tail) {
-    *ptr++ = wrap_arg(head);
-    next::arrayify(ptr, tail...);
-  }
-};
-
-template<>
-struct Args<> {
-  constexpr static unsigned count() {
-    return 0;
-  }
-  inline static void arrayify(Arg *) {
-  }
-};
-
-}   // namespace pcrecpp
-
-
-#endif /* _PCRECPPARG_H */
diff --git a/pcrecpp/pcre_scanner.cc b/pcrecpp/pcre_scanner.cc
deleted file mode 100644
index 2887d6b..0000000
--- a/pcrecpp/pcre_scanner.cc
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright (c) 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Sanjay Ghemawat
-
-#include <vector>
-#include <assert.h>
-
-#include "pcrecpp_internal.h"
-#include "pcre_scanner.h"
-
-using std::vector;
-
-namespace pcrecpp {
-
-Scanner::Scanner()
-  : data_(),
-    input_(data_),
-    skip_(NULL),
-    should_skip_(false),
-    skip_repeat_(false),
-    save_comments_(false),
-    comments_(NULL),
-    comments_offset_(0) {
-}
-
-Scanner::Scanner(const string& in)
-  : data_(in),
-    input_(data_),
-    skip_(NULL),
-    should_skip_(false),
-    skip_repeat_(false),
-    save_comments_(false),
-    comments_(NULL),
-    comments_offset_(0) {
-}
-
-Scanner::~Scanner() {
-  delete skip_;
-  delete comments_;
-}
-
-void Scanner::SetSkipExpression(const char* re) {
-  delete skip_;
-  if (re != NULL) {
-    skip_ = new RE(re);
-    should_skip_ = true;
-    skip_repeat_ = true;
-    ConsumeSkip();
-  } else {
-    skip_ = NULL;
-    should_skip_ = false;
-    skip_repeat_ = false;
-  }
-}
-
-void Scanner::Skip(const char* re) {
-  delete skip_;
-  if (re != NULL) {
-    skip_ = new RE(re);
-    should_skip_ = true;
-    skip_repeat_ = false;
-    ConsumeSkip();
-  } else {
-    skip_ = NULL;
-    should_skip_ = false;
-    skip_repeat_ = false;
-  }
-}
-
-void Scanner::DisableSkip() {
-  assert(skip_ != NULL);
-  should_skip_ = false;
-}
-
-void Scanner::EnableSkip() {
-  assert(skip_ != NULL);
-  should_skip_ = true;
-  ConsumeSkip();
-}
-
-int Scanner::LineNumber() const {
-  // TODO: Make it more efficient by keeping track of the last point
-  // where we computed line numbers and counting newlines since then.
-  // We could use std:count, but not all systems have it. :-(
-  int count = 1;
-  for (const char* p = data_.data(); p < input_.data(); ++p)
-    if (*p == '\n')
-      ++count;
-  return count;
-}
-
-int Scanner::Offset() const {
-  return (int)(input_.data() - data_.c_str());
-}
-
-bool Scanner::LookingAt(const RE& re) const {
-  int consumed;
-  return re.DoMatch(input_, RE::ANCHOR_START, &consumed, 0, 0);
-}
-
-
-// helper function to consume *skip_ and honour save_comments_
-void Scanner::ConsumeSkip() {
-  const char* start_data = input_.data();
-  while (skip_->Consume(&input_)) {
-    if (!skip_repeat_) {
-      // Only one skip allowed.
-      break;
-    }
-  }
-  if (save_comments_) {
-    if (comments_ == NULL) {
-      comments_ = new vector<StringPiece>;
-    }
-    // already pointing one past end, so no need to +1
-    int length = (int)(input_.data() - start_data);
-    if (length > 0) {
-      comments_->push_back(StringPiece(start_data, length));
-    }
-  }
-}
-
-
-void Scanner::GetComments(int start, int end, vector<StringPiece> *ranges) {
-  // short circuit out if we've not yet initialized comments_
-  // (e.g., when save_comments is false)
-  if (!comments_) {
-    return;
-  }
-  // TODO: if we guarantee that comments_ will contain StringPieces
-  // that are ordered by their start, then we can do a binary search
-  // for the first StringPiece at or past start and then scan for the
-  // ones contained in the range, quit early (use equal_range or
-  // lower_bound)
-  for (vector<StringPiece>::const_iterator it = comments_->begin();
-       it != comments_->end(); ++it) {
-    if ((it->data() >= data_.c_str() + start &&
-         it->data() + it->size() <= data_.c_str() + end)) {
-      ranges->push_back(*it);
-    }
-  }
-}
-
-
-void Scanner::GetNextComments(vector<StringPiece> *ranges) {
-  // short circuit out if we've not yet initialized comments_
-  // (e.g., when save_comments is false)
-  if (!comments_) {
-    return;
-  }
-  for (vector<StringPiece>::const_iterator it =
-         comments_->begin() + comments_offset_;
-       it != comments_->end(); ++it) {
-    ranges->push_back(*it);
-    ++comments_offset_;
-  }
-}
-
-}   // namespace pcrecpp
diff --git a/pcrecpp/pcre_scanner_unittest.cc b/pcrecpp/pcre_scanner_unittest.cc
deleted file mode 100644
index c00312c..0000000
--- a/pcrecpp/pcre_scanner_unittest.cc
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright (c) 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Greg J. Badros
-//
-// Unittest for scanner, especially GetNextComments and GetComments()
-// functionality.
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <string.h>      /* for strchr */
-#include <string>
-#include <vector>
-
-#include "pcrecpp.h"
-#include "pcre_stringpiece.h"
-#include "pcre_scanner.h"
-
-#define FLAGS_unittest_stack_size   49152
-
-// Dies with a fatal error if the two values are not equal.
-#define CHECK_EQ(a, b)  do {                                    \
-  if ( (a) != (b) ) {                                           \
-    fprintf(stderr, "%s:%d: Check failed because %s != %s\n",   \
-            __FILE__, __LINE__, #a, #b);                        \
-    exit(1);                                                    \
-  }                                                             \
-} while (0)
-
-using std::vector;
-using pcrecpp::StringPiece;
-using pcrecpp::Scanner;
-
-static void TestScanner() {
-  const char input[] = "\n"
-                       "alpha = 1; // this sets alpha\n"
-                       "bravo = 2; // bravo is set here\n"
-                       "gamma = 33; /* and here is gamma */\n";
-
-  const char *re = "(\\w+) = (\\d+);";
-
-  Scanner s(input);
-  string var;
-  int number;
-  s.SkipCXXComments();
-  s.set_save_comments(true);
-  vector<StringPiece> comments;
-
-  s.Consume(re, &var, &number);
-  CHECK_EQ(var, "alpha");
-  CHECK_EQ(number, 1);
-  CHECK_EQ(s.LineNumber(), 3);
-  s.GetNextComments(&comments);
-  CHECK_EQ(comments.size(), 1);
-  CHECK_EQ(comments[0].as_string(), " // this sets alpha\n");
-  comments.resize(0);
-
-  s.Consume(re, &var, &number);
-  CHECK_EQ(var, "bravo");
-  CHECK_EQ(number, 2);
-  s.GetNextComments(&comments);
-  CHECK_EQ(comments.size(), 1);
-  CHECK_EQ(comments[0].as_string(), " // bravo is set here\n");
-  comments.resize(0);
-
-  s.Consume(re, &var, &number);
-  CHECK_EQ(var, "gamma");
-  CHECK_EQ(number, 33);
-  s.GetNextComments(&comments);
-  CHECK_EQ(comments.size(), 1);
-  CHECK_EQ(comments[0].as_string(), " /* and here is gamma */\n");
-  comments.resize(0);
-
-  s.GetComments(0, sizeof(input), &comments);
-  CHECK_EQ(comments.size(), 3);
-  CHECK_EQ(comments[0].as_string(), " // this sets alpha\n");
-  CHECK_EQ(comments[1].as_string(), " // bravo is set here\n");
-  CHECK_EQ(comments[2].as_string(), " /* and here is gamma */\n");
-  comments.resize(0);
-
-  s.GetComments(0, (int)(strchr(input, '/') - input), &comments);
-  CHECK_EQ(comments.size(), 0);
-  comments.resize(0);
-
-  s.GetComments((int)(strchr(input, '/') - input - 1), sizeof(input),
-                &comments);
-  CHECK_EQ(comments.size(), 3);
-  CHECK_EQ(comments[0].as_string(), " // this sets alpha\n");
-  CHECK_EQ(comments[1].as_string(), " // bravo is set here\n");
-  CHECK_EQ(comments[2].as_string(), " /* and here is gamma */\n");
-  comments.resize(0);
-
-  s.GetComments((int)(strchr(input, '/') - input - 1),
-                (int)(strchr(input + 1, '\n') - input + 1), &comments);
-  CHECK_EQ(comments.size(), 1);
-  CHECK_EQ(comments[0].as_string(), " // this sets alpha\n");
-  comments.resize(0);
-}
-
-static void TestBigComment() {
-  string input;
-  for (int i = 0; i < 1024; ++i) {
-    char buf[1024];  // definitely big enough
-    sprintf(buf, "    # Comment %d\n", i);
-    input += buf;
-  }
-  input += "name = value;\n";
-
-  Scanner s(input.c_str());
-  s.SetSkipExpression("\\s+|#.*\n");
-
-  string name;
-  string value;
-  s.Consume("(\\w+) = (\\w+);", &name, &value);
-  CHECK_EQ(name, "name");
-  CHECK_EQ(value, "value");
-}
-
-// TODO: also test scanner and big-comment in a thread with a
-//       small stack size
-
-int main(int argc, char** argv) {
-  (void)argc;
-  (void)argv;
-  TestScanner();
-  TestBigComment();
-
-  // Done
-  printf("OK\n");
-
-  return 0;
-}
diff --git a/pcrecpp/pcre_stringpiece.cc b/pcrecpp/pcre_stringpiece.cc
deleted file mode 100644
index 599e466..0000000
--- a/pcrecpp/pcre_stringpiece.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wilsonh@google.com (Wilson Hsieh)
-//
-
-#include <iostream>
-#include "pcrecpp_internal.h"
-#include "pcre_stringpiece.h"
-
-std::ostream& operator<<(std::ostream& o, const pcrecpp::StringPiece& piece) {
-  return (o << piece.as_string());
-}
diff --git a/pcrecpp/pcre_stringpiece_unittest.cc b/pcrecpp/pcre_stringpiece_unittest.cc
deleted file mode 100644
index 1c4759d..0000000
--- a/pcrecpp/pcre_stringpiece_unittest.cc
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright 2003 and onwards Google Inc.
-// Author: Sanjay Ghemawat
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <map>
-#include <algorithm>    // for make_pair
-
-#include "pcrecpp.h"
-#include "pcre_stringpiece.h"
-
-// CHECK dies with a fatal error if condition is not true.  It is *not*
-// controlled by NDEBUG, so the check will be executed regardless of
-// compilation mode.  Therefore, it is safe to do things like:
-//    CHECK(fp->Write(x) == 4)
-#define CHECK(condition) do {                           \
-  if (!(condition)) {                                   \
-    fprintf(stderr, "%s:%d: Check failed: %s\n",        \
-            __FILE__, __LINE__, #condition);            \
-    exit(1);                                            \
-  }                                                     \
-} while (0)
-
-using pcrecpp::StringPiece;
-
-static void CheckSTLComparator() {
-  string s1("foo");
-  string s2("bar");
-  string s3("baz");
-
-  StringPiece p1(s1);
-  StringPiece p2(s2);
-  StringPiece p3(s3);
-
-  typedef std::map<StringPiece, int> TestMap;
-  TestMap map;
-
-  map.insert(std::make_pair(p1, 0));
-  map.insert(std::make_pair(p2, 1));
-  map.insert(std::make_pair(p3, 2));
-
-  CHECK(map.size() == 3);
-
-  TestMap::const_iterator iter = map.begin();
-  CHECK(iter->second == 1);
-  ++iter;
-  CHECK(iter->second == 2);
-  ++iter;
-  CHECK(iter->second == 0);
-  ++iter;
-  CHECK(iter == map.end());
-
-  TestMap::iterator new_iter = map.find("zot");
-  CHECK(new_iter == map.end());
-
-  new_iter = map.find("bar");
-  CHECK(new_iter != map.end());
-
-  map.erase(new_iter);
-  CHECK(map.size() == 2);
-
-  iter = map.begin();
-  CHECK(iter->second == 2);
-  ++iter;
-  CHECK(iter->second == 0);
-  ++iter;
-  CHECK(iter == map.end());
-}
-
-static void CheckComparisonOperators() {
-#define CMP_Y(op, x, y)                                         \
-  CHECK( (StringPiece((x)) op StringPiece((y))));               \
-  CHECK( (StringPiece((x)).compare(StringPiece((y))) op 0))
-
-#define CMP_N(op, x, y)                                         \
-  CHECK(!(StringPiece((x)) op StringPiece((y))));               \
-  CHECK(!(StringPiece((x)).compare(StringPiece((y))) op 0))
-
-  CMP_Y(==, "",   "");
-  CMP_Y(==, "a",  "a");
-  CMP_Y(==, "aa", "aa");
-  CMP_N(==, "a",  "");
-  CMP_N(==, "",   "a");
-  CMP_N(==, "a",  "b");
-  CMP_N(==, "a",  "aa");
-  CMP_N(==, "aa", "a");
-
-  CMP_N(!=, "",   "");
-  CMP_N(!=, "a",  "a");
-  CMP_N(!=, "aa", "aa");
-  CMP_Y(!=, "a",  "");
-  CMP_Y(!=, "",   "a");
-  CMP_Y(!=, "a",  "b");
-  CMP_Y(!=, "a",  "aa");
-  CMP_Y(!=, "aa", "a");
-
-  CMP_Y(<, "a",  "b");
-  CMP_Y(<, "a",  "aa");
-  CMP_Y(<, "aa", "b");
-  CMP_Y(<, "aa", "bb");
-  CMP_N(<, "a",  "a");
-  CMP_N(<, "b",  "a");
-  CMP_N(<, "aa", "a");
-  CMP_N(<, "b",  "aa");
-  CMP_N(<, "bb", "aa");
-
-  CMP_Y(<=, "a",  "a");
-  CMP_Y(<=, "a",  "b");
-  CMP_Y(<=, "a",  "aa");
-  CMP_Y(<=, "aa", "b");
-  CMP_Y(<=, "aa", "bb");
-  CMP_N(<=, "b",  "a");
-  CMP_N(<=, "aa", "a");
-  CMP_N(<=, "b",  "aa");
-  CMP_N(<=, "bb", "aa");
-
-  CMP_N(>=, "a",  "b");
-  CMP_N(>=, "a",  "aa");
-  CMP_N(>=, "aa", "b");
-  CMP_N(>=, "aa", "bb");
-  CMP_Y(>=, "a",  "a");
-  CMP_Y(>=, "b",  "a");
-  CMP_Y(>=, "aa", "a");
-  CMP_Y(>=, "b",  "aa");
-  CMP_Y(>=, "bb", "aa");
-
-  CMP_N(>, "a",  "a");
-  CMP_N(>, "a",  "b");
-  CMP_N(>, "a",  "aa");
-  CMP_N(>, "aa", "b");
-  CMP_N(>, "aa", "bb");
-  CMP_Y(>, "b",  "a");
-  CMP_Y(>, "aa", "a");
-  CMP_Y(>, "b",  "aa");
-  CMP_Y(>, "bb", "aa");
-
-#undef CMP_Y
-#undef CMP_N
-}
-
-int main(int argc, char** argv) {
-  (void)argc;
-  (void)argv;
-  CheckComparisonOperators();
-  CheckSTLComparator();
-
-  printf("OK\n");
-  return 0;
-}
diff --git a/pcrecpp/pcrecpp.cc b/pcrecpp/pcrecpp.cc
deleted file mode 100644
index 2c37c44..0000000
--- a/pcrecpp/pcrecpp.cc
+++ /dev/null
@@ -1,727 +0,0 @@
-// Copyright (c) 2010, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Sanjay Ghemawat
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <limits.h>      /* for SHRT_MIN, USHRT_MAX, etc */
-#include <string.h>      /* for memcpy */
-#include <assert.h>
-#include <errno.h>
-#include <string>
-#include <algorithm>
-
-#include "pcrecpp_internal.h"
-#include "pcre2.h"
-#include "pcrecpp.h"
-#include "pcre_stringpiece.h"
-
-
-namespace pcrecpp {
-
-// If the user doesn't ask for any options, we just use this one
-static RE_Options default_options;
-
-void RE::Init(const string& pat, const RE_Options* options) {
-  pattern_ = pat;
-  if (options == NULL) {
-    options_ = default_options;
-  } else {
-    options_ = *options;
-  }
-  error_ = "";
-  re_full_ = NULL;
-  re_partial_ = NULL;
-
-  re_partial_ = Compile(UNANCHORED);
-  if (re_partial_ != NULL) {
-    re_full_ = Compile(ANCHOR_BOTH);
-  }
-}
-
-void RE::Cleanup() {
-  if (re_full_ != NULL)         pcre2_code_free(re_full_);
-  if (re_partial_ != NULL)      pcre2_code_free(re_partial_);
-  error_ = "";
-}
-
-
-RE::~RE() {
-  Cleanup();
-}
-
-static void format_pcre_error(int error, string & str) {
-  PCRE2_UCHAR8 buffer[256];
-  auto rc = pcre2_get_error_message(error, buffer, 256);
-  str.assign(reinterpret_cast<string::value_type*>(buffer));
-  if (rc == PCRE2_ERROR_NOMEMORY) {
-    str.append("...");
-  }
-}
-
-pcre2_code* RE::Compile(Anchor anchor) {
-  // First, convert RE_Options into pcre options
-  int pcre_options = 0;
-  pcre_options = options_.all_options();
-  typedef std::unique_ptr<pcre2_compile_context,
-      decltype(pcre2_compile_context_free)*> compile_context_ptr;
-  compile_context_ptr compile_context(NULL, pcre2_compile_context_free);
-
-  // As of pcre2 the newline mode must be passed through the compile context.
-  // So we only need one if the newline mode is actually set.
-  if (options_.newline_mode()) {
-    compile_context = compile_context_ptr(pcre2_compile_context_create(NULL),
-    pcre2_compile_context_free);
-    if (!compile_context) {
-      error_ = "Unable to allocate memory for pcre2_compile_congext";
-      return NULL;
-    }
-    if (pcre2_set_newline(compile_context.get(),
-                          options_.newline_mode()) == PCRE2_ERROR_BADDATA) {
-      error_ = "REOptions: bad newline mode given";
-      return NULL;
-    }
-  }
-
-  // Special treatment for anchoring.  This is needed because at
-  // runtime pcre only provides an option for anchoring at the
-  // beginning of a string (unless you use offset).
-  //
-  // There are three types of anchoring we want:
-  //    UNANCHORED      Compile the original pattern, and use
-  //                    a pcre unanchored match.
-  //    ANCHOR_START    Compile the original pattern, and use
-  //                    a pcre anchored match.
-  //    ANCHOR_BOTH     Tack a "\z" to the end of the original pattern
-  //                    and use a pcre anchored match.
-
-  int compile_error;
-  PCRE2_SIZE eoffset;
-  pcre2_code* re;
-  if (anchor != ANCHOR_BOTH) {
-    re = pcre2_compile(reinterpret_cast<PCRE2_SPTR>(pattern_.c_str()),
-                       pattern_.length(), pcre_options, &compile_error,
-                       &eoffset, compile_context.get());
-  } else {
-    // Tack a '\z' at the end of RE.  Parenthesize it first so that
-    // the '\z' applies to all top-level alternatives in the regexp.
-    string wrapped = "(?:";  // A non-counting grouping operator
-    wrapped += pattern_;
-    wrapped += ")\\z";
-    re = pcre2_compile(reinterpret_cast<PCRE2_SPTR>(wrapped.c_str()),
-                       wrapped.length(), pcre_options, &compile_error, &eoffset,
-                       compile_context.get());
-  }
-  if (re == NULL) {
-    format_pcre_error(compile_error, error_);
-  }
-  return re;
-}
-
-/***** Matching interfaces *****/
-
-bool RE::Replace(const StringPiece& rewrite,
-                 string *str) const {
-  pcre2_match_data_ptr match_data;
-  int matches = TryMatch(*str, 0, UNANCHORED, true, match_data);
-  if (matches == 0)
-    return false;
-
-  string s;
-  if (!Rewrite(&s, rewrite, *str, match_data))
-    return false;
-
-  auto vec = pcre2_get_ovector_pointer(match_data.get());
-
-  assert(vec[0] >= 0);
-  assert(vec[1] >= 0);
-  str->replace(vec[0], vec[1] - vec[0], s);
-  return true;
-}
-
-static bool is_multi_char_newline_mode(int value) {
-  switch (value) {
-    case PCRE2_NEWLINE_CR:
-    case PCRE2_NEWLINE_LF:
-      return false;
-    case PCRE2_NEWLINE_CRLF:
-    case PCRE2_NEWLINE_ANY:
-    case PCRE2_NEWLINE_ANYCRLF:
-      return true;
-    default:
-      return false;
-  }
-}
-
-int RE::GlobalReplace(const StringPiece& rewrite,
-                      string *str) const {
-  int count = 0;
-  string out;
-  int start = 0;
-  bool last_match_was_empty_string = false;
-  pcre2_match_data_ptr match_data;
-
-  while (start <= static_cast<int>(str->length())) {
-    // If the previous match was for the empty string, we shouldn't
-    // just match again: we'll match in the same way and get an
-    // infinite loop.  Instead, we do the match in a special way:
-    // anchored -- to force another try at the same position --
-    // and with a flag saying that this time, ignore empty matches.
-    // If this special match returns, that means there's a non-empty
-    // match at this position as well, and we can continue.  If not,
-    // we do what perl does, and just advance by one.
-    // Notice that perl prints '@@@' for this;
-    //    perl -le '$_ = "aa"; s/b*|aa/@/g; print'
-    int matches;
-    if (last_match_was_empty_string) {
-      matches = TryMatch(*str, start, ANCHOR_START, false, match_data);
-      if (matches <= 0) {
-        int matchend = start + 1;     // advance one character.
-        // If the current char is CR and we're in CRLF mode, skip LF too.
-        // Note it's better to call pcre2_pattern_info() than to examine
-        // all_options(), since options_ could have changed between
-        // compile-time and now, but this is simpler and safe enough.
-        // Modified by PH to add ANY and ANYCRLF.
-        if (matchend < static_cast<int>(str->length()) &&
-            (*str)[start] == '\r' && (*str)[matchend] == '\n' &&
-            is_multi_char_newline_mode(options_.newline_mode())) {
-          matchend++;
-        }
-        // We also need to advance more than one char if we're in utf8 mode.
-#ifdef SUPPORT_UTF8
-        if (options_.utf8()) {
-          while (matchend < static_cast<int>(str->length()) &&
-                 ((*str)[matchend] & 0xc0) == 0x80)
-            matchend++;
-        }
-#endif
-        if (start < static_cast<int>(str->length()))
-          out.append(*str, start, matchend - start);
-        start = matchend;
-        last_match_was_empty_string = false;
-        continue;
-      }
-    } else {
-      matches = TryMatch(*str, start, UNANCHORED, true, match_data);
-      if (matches <= 0)
-        break;
-    }
-    auto vec = pcre2_get_ovector_pointer(match_data.get());
-    int matchstart = vec[0], matchend = vec[1];
-    assert(matchstart >= start);
-    assert(matchend >= matchstart);
-    out.append(*str, start, matchstart - start);
-    Rewrite(&out, rewrite, *str, match_data);
-    start = matchend;
-    count++;
-    last_match_was_empty_string = (matchstart == matchend);
-  }
-
-  if (count == 0)
-    return 0;
-
-  if (start < static_cast<int>(str->length()))
-    out.append(*str, start, str->length() - start);
-  swap(out, *str);
-  return count;
-}
-
-bool RE::Extract(const StringPiece& rewrite,
-                 const StringPiece& text,
-                 string *out) const {
-  pcre2_match_data_ptr match_data;
-  int matches = TryMatch(text, 0, UNANCHORED, true, match_data);
-  if (matches == 0)
-    return false;
-  out->erase();
-  return Rewrite(out, rewrite, text, match_data);
-}
-
-/*static*/ string RE::QuoteMeta(const StringPiece& unquoted) {
-  string result;
-
-  // Escape any ascii character not in [A-Za-z_0-9].
-  //
-  // Note that it's legal to escape a character even if it has no
-  // special meaning in a regular expression -- so this function does
-  // that.  (This also makes it identical to the perl function of the
-  // same name; see `perldoc -f quotemeta`.)  The one exception is
-  // escaping NUL: rather than doing backslash + NUL, like perl does,
-  // we do '\0', because pcre itself doesn't take embedded NUL chars.
-  for (int ii = 0; ii < unquoted.size(); ++ii) {
-    // Note that using 'isalnum' here raises the benchmark time from
-    // 32ns to 58ns:
-    if (unquoted[ii] == '\0') {
-      result += "\\0";
-    } else if ((unquoted[ii] < 'a' || unquoted[ii] > 'z') &&
-               (unquoted[ii] < 'A' || unquoted[ii] > 'Z') &&
-               (unquoted[ii] < '0' || unquoted[ii] > '9') &&
-               unquoted[ii] != '_' &&
-               // If this is the part of a UTF8 or Latin1 character, we need
-               // to copy this byte without escaping.  Experimentally this is
-               // what works correctly with the regexp library.
-               !(unquoted[ii] & 128)) {
-      result += '\\';
-      result += unquoted[ii];
-    } else {
-      result += unquoted[ii];
-    }
-  }
-
-  return result;
-}
-
-/***** Actual matching and rewriting code *****/
-int RE::TryMatch(const StringPiece& text,
-                 int startpos,
-                 Anchor anchor,
-                 bool empty_ok,
-                 pcre2_match_data_ptr & match_data) const {
-  typedef std::unique_ptr<pcre2_match_context,
-      decltype(pcre2_match_context_free)*> match_context_ptr;
-
-  pcre2_code* re = (anchor == ANCHOR_BOTH) ? re_full_ : re_partial_;
-  if (re == NULL) {
-    //fprintf(stderr, "Matching against invalid re: %s\n", error_->c_str());
-    return 0;
-  }
-  match_context_ptr match_context = match_context_ptr(
-      pcre2_match_context_create(NULL),
-      pcre2_match_context_free);
-  if (!match_context)
-    return 0;
-
-  if (options_.match_limit() > 0) {
-    pcre2_set_match_limit(match_context.get(), options_.match_limit());
-  }
-  if (options_.match_limit_recursion() > 0) {
-    pcre2_set_recursion_limit(match_context.get(),
-                              options_.match_limit_recursion());
-  }
-
-  match_data = pcre2_match_data_ptr(
-      pcre2_match_data_create_from_pattern(re, NULL),
-      pcre2_match_data_free);
-  if (!match_data) {
-    return 0;
-  }
-
-  // int options = 0;
-  // Changed by PH as a result of bugzilla #1288
-  int options = (options_.all_options() & PCRE2_NO_UTF_CHECK);
-
-  if (anchor != UNANCHORED)
-    options |= PCRE2_ANCHORED;
-  if (!empty_ok)
-    options |= PCRE2_NOTEMPTY;
-
-  int rc = pcre2_match(
-      re, reinterpret_cast<PCRE2_SPTR>((text.empty()) ? "" : text.data()),
-      text.size(), startpos, options, match_data.get(), match_context.get());
-
-  // Handle errors
-  if (rc == PCRE2_ERROR_NOMATCH) {
-    return 0;
-  }
-  if (rc == PCRE2_ERROR_PARTIAL) {
-    // not sure what to do with partial yet
-    return 0;
-  } else if (rc < 0) {
-    // For any other error condition also return 0.
-    return 0;
-  }
-
-  return rc; // return number of matches found
-}
-
-bool RE::DoMatchImpl(const StringPiece& text,
-                     Anchor anchor,
-                     int* consumed,
-                     const Arg* args,
-                     int n) const {
-  pcre2_match_data_ptr match_data;
-  int matches = TryMatch(text, 0, anchor, true, match_data);
-  assert(matches >= 0);  // TryMatch never returns negatives
-  if (matches == 0)
-    return false;
-
-  auto vec = pcre2_get_ovector_pointer(match_data.get());
-
-  // allow for NULL
-  if (consumed != NULL)
-    *consumed = vec[1];
-
-  if (n == 0 || args == NULL) {
-    // We are not interested in results
-    return true;
-  }
-
-  if (NumberOfCapturingGroups() < n) {
-    // RE has fewer capturing groups than number of arg pointers passed in
-    return false;
-  }
-
-  // If we got here, we must have matched the whole pattern.
-  // We do not need (can not do) any more checks on the value of 'matches' here
-  // -- see the comment for TryMatch.
-  for (int i = 0; i < n; i++) {
-    const int start = vec[2*(i+1)];
-    const int limit = vec[2*(i+1)+1];
-    if (!args[i].Parse(text.data() + start, limit - start)) {
-      // TODO: Should we indicate what the error was?
-      return false;
-    }
-  }
-
-  return true;
-}
-
-bool RE::DoMatch(const StringPiece& text,
-                 Anchor anchor,
-                 int* consumed,
-                 Arg const args[],
-                 int n) const {
-  assert(n >= 0);
-  bool retval = DoMatchImpl(text, anchor, consumed, args, n);
-  return retval;
-}
-
-bool RE::Rewrite(string *out, const StringPiece &rewrite,
-                 const StringPiece &text,
-                 pcre2_match_data_ptr const & match_data) const {
-  auto veclen = pcre2_get_ovector_count(match_data.get());
-  auto vec = pcre2_get_ovector_pointer(match_data.get());
-  for (const char *s = rewrite.data(), *end = s + rewrite.size();
-       s < end; s++) {
-    int c = *s;
-    if (c == '\\') {
-      c = *++s;
-      if (isdigit(c)) {
-        decltype(veclen) n = (c - '0');
-        if (n >= veclen) {
-          //fprintf(stderr, requested group %d in regexp %.*s\n",
-          //        n, rewrite.size(), rewrite.data());
-          return false;
-        }
-        int start = vec[2 * n];
-        if (start >= 0)
-          out->append(text.data() + start, vec[2 * n + 1] - start);
-      } else if (c == '\\') {
-        *out += '\\';
-      } else {
-        //fprintf(stderr, "invalid rewrite pattern: %.*s\n",
-        //        rewrite.size(), rewrite.data());
-        return false;
-      }
-    } else {
-      *out += c;
-    }
-  }
-  return true;
-}
-
-// Return the number of capturing subpatterns, or -1 if the
-// regexp wasn't valid on construction.
-int RE::NumberOfCapturingGroups() const {
-  if (re_partial_ == NULL) return -1;
-
-  int result;
-  int pcre_retval = pcre2_pattern_info(re_partial_, PCRE2_INFO_CAPTURECOUNT,
-                                       &result);
-  assert(pcre_retval == 0);
-  return result;
-}
-
-/***** Parsers for various types *****/
-
-bool Arg::parse_null(const char* str, int n, void* dest) {
-  (void)str;
-  (void)n;
-  // We fail if somebody asked us to store into a non-NULL void* pointer
-  return (dest == NULL);
-}
-
-bool Arg::parse_string(const char* str, int n, void* dest) {
-  if (dest == NULL) return true;
-  reinterpret_cast<string*>(dest)->assign(str, n);
-  return true;
-}
-
-bool Arg::parse_stringpiece(const char* str, int n, void* dest) {
-  if (dest == NULL) return true;
-  reinterpret_cast<StringPiece*>(dest)->set(str, n);
-  return true;
-}
-
-bool Arg::parse_char(const char* str, int n, void* dest) {
-  if (n != 1) return false;
-  if (dest == NULL) return true;
-  *(reinterpret_cast<char*>(dest)) = str[0];
-  return true;
-}
-
-bool Arg::parse_uchar(const char* str, int n, void* dest) {
-  if (n != 1) return false;
-  if (dest == NULL) return true;
-  *(reinterpret_cast<unsigned char*>(dest)) = str[0];
-  return true;
-}
-
-// Largest number spec that we are willing to parse
-static const int kMaxNumberLength = 32;
-
-// REQUIRES "buf" must have length at least kMaxNumberLength+1
-// REQUIRES "n > 0"
-// Copies "str" into "buf" and null-terminates if necessary.
-// Returns one of:
-//      a. "str" if no termination is needed
-//      b. "buf" if the string was copied and null-terminated
-//      c. "" if the input was invalid and has no hope of being parsed
-static const char* TerminateNumber(char* buf, const char* str, int n) {
-  if ((n > 0) && isspace(*str)) {
-    // We are less forgiving than the strtoxxx() routines and do not
-    // allow leading spaces.
-    return "";
-  }
-
-  // See if the character right after the input text may potentially
-  // look like a digit.
-  if (isdigit(str[n]) ||
-      ((str[n] >= 'a') && (str[n] <= 'f')) ||
-      ((str[n] >= 'A') && (str[n] <= 'F'))) {
-    if (n > kMaxNumberLength) return ""; // Input too big to be a valid number
-    memcpy(buf, str, n);
-    buf[n] = '\0';
-    return buf;
-  } else {
-    // We can parse right out of the supplied string, so return it.
-    return str;
-  }
-}
-
-bool Arg::parse_long_radix(const char* str,
-                           int n,
-                           void* dest,
-                           int radix) {
-  if (n == 0) return false;
-  char buf[kMaxNumberLength+1];
-  str = TerminateNumber(buf, str, n);
-  char* end;
-  errno = 0;
-  long r = strtol(str, &end, radix);
-  if (end != str + n) return false;   // Leftover junk
-  if (errno) return false;
-  if (dest == NULL) return true;
-  *(reinterpret_cast<long*>(dest)) = r;
-  return true;
-}
-
-bool Arg::parse_ulong_radix(const char* str,
-                            int n,
-                            void* dest,
-                            int radix) {
-  if (n == 0) return false;
-  char buf[kMaxNumberLength+1];
-  str = TerminateNumber(buf, str, n);
-  if (str[0] == '-') return false;    // strtoul() on a negative number?!
-  char* end;
-  errno = 0;
-  unsigned long r = strtoul(str, &end, radix);
-  if (end != str + n) return false;   // Leftover junk
-  if (errno) return false;
-  if (dest == NULL) return true;
-  *(reinterpret_cast<unsigned long*>(dest)) = r;
-  return true;
-}
-
-bool Arg::parse_short_radix(const char* str,
-                            int n,
-                            void* dest,
-                            int radix) {
-  long r;
-  if (!parse_long_radix(str, n, &r, radix)) return false; // Could not parse
-  if (r < SHRT_MIN || r > SHRT_MAX) return false;       // Out of range
-  if (dest == NULL) return true;
-  *(reinterpret_cast<short*>(dest)) = static_cast<short>(r);
-  return true;
-}
-
-bool Arg::parse_ushort_radix(const char* str,
-                             int n,
-                             void* dest,
-                             int radix) {
-  unsigned long r;
-  if (!parse_ulong_radix(str, n, &r, radix)) return false; // Could not parse
-  if (r > USHRT_MAX) return false;                      // Out of range
-  if (dest == NULL) return true;
-  *(reinterpret_cast<unsigned short*>(dest)) = static_cast<unsigned short>(r);
-  return true;
-}
-
-bool Arg::parse_int_radix(const char* str,
-                          int n,
-                          void* dest,
-                          int radix) {
-  long r;
-  if (!parse_long_radix(str, n, &r, radix)) return false; // Could not parse
-  if (r < INT_MIN || r > INT_MAX) return false;         // Out of range
-  if (dest == NULL) return true;
-  *(reinterpret_cast<int*>(dest)) = r;
-  return true;
-}
-
-bool Arg::parse_uint_radix(const char* str,
-                           int n,
-                           void* dest,
-                           int radix) {
-  unsigned long r;
-  if (!parse_ulong_radix(str, n, &r, radix)) return false; // Could not parse
-  if (r > UINT_MAX) return false;                       // Out of range
-  if (dest == NULL) return true;
-  *(reinterpret_cast<unsigned int*>(dest)) = r;
-  return true;
-}
-
-bool Arg::parse_longlong_radix(const char* str,
-                               int n,
-                               void* dest,
-                               int radix) {
-#ifndef HAVE_LONG_LONG
-  return false;
-#else
-  if (n == 0) return false;
-  char buf[kMaxNumberLength+1];
-  str = TerminateNumber(buf, str, n);
-  char* end;
-  errno = 0;
-#if defined HAVE_STRTOQ
-  long long r = strtoq(str, &end, radix);
-#elif defined HAVE_STRTOLL
-  long long r = strtoll(str, &end, radix);
-#elif defined HAVE__STRTOI64
-  long long r = _strtoi64(str, &end, radix);
-#elif defined HAVE_STRTOIMAX
-  long long r = strtoimax(str, &end, radix);
-#else
-#error parse_longlong_radix: cannot convert input to a long-long
-#endif
-  if (end != str + n) return false;   // Leftover junk
-  if (errno) return false;
-  if (dest == NULL) return true;
-  *(reinterpret_cast<long long*>(dest)) = r;
-  return true;
-#endif   /* HAVE_LONG_LONG */
-}
-
-bool Arg::parse_ulonglong_radix(const char* str,
-                                int n,
-                                void* dest,
-                                int radix) {
-#ifndef HAVE_UNSIGNED_LONG_LONG
-  return false;
-#else
-  if (n == 0) return false;
-  char buf[kMaxNumberLength+1];
-  str = TerminateNumber(buf, str, n);
-  if (str[0] == '-') return false;    // strtoull() on a negative number?!
-  char* end;
-  errno = 0;
-#if defined HAVE_STRTOQ
-  unsigned long long r = strtouq(str, &end, radix);
-#elif defined HAVE_STRTOLL
-  unsigned long long r = strtoull(str, &end, radix);
-#elif defined HAVE__STRTOI64
-  unsigned long long r = _strtoui64(str, &end, radix);
-#elif defined HAVE_STRTOIMAX
-  unsigned long long r = strtoumax(str, &end, radix);
-#else
-#error parse_ulonglong_radix: cannot convert input to a long-long
-#endif
-  if (end != str + n) return false;   // Leftover junk
-  if (errno) return false;
-  if (dest == NULL) return true;
-  *(reinterpret_cast<unsigned long long*>(dest)) = r;
-  return true;
-#endif   /* HAVE_UNSIGNED_LONG_LONG */
-}
-
-bool Arg::parse_double(const char* str, int n, void* dest) {
-  if (n == 0) return false;
-  static const int kMaxLength = 200;
-  char buf[kMaxLength];
-  if (n >= kMaxLength) return false;
-  memcpy(buf, str, n);
-  buf[n] = '\0';
-  errno = 0;
-  char* end;
-  double r = strtod(buf, &end);
-  if (end != buf + n) return false;   // Leftover junk
-  if (errno) return false;
-  if (dest == NULL) return true;
-  *(reinterpret_cast<double*>(dest)) = r;
-  return true;
-}
-
-bool Arg::parse_float(const char* str, int n, void* dest) {
-  double r;
-  if (!parse_double(str, n, &r)) return false;
-  if (dest == NULL) return true;
-  *(reinterpret_cast<float*>(dest)) = static_cast<float>(r);
-  return true;
-}
-
-
-#define DEFINE_INTEGER_PARSERS(name)                                    \
-  bool Arg::parse_##name(const char* str, int n, void* dest) {          \
-    return parse_##name##_radix(str, n, dest, 10);                      \
-  }                                                                     \
-  bool Arg::parse_##name##_hex(const char* str, int n, void* dest) {    \
-    return parse_##name##_radix(str, n, dest, 16);                      \
-  }                                                                     \
-  bool Arg::parse_##name##_octal(const char* str, int n, void* dest) {  \
-    return parse_##name##_radix(str, n, dest, 8);                       \
-  }                                                                     \
-  bool Arg::parse_##name##_cradix(const char* str, int n, void* dest) { \
-    return parse_##name##_radix(str, n, dest, 0);                       \
-  }
-
-DEFINE_INTEGER_PARSERS(short)      /*                                   */
-DEFINE_INTEGER_PARSERS(ushort)     /*                                   */
-DEFINE_INTEGER_PARSERS(int)        /* Don't use semicolons after these  */
-DEFINE_INTEGER_PARSERS(uint)       /* statements because they can cause */
-DEFINE_INTEGER_PARSERS(long)       /* compiler warnings if the checking */
-DEFINE_INTEGER_PARSERS(ulong)      /* level is turned up high enough.   */
-DEFINE_INTEGER_PARSERS(longlong)   /*                                   */
-DEFINE_INTEGER_PARSERS(ulonglong)  /*                                   */
-
-#undef DEFINE_INTEGER_PARSERS
-
-}   // namespace pcrecpp
diff --git a/pcrecpp/pcrecpp_internal.h b/pcrecpp/pcrecpp_internal.h
deleted file mode 100644
index 827f9e0..0000000
--- a/pcrecpp/pcrecpp_internal.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*************************************************
-*       Perl-Compatible Regular Expressions      *
-*************************************************/
-
-/*
-Copyright (c) 2005, Google Inc.
-All rights reserved.
-
------------------------------------------------------------------------------
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-
-    * Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-
-    * Neither the name of the University of Cambridge nor the names of its
-      contributors may be used to endorse or promote products derived from
-      this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
-*/
-
-
-#ifndef PCRECPP_INTERNAL_H
-#define PCRECPP_INTERNAL_H
-
-/* When compiling a DLL for Windows, the exported symbols have to be declared
-using some MS magic. I found some useful information on this web page:
-http://msdn2.microsoft.com/en-us/library/y4h7bcy6(VS.80).aspx. According to the
-information there, using __declspec(dllexport) without "extern" we have a
-definition; with "extern" we have a declaration. The settings here override the
-setting in pcre.h. We use:
-
-  PCRECPP_EXP_DECL       for declarations
-  PCRECPP_EXP_DEFN       for definitions of exported functions
-
-*/
-
-#ifndef PCRECPP_EXP_DECL
-#  ifdef _WIN32
-#    ifndef PCRE_STATIC
-#      define PCRECPP_EXP_DECL       extern __declspec(dllexport)
-#      define PCRECPP_EXP_DEFN       __declspec(dllexport)
-#    else
-#      define PCRECPP_EXP_DECL       extern
-#      define PCRECPP_EXP_DEFN
-#    endif
-#  else
-#    define PCRECPP_EXP_DECL         extern
-#    define PCRECPP_EXP_DEFN
-#  endif
-#endif
-
-#endif  /* PCRECPP_INTERNAL_H */
-
-/* End of pcrecpp_internal.h */
diff --git a/pcrecpp/pcrecpp_unittest.cc b/pcrecpp/pcrecpp_unittest.cc
deleted file mode 100644
index 67f2398..0000000
--- a/pcrecpp/pcrecpp_unittest.cc
+++ /dev/null
@@ -1,1282 +0,0 @@
-// -*- coding: utf-8 -*-
-//
-// Copyright (c) 2005 - 2010, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: Sanjay Ghemawat
-//
-// TODO: Test extractions for PartialMatch/Consume
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <string.h>      /* for memset and strcmp */
-#include <cassert>
-#include <vector>
-#include "pcrecpp.h"
-
-using pcrecpp::StringPiece;
-using pcrecpp::RE;
-using pcrecpp::RE_Options;
-using pcrecpp::Hex;
-using pcrecpp::Octal;
-using pcrecpp::CRadix;
-
-static bool VERBOSE_TEST  = false;
-
-// CHECK dies with a fatal error if condition is not true.  It is *not*
-// controlled by NDEBUG, so the check will be executed regardless of
-// compilation mode.  Therefore, it is safe to do things like:
-//    CHECK_EQ(fp->Write(x), 4)
-#define CHECK(condition) do {                           \
-  if (!(condition)) {                                   \
-    fprintf(stderr, "%s:%d: Check failed: %s\n",        \
-            __FILE__, __LINE__, #condition);            \
-    exit(1);                                            \
-  }                                                     \
-} while (0)
-
-#define CHECK_EQ(a, b)   CHECK(a == b)
-
-static void Timing1(int num_iters) {
-  // Same pattern lots of times
-  RE pattern("ruby:\\d+");
-  StringPiece p("ruby:1234");
-  for (int j = num_iters; j > 0; j--) {
-    CHECK(pattern.FullMatch(p));
-  }
-}
-
-static void Timing2(int num_iters) {
-  // Same pattern lots of times
-  RE pattern("ruby:(\\d+)");
-  int i;
-  for (int j = num_iters; j > 0; j--) {
-    CHECK(pattern.FullMatch("ruby:1234", &i));
-    CHECK_EQ(i, 1234);
-  }
-}
-
-static void Timing3(int num_iters) {
-  string text_string;
-  for (int j = num_iters; j > 0; j--) {
-    text_string += "this is another line\n";
-  }
-
-  RE line_matcher(".*\n");
-  string line;
-  StringPiece text(text_string);
-  int counter = 0;
-  while (line_matcher.Consume(&text)) {
-    counter++;
-  }
-  printf("Matched %d lines\n", counter);
-}
-
-#if 0  // uncomment this if you have a way of defining VirtualProcessSize()
-
-static void LeakTest() {
-  // Check for memory leaks
-  unsigned long long initial_size = 0;
-  for (int i = 0; i < 100000; i++) {
-    if (i == 50000) {
-      initial_size = VirtualProcessSize();
-      printf("Size after 50000: %llu\n", initial_size);
-    }
-    char buf[100];  // definitely big enough
-    sprintf(buf, "pat%09d", i);
-    RE newre(buf);
-  }
-  uint64 final_size = VirtualProcessSize();
-  printf("Size after 100000: %llu\n", final_size);
-  const double growth = double(final_size - initial_size) / final_size;
-  printf("Growth: %0.2f%%", growth * 100);
-  CHECK(growth < 0.02);       // Allow < 2% growth
-}
-
-#endif
-
-static void RadixTests() {
-  printf("Testing hex\n");
-
-#define CHECK_HEX(type, value) \
-  do { \
-    type v; \
-    CHECK(RE("([0-9a-fA-F]+)[uUlL]*").FullMatch(#value, Hex(&v))); \
-    CHECK_EQ(v, 0x ## value); \
-    CHECK(RE("([0-9a-fA-FxX]+)[uUlL]*").FullMatch("0x" #value, CRadix(&v))); \
-    CHECK_EQ(v, 0x ## value); \
-  } while(0)
-
-  CHECK_HEX(short,              2bad);
-  CHECK_HEX(unsigned short,     2badU);
-  CHECK_HEX(int,                dead);
-  CHECK_HEX(unsigned int,       deadU);
-  CHECK_HEX(long,               7eadbeefL);
-  CHECK_HEX(unsigned long,      deadbeefUL);
-#ifdef HAVE_LONG_LONG
-  CHECK_HEX(long long,          12345678deadbeefLL);
-#endif
-#ifdef HAVE_UNSIGNED_LONG_LONG
-  CHECK_HEX(unsigned long long, cafebabedeadbeefULL);
-#endif
-
-#undef CHECK_HEX
-
-  printf("Testing octal\n");
-
-#define CHECK_OCTAL(type, value) \
-  do { \
-    type v; \
-    CHECK(RE("([0-7]+)[uUlL]*").FullMatch(#value, Octal(&v))); \
-    CHECK_EQ(v, 0 ## value); \
-    CHECK(RE("([0-9a-fA-FxX]+)[uUlL]*").FullMatch("0" #value, CRadix(&v))); \
-    CHECK_EQ(v, 0 ## value); \
-  } while(0)
-
-  CHECK_OCTAL(short,              77777);
-  CHECK_OCTAL(unsigned short,     177777U);
-  CHECK_OCTAL(int,                17777777777);
-  CHECK_OCTAL(unsigned int,       37777777777U);
-  CHECK_OCTAL(long,               17777777777L);
-  CHECK_OCTAL(unsigned long,      37777777777UL);
-#ifdef HAVE_LONG_LONG
-  CHECK_OCTAL(long long,          777777777777777777777LL);
-#endif
-#ifdef HAVE_UNSIGNED_LONG_LONG
-  CHECK_OCTAL(unsigned long long, 1777777777777777777777ULL);
-#endif
-
-#undef CHECK_OCTAL
-
-  printf("Testing decimal\n");
-
-#define CHECK_DECIMAL(type, value) \
-  do { \
-    type v; \
-    CHECK(RE("(-?[0-9]+)[uUlL]*").FullMatch(#value, &v)); \
-    CHECK_EQ(v, value); \
-    CHECK(RE("(-?[0-9a-fA-FxX]+)[uUlL]*").FullMatch(#value, CRadix(&v))); \
-    CHECK_EQ(v, value); \
-  } while(0)
-
-  CHECK_DECIMAL(short,              -1);
-  CHECK_DECIMAL(unsigned short,     9999);
-  CHECK_DECIMAL(int,                -1000);
-  CHECK_DECIMAL(unsigned int,       12345U);
-  CHECK_DECIMAL(long,               -10000000L);
-  CHECK_DECIMAL(unsigned long,      3083324652U);
-#ifdef HAVE_LONG_LONG
-  CHECK_DECIMAL(long long,          -100000000000000LL);
-#endif
-#ifdef HAVE_UNSIGNED_LONG_LONG
-  CHECK_DECIMAL(unsigned long long, 1234567890987654321ULL);
-#endif
-
-#undef CHECK_DECIMAL
-
-}
-
-static void TestReplace() {
-  printf("Testing Replace\n");
-
-  struct ReplaceTest {
-    const char *regexp;
-    const char *rewrite;
-    const char *original;
-    const char *single;
-    const char *global;
-    int global_count;         // the expected return value from ReplaceAll
-  };
-  static const ReplaceTest tests[] = {
-    { "(qu|[b-df-hj-np-tv-z]*)([a-z]+)",
-      "\\2\\1ay",
-      "the quick brown fox jumps over the lazy dogs.",
-      "ethay quick brown fox jumps over the lazy dogs.",
-      "ethay ickquay ownbray oxfay umpsjay overay ethay azylay ogsday.",
-      9 },
-    { "\\w+",
-      "\\0-NOSPAM",
-      "paul.haahr@google.com",
-      "paul-NOSPAM.haahr@google.com",
-      "paul-NOSPAM.haahr-NOSPAM@google-NOSPAM.com-NOSPAM",
-      4 },
-    { "^",
-      "(START)",
-      "foo",
-      "(START)foo",
-      "(START)foo",
-      1 },
-    { "^",
-      "(START)",
-      "",
-      "(START)",
-      "(START)",
-      1 },
-    { "$",
-      "(END)",
-      "",
-      "(END)",
-      "(END)",
-      1 },
-    { "b",
-      "bb",
-      "ababababab",
-      "abbabababab",
-      "abbabbabbabbabb",
-       5 },
-    { "b",
-      "bb",
-      "bbbbbb",
-      "bbbbbbb",
-      "bbbbbbbbbbbb",
-      6 },
-    { "b+",
-      "bb",
-      "bbbbbb",
-      "bb",
-      "bb",
-      1 },
-    { "b*",
-      "bb",
-      "bbbbbb",
-      "bb",
-      "bbbb",
-      2 },
-    { "b*",
-      "bb",
-      "aaaaa",
-      "bbaaaaa",
-      "bbabbabbabbabbabb",
-      6 },
-    { "b*",
-      "bb",
-      "aa\naa\n",
-      "bbaa\naa\n",
-      "bbabbabb\nbbabbabb\nbb",
-      7 },
-    { "b*",
-      "bb",
-      "aa\raa\r",
-      "bbaa\raa\r",
-      "bbabbabb\rbbabbabb\rbb",
-      7 },
-    { "b*",
-      "bb",
-      "aa\r\naa\r\n",
-      "bbaa\r\naa\r\n",
-      "bbabbabb\r\nbbabbabb\r\nbb",
-      7 },
-    // Check empty-string matching (it's tricky!)
-    { "aa|b*",
-      "@",
-      "aa",
-      "@",
-      "@@",
-      2 },
-    { "b*|aa",
-      "@",
-      "aa",
-      "@aa",
-      "@@@",
-      3 },
-#ifdef SUPPORT_UTF8
-    { "b*",
-      "bb",
-      "\xE3\x83\x9B\xE3\x83\xBC\xE3\x83\xA0\xE3\x81\xB8",   // utf8
-      "bb\xE3\x83\x9B\xE3\x83\xBC\xE3\x83\xA0\xE3\x81\xB8",
-      "bb\xE3\x83\x9B""bb""\xE3\x83\xBC""bb""\xE3\x83\xA0""bb""\xE3\x81\xB8""bb",
-      5 },
-    { "b*",
-      "bb",
-      "\xE3\x83\x9B\r\n\xE3\x83\xBC\r\xE3\x83\xA0\n\xE3\x81\xB8\r\n",   // utf8
-      "bb\xE3\x83\x9B\r\n\xE3\x83\xBC\r\xE3\x83\xA0\n\xE3\x81\xB8\r\n",
-      ("bb\xE3\x83\x9B""bb\r\nbb""\xE3\x83\xBC""bb\rbb""\xE3\x83\xA0"
-       "bb\nbb""\xE3\x81\xB8""bb\r\nbb"),
-      9 },
-#endif
-    { "", NULL, NULL, NULL, NULL, 0 }
-  };
-
-#ifdef SUPPORT_UTF8
-  const bool support_utf8 = true;
-#else
-  const bool support_utf8 = false;
-#endif
-
-  for (const ReplaceTest *t = tests; t->original != NULL; ++t) {
-    RE re(t->regexp, RE_Options().set_newline_mode(PCRE2_NEWLINE_CRLF)
-                                 .set_utf(support_utf8));
-    assert(re.error().empty());
-    string one(t->original);
-    CHECK(re.Replace(t->rewrite, &one));
-    CHECK_EQ(one, t->single);
-    string all(t->original);
-    const int replace_count = re.GlobalReplace(t->rewrite, &all);
-    CHECK_EQ(all, t->global);
-    CHECK_EQ(replace_count, t->global_count);
-  }
-
-  // One final test: test \r\n replacement when we're not in CRLF mode
-  {
-    RE re("b*", RE_Options().set_newline_mode(PCRE2_NEWLINE_CR)
-                            .set_utf(support_utf8));
-    assert(re.error().empty());
-    string all("aa\r\naa\r\n");
-    CHECK_EQ(re.GlobalReplace("bb", &all), 9);
-    CHECK_EQ(all, string("bbabbabb\rbb\nbbabbabb\rbb\nbb"));
-  }
-  {
-    RE re("b*", RE_Options().set_newline_mode(PCRE2_NEWLINE_LF)
-                            .set_utf(support_utf8));
-    assert(re.error().empty());
-    string all("aa\r\naa\r\n");
-    CHECK_EQ(re.GlobalReplace("bb", &all), 9);
-    CHECK_EQ(all, string("bbabbabb\rbb\nbbabbabb\rbb\nbb"));
-  }
-  // TODO: test what happens when no PCRE_NEWLINE_* flag is set.
-  //       Alas, the answer depends on how pcre was compiled.
-}
-
-static void TestExtract() {
-  printf("Testing Extract\n");
-
-  string s;
-
-  CHECK(RE("(.*)@([^.]*)").Extract("\\2!\\1", "boris@kremvax.ru", &s));
-  CHECK_EQ(s, "kremvax!boris");
-
-  // check the RE interface as well
-  CHECK(RE(".*").Extract("'\\0'", "foo", &s));
-  CHECK_EQ(s, "'foo'");
-  CHECK(!RE("bar").Extract("'\\0'", "baz", &s));
-  CHECK_EQ(s, "'foo'");
-}
-
-static void TestConsume() {
-  printf("Testing Consume\n");
-
-  string word;
-
-  string s("   aaa b!@#$@#$cccc");
-  StringPiece input(s);
-
-  RE r("\\s*(\\w+)");    // matches a word, possibly proceeded by whitespace
-  CHECK(r.Consume(&input, &word));
-  CHECK_EQ(word, "aaa");
-  CHECK(r.Consume(&input, &word));
-  CHECK_EQ(word, "b");
-  CHECK(! r.Consume(&input, &word));
-}
-
-static void TestFindAndConsume() {
-  printf("Testing FindAndConsume\n");
-
-  string word;
-
-  string s("   aaa b!@#$@#$cccc");
-  StringPiece input(s);
-
-  RE r("(\\w+)");      // matches a word
-  CHECK(r.FindAndConsume(&input, &word));
-  CHECK_EQ(word, "aaa");
-  CHECK(r.FindAndConsume(&input, &word));
-  CHECK_EQ(word, "b");
-  CHECK(r.FindAndConsume(&input, &word));
-  CHECK_EQ(word, "cccc");
-  CHECK(! r.FindAndConsume(&input, &word));
-}
-
-static void TestMatchNumberPeculiarity() {
-  printf("Testing match-number peculiarity\n");
-
-  string word1;
-  string word2;
-  string word3;
-
-  RE r("(foo)|(bar)|(baz)");
-  CHECK(r.PartialMatch("foo", &word1, &word2, &word3));
-  CHECK_EQ(word1, "foo");
-  CHECK_EQ(word2, "");
-  CHECK_EQ(word3, "");
-  CHECK(r.PartialMatch("bar", &word1, &word2, &word3));
-  CHECK_EQ(word1, "");
-  CHECK_EQ(word2, "bar");
-  CHECK_EQ(word3, "");
-  CHECK(r.PartialMatch("baz", &word1, &word2, &word3));
-  CHECK_EQ(word1, "");
-  CHECK_EQ(word2, "");
-  CHECK_EQ(word3, "baz");
-  CHECK(!r.PartialMatch("f", &word1, &word2, &word3));
-
-  string a;
-  CHECK(RE("(foo)|hello").FullMatch("hello", &a));
-  CHECK_EQ(a, "");
-}
-
-static void TestRecursion() {
-  printf("Testing recursion\n");
-
-  // Get one string that passes (sometimes), one that never does.
-  string text_good("abcdefghijk");
-  string text_bad("acdefghijkl");
-
-  // According to pcretest, matching text_good against (\w+)*b
-  // requires match_limit of at least 8192, and match_recursion_limit
-  // of at least 37.
-
-  RE_Options options_ml;
-  options_ml.set_match_limit(8192);
-  RE re("(\\w+)*b", options_ml);
-  CHECK(re.PartialMatch(text_good) == true);
-  CHECK(re.PartialMatch(text_bad) == false);
-  CHECK(re.FullMatch(text_good) == false);
-  CHECK(re.FullMatch(text_bad) == false);
-
-  options_ml.set_match_limit(1024);
-  RE re2("(\\w+)*b", options_ml);
-  CHECK(re2.PartialMatch(text_good) == false);   // because of match_limit
-  CHECK(re2.PartialMatch(text_bad) == false);
-  CHECK(re2.FullMatch(text_good) == false);
-  CHECK(re2.FullMatch(text_bad) == false);
-
-  RE_Options options_mlr;
-  options_mlr.set_match_limit_recursion(50);
-  RE re3("(\\w+)*b", options_mlr);
-  CHECK(re3.PartialMatch(text_good) == true);
-  CHECK(re3.PartialMatch(text_bad) == false);
-  CHECK(re3.FullMatch(text_good) == false);
-  CHECK(re3.FullMatch(text_bad) == false);
-
-  options_mlr.set_match_limit_recursion(10);
-  RE re4("(\\w+)*b", options_mlr);
-  CHECK(re4.PartialMatch(text_good) == false);
-  CHECK(re4.PartialMatch(text_bad) == false);
-  CHECK(re4.FullMatch(text_good) == false);
-  CHECK(re4.FullMatch(text_bad) == false);
-}
-
-// A meta-quoted string, interpreted as a pattern, should always match
-// the original unquoted string.
-static void TestQuoteMeta(string unquoted, RE_Options options = RE_Options()) {
-  string quoted = RE::QuoteMeta(unquoted);
-  RE re(quoted, options);
-  CHECK(re.FullMatch(unquoted));
-}
-
-// A string containing meaningful regexp characters, which is then meta-
-// quoted, should not generally match a string the unquoted string does.
-static void NegativeTestQuoteMeta(string unquoted, string should_not_match,
-                                  RE_Options options = RE_Options()) {
-  string quoted = RE::QuoteMeta(unquoted);
-  RE re(quoted, options);
-  CHECK(!re.FullMatch(should_not_match));
-}
-
-// Tests that quoted meta characters match their original strings,
-// and that a few things that shouldn't match indeed do not.
-static void TestQuotaMetaSimple() {
-  TestQuoteMeta("foo");
-  TestQuoteMeta("foo.bar");
-  TestQuoteMeta("foo\\.bar");
-  TestQuoteMeta("[1-9]");
-  TestQuoteMeta("1.5-2.0?");
-  TestQuoteMeta("\\d");
-  TestQuoteMeta("Who doesn't like ice cream?");
-  TestQuoteMeta("((a|b)c?d*e+[f-h]i)");
-  TestQuoteMeta("((?!)xxx).*yyy");
-  TestQuoteMeta("([");
-  TestQuoteMeta(string("foo\0bar", 7));
-}
-
-static void TestQuoteMetaSimpleNegative() {
-  NegativeTestQuoteMeta("foo", "bar");
-  NegativeTestQuoteMeta("...", "bar");
-  NegativeTestQuoteMeta("\\.", ".");
-  NegativeTestQuoteMeta("\\.", "..");
-  NegativeTestQuoteMeta("(a)", "a");
-  NegativeTestQuoteMeta("(a|b)", "a");
-  NegativeTestQuoteMeta("(a|b)", "(a)");
-  NegativeTestQuoteMeta("(a|b)", "a|b");
-  NegativeTestQuoteMeta("[0-9]", "0");
-  NegativeTestQuoteMeta("[0-9]", "0-9");
-  NegativeTestQuoteMeta("[0-9]", "[9]");
-  NegativeTestQuoteMeta("((?!)xxx)", "xxx");
-}
-
-static void TestQuoteMetaLatin1() {
-  TestQuoteMeta("3\xb2 = 9");
-}
-
-static void TestQuoteMetaUtf8() {
-#ifdef SUPPORT_UTF8
-  TestQuoteMeta("Pl\xc3\xa1\x63ido Domingo", pcrecpp::UTF8());
-  TestQuoteMeta("xyz", pcrecpp::UTF8());            // No fancy utf8
-  TestQuoteMeta("\xc2\xb0", pcrecpp::UTF8());       // 2-byte utf8 (degree symbol)
-  TestQuoteMeta("27\xc2\xb0 degrees", pcrecpp::UTF8());  // As a middle character
-  TestQuoteMeta("\xe2\x80\xb3", pcrecpp::UTF8());   // 3-byte utf8 (double prime)
-  TestQuoteMeta("\xf0\x9d\x85\x9f", pcrecpp::UTF8()); // 4-byte utf8 (music note)
-  TestQuoteMeta("27\xc2\xb0"); // Interpreted as Latin-1, but should still work
-  NegativeTestQuoteMeta("27\xc2\xb0",               // 2-byte utf (degree symbol)
-                        "27\\\xc2\\\xb0",
-                        pcrecpp::UTF8());
-#endif
-}
-
-static void TestQuoteMetaAll() {
-  printf("Testing QuoteMeta\n");
-  TestQuotaMetaSimple();
-  TestQuoteMetaSimpleNegative();
-  TestQuoteMetaLatin1();
-  TestQuoteMetaUtf8();
-}
-
-//
-// Options tests contributed by
-// Giuseppe Maxia, CTO, Stardata s.r.l.
-// July 2005
-//
-static void GetOneOptionResult(
-                const char *option_name,
-                const char *regex,
-                const char *str,
-                RE_Options options,
-                bool full,
-                string expected) {
-
-  printf("Testing Option <%s>\n", option_name);
-  if(VERBOSE_TEST)
-    printf("/%s/ finds \"%s\" within \"%s\" \n",
-                    regex,
-                    expected.c_str(),
-                    str);
-  string captured("");
-  if (full)
-    RE(regex,options).FullMatch(str, &captured);
-  else
-    RE(regex,options).PartialMatch(str, &captured);
-  CHECK_EQ(captured, expected);
-}
-
-static void TestOneOption(
-                const char *option_name,
-                const char *regex,
-                const char *str,
-                RE_Options options,
-                bool full,
-                bool assertive = true) {
-
-  printf("Testing Option <%s>\n", option_name);
-  if (VERBOSE_TEST)
-    printf("'%s' %s /%s/ \n",
-                  str,
-                  (assertive? "matches" : "doesn't match"),
-                  regex);
-  if (assertive) {
-    if (full)
-      CHECK(RE(regex,options).FullMatch(str));
-    else
-      CHECK(RE(regex,options).PartialMatch(str));
-  } else {
-    if (full)
-      CHECK(!RE(regex,options).FullMatch(str));
-    else
-      CHECK(!RE(regex,options).PartialMatch(str));
-  }
-}
-
-static void Test_CASELESS() {
-  RE_Options options;
-  RE_Options options2;
-
-  options.set_caseless(true);
-  TestOneOption("CASELESS (class)",  "HELLO",    "hello", options, false);
-  TestOneOption("CASELESS (class2)", "HELLO",    "hello", options2.set_caseless(true), false);
-  TestOneOption("CASELESS (class)",  "^[A-Z]+$", "Hello", options, false);
-
-  TestOneOption("CASELESS (function)", "HELLO",    "hello", pcrecpp::CASELESS(), false);
-  TestOneOption("CASELESS (function)", "^[A-Z]+$", "Hello", pcrecpp::CASELESS(), false);
-  options.set_caseless(false);
-  TestOneOption("no CASELESS", "HELLO",    "hello", options, false, false);
-}
-
-static void Test_MULTILINE() {
-  RE_Options options;
-  RE_Options options2;
-  const char *str = "HELLO\n" "cruel\n" "world\n";
-
-  options.set_multiline(true);
-  TestOneOption("MULTILINE (class)",    "^cruel$", str, options, false);
-  TestOneOption("MULTILINE (class2)",   "^cruel$", str, options2.set_multiline(true), false);
-  TestOneOption("MULTILINE (function)", "^cruel$", str, pcrecpp::MULTILINE(), false);
-  options.set_multiline(false);
-  TestOneOption("no MULTILINE", "^cruel$", str, options, false, false);
-}
-
-static void Test_DOTALL() {
-  RE_Options options;
-  RE_Options options2;
-  const char *str = "HELLO\n" "cruel\n" "world";
-
-  options.set_dotall(true);
-  TestOneOption("DOTALL (class)",    "HELLO.*world", str, options, true);
-  TestOneOption("DOTALL (class2)",   "HELLO.*world", str, options2.set_dotall(true), true);
-  TestOneOption("DOTALL (function)",    "HELLO.*world", str, pcrecpp::DOTALL(), true);
-  options.set_dotall(false);
-  TestOneOption("no DOTALL", "HELLO.*world", str, options, true, false);
-}
-
-static void Test_DOLLAR_ENDONLY() {
-  RE_Options options;
-  RE_Options options2;
-  const char *str = "HELLO world\n";
-
-  TestOneOption("no DOLLAR_ENDONLY", "world$", str, options, false);
-  options.set_dollar_endonly(true);
-  TestOneOption("DOLLAR_ENDONLY 1",    "world$", str, options, false, false);
-  TestOneOption("DOLLAR_ENDONLY 2",    "world$", str, options2.set_dollar_endonly(true), false, false);
-}
-
-static void Test_EXTENDED() {
-  RE_Options options;
-  RE_Options options2;
-  const char *str = "HELLO world";
-
-  options.set_extended(true);
-  TestOneOption("EXTENDED (class)",    "HELLO world", str, options, false, false);
-  TestOneOption("EXTENDED (class2)",   "HELLO world", str, options2.set_extended(true), false, false);
-  TestOneOption("EXTENDED (class)",
-                    "^ HE L{2} O "
-                    "\\s+        "
-                    "\\w+ $      ",
-                    str,
-                    options,
-                    false);
-
-  TestOneOption("EXTENDED (function)",    "HELLO world", str, pcrecpp::EXTENDED(), false, false);
-  TestOneOption("EXTENDED (function)",
-                    "^ HE L{2} O "
-                    "\\s+        "
-                    "\\w+ $      ",
-                    str,
-                    pcrecpp::EXTENDED(),
-                    false);
-
-  options.set_extended(false);
-  TestOneOption("no EXTENDED", "HELLO world", str, options, false);
-}
-
-static void Test_NO_AUTO_CAPTURE() {
-  RE_Options options;
-  const char *str = "HELLO world";
-  string captured;
-
-  printf("Testing Option <no NO_AUTO_CAPTURE>\n");
-  if (VERBOSE_TEST)
-    printf("parentheses capture text\n");
-  RE re("(world|universe)$", options);
-  CHECK(re.Extract("\\1", str , &captured));
-  CHECK_EQ(captured, "world");
-  options.set_no_auto_capture(true);
-  printf("testing Option <NO_AUTO_CAPTURE>\n");
-  if (VERBOSE_TEST)
-    printf("parentheses do not capture text\n");
-  re.Extract("\\1",str, &captured );
-  CHECK_EQ(captured, "world");
-}
-
-static void Test_UNGREEDY() {
-  RE_Options options;
-  const char *str = "HELLO, 'this' is the 'world'";
-
-  options.set_ungreedy(true);
-  GetOneOptionResult("UNGREEDY 1", "('.*')", str, options, false, "'this'" );
-  GetOneOptionResult("UNGREEDY 2", "('.*')", str, RE_Options().set_ungreedy(true), false, "'this'" );
-  GetOneOptionResult("UNGREEDY", "('.*?')", str, options, false, "'this' is the 'world'" );
-
-  options.set_ungreedy(false);
-  GetOneOptionResult("no UNGREEDY", "('.*')", str, options, false, "'this' is the 'world'" );
-  GetOneOptionResult("no UNGREEDY", "('.*?')", str, options, false, "'this'" );
-}
-
-static void Test_all_options() {
-  const char *str = "HELLO\n" "cruel\n" "world";
-  RE_Options options;
-  options.set_all_options(PCRE2_CASELESS | PCRE2_DOTALL);
-
-  TestOneOption("all_options (CASELESS|DOTALL)", "^hello.*WORLD", str , options, false);
-  options.set_all_options(0);
-  TestOneOption("all_options (0)", "^hello.*WORLD", str , options, false, false);
-  options.set_all_options(PCRE2_MULTILINE | PCRE2_EXTENDED);
-
-  TestOneOption("all_options (MULTILINE|EXTENDED)", " ^ c r u e l $ ", str, options, false);
-  TestOneOption("all_options (MULTILINE|EXTENDED) with constructor",
-                  " ^ c r u e l $ ",
-                  str,
-                  RE_Options(PCRE2_MULTILINE | PCRE2_EXTENDED),
-                  false);
-
-  TestOneOption("all_options (MULTILINE|EXTENDED) with concatenation",
-                  " ^ c r u e l $ ",
-                  str,
-                  RE_Options()
-                       .set_multiline(true)
-                       .set_extended(true),
-                  false);
-
-  options.set_all_options(0);
-  TestOneOption("all_options (0)", "^ c r u e l $", str, options, false, false);
-
-}
-
-static void TestOptions() {
-  printf("Testing Options\n");
-  Test_CASELESS();
-  Test_MULTILINE();
-  Test_DOTALL();
-  Test_DOLLAR_ENDONLY();
-  Test_EXTENDED();
-  Test_NO_AUTO_CAPTURE();
-  Test_UNGREEDY();
-  Test_all_options();
-}
-
-static void TestConstructors() {
-  printf("Testing constructors\n");
-
-  RE_Options options;
-  options.set_dotall(true);
-  const char *str = "HELLO\n" "cruel\n" "world";
-
-  RE orig("HELLO.*world", options);
-  CHECK(orig.FullMatch(str));
-
-  RE copy1(orig);
-  CHECK(copy1.FullMatch(str));
-
-  RE copy2("not a match");
-  CHECK(!copy2.FullMatch(str));
-  copy2 = copy1;
-  CHECK(copy2.FullMatch(str));
-  copy2 = orig;
-  CHECK(copy2.FullMatch(str));
-
-  // Make sure when we assign to ourselves, nothing bad happens
-  orig = orig;
-  copy1 = copy1;
-  copy2 = copy2;
-  CHECK(orig.FullMatch(str));
-  CHECK(copy1.FullMatch(str));
-  CHECK(copy2.FullMatch(str));
-}
-
-int main(int argc, char** argv) {
-  // Treat any flag as --help
-  if (argc > 1 && argv[1][0] == '-') {
-    printf("Usage: %s [timing1|timing2|timing3 num-iters]\n"
-           "       If 'timingX ###' is specified, run the given timing test\n"
-           "       with the given number of iterations, rather than running\n"
-           "       the default corectness test.\n", argv[0]);
-    return 0;
-  }
-
-  if (argc > 1) {
-    if ( argc == 2 || atoi(argv[2]) == 0) {
-      printf("timing mode needs a num-iters argument\n");
-      return 1;
-    }
-    if (!strcmp(argv[1], "timing1"))
-      Timing1(atoi(argv[2]));
-    else if (!strcmp(argv[1], "timing2"))
-      Timing2(atoi(argv[2]));
-    else if (!strcmp(argv[1], "timing3"))
-      Timing3(atoi(argv[2]));
-    else
-      printf("Unknown argument '%s'\n", argv[1]);
-    return 0;
-  }
-
-  printf("PCRE C++ wrapper tests\n");
-  printf("Testing FullMatch\n");
-
-  int i;
-  string s;
-
-  /***** FullMatch with no args *****/
-
-  CHECK(RE("h.*o").FullMatch("hello"));
-  CHECK(!RE("h.*o").FullMatch("othello"));     // Must be anchored at front
-  CHECK(!RE("h.*o").FullMatch("hello!"));      // Must be anchored at end
-  CHECK(RE("a*").FullMatch("aaaa"));           // Fullmatch with normal op
-  CHECK(RE("a*?").FullMatch("aaaa"));          // Fullmatch with nongreedy op
-  CHECK(RE("a*?\\z").FullMatch("aaaa"));       // Two unusual ops
-
-  /***** FullMatch with args *****/
-
-  // Zero-arg
-  CHECK(RE("\\d+").FullMatch("1001"));
-
-  // Single-arg
-  CHECK(RE("(\\d+)").FullMatch("1001",   &i));
-  CHECK_EQ(i, 1001);
-  CHECK(RE("(-?\\d+)").FullMatch("-123", &i));
-  CHECK_EQ(i, -123);
-  CHECK(!RE("()\\d+").FullMatch("10", &i));
-  CHECK(!RE("(\\d+)").FullMatch("1234567890123456789012345678901234567890",
-                                &i));
-
-  // Digits surrounding integer-arg
-  CHECK(RE("1(\\d*)4").FullMatch("1234", &i));
-  CHECK_EQ(i, 23);
-  CHECK(RE("(\\d)\\d+").FullMatch("1234", &i));
-  CHECK_EQ(i, 1);
-  CHECK(RE("(-\\d)\\d+").FullMatch("-1234", &i));
-  CHECK_EQ(i, -1);
-  CHECK(RE("(\\d)").PartialMatch("1234", &i));
-  CHECK_EQ(i, 1);
-  CHECK(RE("(-\\d)").PartialMatch("-1234", &i));
-  CHECK_EQ(i, -1);
-
-  // String-arg
-  CHECK(RE("h(.*)o").FullMatch("hello", &s));
-  CHECK_EQ(s, string("ell"));
-
-  // StringPiece-arg
-  StringPiece sp;
-  CHECK(RE("(\\w+):(\\d+)").FullMatch("ruby:1234", &sp, &i));
-  CHECK_EQ(sp.size(), 4);
-  CHECK(memcmp(sp.data(), "ruby", 4) == 0);
-  CHECK_EQ(i, 1234);
-
-  // Multi-arg
-  CHECK(RE("(\\w+):(\\d+)").FullMatch("ruby:1234", &s, &i));
-  CHECK_EQ(s, string("ruby"));
-  CHECK_EQ(i, 1234);
-
-  // Ignore non-void* NULL arg
-  CHECK(RE("he(.*)lo").FullMatch("hello", (char*)NULL));
-  CHECK(RE("h(.*)o").FullMatch("hello", (string*)NULL));
-  CHECK(RE("h(.*)o").FullMatch("hello", (StringPiece*)NULL));
-  CHECK(RE("(.*)").FullMatch("1234", (int*)NULL));
-#ifdef HAVE_LONG_LONG
-  CHECK(RE("(.*)").FullMatch("1234567890123456", (long long*)NULL));
-#endif
-  CHECK(RE("(.*)").FullMatch("123.4567890123456", (double*)NULL));
-  CHECK(RE("(.*)").FullMatch("123.4567890123456", (float*)NULL));
-
-  // Fail on non-void* NULL arg if the match doesn't parse for the given type.
-  CHECK(!RE("h(.*)lo").FullMatch("hello", &s, (char*)NULL));
-  CHECK(!RE("(.*)").FullMatch("hello", (int*)NULL));
-  CHECK(!RE("(.*)").FullMatch("1234567890123456", (int*)NULL));
-  CHECK(!RE("(.*)").FullMatch("hello", (double*)NULL));
-  CHECK(!RE("(.*)").FullMatch("hello", (float*)NULL));
-
-  // Ignored arg
-  CHECK(RE("(\\w+)(:)(\\d+)").FullMatch("ruby:1234", &s, (void*)NULL, &i));
-  CHECK_EQ(s, string("ruby"));
-  CHECK_EQ(i, 1234);
-
-  // Type tests
-  {
-    char c;
-    CHECK(RE("(H)ello").FullMatch("Hello", &c));
-    CHECK_EQ(c, 'H');
-  }
-  {
-    unsigned char c;
-    CHECK(RE("(H)ello").FullMatch("Hello", &c));
-    CHECK_EQ(c, static_cast<unsigned char>('H'));
-  }
-  {
-    short v;
-    CHECK(RE("(-?\\d+)").FullMatch("100",     &v));    CHECK_EQ(v, 100);
-    CHECK(RE("(-?\\d+)").FullMatch("-100",    &v));    CHECK_EQ(v, -100);
-    CHECK(RE("(-?\\d+)").FullMatch("32767",   &v));    CHECK_EQ(v, 32767);
-    CHECK(RE("(-?\\d+)").FullMatch("-32768",  &v));    CHECK_EQ(v, -32768);
-    CHECK(!RE("(-?\\d+)").FullMatch("-32769", &v));
-    CHECK(!RE("(-?\\d+)").FullMatch("32768",  &v));
-  }
-  {
-    unsigned short v;
-    CHECK(RE("(\\d+)").FullMatch("100",     &v));    CHECK_EQ(v, 100);
-    CHECK(RE("(\\d+)").FullMatch("32767",   &v));    CHECK_EQ(v, 32767);
-    CHECK(RE("(\\d+)").FullMatch("65535",   &v));    CHECK_EQ(v, 65535);
-    CHECK(!RE("(\\d+)").FullMatch("65536",  &v));
-  }
-  {
-    int v;
-    static const int max_value = 0x7fffffff;
-    static const int min_value = -max_value - 1;
-    CHECK(RE("(-?\\d+)").FullMatch("100",         &v)); CHECK_EQ(v, 100);
-    CHECK(RE("(-?\\d+)").FullMatch("-100",        &v)); CHECK_EQ(v, -100);
-    CHECK(RE("(-?\\d+)").FullMatch("2147483647",  &v)); CHECK_EQ(v, max_value);
-    CHECK(RE("(-?\\d+)").FullMatch("-2147483648", &v)); CHECK_EQ(v, min_value);
-    CHECK(!RE("(-?\\d+)").FullMatch("-2147483649", &v));
-    CHECK(!RE("(-?\\d+)").FullMatch("2147483648",  &v));
-  }
-  {
-    unsigned int v;
-    static const unsigned int max_value = 0xfffffffful;
-    CHECK(RE("(\\d+)").FullMatch("100",         &v)); CHECK_EQ(v, 100);
-    CHECK(RE("(\\d+)").FullMatch("4294967295",  &v)); CHECK_EQ(v, max_value);
-    CHECK(!RE("(\\d+)").FullMatch("4294967296", &v));
-  }
-#ifdef HAVE_LONG_LONG
-# if defined(__MINGW__) || defined(__MINGW32__)
-#   define LLD "%I64d"
-#   define LLU "%I64u"
-# else
-#   define LLD "%lld"
-#   define LLU "%llu"
-# endif
-  {
-    long long v;
-    static const long long max_value = 0x7fffffffffffffffLL;
-    static const long long min_value = -max_value - 1;
-    char buf[32];  // definitely big enough for a long long
-
-    CHECK(RE("(-?\\d+)").FullMatch("100", &v)); CHECK_EQ(v, 100);
-    CHECK(RE("(-?\\d+)").FullMatch("-100",&v)); CHECK_EQ(v, -100);
-
-    sprintf(buf, LLD, max_value);
-    CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, max_value);
-
-    sprintf(buf, LLD, min_value);
-    CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, min_value);
-
-    sprintf(buf, LLD, max_value);
-    assert(buf[strlen(buf)-1] != '9');
-    buf[strlen(buf)-1]++;
-    CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));
-
-    sprintf(buf, LLD, min_value);
-    assert(buf[strlen(buf)-1] != '9');
-    buf[strlen(buf)-1]++;
-    CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));
-  }
-#endif
-#if defined HAVE_UNSIGNED_LONG_LONG && defined HAVE_LONG_LONG
-  {
-    unsigned long long v;
-    long long v2;
-    static const unsigned long long max_value = 0xffffffffffffffffULL;
-    char buf[32];  // definitely big enough for a unsigned long long
-
-    CHECK(RE("(-?\\d+)").FullMatch("100",&v)); CHECK_EQ(v, 100);
-    CHECK(RE("(-?\\d+)").FullMatch("-100",&v2)); CHECK_EQ(v2, -100);
-
-    sprintf(buf, LLU, max_value);
-    CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, max_value);
-
-    assert(buf[strlen(buf)-1] != '9');
-    buf[strlen(buf)-1]++;
-    CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));
-  }
-#endif
-  {
-    float v;
-    CHECK(RE("(.*)").FullMatch("100", &v));
-    CHECK(RE("(.*)").FullMatch("-100.", &v));
-    CHECK(RE("(.*)").FullMatch("1e23", &v));
-  }
-  {
-    double v;
-    CHECK(RE("(.*)").FullMatch("100", &v));
-    CHECK(RE("(.*)").FullMatch("-100.", &v));
-    CHECK(RE("(.*)").FullMatch("1e23", &v));
-  }
-
-  // Check that matching is fully anchored
-  CHECK(!RE("(\\d+)").FullMatch("x1001",  &i));
-  CHECK(!RE("(\\d+)").FullMatch("1001x",  &i));
-  CHECK(RE("x(\\d+)").FullMatch("x1001", &i)); CHECK_EQ(i, 1001);
-  CHECK(RE("(\\d+)x").FullMatch("1001x", &i)); CHECK_EQ(i, 1001);
-
-  // Braces
-  CHECK(RE("[0-9a-f+.-]{5,}").FullMatch("0abcd"));
-  CHECK(RE("[0-9a-f+.-]{5,}").FullMatch("0abcde"));
-  CHECK(!RE("[0-9a-f+.-]{5,}").FullMatch("0abc"));
-
-  // Complicated RE
-  CHECK(RE("foo|bar|[A-Z]").FullMatch("foo"));
-  CHECK(RE("foo|bar|[A-Z]").FullMatch("bar"));
-  CHECK(RE("foo|bar|[A-Z]").FullMatch("X"));
-  CHECK(!RE("foo|bar|[A-Z]").FullMatch("XY"));
-
-  // Check full-match handling (needs '$' tacked on internally)
-  CHECK(RE("fo|foo").FullMatch("fo"));
-  CHECK(RE("fo|foo").FullMatch("foo"));
-  CHECK(RE("fo|foo$").FullMatch("fo"));
-  CHECK(RE("fo|foo$").FullMatch("foo"));
-  CHECK(RE("foo$").FullMatch("foo"));
-  CHECK(!RE("foo\\$").FullMatch("foo$bar"));
-  CHECK(!RE("fo|bar").FullMatch("fox"));
-
-  // Uncomment the following if we change the handling of '$' to
-  // prevent it from matching a trailing newline
-  if (false) {
-    // Check that we don't get bitten by pcre's special handling of a
-    // '\n' at the end of the string matching '$'
-    CHECK(!RE("foo$").PartialMatch("foo\n"));
-  }
-
-  // Number of args
-  int a[16];
-  CHECK(RE("").FullMatch(""));
-
-  memset(a, 0, sizeof(0));
-  CHECK(RE("(\\d){1}").FullMatch("1",
-                                 &a[0]));
-  CHECK_EQ(a[0], 1);
-
-  memset(a, 0, sizeof(0));
-  CHECK(RE("(\\d)(\\d)").FullMatch("12",
-                                   &a[0],  &a[1]));
-  CHECK_EQ(a[0], 1);
-  CHECK_EQ(a[1], 2);
-
-  memset(a, 0, sizeof(0));
-  CHECK(RE("(\\d)(\\d)(\\d)").FullMatch("123",
-                                        &a[0],  &a[1],  &a[2]));
-  CHECK_EQ(a[0], 1);
-  CHECK_EQ(a[1], 2);
-  CHECK_EQ(a[2], 3);
-
-  memset(a, 0, sizeof(0));
-  CHECK(RE("(\\d)(\\d)(\\d)(\\d)").FullMatch("1234",
-                                             &a[0],  &a[1],  &a[2],  &a[3]));
-  CHECK_EQ(a[0], 1);
-  CHECK_EQ(a[1], 2);
-  CHECK_EQ(a[2], 3);
-  CHECK_EQ(a[3], 4);
-
-  memset(a, 0, sizeof(0));
-  CHECK(RE("(\\d)(\\d)(\\d)(\\d)(\\d)").FullMatch("12345",
-                                                  &a[0],  &a[1],  &a[2],
-                                                  &a[3],  &a[4]));
-  CHECK_EQ(a[0], 1);
-  CHECK_EQ(a[1], 2);
-  CHECK_EQ(a[2], 3);
-  CHECK_EQ(a[3], 4);
-  CHECK_EQ(a[4], 5);
-
-  memset(a, 0, sizeof(0));
-  CHECK(RE("(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)").FullMatch("123456",
-                                                       &a[0],  &a[1],  &a[2],
-                                                       &a[3],  &a[4],  &a[5]));
-  CHECK_EQ(a[0], 1);
-  CHECK_EQ(a[1], 2);
-  CHECK_EQ(a[2], 3);
-  CHECK_EQ(a[3], 4);
-  CHECK_EQ(a[4], 5);
-  CHECK_EQ(a[5], 6);
-
-  memset(a, 0, sizeof(0));
-  CHECK(RE("(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)").FullMatch("1234567",
-                                                            &a[0],  &a[1],  &a[2],  &a[3],
-                                                            &a[4],  &a[5],  &a[6]));
-  CHECK_EQ(a[0], 1);
-  CHECK_EQ(a[1], 2);
-  CHECK_EQ(a[2], 3);
-  CHECK_EQ(a[3], 4);
-  CHECK_EQ(a[4], 5);
-  CHECK_EQ(a[5], 6);
-  CHECK_EQ(a[6], 7);
-
-  memset(a, 0, sizeof(0));
-  CHECK(RE("(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)"
-           "(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)").FullMatch(
-               "1234567890123456",
-               &a[0],  &a[1],  &a[2],  &a[3],
-               &a[4],  &a[5],  &a[6],  &a[7],
-               &a[8],  &a[9],  &a[10], &a[11],
-               &a[12], &a[13], &a[14], &a[15]));
-  CHECK_EQ(a[0], 1);
-  CHECK_EQ(a[1], 2);
-  CHECK_EQ(a[2], 3);
-  CHECK_EQ(a[3], 4);
-  CHECK_EQ(a[4], 5);
-  CHECK_EQ(a[5], 6);
-  CHECK_EQ(a[6], 7);
-  CHECK_EQ(a[7], 8);
-  CHECK_EQ(a[8], 9);
-  CHECK_EQ(a[9], 0);
-  CHECK_EQ(a[10], 1);
-  CHECK_EQ(a[11], 2);
-  CHECK_EQ(a[12], 3);
-  CHECK_EQ(a[13], 4);
-  CHECK_EQ(a[14], 5);
-  CHECK_EQ(a[15], 6);
-
-  /***** PartialMatch *****/
-
-  printf("Testing PartialMatch\n");
-
-  CHECK(RE("h.*o").PartialMatch("hello"));
-  CHECK(RE("h.*o").PartialMatch("othello"));
-  CHECK(RE("h.*o").PartialMatch("hello!"));
-  CHECK(RE("((((((((((((((((((((x))))))))))))))))))))").PartialMatch("x"));
-
-  /***** other tests *****/
-
-  RadixTests();
-  TestReplace();
-  TestExtract();
-  TestConsume();
-  TestFindAndConsume();
-  TestQuoteMetaAll();
-  TestMatchNumberPeculiarity();
-
-  // Check the pattern() accessor
-  {
-    const string kPattern = "http://([^/]+)/.*";
-    const RE re(kPattern);
-    CHECK_EQ(kPattern, re.pattern());
-  }
-
-  // Check RE error field.
-  {
-    RE re("foo");
-    CHECK(re.error().empty());  // Must have no error
-  }
-
-#ifdef SUPPORT_UTF8
-  // Check UTF-8 handling
-  {
-    printf("Testing UTF-8 handling\n");
-
-    // Three Japanese characters (nihongo)
-    const unsigned char utf8_string[] = {
-         0xe6, 0x97, 0xa5, // 65e5
-         0xe6, 0x9c, 0xac, // 627c
-         0xe8, 0xaa, 0x9e, // 8a9e
-         0
-    };
-    const unsigned char utf8_pattern[] = {
-         '.',
-         0xe6, 0x9c, 0xac, // 627c
-         '.',
-         0
-    };
-
-    // Both should match in either mode, bytes or UTF-8
-    RE re_test1(".........");
-    CHECK(re_test1.FullMatch(utf8_string));
-    RE re_test2("...", pcrecpp::UTF8());
-    CHECK(re_test2.FullMatch(utf8_string));
-
-    // Check that '.' matches one byte or UTF-8 character
-    // according to the mode.
-    string ss;
-    RE re_test3("(.)");
-    CHECK(re_test3.PartialMatch(utf8_string, &ss));
-    CHECK_EQ(ss, string("\xe6"));
-    RE re_test4("(.)", pcrecpp::UTF8());
-    CHECK(re_test4.PartialMatch(utf8_string, &ss));
-    CHECK_EQ(ss, string("\xe6\x97\xa5"));
-
-    // Check that string matches itself in either mode
-    RE re_test5(utf8_string);
-    CHECK(re_test5.FullMatch(utf8_string));
-    RE re_test6(utf8_string, pcrecpp::UTF8());
-    CHECK(re_test6.FullMatch(utf8_string));
-
-    // Check that pattern matches string only in UTF8 mode
-    RE re_test7(utf8_pattern);
-    CHECK(!re_test7.FullMatch(utf8_string));
-    RE re_test8(utf8_pattern, pcrecpp::UTF8());
-    CHECK(re_test8.FullMatch(utf8_string));
-  }
-
-  // Check that ungreedy, UTF8 regular expressions don't match when they
-  // oughtn't -- see bug 82246.
-  {
-    // This code always worked.
-    const char* pattern = "\\w+X";
-    const string target = "a aX";
-    RE match_sentence(pattern);
-    RE match_sentence_re(pattern, pcrecpp::UTF8());
-
-    CHECK(!match_sentence.FullMatch(target));
-    CHECK(!match_sentence_re.FullMatch(target));
-  }
-
-  {
-    const char* pattern = "(?U)\\w+X";
-    const string target = "a aX";
-    RE match_sentence(pattern);
-    RE match_sentence_re(pattern, pcrecpp::UTF8());
-
-    CHECK(!match_sentence.FullMatch(target));
-    CHECK(!match_sentence_re.FullMatch(target));
-  }
-#endif  /* def SUPPORT_UTF8 */
-
-  printf("Testing error reporting\n");
-
-  { RE re("a\\1"); CHECK(!re.error().empty()); }
-  {
-    RE re("a[x");
-    CHECK(!re.error().empty());
-  }
-  {
-    RE re("a[z-a]");
-    CHECK(!re.error().empty());
-  }
-  {
-    RE re("a[[:foobar:]]");
-    CHECK(!re.error().empty());
-  }
-  {
-    RE re("a(b");
-    CHECK(!re.error().empty());
-  }
-  {
-    RE re("a\\");
-    CHECK(!re.error().empty());
-  }
-
-  // Test that recursion is stopped
-  TestRecursion();
-
-  // Test Options
-  if (getenv("VERBOSE_TEST") != NULL)
-    VERBOSE_TEST  = true;
-  TestOptions();
-
-  // Test the constructors
-  TestConstructors();
-
-  // Done
-  printf("OK\n");
-
-  return 0;
-}