| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 CHECK_ESCAPES("a(?!b)", false); | 206 CHECK_ESCAPES("a(?!b)", false); |
| 207 CHECK_ESCAPES("\\x60", true); | 207 CHECK_ESCAPES("\\x60", true); |
| 208 CHECK_ESCAPES("\\u0060", true); | 208 CHECK_ESCAPES("\\u0060", true); |
| 209 CHECK_ESCAPES("\\cA", true); | 209 CHECK_ESCAPES("\\cA", true); |
| 210 CHECK_ESCAPES("\\q", true); | 210 CHECK_ESCAPES("\\q", true); |
| 211 CHECK_ESCAPES("\\1112", true); | 211 CHECK_ESCAPES("\\1112", true); |
| 212 CHECK_ESCAPES("\\0", true); | 212 CHECK_ESCAPES("\\0", true); |
| 213 CHECK_ESCAPES("(a)\\1", false); | 213 CHECK_ESCAPES("(a)\\1", false); |
| 214 } | 214 } |
| 215 | 215 |
| 216 TEST(ParserRegression) { |
| 217 CHECK_PARSE_EQ("[A-Z$-][x]", "(: [A-Z $ -] [x])"); |
| 218 } |
| 216 | 219 |
| 217 static void ExpectError(const char* input, | 220 static void ExpectError(const char* input, |
| 218 const char* expected) { | 221 const char* expected) { |
| 219 v8::HandleScope scope; | 222 v8::HandleScope scope; |
| 220 unibrow::Utf8InputBuffer<> buffer(input, strlen(input)); | 223 unibrow::Utf8InputBuffer<> buffer(input, strlen(input)); |
| 221 ZoneScope zone_scope(DELETE_ON_EXIT); | 224 ZoneScope zone_scope(DELETE_ON_EXIT); |
| 222 RegExpParseResult result; | 225 RegExpParseResult result; |
| 223 CHECK_EQ(false, v8::internal::ParseRegExp(&buffer, &result)); | 226 CHECK_EQ(false, v8::internal::ParseRegExp(&buffer, &result)); |
| 224 CHECK(result.tree == NULL); | 227 CHECK(result.tree == NULL); |
| 225 CHECK(!result.error.is_null()); | 228 CHECK(!result.error.is_null()); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 Handle<String> f2 = Factory::NewStringFromAscii(CStrVector("foo bar baz")); | 514 Handle<String> f2 = Factory::NewStringFromAscii(CStrVector("foo bar baz")); |
| 512 CHECK(Re2kInterpreter::Match(*array, *f2, captures, 0)); | 515 CHECK(Re2kInterpreter::Match(*array, *f2, captures, 0)); |
| 513 CHECK_EQ(0, captures[0]); | 516 CHECK_EQ(0, captures[0]); |
| 514 CHECK_EQ(2, captures[1]); | 517 CHECK_EQ(2, captures[1]); |
| 515 | 518 |
| 516 Handle<String> f3 = Factory::NewStringFromAscii(CStrVector("tomfoolery")); | 519 Handle<String> f3 = Factory::NewStringFromAscii(CStrVector("tomfoolery")); |
| 517 CHECK(Re2kInterpreter::Match(*array, *f3, captures, 0)); | 520 CHECK(Re2kInterpreter::Match(*array, *f3, captures, 0)); |
| 518 CHECK_EQ(3, captures[0]); | 521 CHECK_EQ(3, captures[0]); |
| 519 CHECK_EQ(5, captures[1]); | 522 CHECK_EQ(5, captures[1]); |
| 520 } | 523 } |
| OLD | NEW |