OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1365 private: | 1365 private: |
1366 V8EXPORT static void CheckCast(v8::Value* obj); | 1366 V8EXPORT static void CheckCast(v8::Value* obj); |
1367 }; | 1367 }; |
1368 | 1368 |
1369 | 1369 |
1370 /** | 1370 /** |
1371 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). | 1371 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). |
1372 */ | 1372 */ |
1373 class RegExp : public Value { | 1373 class RegExp : public Value { |
1374 public: | 1374 public: |
| 1375 /** |
| 1376 * Regular expression flag bits. They can be or'ed to enable a set |
| 1377 * of flags. |
| 1378 */ |
1375 enum Flags { | 1379 enum Flags { |
1376 kNone = 0, | 1380 kNone = 0, |
1377 kGlobal = 1, | 1381 kGlobal = 1, |
1378 kIgnoreCase = 2, | 1382 kIgnoreCase = 2, |
1379 kMultiline = 4 | 1383 kMultiline = 4 |
1380 }; | 1384 }; |
1381 | 1385 |
| 1386 /** |
| 1387 * Creates a regular expression from the given pattern string and |
| 1388 * the flags bit field. May throw a JavaScript exception as |
| 1389 * described in ECMA-252, 15.10.4.1. |
| 1390 * |
| 1391 * For example, |
| 1392 * RegExp::New(v8::String::New("foo"), |
| 1393 * static_cast<RegExp::Flags>(kGlobal | kMultiline)) |
| 1394 * is equivalent to evaluating "/foo/gm". |
| 1395 */ |
1382 V8EXPORT static Local<RegExp> New(Handle<String> pattern, | 1396 V8EXPORT static Local<RegExp> New(Handle<String> pattern, |
1383 Flags flags); | 1397 Flags flags); |
1384 | 1398 |
1385 /** | 1399 /** |
1386 * Returns the value of the source property: a string representing | 1400 * Returns the value of the source property: a string representing |
1387 * the regular expression. | 1401 * the regular expression. |
1388 */ | 1402 */ |
1389 V8EXPORT Local<String> GetSource() const; | 1403 V8EXPORT Local<String> GetSource() const; |
1390 | 1404 |
| 1405 /** |
| 1406 * Returns the flags bit field. |
| 1407 */ |
1391 V8EXPORT Flags GetFlags() const; | 1408 V8EXPORT Flags GetFlags() const; |
1392 | 1409 |
1393 static inline RegExp* Cast(v8::Value* obj); | 1410 static inline RegExp* Cast(v8::Value* obj); |
1394 | 1411 |
1395 private: | 1412 private: |
1396 V8EXPORT static void CheckCast(v8::Value* obj); | 1413 V8EXPORT static void CheckCast(v8::Value* obj); |
1397 }; | 1414 }; |
1398 | 1415 |
1399 | 1416 |
1400 enum PropertyAttribute { | 1417 enum PropertyAttribute { |
(...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3723 | 3740 |
3724 | 3741 |
3725 } // namespace v8 | 3742 } // namespace v8 |
3726 | 3743 |
3727 | 3744 |
3728 #undef V8EXPORT | 3745 #undef V8EXPORT |
3729 #undef TYPE_CHECK | 3746 #undef TYPE_CHECK |
3730 | 3747 |
3731 | 3748 |
3732 #endif // V8_H_ | 3749 #endif // V8_H_ |
OLD | NEW |