| OLD | NEW |
| 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/pattern.h" | 5 #include "tools/gn/pattern.h" |
| 6 | 6 |
| 7 #include "tools/gn/value.h" | 7 #include "tools/gn/value.h" |
| 8 | 8 |
| 9 const char kPattern_Help[] = | 9 const char kPattern_Help[] = |
| 10 "Patterns\n" | 10 "Patterns\n" |
| 11 " Patterns are VERY limited regular expressions that are used in\n" | 11 " Patterns are VERY limited regular expressions that are used in\n" |
| 12 " several places.\n" | 12 " several places.\n" |
| 13 "\n" | 13 "\n" |
| 14 " Patterns must match the entire input string to be counted as a match.\n" | 14 " Patterns must match the entire input string to be counted as a match.\n" |
| 15 " In regular expression parlance, there is an implicit \"^...$\"\n" | 15 " In regular expression parlance, there is an implicit \"^...$\"\n" |
| 16 " surrounding your input. If you want to match a substring, you need to\n" | 16 " surrounding your input. If you want to match a substring, you need to\n" |
| 17 " use wildcards at the beginning and end.\n" | 17 " use wildcards at the beginning and end.\n" |
| 18 "\n" | 18 "\n" |
| 19 " There are only two special tokens understood by the pattern matcher.\n" | 19 " There are only two special tokens understood by the pattern matcher.\n" |
| 20 " Everything else is a literal.\n" | 20 " Everything else is a literal.\n" |
| 21 "\n" | 21 "\n" |
| 22 " * Matches zero or more of any character. It does not depend on the\n" | 22 " * Matches zero or more of any character. It does not depend on the\n" |
| 23 " preceeding character (in regular expression parlance it is\n" | 23 " preceding character (in regular expression parlance it is\n" |
| 24 " equivalent to \".*\").\n" | 24 " equivalent to \".*\").\n" |
| 25 "\n" | 25 "\n" |
| 26 " \\b Matches a path boundary. This will match the beginning or end of\n" | 26 " \\b Matches a path boundary. This will match the beginning or end of\n" |
| 27 " a string, or a slash.\n" | 27 " a string, or a slash.\n" |
| 28 "\n" | 28 "\n" |
| 29 "Examples\n" | 29 "Examples\n" |
| 30 "\n" | 30 "\n" |
| 31 " \"*asdf*\"\n" | 31 " \"*asdf*\"\n" |
| 32 " Matches a string containing \"asdf\" anywhere.\n" | 32 " Matches a string containing \"asdf\" anywhere.\n" |
| 33 "\n" | 33 "\n" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 return true; | 214 return true; |
| 215 } | 215 } |
| 216 return false; | 216 return false; |
| 217 } | 217 } |
| 218 | 218 |
| 219 bool PatternList::MatchesValue(const Value& v) const { | 219 bool PatternList::MatchesValue(const Value& v) const { |
| 220 if (v.type() == Value::STRING) | 220 if (v.type() == Value::STRING) |
| 221 return MatchesString(v.string_value()); | 221 return MatchesString(v.string_value()); |
| 222 return false; | 222 return false; |
| 223 } | 223 } |
| OLD | NEW |