| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 CHECK_PARSE_EQ("[\\11]", "[\\x09]"); | 207 CHECK_PARSE_EQ("[\\11]", "[\\x09]"); |
| 208 CHECK_PARSE_EQ("[\\11a]", "[\\x09 a]"); | 208 CHECK_PARSE_EQ("[\\11a]", "[\\x09 a]"); |
| 209 CHECK_PARSE_EQ("[\\011]", "[\\x09]"); | 209 CHECK_PARSE_EQ("[\\011]", "[\\x09]"); |
| 210 CHECK_PARSE_EQ("[\\00011]", "[\\x00 1 1]"); | 210 CHECK_PARSE_EQ("[\\00011]", "[\\x00 1 1]"); |
| 211 CHECK_PARSE_EQ("[\\118]", "[\\x09 8]"); | 211 CHECK_PARSE_EQ("[\\118]", "[\\x09 8]"); |
| 212 CHECK_PARSE_EQ("[\\111]", "[I]"); | 212 CHECK_PARSE_EQ("[\\111]", "[I]"); |
| 213 CHECK_PARSE_EQ("[\\1111]", "[I 1]"); | 213 CHECK_PARSE_EQ("[\\1111]", "[I 1]"); |
| 214 CHECK_PARSE_EQ("\\x34", "'\x34'"); | 214 CHECK_PARSE_EQ("\\x34", "'\x34'"); |
| 215 CHECK_PARSE_EQ("\\x60", "'\x60'"); | 215 CHECK_PARSE_EQ("\\x60", "'\x60'"); |
| 216 CHECK_PARSE_EQ("\\x3z", "'x3z'"); | 216 CHECK_PARSE_EQ("\\x3z", "'x3z'"); |
| 217 CHECK_PARSE_EQ("\\c", "'c'"); |
| 217 CHECK_PARSE_EQ("\\u0034", "'\x34'"); | 218 CHECK_PARSE_EQ("\\u0034", "'\x34'"); |
| 218 CHECK_PARSE_EQ("\\u003z", "'u003z'"); | 219 CHECK_PARSE_EQ("\\u003z", "'u003z'"); |
| 219 CHECK_PARSE_EQ("foo[z]*", "(: 'foo' (# 0 - g [z]))"); | 220 CHECK_PARSE_EQ("foo[z]*", "(: 'foo' (# 0 - g [z]))"); |
| 220 | 221 |
| 221 CHECK_SIMPLE("a", true); | 222 CHECK_SIMPLE("a", true); |
| 222 CHECK_SIMPLE("a|b", false); | 223 CHECK_SIMPLE("a|b", false); |
| 223 CHECK_SIMPLE("a\\n", false); | 224 CHECK_SIMPLE("a\\n", false); |
| 224 CHECK_SIMPLE("^a", false); | 225 CHECK_SIMPLE("^a", false); |
| 225 CHECK_SIMPLE("a$", false); | 226 CHECK_SIMPLE("a$", false); |
| 226 CHECK_SIMPLE("a\\b!", false); | 227 CHECK_SIMPLE("a\\b!", false); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 V8::Initialize(NULL); | 357 V8::Initialize(NULL); |
| 357 const char* kEndBackslash = "\\ at end of pattern"; | 358 const char* kEndBackslash = "\\ at end of pattern"; |
| 358 ExpectError("\\", kEndBackslash); | 359 ExpectError("\\", kEndBackslash); |
| 359 const char* kUnterminatedGroup = "Unterminated group"; | 360 const char* kUnterminatedGroup = "Unterminated group"; |
| 360 ExpectError("(foo", kUnterminatedGroup); | 361 ExpectError("(foo", kUnterminatedGroup); |
| 361 const char* kInvalidGroup = "Invalid group"; | 362 const char* kInvalidGroup = "Invalid group"; |
| 362 ExpectError("(?", kInvalidGroup); | 363 ExpectError("(?", kInvalidGroup); |
| 363 const char* kUnterminatedCharacterClass = "Unterminated character class"; | 364 const char* kUnterminatedCharacterClass = "Unterminated character class"; |
| 364 ExpectError("[", kUnterminatedCharacterClass); | 365 ExpectError("[", kUnterminatedCharacterClass); |
| 365 ExpectError("[a-", kUnterminatedCharacterClass); | 366 ExpectError("[a-", kUnterminatedCharacterClass); |
| 366 const char* kEndControl = "\\c at end of pattern"; | |
| 367 ExpectError("\\c", kEndControl); | |
| 368 const char* kNothingToRepeat = "Nothing to repeat"; | 367 const char* kNothingToRepeat = "Nothing to repeat"; |
| 369 ExpectError("*", kNothingToRepeat); | 368 ExpectError("*", kNothingToRepeat); |
| 370 ExpectError("?", kNothingToRepeat); | 369 ExpectError("?", kNothingToRepeat); |
| 371 ExpectError("+", kNothingToRepeat); | 370 ExpectError("+", kNothingToRepeat); |
| 372 ExpectError("{1}", kNothingToRepeat); | 371 ExpectError("{1}", kNothingToRepeat); |
| 373 ExpectError("{1,2}", kNothingToRepeat); | 372 ExpectError("{1,2}", kNothingToRepeat); |
| 374 ExpectError("{1,}", kNothingToRepeat); | 373 ExpectError("{1,}", kNothingToRepeat); |
| 375 | 374 |
| 376 // Check that we don't allow more than kMaxCapture captures | 375 // Check that we don't allow more than kMaxCapture captures |
| 377 const int kMaxCaptures = 1 << 16; // Must match RegExpParser::kMaxCaptures. | 376 const int kMaxCaptures = 1 << 16; // Must match RegExpParser::kMaxCaptures. |
| (...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1555 CHECK(!InClass(i, excluded)); | 1554 CHECK(!InClass(i, excluded)); |
| 1556 } | 1555 } |
| 1557 } | 1556 } |
| 1558 } | 1557 } |
| 1559 | 1558 |
| 1560 | 1559 |
| 1561 TEST(Graph) { | 1560 TEST(Graph) { |
| 1562 V8::Initialize(NULL); | 1561 V8::Initialize(NULL); |
| 1563 Execute("(?:(?:x(.))?\1)+$", false, true, true); | 1562 Execute("(?:(?:x(.))?\1)+$", false, true, true); |
| 1564 } | 1563 } |
| OLD | NEW |