| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 v8::HandleScope scope(CcTest::isolate()); | 103 v8::HandleScope scope(CcTest::isolate()); |
| 104 Zone zone; | 104 Zone zone; |
| 105 FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); | 105 FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); |
| 106 RegExpCompileData result; | 106 RegExpCompileData result; |
| 107 CHECK(v8::internal::RegExpParser::ParseRegExp( | 107 CHECK(v8::internal::RegExpParser::ParseRegExp( |
| 108 CcTest::i_isolate(), &zone, &reader, false, false, &result)); | 108 CcTest::i_isolate(), &zone, &reader, false, false, &result)); |
| 109 CHECK(result.tree != NULL); | 109 CHECK(result.tree != NULL); |
| 110 CHECK(result.error.is_null()); | 110 CHECK(result.error.is_null()); |
| 111 std::ostringstream os; | 111 std::ostringstream os; |
| 112 result.tree->Print(os, &zone); | 112 result.tree->Print(os, &zone); |
| 113 if (strcmp(expected, os.str().c_str()) != 0) { |
| 114 printf("%s | %s\n", expected, os.str().c_str()); |
| 115 } |
| 113 CHECK_EQ(0, strcmp(expected, os.str().c_str())); | 116 CHECK_EQ(0, strcmp(expected, os.str().c_str())); |
| 114 } | 117 } |
| 115 | 118 |
| 116 | 119 |
| 117 static bool CheckSimple(const char* input) { | 120 static bool CheckSimple(const char* input) { |
| 118 v8::HandleScope scope(CcTest::isolate()); | 121 v8::HandleScope scope(CcTest::isolate()); |
| 119 Zone zone; | 122 Zone zone; |
| 120 FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); | 123 FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); |
| 121 RegExpCompileData result; | 124 RegExpCompileData result; |
| 122 CHECK(v8::internal::RegExpParser::ParseRegExp( | 125 CHECK(v8::internal::RegExpParser::ParseRegExp( |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 " (# 0 - g '\\x04'))"); | 265 " (# 0 - g '\\x04'))"); |
| 263 CheckParseEq("(x)(x)(x)(x)(x)(x)(x)(x)(x)(x)\\10", | 266 CheckParseEq("(x)(x)(x)(x)(x)(x)(x)(x)(x)(x)\\10", |
| 264 "(: (^ 'x') (^ 'x') (^ 'x') (^ 'x') (^ 'x') (^ 'x')" | 267 "(: (^ 'x') (^ 'x') (^ 'x') (^ 'x') (^ 'x') (^ 'x')" |
| 265 " (^ 'x') (^ 'x') (^ 'x') (^ 'x') (<- 10))"); | 268 " (^ 'x') (^ 'x') (^ 'x') (^ 'x') (<- 10))"); |
| 266 CheckParseEq("(x)(x)(x)(x)(x)(x)(x)(x)(x)(x)\\11", | 269 CheckParseEq("(x)(x)(x)(x)(x)(x)(x)(x)(x)(x)\\11", |
| 267 "(: (^ 'x') (^ 'x') (^ 'x') (^ 'x') (^ 'x') (^ 'x')" | 270 "(: (^ 'x') (^ 'x') (^ 'x') (^ 'x') (^ 'x') (^ 'x')" |
| 268 " (^ 'x') (^ 'x') (^ 'x') (^ 'x') '\\x09')"); | 271 " (^ 'x') (^ 'x') (^ 'x') (^ 'x') '\\x09')"); |
| 269 CheckParseEq("(a)\\1", "(: (^ 'a') (<- 1))"); | 272 CheckParseEq("(a)\\1", "(: (^ 'a') (<- 1))"); |
| 270 CheckParseEq("(a\\1)", "(^ 'a')"); | 273 CheckParseEq("(a\\1)", "(^ 'a')"); |
| 271 CheckParseEq("(\\1a)", "(^ 'a')"); | 274 CheckParseEq("(\\1a)", "(^ 'a')"); |
| 275 CheckParseEq("(\\2)(\\1)", "(: (^ (<- 2)) (^ (<- 1)))"); |
| 272 CheckParseEq("(?=a)?a", "'a'"); | 276 CheckParseEq("(?=a)?a", "'a'"); |
| 273 CheckParseEq("(?=a){0,10}a", "'a'"); | 277 CheckParseEq("(?=a){0,10}a", "'a'"); |
| 274 CheckParseEq("(?=a){1,10}a", "(: (-> + 'a') 'a')"); | 278 CheckParseEq("(?=a){1,10}a", "(: (-> + 'a') 'a')"); |
| 275 CheckParseEq("(?=a){9,10}a", "(: (-> + 'a') 'a')"); | 279 CheckParseEq("(?=a){9,10}a", "(: (-> + 'a') 'a')"); |
| 276 CheckParseEq("(?!a)?a", "'a'"); | 280 CheckParseEq("(?!a)?a", "'a'"); |
| 277 CheckParseEq("\\1(a)", "(: (<- 1) (^ 'a'))"); | 281 CheckParseEq("\\1(a)", "(: (<- 1) (^ 'a'))"); |
| 278 CheckParseEq("(?!(a))\\1", "(: (-> - (^ 'a')) (<- 1))"); | 282 CheckParseEq("(?!(a))\\1", "(: (-> - (^ 'a')) (<- 1))"); |
| 279 CheckParseEq("(?!\\1(a\\1)\\1)\\1", | 283 CheckParseEq("(?!\\1(a\\1)\\1)\\1", |
| 280 "(: (-> - (: (<- 1) (^ 'a') (<- 1))) (<- 1))"); | 284 "(: (-> - (: (<- 1) (^ 'a') (<- 1))) (<- 1))"); |
| 281 CheckParseEq("\\1\\2(a(?:\\1(b\\1\\2))\\2)\\1", | 285 CheckParseEq("\\1\\2(a(?:\\1(b\\1\\2))\\2)\\1", |
| (...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1836 | 1840 |
| 1837 ZoneList<CharacterRange> first_only(4, &zone); | 1841 ZoneList<CharacterRange> first_only(4, &zone); |
| 1838 ZoneList<CharacterRange> second_only(4, &zone); | 1842 ZoneList<CharacterRange> second_only(4, &zone); |
| 1839 ZoneList<CharacterRange> both(4, &zone); | 1843 ZoneList<CharacterRange> both(4, &zone); |
| 1840 } | 1844 } |
| 1841 | 1845 |
| 1842 | 1846 |
| 1843 TEST(Graph) { | 1847 TEST(Graph) { |
| 1844 Execute("\\b\\w+\\b", false, true, true); | 1848 Execute("\\b\\w+\\b", false, true, true); |
| 1845 } | 1849 } |
| OLD | NEW |