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

Side by Side Diff: src/objects.h

Issue 2791183002: [regexp] Throw on invalid capture group names in replacer string (Closed)
Patch Set: Typo 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 | src/objects.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project 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 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 9249 matching lines...) Expand 10 before | Expand all | Expand 10 after
9260 Handle<Object> search, Handle<Object> position); 9260 Handle<Object> search, Handle<Object> position);
9261 9261
9262 // Encapsulates logic related to a match and its capture groups as required 9262 // Encapsulates logic related to a match and its capture groups as required
9263 // by GetSubstitution. 9263 // by GetSubstitution.
9264 class Match { 9264 class Match {
9265 public: 9265 public:
9266 virtual Handle<String> GetMatch() = 0; 9266 virtual Handle<String> GetMatch() = 0;
9267 virtual Handle<String> GetPrefix() = 0; 9267 virtual Handle<String> GetPrefix() = 0;
9268 virtual Handle<String> GetSuffix() = 0; 9268 virtual Handle<String> GetSuffix() = 0;
9269 9269
9270 // A named capture can be invalid (if it is not specified in the pattern),
9271 // unmatched (specified but not matched in the current string), and matched.
9272 enum CaptureState { INVALID, UNMATCHED, MATCHED };
9273
9270 virtual int CaptureCount() = 0; 9274 virtual int CaptureCount() = 0;
9271 virtual bool HasNamedCaptures() = 0; 9275 virtual bool HasNamedCaptures() = 0;
9272 virtual MaybeHandle<String> GetCapture(int i, bool* capture_exists) = 0; 9276 virtual MaybeHandle<String> GetCapture(int i, bool* capture_exists) = 0;
9273 virtual MaybeHandle<String> GetNamedCapture(Handle<String> name, 9277 virtual MaybeHandle<String> GetNamedCapture(Handle<String> name,
9274 bool* capture_exists) = 0; 9278 CaptureState* state) = 0;
9275 9279
9276 virtual ~Match() {} 9280 virtual ~Match() {}
9277 }; 9281 };
9278 9282
9279 // ES#sec-getsubstitution 9283 // ES#sec-getsubstitution
9280 // GetSubstitution(matched, str, position, captures, replacement) 9284 // GetSubstitution(matched, str, position, captures, replacement)
9281 // Expand the $-expressions in the string and return a new string with 9285 // Expand the $-expressions in the string and return a new string with
9282 // the result. 9286 // the result.
9283 MUST_USE_RESULT static MaybeHandle<String> GetSubstitution( 9287 MUST_USE_RESULT static MaybeHandle<String> GetSubstitution(
9284 Isolate* isolate, Match* match, Handle<String> replacement); 9288 Isolate* isolate, Match* match, Handle<String> replacement);
(...skipping 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after
11399 } 11403 }
11400 }; 11404 };
11401 11405
11402 11406
11403 } // NOLINT, false-positive due to second-order macros. 11407 } // NOLINT, false-positive due to second-order macros.
11404 } // NOLINT, false-positive due to second-order macros. 11408 } // NOLINT, false-positive due to second-order macros.
11405 11409
11406 #include "src/objects/object-macros-undef.h" 11410 #include "src/objects/object-macros-undef.h"
11407 11411
11408 #endif // V8_OBJECTS_H_ 11412 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698