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

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

Issue 10918226: Get rid of #resource directive in VM (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | « runtime/vm/parser.h ('k') | runtime/vm/scanner.cc » ('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 4113 matching lines...) Expand 10 before | Expand all | Expand 10 after
4124 ExpectToken(Token::kSEMICOLON); 4124 ExpectToken(Token::kSEMICOLON);
4125 Dart_Handle handle = CallLibraryTagHandler(kCanonicalizeUrl, 4125 Dart_Handle handle = CallLibraryTagHandler(kCanonicalizeUrl,
4126 source_pos, 4126 source_pos,
4127 url); 4127 url);
4128 const String& canon_url = String::CheckedHandle(Api::UnwrapHandle(handle)); 4128 const String& canon_url = String::CheckedHandle(Api::UnwrapHandle(handle));
4129 CallLibraryTagHandler(kSourceTag, source_pos, canon_url); 4129 CallLibraryTagHandler(kSourceTag, source_pos, canon_url);
4130 } 4130 }
4131 } 4131 }
4132 4132
4133 4133
4134 // TODO(hausner): Remove support for old library definition syntax.
4135 void Parser::ParseLibraryResourceObsoleteSyntax() {
4136 while (CurrentToken() == Token::kRESOURCE) {
4137 // Currently the VM does ignore #resource library tags. They are only used
4138 // by the IDE.
4139 ConsumeToken();
4140 ExpectToken(Token::kLPAREN);
4141 if (CurrentToken() != Token::kSTRING) {
4142 ErrorMsg("resource url expected");
4143 }
4144 ConsumeToken();
4145 ExpectToken(Token::kRPAREN);
4146 ExpectToken(Token::kSEMICOLON);
4147 }
4148 }
4149
4150
4151 void Parser::ParseLibraryName() { 4134 void Parser::ParseLibraryName() {
4152 ASSERT(IsLiteral("library")); 4135 ASSERT(IsLiteral("library"));
4153 ConsumeToken(); 4136 ConsumeToken();
4154 // TODO(hausner): Exact syntax of library name still unclear: identifier, 4137 // TODO(hausner): Exact syntax of library name still unclear: identifier,
4155 // qualified identifier or even multiple dots allowed? For now we just 4138 // qualified identifier or even multiple dots allowed? For now we just
4156 // accept simple identifiers. 4139 // accept simple identifiers.
4157 const String& lib_name = *ExpectIdentifier("library name expected"); 4140 const String& lib_name = *ExpectIdentifier("library name expected");
4158 library_.SetName(lib_name); 4141 library_.SetName(lib_name);
4159 ExpectSemicolon(); 4142 ExpectSemicolon();
4160 } 4143 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
4233 4216
4234 // Handle the script tag. 4217 // Handle the script tag.
4235 if (CurrentToken() == Token::kSCRIPTTAG) { 4218 if (CurrentToken() == Token::kSCRIPTTAG) {
4236 // Nothing to do for script tags except to skip them. 4219 // Nothing to do for script tags except to skip them.
4237 ConsumeToken(); 4220 ConsumeToken();
4238 } 4221 }
4239 4222
4240 // TODO(hausner): Remove support for old library definition syntax. 4223 // TODO(hausner): Remove support for old library definition syntax.
4241 if ((CurrentToken() == Token::kLIBRARY) || 4224 if ((CurrentToken() == Token::kLIBRARY) ||
4242 (CurrentToken() == Token::kIMPORT) || 4225 (CurrentToken() == Token::kIMPORT) ||
4243 (CurrentToken() == Token::kSOURCE) || 4226 (CurrentToken() == Token::kSOURCE)) {
4244 (CurrentToken() == Token::kRESOURCE)) {
4245 ParseLibraryNameObsoleteSyntax(); 4227 ParseLibraryNameObsoleteSyntax();
4246 ParseLibraryImportObsoleteSyntax(); 4228 ParseLibraryImportObsoleteSyntax();
4247 ParseLibraryIncludeObsoleteSyntax(); 4229 ParseLibraryIncludeObsoleteSyntax();
4248 ParseLibraryResourceObsoleteSyntax();
4249 return; 4230 return;
4250 } 4231 }
4251 4232
4252 // We may read metadata tokens that are part of the toplevel 4233 // We may read metadata tokens that are part of the toplevel
4253 // declaration that follows the library definitions. Therefore, we 4234 // declaration that follows the library definitions. Therefore, we
4254 // need to remember the position of the last token that was 4235 // need to remember the position of the last token that was
4255 // successfully consumed. 4236 // successfully consumed.
4256 intptr_t metadata_pos = TokenPos(); 4237 intptr_t metadata_pos = TokenPos();
4257 SkipMetadata(); 4238 SkipMetadata();
4258 if (IsLiteral("library")) { 4239 if (IsLiteral("library")) {
(...skipping 5282 matching lines...) Expand 10 before | Expand all | Expand 10 after
9541 void Parser::SkipQualIdent() { 9522 void Parser::SkipQualIdent() {
9542 ASSERT(IsIdentifier()); 9523 ASSERT(IsIdentifier());
9543 ConsumeToken(); 9524 ConsumeToken();
9544 if (CurrentToken() == Token::kPERIOD) { 9525 if (CurrentToken() == Token::kPERIOD) {
9545 ConsumeToken(); // Consume the kPERIOD token. 9526 ConsumeToken(); // Consume the kPERIOD token.
9546 ExpectIdentifier("identifier expected after '.'"); 9527 ExpectIdentifier("identifier expected after '.'");
9547 } 9528 }
9548 } 9529 }
9549 9530
9550 } // namespace dart 9531 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/parser.h ('k') | runtime/vm/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698