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

Unified Diff: tools/gn/escape.h

Issue 311733002: Redo escaping in GN (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 6 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
Index: tools/gn/escape.h
diff --git a/tools/gn/escape.h b/tools/gn/escape.h
index 1e4fa6897719cd8148e2fc84fdd773bd2898f259..6f8cf9cc3b10976186c8c6864c5e56efd193550a 100644
--- a/tools/gn/escape.h
+++ b/tools/gn/escape.h
@@ -14,35 +14,42 @@ enum EscapingMode {
ESCAPE_NONE,
// Ninja string escaping.
- ESCAPE_NINJA = 1,
+ ESCAPE_NINJA,
- // Shell string escaping.
- ESCAPE_SHELL = 2,
+ // For writing commands to ninja files.
+ ESCAPE_NINJA_COMMAND,
+};
- // For writing shell commands to ninja files.
- ESCAPE_NINJA_SHELL = ESCAPE_NINJA | ESCAPE_SHELL,
+enum EscapingPlatform {
+ // Do escaping for the current platform.
+ ESCAPE_PLATFORM_CURRENT,
- ESCAPE_JSON = 4,
+ // Force escaping for the given platform.
+ ESCAPE_PLATFORM_POSIX,
+ ESCAPE_PLATFORM_WIN,
};
struct EscapeOptions {
EscapeOptions()
: mode(ESCAPE_NONE),
- convert_slashes(false),
+ platform(ESCAPE_PLATFORM_CURRENT),
inhibit_quoting(false) {
}
EscapingMode mode;
- // When set, converts forward-slashes to system-specific path separators.
- bool convert_slashes;
+ // Controls how "fork" escaping is done. You will generally want to keep the
+ // default "current" platform.
+ EscapingPlatform platform;
// When the escaping mode is ESCAPE_SHELL, the escaper will normally put
// quotes around things with spaces. If this value is set to true, we'll
// disable the quoting feature and just add the spaces.
//
// This mode is for when quoting is done at some higher-level. Defaults to
- // false.
+ // false. Note that Windows has strange behavior where the meaning of the
+ // backslashes changes according to if it is followed by a quote. The
+ // escaping rules assume that a double-quote will be appended to the result.
bool inhibit_quoting;
};
« no previous file with comments | « third_party/mesa/BUILD.gn ('k') | tools/gn/escape.cc » ('j') | tools/gn/escape_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698