Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 696 | 696 |
| 697 Handle<String> pattern() const { return pattern_; } | 697 Handle<String> pattern() const { return pattern_; } |
| 698 Handle<String> flags() const { return flags_; } | 698 Handle<String> flags() const { return flags_; } |
| 699 | 699 |
| 700 private: | 700 private: |
| 701 Handle<String> pattern_; | 701 Handle<String> pattern_; |
| 702 Handle<String> flags_; | 702 Handle<String> flags_; |
| 703 }; | 703 }; |
| 704 | 704 |
| 705 // An array literal has a literals object that is used | 705 // An array literal has a literals object that is used |
| 706 // used for minimizing the work when contructing it at runtime. | 706 // used for minimizing the work when constructing it at runtime. |
|
Mads Ager (chromium)
2009/01/02 10:45:16
used used -> used
| |
| 707 class ArrayLiteral: public Expression { | 707 class ArrayLiteral: public Expression { |
| 708 public: | 708 public: |
| 709 ArrayLiteral(Handle<FixedArray> literals, | 709 ArrayLiteral(Handle<FixedArray> literals, |
| 710 ZoneList<Expression*>* values) | 710 ZoneList<Expression*>* values) |
| 711 : literals_(literals), values_(values) { | 711 : literals_(literals), values_(values) { |
| 712 } | 712 } |
| 713 | 713 |
| 714 virtual void Accept(AstVisitor* v); | 714 virtual void Accept(AstVisitor* v); |
| 715 | 715 |
| 716 Handle<FixedArray> literals() const { return literals_; } | 716 Handle<FixedArray> literals() const { return literals_; } |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1287 virtual RegExpAssertion* AsAssertion(); | 1287 virtual RegExpAssertion* AsAssertion(); |
| 1288 virtual bool IsAssertion(); | 1288 virtual bool IsAssertion(); |
| 1289 virtual int min_match() { return 0; } | 1289 virtual int min_match() { return 0; } |
| 1290 virtual int max_match() { return 0; } | 1290 virtual int max_match() { return 0; } |
| 1291 Type type() { return type_; } | 1291 Type type() { return type_; } |
| 1292 private: | 1292 private: |
| 1293 Type type_; | 1293 Type type_; |
| 1294 }; | 1294 }; |
| 1295 | 1295 |
| 1296 | 1296 |
| 1297 class CharacterSet BASE_EMBEDDED { | |
| 1298 public: | |
| 1299 explicit CharacterSet(uc16 special_set_type) | |
| 1300 : ranges_(NULL), | |
| 1301 standard_set_type_(special_set_type) {} | |
| 1302 explicit CharacterSet(ZoneList<CharacterRange>* ranges) | |
| 1303 : ranges_(ranges), | |
| 1304 standard_set_type_(0) {} | |
| 1305 ZoneList<CharacterRange>* ranges(); | |
| 1306 uc16 standard_set_type() { return standard_set_type_; } | |
| 1307 void set_standard_set_type(uc16 special_set_type) { | |
| 1308 standard_set_type_ = special_set_type; | |
| 1309 } | |
| 1310 bool is_standard() { return standard_set_type_ != 0; } | |
| 1311 private: | |
| 1312 ZoneList<CharacterRange>* ranges_; | |
| 1313 uc16 standard_set_type_; | |
|
Mads Ager (chromium)
2009/01/02 10:45:16
Why not just type?
I find the standard_set_type/s
| |
| 1314 }; | |
| 1315 | |
| 1316 | |
| 1297 class RegExpCharacterClass: public RegExpTree { | 1317 class RegExpCharacterClass: public RegExpTree { |
| 1298 public: | 1318 public: |
| 1299 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated) | 1319 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated) |
| 1300 : ranges_(ranges), | 1320 : set_(ranges), |
| 1301 is_negated_(is_negated) { } | 1321 is_negated_(is_negated) { } |
| 1302 explicit RegExpCharacterClass(uc16 type) | 1322 explicit RegExpCharacterClass(uc16 type) |
| 1303 : ranges_(new ZoneList<CharacterRange>(2)), | 1323 : set_(type), |
| 1304 is_negated_(false) { | 1324 is_negated_(false) { } |
| 1305 CharacterRange::AddClassEscape(type, ranges_); | |
| 1306 } | |
| 1307 virtual void* Accept(RegExpVisitor* visitor, void* data); | 1325 virtual void* Accept(RegExpVisitor* visitor, void* data); |
| 1308 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 1326 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 1309 RegExpNode* on_success); | 1327 RegExpNode* on_success); |
| 1310 virtual RegExpCharacterClass* AsCharacterClass(); | 1328 virtual RegExpCharacterClass* AsCharacterClass(); |
| 1311 virtual bool IsCharacterClass(); | 1329 virtual bool IsCharacterClass(); |
| 1312 virtual bool IsTextElement() { return true; } | 1330 virtual bool IsTextElement() { return true; } |
| 1313 virtual int min_match() { return 1; } | 1331 virtual int min_match() { return 1; } |
| 1314 virtual int max_match() { return 1; } | 1332 virtual int max_match() { return 1; } |
| 1315 virtual void AppendToText(RegExpText* text); | 1333 virtual void AppendToText(RegExpText* text); |
| 1316 ZoneList<CharacterRange>* ranges() { return ranges_; } | 1334 CharacterSet character_set() { return set_; } |
| 1335 // TODO(lrn): Remove need for complex version if is_standard that | |
| 1336 // recognizes a mangled standard set and just do { return set_.is_special(); } | |
| 1337 bool is_standard(); | |
| 1338 // Returns a value representing the standard character set if is_standard() | |
| 1339 // returns true. | |
| 1340 // Currently used values are: | |
| 1341 // s : unicode whitespace | |
| 1342 // S : unicode non-whitespace | |
| 1343 // w : ASCII word character (digit, letter, underscore) | |
| 1344 // W : non-ASCII word character | |
| 1345 // d : ASCII digit | |
| 1346 // D : non-ASCII digit | |
| 1347 // . : non-unicode newline | |
| 1348 // * : All characters | |
| 1349 uc16 standard_type() { return set_.standard_set_type(); } | |
| 1350 ZoneList<CharacterRange>* ranges() { return set_.ranges(); } | |
| 1317 bool is_negated() { return is_negated_; } | 1351 bool is_negated() { return is_negated_; } |
| 1318 private: | 1352 private: |
| 1319 ZoneList<CharacterRange>* ranges_; | 1353 CharacterSet set_; |
| 1320 bool is_negated_; | 1354 bool is_negated_; |
| 1321 }; | 1355 }; |
| 1322 | 1356 |
| 1323 | 1357 |
| 1324 class RegExpAtom: public RegExpTree { | 1358 class RegExpAtom: public RegExpTree { |
| 1325 public: | 1359 public: |
| 1326 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { } | 1360 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { } |
| 1327 virtual void* Accept(RegExpVisitor* visitor, void* data); | 1361 virtual void* Accept(RegExpVisitor* visitor, void* data); |
| 1328 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 1362 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 1329 RegExpNode* on_success); | 1363 RegExpNode* on_success); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1542 #undef DEF_VISIT | 1576 #undef DEF_VISIT |
| 1543 | 1577 |
| 1544 private: | 1578 private: |
| 1545 bool stack_overflow_; | 1579 bool stack_overflow_; |
| 1546 }; | 1580 }; |
| 1547 | 1581 |
| 1548 | 1582 |
| 1549 } } // namespace v8::internal | 1583 } } // namespace v8::internal |
| 1550 | 1584 |
| 1551 #endif // V8_AST_H_ | 1585 #endif // V8_AST_H_ |
| OLD | NEW |