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

Unified Diff: regexp2000/src/ast.cc

Issue 11407: * Changed meaning of "%k" format to always output fixed-width ASCII-only representations. (Closed)
Patch Set: Created 12 years, 1 month 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 | « no previous file | regexp2000/src/string-stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: regexp2000/src/ast.cc
diff --git a/regexp2000/src/ast.cc b/regexp2000/src/ast.cc
index aa4509b016deecdbe2d991dc2f633fc938709d8c..18698984dfe9db89da77428ed8b5fef61931fd6d 100644
--- a/regexp2000/src/ast.cc
+++ b/regexp2000/src/ast.cc
@@ -254,21 +254,11 @@ void* RegExpUnparser::VisitAlternative(RegExpAlternative* that, void* data) {
return NULL;
}
-static void AddChar(StringStream* stream, uc16 character) {
- if (character < 32 || (character >= 128 && character < 256)) {
- stream->Add("\\x%02x", character);
- } else if (character >= 256) {
- stream->Add("\\u%04x", character);
- } else {
- stream->Add("%c", character);
- }
-}
void RegExpUnparser::VisitCharacterRange(CharacterRange that) {
- AddChar(stream(), that.from());
+ stream()->Add("%k", that.from());
if (!that.IsSingleton()) {
- stream()->Add("-");
- AddChar(stream(), that.to());
+ stream()->Add("-%k", that.to());
}
}
@@ -317,7 +307,7 @@ void* RegExpUnparser::VisitAtom(RegExpAtom* that, void* data) {
stream()->Add("'");
Vector<const uc16> chardata = that->data();
for (int i = 0; i < chardata.length(); i++) {
- AddChar(stream(), chardata[i]);
+ stream()->Add("%k", chardata[i]);
}
stream()->Add("'");
return NULL;
« no previous file with comments | « no previous file | regexp2000/src/string-stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698