| OLD | NEW |
| 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 3358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3369 Dart_Handle handle = CallLibraryTagHandler(kCanonicalizeUrl, | 3369 Dart_Handle handle = CallLibraryTagHandler(kCanonicalizeUrl, |
| 3370 source_pos, | 3370 source_pos, |
| 3371 url, | 3371 url, |
| 3372 import_map); | 3372 import_map); |
| 3373 const String& canon_url = String::CheckedHandle(Api::UnwrapHandle(handle)); | 3373 const String& canon_url = String::CheckedHandle(Api::UnwrapHandle(handle)); |
| 3374 CallLibraryTagHandler(kSourceTag, source_pos, canon_url, import_map); | 3374 CallLibraryTagHandler(kSourceTag, source_pos, canon_url, import_map); |
| 3375 } | 3375 } |
| 3376 } | 3376 } |
| 3377 | 3377 |
| 3378 | 3378 |
| 3379 void Parser::ParseLibraryResource() { |
| 3380 TRACE_PARSER("ParseLibraryResource"); |
| 3381 while (CurrentToken() == Token::kRESOURCE) { |
| 3382 // Currently the VM does ignore #resource library tags. They are only used |
| 3383 // by the IDE. |
| 3384 ConsumeToken(); |
| 3385 ExpectToken(Token::kLPAREN); |
| 3386 if (CurrentToken() != Token::kSTRING) { |
| 3387 ErrorMsg("resource url expected"); |
| 3388 } |
| 3389 ConsumeToken(); |
| 3390 ExpectToken(Token::kRPAREN); |
| 3391 ExpectToken(Token::kSEMICOLON); |
| 3392 } |
| 3393 } |
| 3394 |
| 3395 |
| 3379 void Parser::ParseLibraryDefinition() { | 3396 void Parser::ParseLibraryDefinition() { |
| 3380 TRACE_PARSER("ParseLibraryDefinition"); | 3397 TRACE_PARSER("ParseLibraryDefinition"); |
| 3381 // Handle the script tag. | 3398 // Handle the script tag. |
| 3382 if (CurrentToken() == Token::kSCRIPTTAG) { | 3399 if (CurrentToken() == Token::kSCRIPTTAG) { |
| 3383 // Nothing to do for script tags except to skip them. | 3400 // Nothing to do for script tags except to skip them. |
| 3384 ConsumeToken(); | 3401 ConsumeToken(); |
| 3385 } | 3402 } |
| 3386 | 3403 |
| 3387 ParseLibraryName(); | 3404 ParseLibraryName(); |
| 3388 ParseLibraryImport(); | 3405 ParseLibraryImport(); |
| 3389 ParseLibraryInclude(); | 3406 ParseLibraryInclude(); |
| 3407 ParseLibraryResource(); |
| 3390 } | 3408 } |
| 3391 | 3409 |
| 3392 | 3410 |
| 3393 void Parser::ParseTopLevel() { | 3411 void Parser::ParseTopLevel() { |
| 3394 TRACE_PARSER("ParseTopLevel"); | 3412 TRACE_PARSER("ParseTopLevel"); |
| 3395 // Collect the classes found at the top level in this growable array. | 3413 // Collect the classes found at the top level in this growable array. |
| 3396 // They need to be registered with class finalization after parsing | 3414 // They need to be registered with class finalization after parsing |
| 3397 // has been completed. | 3415 // has been completed. |
| 3398 GrowableArray<const Class*> classes; | 3416 GrowableArray<const Class*> classes; |
| 3399 SetPosition(0); | 3417 SetPosition(0); |
| (...skipping 4461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7861 void Parser::SkipQualIdent() { | 7879 void Parser::SkipQualIdent() { |
| 7862 ASSERT(IsIdentifier()); | 7880 ASSERT(IsIdentifier()); |
| 7863 ConsumeToken(); | 7881 ConsumeToken(); |
| 7864 if (CurrentToken() == Token::kPERIOD) { | 7882 if (CurrentToken() == Token::kPERIOD) { |
| 7865 ConsumeToken(); // Consume the kPERIOD token. | 7883 ConsumeToken(); // Consume the kPERIOD token. |
| 7866 ExpectIdentifier("identifier expected after '.'"); | 7884 ExpectIdentifier("identifier expected after '.'"); |
| 7867 } | 7885 } |
| 7868 } | 7886 } |
| 7869 | 7887 |
| 7870 } // namespace dart | 7888 } // namespace dart |
| OLD | NEW |