OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 288 matching lines...) Loading... |
299 #else | 299 #else |
300 #define LAST(x) | 300 #define LAST(x) |
301 #endif | 301 #endif |
302 }; | 302 }; |
303 | 303 |
304 | 304 |
305 class RegExpParser { | 305 class RegExpParser { |
306 public: | 306 public: |
307 RegExpParser(FlatStringReader* in, | 307 RegExpParser(FlatStringReader* in, |
308 Handle<String>* error, | 308 Handle<String>* error, |
309 bool multiline_mode); | 309 bool multiline_mode, |
| 310 Zone* zone); |
310 | 311 |
311 static bool ParseRegExp(FlatStringReader* input, | 312 static bool ParseRegExp(FlatStringReader* input, |
312 bool multiline, | 313 bool multiline, |
313 RegExpCompileData* result); | 314 RegExpCompileData* result, |
| 315 Zone* zone); |
314 | 316 |
315 RegExpTree* ParsePattern(); | 317 RegExpTree* ParsePattern(); |
316 RegExpTree* ParseDisjunction(); | 318 RegExpTree* ParseDisjunction(); |
317 RegExpTree* ParseGroup(); | 319 RegExpTree* ParseGroup(); |
318 RegExpTree* ParseCharacterClass(); | 320 RegExpTree* ParseCharacterClass(); |
319 | 321 |
320 // Parses a {...,...} quantifier and stores the range in the given | 322 // Parses a {...,...} quantifier and stores the range in the given |
321 // out parameters. | 323 // out parameters. |
322 bool ParseIntervalQuantifier(int* min_out, int* max_out); | 324 bool ParseIntervalQuantifier(int* min_out, int* max_out); |
323 | 325 |
(...skipping 67 matching lines...) Loading... |
391 RegExpParserState* previous_state_; | 393 RegExpParserState* previous_state_; |
392 // Builder for the stored disjunction. | 394 // Builder for the stored disjunction. |
393 RegExpBuilder* builder_; | 395 RegExpBuilder* builder_; |
394 // Stored disjunction type (capture, look-ahead or grouping), if any. | 396 // Stored disjunction type (capture, look-ahead or grouping), if any. |
395 SubexpressionType group_type_; | 397 SubexpressionType group_type_; |
396 // Stored disjunction's capture index (if any). | 398 // Stored disjunction's capture index (if any). |
397 int disjunction_capture_index_; | 399 int disjunction_capture_index_; |
398 }; | 400 }; |
399 | 401 |
400 Isolate* isolate() { return isolate_; } | 402 Isolate* isolate() { return isolate_; } |
401 Zone* zone() const { return isolate_->zone(); } | 403 Zone* zone() const { return zone_; } |
402 | 404 |
403 uc32 current() { return current_; } | 405 uc32 current() { return current_; } |
404 bool has_more() { return has_more_; } | 406 bool has_more() { return has_more_; } |
405 bool has_next() { return next_pos_ < in()->length(); } | 407 bool has_next() { return next_pos_ < in()->length(); } |
406 uc32 Next(); | 408 uc32 Next(); |
407 FlatStringReader* in() { return in_; } | 409 FlatStringReader* in() { return in_; } |
408 void ScanForCaptures(); | 410 void ScanForCaptures(); |
409 | 411 |
410 Isolate* isolate_; | 412 Isolate* isolate_; |
| 413 Zone* zone_; |
411 Handle<String>* error_; | 414 Handle<String>* error_; |
412 ZoneList<RegExpCapture*>* captures_; | 415 ZoneList<RegExpCapture*>* captures_; |
413 FlatStringReader* in_; | 416 FlatStringReader* in_; |
414 uc32 current_; | 417 uc32 current_; |
415 int next_pos_; | 418 int next_pos_; |
416 // The capture count is only valid after we have scanned for captures. | 419 // The capture count is only valid after we have scanned for captures. |
417 int capture_count_; | 420 int capture_count_; |
418 bool has_more_; | 421 bool has_more_; |
419 bool multiline_; | 422 bool multiline_; |
420 bool simple_; | 423 bool simple_; |
(...skipping 447 matching lines...) Loading... |
868 private: | 871 private: |
869 static const int kTypeSlot = 0; | 872 static const int kTypeSlot = 0; |
870 static const int kElementsSlot = 1; | 873 static const int kElementsSlot = 1; |
871 | 874 |
872 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 875 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
873 }; | 876 }; |
874 | 877 |
875 } } // namespace v8::internal | 878 } } // namespace v8::internal |
876 | 879 |
877 #endif // V8_PARSER_H_ | 880 #endif // V8_PARSER_H_ |
OLD | NEW |