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

Side by Side Diff: tools/gn/escape.cc

Issue 2809633002: Add curly brackets to list of characters that gn needs to escape (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/gn/escape_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/escape.h" 5 #include "tools/gn/escape.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/containers/stack_container.h" 9 #include "base/containers/stack_container.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 10 matching lines...) Expand all
21 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 21 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
22 // 0 1 2 3 4 5 6 7 8 9 : ; < = > ? 22 // 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
23 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 23 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0,
24 // @ A B C D E F G H I J K L M N O 24 // @ A B C D E F G H I J K L M N O
25 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 25 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
26 // P Q R S T U V W X Y Z [ \ ] ^ _ 26 // P Q R S T U V W X Y Z [ \ ] ^ _
27 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 27 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
28 // ` a b c d e f g h i j k l m n o 28 // ` a b c d e f g h i j k l m n o
29 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 29 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
30 // p q r s t u v w x y z { | } ~ 30 // p q r s t u v w x y z { | } ~
31 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0 }; 31 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
32 32
33 // Append one character to the given string, escaping it for Ninja. 33 // Append one character to the given string, escaping it for Ninja.
34 // 34 //
35 // Ninja's escaping rules are very simple. We always escape colons even 35 // Ninja's escaping rules are very simple. We always escape colons even
36 // though they're OK in many places, in case the resulting string is used on 36 // though they're OK in many places, in case the resulting string is used on
37 // the left-hand-side of a rule. 37 // the left-hand-side of a rule.
38 template<typename DestString> 38 template<typename DestString>
39 inline void NinjaEscapeChar(char ch, DestString* dest) { 39 inline void NinjaEscapeChar(char ch, DestString* dest) {
40 if (ch == '$' || ch == ' ' || ch == ':') 40 if (ch == '$' || ch == ' ' || ch == ':')
41 dest->push_back('$'); 41 dest->push_back('$');
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } 200 }
201 201
202 void EscapeStringToStream(std::ostream& out, 202 void EscapeStringToStream(std::ostream& out,
203 const base::StringPiece& str, 203 const base::StringPiece& str,
204 const EscapeOptions& options) { 204 const EscapeOptions& options) {
205 base::StackString<256> escaped; 205 base::StackString<256> escaped;
206 EscapeStringToString(str, options, &escaped.container(), nullptr); 206 EscapeStringToString(str, options, &escaped.container(), nullptr);
207 if (!escaped->empty()) 207 if (!escaped->empty())
208 out.write(escaped->data(), escaped->size()); 208 out.write(escaped->data(), escaped->size());
209 } 209 }
OLDNEW
« no previous file with comments | « no previous file | tools/gn/escape_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698