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

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

Issue 1546393002: Allow \n in GN string literals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix documentation line 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/gn/string_utils.cc » ('j') | tools/gn/string_utils.cc » ('J')
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/parser.h" 5 #include "tools/gn/parser.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "tools/gn/functions.h" 10 #include "tools/gn/functions.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 "\n" 55 "\n"
56 "String literals\n" 56 "String literals\n"
57 "\n" 57 "\n"
58 " A string literal represents a string value consisting of the quoted\n" 58 " A string literal represents a string value consisting of the quoted\n"
59 " characters with possible escape sequences and variable expansions.\n" 59 " characters with possible escape sequences and variable expansions.\n"
60 "\n" 60 "\n"
61 " string = `\"` { char | escape | expansion } `\"` .\n" 61 " string = `\"` { char | escape | expansion } `\"` .\n"
62 " escape = `\\` ( \"$\" | `\"` | char ) .\n" 62 " escape = `\\` ( \"$\" | `\"` | char ) .\n"
63 " BracketExpansion = \"{\" ( identifier | ArrayAccess | ScopeAccess " 63 " BracketExpansion = \"{\" ( identifier | ArrayAccess | ScopeAccess "
64 ") \"}\" .\n" 64 ") \"}\" .\n"
65 " expansion = \"$\" ( identifier | BracketExpansion ) .\n" 65 " Hex = \"0x\" [0-9A-Fa-f][0-9A-Fa-f]\n"
66 " expansion = \"$\" ( identifier | BracketExpansion | Hex ) .\n"
66 " char = /* any character except \"$\", `\"`, or newline " 67 " char = /* any character except \"$\", `\"`, or newline "
67 "*/ .\n" 68 "*/ .\n"
68 "\n" 69 "\n"
69 " After a backslash, certain sequences represent special characters:\n" 70 " After a backslash, certain sequences represent special characters:\n"
70 "\n" 71 "\n"
71 " \\\" U+0022 quotation mark\n" 72 " \\\" U+0022 quotation mark\n"
72 " \\$ U+0024 dollar sign\n" 73 " \\$ U+0024 dollar sign\n"
73 " \\\\ U+005C backslash\n" 74 " \\\\ U+005C backslash\n"
74 "\n" 75 "\n"
75 " All other backslashes represent themselves.\n" 76 " All other backslashes represent themselves.\n"
76 "\n" 77 "\n"
78 " To insert an arbitrary byte value, use $0xFF. For example, to\n"
79 " insert a newline character: \"Line one$0x0ALine two\".\n"
80 "\n"
77 "Punctuation\n" 81 "Punctuation\n"
78 "\n" 82 "\n"
79 " The following character sequences represent punctuation:\n" 83 " The following character sequences represent punctuation:\n"
80 "\n" 84 "\n"
81 " + += == != ( )\n" 85 " + += == != ( )\n"
82 " - -= < <= [ ]\n" 86 " - -= < <= [ ]\n"
83 " ! = > >= { }\n" 87 " ! = > >= { }\n"
84 " && || . ,\n" 88 " && || . ,\n"
85 "\n" 89 "\n"
86 "Grammar\n" 90 "Grammar\n"
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 break; 757 break;
754 } 758 }
755 } 759 }
756 760
757 // Suffix comments were assigned in reverse, so if there were multiple on 761 // Suffix comments were assigned in reverse, so if there were multiple on
758 // the same node, they need to be reversed. 762 // the same node, they need to be reversed.
759 if ((*i)->comments() && !(*i)->comments()->suffix().empty()) 763 if ((*i)->comments() && !(*i)->comments()->suffix().empty())
760 const_cast<ParseNode*>(*i)->comments_mutable()->ReverseSuffix(); 764 const_cast<ParseNode*>(*i)->comments_mutable()->ReverseSuffix();
761 } 765 }
762 } 766 }
OLDNEW
« no previous file with comments | « no previous file | tools/gn/string_utils.cc » ('j') | tools/gn/string_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698