| 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 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 private: | 1267 private: |
| 1268 Type type_; | 1268 Type type_; |
| 1269 }; | 1269 }; |
| 1270 | 1270 |
| 1271 | 1271 |
| 1272 class RegExpCharacterClass: public RegExpTree { | 1272 class RegExpCharacterClass: public RegExpTree { |
| 1273 public: | 1273 public: |
| 1274 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated) | 1274 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated) |
| 1275 : ranges_(ranges), | 1275 : ranges_(ranges), |
| 1276 is_negated_(is_negated) { } | 1276 is_negated_(is_negated) { } |
| 1277 RegExpCharacterClass(uc16 type) |
| 1278 : ranges_(new ZoneList<CharacterRange>(2)), |
| 1279 is_negated_(false) { |
| 1280 CharacterRange::AddClassEscape(type, ranges_); |
| 1281 } |
| 1277 virtual void* Accept(RegExpVisitor* visitor, void* data); | 1282 virtual void* Accept(RegExpVisitor* visitor, void* data); |
| 1278 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 1283 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 1279 RegExpNode* on_success, | 1284 RegExpNode* on_success, |
| 1280 RegExpNode* on_failure); | 1285 RegExpNode* on_failure); |
| 1281 virtual RegExpCharacterClass* AsCharacterClass(); | 1286 virtual RegExpCharacterClass* AsCharacterClass(); |
| 1282 ZoneList<CharacterRange>* ranges() { return ranges_; } | 1287 ZoneList<CharacterRange>* ranges() { return ranges_; } |
| 1283 bool is_negated() { return is_negated_; } | 1288 bool is_negated() { return is_negated_; } |
| 1284 private: | 1289 private: |
| 1285 ZoneList<CharacterRange>* ranges_; | 1290 ZoneList<CharacterRange>* ranges_; |
| 1286 bool is_negated_; | 1291 bool is_negated_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1305 public: | 1310 public: |
| 1306 RegExpQuantifier(int min, int max, bool is_greedy, RegExpTree* body) | 1311 RegExpQuantifier(int min, int max, bool is_greedy, RegExpTree* body) |
| 1307 : min_(min), | 1312 : min_(min), |
| 1308 max_(max), | 1313 max_(max), |
| 1309 is_greedy_(is_greedy), | 1314 is_greedy_(is_greedy), |
| 1310 body_(body) { } | 1315 body_(body) { } |
| 1311 virtual void* Accept(RegExpVisitor* visitor, void* data); | 1316 virtual void* Accept(RegExpVisitor* visitor, void* data); |
| 1312 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 1317 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 1313 RegExpNode* on_success, | 1318 RegExpNode* on_success, |
| 1314 RegExpNode* on_failure); | 1319 RegExpNode* on_failure); |
| 1320 static RegExpNode* ToNode(int min, |
| 1321 int max, |
| 1322 bool is_greedy, |
| 1323 RegExpTree* body, |
| 1324 RegExpCompiler* compiler, |
| 1325 RegExpNode* on_success, |
| 1326 RegExpNode* on_failure); |
| 1315 virtual RegExpQuantifier* AsQuantifier(); | 1327 virtual RegExpQuantifier* AsQuantifier(); |
| 1316 int min() { return min_; } | 1328 int min() { return min_; } |
| 1317 int max() { return max_; } | 1329 int max() { return max_; } |
| 1318 bool is_greedy() { return is_greedy_; } | 1330 bool is_greedy() { return is_greedy_; } |
| 1319 RegExpTree* body() { return body_; } | 1331 RegExpTree* body() { return body_; } |
| 1320 // We just use a very large integer value as infinity because 2^30 | 1332 // We just use a very large integer value as infinity because 2^30 |
| 1321 // is infinite in practice. | 1333 // is infinite in practice. |
| 1322 static const int kInfinity = (1 << 30); | 1334 static const int kInfinity = (1 << 30); |
| 1323 private: | 1335 private: |
| 1324 int min_; | 1336 int min_; |
| 1325 int max_; | 1337 int max_; |
| 1326 bool is_greedy_; | 1338 bool is_greedy_; |
| 1327 RegExpTree* body_; | 1339 RegExpTree* body_; |
| 1328 }; | 1340 }; |
| 1329 | 1341 |
| 1330 | 1342 |
| 1331 class RegExpCapture: public RegExpTree { | 1343 class RegExpCapture: public RegExpTree { |
| 1332 public: | 1344 public: |
| 1333 explicit RegExpCapture(RegExpTree* body, int index) | 1345 explicit RegExpCapture(RegExpTree* body, int index) |
| 1334 : body_(body), index_(index) { } | 1346 : body_(body), index_(index) { } |
| 1335 virtual void* Accept(RegExpVisitor* visitor, void* data); | 1347 virtual void* Accept(RegExpVisitor* visitor, void* data); |
| 1336 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 1348 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 1337 RegExpNode* on_success, | 1349 RegExpNode* on_success, |
| 1338 RegExpNode* on_failure); | 1350 RegExpNode* on_failure); |
| 1351 static RegExpNode* ToNode(RegExpTree* body, |
| 1352 int index, |
| 1353 RegExpCompiler* compiler, |
| 1354 RegExpNode* on_success, |
| 1355 RegExpNode* on_failure); |
| 1339 virtual RegExpCapture* AsCapture(); | 1356 virtual RegExpCapture* AsCapture(); |
| 1340 RegExpTree* body() { return body_; } | 1357 RegExpTree* body() { return body_; } |
| 1341 int index() { return index_; } | 1358 int index() { return index_; } |
| 1342 static int StartRegister(int index) { return (index - 1) * 2; } | 1359 static int StartRegister(int index) { return index * 2; } |
| 1343 static int EndRegister(int index) { return (index - 1) * 2 + 1; } | 1360 static int EndRegister(int index) { return index * 2 + 1; } |
| 1344 private: | 1361 private: |
| 1345 RegExpTree* body_; | 1362 RegExpTree* body_; |
| 1346 int index_; | 1363 int index_; |
| 1347 }; | 1364 }; |
| 1348 | 1365 |
| 1349 | 1366 |
| 1350 class RegExpLookahead: public RegExpTree { | 1367 class RegExpLookahead: public RegExpTree { |
| 1351 public: | 1368 public: |
| 1352 RegExpLookahead(RegExpTree* body, bool is_positive) | 1369 RegExpLookahead(RegExpTree* body, bool is_positive) |
| 1353 : body_(body), | 1370 : body_(body), |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 #undef DEF_VISIT | 1458 #undef DEF_VISIT |
| 1442 | 1459 |
| 1443 private: | 1460 private: |
| 1444 bool stack_overflow_; | 1461 bool stack_overflow_; |
| 1445 }; | 1462 }; |
| 1446 | 1463 |
| 1447 | 1464 |
| 1448 } } // namespace v8::internal | 1465 } } // namespace v8::internal |
| 1449 | 1466 |
| 1450 #endif // V8_AST_H_ | 1467 #endif // V8_AST_H_ |
| OLD | NEW |