Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(704)

Unified Diff: src/ostreams.cc

Issue 1578253005: [regexp] implement character classes for unicode regexps. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: lookaround builder Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ostreams.h ('k') | src/regexp/jsregexp.h » ('j') | src/regexp/jsregexp.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ostreams.cc
diff --git a/src/ostreams.cc b/src/ostreams.cc
index a7a67f5d2f06002fc9899b7c391476fd16022932..1652d4f6d57086884767a98101f7cbfdb7b5305d 100644
--- a/src/ostreams.cc
+++ b/src/ostreams.cc
@@ -60,6 +60,14 @@ std::ostream& PrintUC16(std::ostream& os, uint16_t c, bool (*pred)(uint16_t)) {
return os << buf;
}
+
+std::ostream& PrintUC32(std::ostream& os, int32_t c, bool (*pred)(uint16_t)) {
+ if (c <= 0xffff) return PrintUC16(os, static_cast<uint16_t>(c), pred);
erikcorry 2016/01/20 10:47:05 kMaxUtf16CodeUnit
Yang 2016/01/20 13:06:20 Done.
+ char buf[12];
erikcorry 2016/01/20 10:47:05 Perhaps 13 so that if c.value is somehow a maximal
Yang 2016/01/20 13:06:20 Done.
+ snprintf(buf, sizeof(buf), "\\u{%06x}", c);
+ return os << buf;
+}
+
} // namespace
@@ -81,5 +89,10 @@ std::ostream& operator<<(std::ostream& os, const AsUC16& c) {
return PrintUC16(os, c.value, IsPrint);
}
+
+std::ostream& operator<<(std::ostream& os, const AsUC32& c) {
+ return PrintUC32(os, c.value, IsPrint);
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/ostreams.h ('k') | src/regexp/jsregexp.h » ('j') | src/regexp/jsregexp.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698