Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: test/cctest/test-parsing.cc

Issue 163333003: (Pre)Parser: Move ParsePrimaryExpression to ParserBase. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ws Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/preparser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 v8::HandleScope handles(CcTest::isolate()); 1384 v8::HandleScope handles(CcTest::isolate());
1385 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate()); 1385 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
1386 v8::Context::Scope context_scope(context); 1386 v8::Context::Scope context_scope(context);
1387 1387
1388 int marker; 1388 int marker;
1389 CcTest::i_isolate()->stack_guard()->SetStackLimit( 1389 CcTest::i_isolate()->stack_guard()->SetStackLimit(
1390 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); 1390 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
1391 1391
1392 static const ParserFlag flags[] = { 1392 static const ParserFlag flags[] = {
1393 kAllowLazy, kAllowHarmonyScoping, kAllowModules, kAllowGenerators, 1393 kAllowLazy, kAllowHarmonyScoping, kAllowModules, kAllowGenerators,
1394 kAllowForOf 1394 kAllowForOf, kAllowNativesSyntax
1395 }; 1395 };
1396 for (int i = 0; context_data[i][0] != NULL; ++i) { 1396 for (int i = 0; context_data[i][0] != NULL; ++i) {
1397 for (int j = 0; statement_data[j] != NULL; ++j) { 1397 for (int j = 0; statement_data[j] != NULL; ++j) {
1398 int kPrefixLen = i::StrLength(context_data[i][0]); 1398 int kPrefixLen = i::StrLength(context_data[i][0]);
1399 int kStatementLen = i::StrLength(statement_data[j]); 1399 int kStatementLen = i::StrLength(statement_data[j]);
1400 int kSuffixLen = i::StrLength(context_data[i][1]); 1400 int kSuffixLen = i::StrLength(context_data[i][1]);
1401 int kProgramSize = kPrefixLen + kStatementLen + kSuffixLen; 1401 int kProgramSize = kPrefixLen + kStatementLen + kSuffixLen;
1402 1402
1403 // Plug the source code pieces together. 1403 // Plug the source code pieces together.
1404 i::ScopedVector<char> program(kProgramSize + 1); 1404 i::ScopedVector<char> program(kProgramSize + 1);
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 2039
2040 const char* statement_data[] = { 2040 const char* statement_data[] = {
2041 "/foo/", 2041 "/foo/",
2042 "/foo/g", 2042 "/foo/g",
2043 "/foo/whatever", // This is an error but not detected by the parser. 2043 "/foo/whatever", // This is an error but not detected by the parser.
2044 NULL 2044 NULL
2045 }; 2045 };
2046 2046
2047 RunParserSyncTest(context_data, statement_data, kSuccess); 2047 RunParserSyncTest(context_data, statement_data, kSuccess);
2048 } 2048 }
2049
2050
2051 TEST(Intrinsics) {
2052 const char* context_data[][2] = {
2053 {"", ""},
2054 { NULL, NULL }
2055 };
2056
2057 const char* statement_data[] = {
2058 "%someintrinsic(arg)",
2059 NULL
2060 };
2061
2062 // Parsing will fail or succeed depending on whether we allow natives syntax
2063 // or not.
2064 RunParserSyncTest(context_data, statement_data, kSuccessOrError);
2065 }
OLDNEW
« no previous file with comments | « src/preparser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698