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

Side by Side Diff: runtime/vm/parser.cc

Issue 11316283: Eliminate old style import from language tests (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 | « no previous file | tests/language/application_negative_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/compiler_stats.h" 10 #include "vm/compiler_stats.h"
(...skipping 4055 matching lines...) Expand 10 before | Expand all | Expand 10 after
4066 url); 4066 url);
4067 const String& canon_url = String::CheckedHandle(Api::UnwrapHandle(handle)); 4067 const String& canon_url = String::CheckedHandle(Api::UnwrapHandle(handle));
4068 CallLibraryTagHandler(kSourceTag, source_pos, canon_url); 4068 CallLibraryTagHandler(kSourceTag, source_pos, canon_url);
4069 } 4069 }
4070 } 4070 }
4071 4071
4072 4072
4073 void Parser::ParseLibraryName() { 4073 void Parser::ParseLibraryName() {
4074 ASSERT(CurrentToken() == Token::kLIBRARY); 4074 ASSERT(CurrentToken() == Token::kLIBRARY);
4075 ConsumeToken(); 4075 ConsumeToken();
4076 // TODO(hausner): Exact syntax of library name still unclear: identifier, 4076 String& lib_name = *ExpectIdentifier("library name expected");
4077 // qualified identifier or even multiple dots allowed? For now we just 4077 if (CurrentToken() == Token::kPERIOD) {
4078 // accept simple identifiers. 4078 const String& dot = String::Handle(Symbols::Dot());
4079 const String& lib_name = *ExpectIdentifier("library name expected"); 4079 while (CurrentToken() == Token::kPERIOD) {
4080 ConsumeToken();
4081 lib_name = String::Concat(lib_name, dot);
4082 lib_name = String::Concat(lib_name,
4083 *ExpectIdentifier("malformed library name"));
4084 }
4085 lib_name = Symbols::New(lib_name);
4086 }
4080 library_.SetName(lib_name); 4087 library_.SetName(lib_name);
4081 ExpectSemicolon(); 4088 ExpectSemicolon();
4082 } 4089 }
4083 4090
4084 4091
4085 void Parser::ParseIdentList(GrowableObjectArray* names) { 4092 void Parser::ParseIdentList(GrowableObjectArray* names) {
4086 if (!IsIdentifier()) { 4093 if (!IsIdentifier()) {
4087 ErrorMsg("identifier expected"); 4094 ErrorMsg("identifier expected");
4088 } 4095 }
4089 while (IsIdentifier()) { 4096 while (IsIdentifier()) {
(...skipping 17 matching lines...) Expand all
4107 ErrorMsg("library url expected"); 4114 ErrorMsg("library url expected");
4108 } 4115 }
4109 const String& url = *CurrentLiteral(); 4116 const String& url = *CurrentLiteral();
4110 if (url.Length() == 0) { 4117 if (url.Length() == 0) {
4111 ErrorMsg("library url expected"); 4118 ErrorMsg("library url expected");
4112 } 4119 }
4113 ConsumeToken(); 4120 ConsumeToken();
4114 String& prefix = String::Handle(); 4121 String& prefix = String::Handle();
4115 if (is_import && IsLiteral("as")) { 4122 if (is_import && IsLiteral("as")) {
4116 ConsumeToken(); 4123 ConsumeToken();
4117 prefix = ExpectIdentifier("prefix expected")->raw(); 4124 prefix = ExpectIdentifier("prefix identifier expected")->raw();
4118 } 4125 }
4119 4126
4120 Array& show_names = Array::Handle(); 4127 Array& show_names = Array::Handle();
4121 Array& hide_names = Array::Handle(); 4128 Array& hide_names = Array::Handle();
4122 if (IsLiteral("show") || IsLiteral("hide")) { 4129 if (IsLiteral("show") || IsLiteral("hide")) {
4123 GrowableObjectArray& show_list = 4130 GrowableObjectArray& show_list =
4124 GrowableObjectArray::Handle(GrowableObjectArray::New()); 4131 GrowableObjectArray::Handle(GrowableObjectArray::New());
4125 GrowableObjectArray& hide_list = 4132 GrowableObjectArray& hide_list =
4126 GrowableObjectArray::Handle(GrowableObjectArray::New()); 4133 GrowableObjectArray::Handle(GrowableObjectArray::New());
4127 for (;;) { 4134 for (;;) {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
4276 SkipMetadata(); 4283 SkipMetadata();
4277 // TODO(hausner): Once support for old #source directive is removed 4284 // TODO(hausner): Once support for old #source directive is removed
4278 // from the compiler, add an error message here if we don't find 4285 // from the compiler, add an error message here if we don't find
4279 // a 'part of' directive. 4286 // a 'part of' directive.
4280 if (CurrentToken() == Token::kPART) { 4287 if (CurrentToken() == Token::kPART) {
4281 ConsumeToken(); 4288 ConsumeToken();
4282 if (!IsLiteral("of")) { 4289 if (!IsLiteral("of")) {
4283 ErrorMsg("'part of' expected"); 4290 ErrorMsg("'part of' expected");
4284 } 4291 }
4285 ConsumeToken(); 4292 ConsumeToken();
4286 // TODO(hausner): Exact syntax of library name still unclear: identifier,
4287 // qualified identifier or even multiple dots allowed? For now we just
4288 // accept simple identifiers.
4289 // The VM is not required to check that the library name matches the 4293 // The VM is not required to check that the library name matches the
4290 // name of the current library, so we ignore it. 4294 // name of the current library, so we ignore it.
4291 ExpectIdentifier("library name expected"); 4295 ExpectIdentifier("library name expected");
4296 while (CurrentToken() == Token::kPERIOD) {
4297 ConsumeToken();
4298 ExpectIdentifier("malformed library name");
4299 }
4292 ExpectSemicolon(); 4300 ExpectSemicolon();
4293 } else { 4301 } else {
4294 SetPosition(metadata_pos); 4302 SetPosition(metadata_pos);
4295 } 4303 }
4296 } 4304 }
4297 4305
4298 4306
4299 void Parser::ParseTopLevel() { 4307 void Parser::ParseTopLevel() {
4300 TRACE_PARSER("ParseTopLevel"); 4308 TRACE_PARSER("ParseTopLevel");
4301 // Collect the classes found at the top level in this growable array. 4309 // Collect the classes found at the top level in this growable array.
(...skipping 5396 matching lines...) Expand 10 before | Expand all | Expand 10 after
9698 void Parser::SkipQualIdent() { 9706 void Parser::SkipQualIdent() {
9699 ASSERT(IsIdentifier()); 9707 ASSERT(IsIdentifier());
9700 ConsumeToken(); 9708 ConsumeToken();
9701 if (CurrentToken() == Token::kPERIOD) { 9709 if (CurrentToken() == Token::kPERIOD) {
9702 ConsumeToken(); // Consume the kPERIOD token. 9710 ConsumeToken(); // Consume the kPERIOD token.
9703 ExpectIdentifier("identifier expected after '.'"); 9711 ExpectIdentifier("identifier expected after '.'");
9704 } 9712 }
9705 } 9713 }
9706 9714
9707 } // namespace dart 9715 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/application_negative_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698