Chromium Code Reviews| Index: runtime/vm/parser.cc |
| =================================================================== |
| --- runtime/vm/parser.cc (revision 15598) |
| +++ runtime/vm/parser.cc (working copy) |
| @@ -4073,10 +4073,17 @@ |
| void Parser::ParseLibraryName() { |
| ASSERT(CurrentToken() == Token::kLIBRARY); |
| ConsumeToken(); |
| - // TODO(hausner): Exact syntax of library name still unclear: identifier, |
| - // qualified identifier or even multiple dots allowed? For now we just |
| - // accept simple identifiers. |
| - const String& lib_name = *ExpectIdentifier("library name expected"); |
| + String& lib_name = *ExpectIdentifier("library name expected"); |
| + if (CurrentToken() == Token::kPERIOD) { |
| + const String& dot = String::Handle(Symbols::Dot()); |
| + while (CurrentToken() == Token::kPERIOD) { |
| + ConsumeToken(); |
| + lib_name = String::Concat(lib_name, dot); |
| + lib_name = String::Concat(lib_name, |
| + *ExpectIdentifier("library name part expected after dot")); |
|
srdjan
2012/11/30 22:54:42
'part' is confusing in the context of libraries.
hausner
2012/11/30 23:10:02
Reworded message as discussed.
|
| + } |
| + lib_name = Symbols::New(lib_name); |
| + } |
| library_.SetName(lib_name); |
| ExpectSemicolon(); |
| } |
| @@ -4114,7 +4121,7 @@ |
| String& prefix = String::Handle(); |
| if (is_import && IsLiteral("as")) { |
| ConsumeToken(); |
| - prefix = ExpectIdentifier("prefix expected")->raw(); |
| + prefix = ExpectIdentifier("prefix identifier expected")->raw(); |
| } |
| Array& show_names = Array::Handle(); |
| @@ -4283,12 +4290,13 @@ |
| ErrorMsg("'part of' expected"); |
| } |
| ConsumeToken(); |
| - // TODO(hausner): Exact syntax of library name still unclear: identifier, |
| - // qualified identifier or even multiple dots allowed? For now we just |
| - // accept simple identifiers. |
| // The VM is not required to check that the library name matches the |
| // name of the current library, so we ignore it. |
| ExpectIdentifier("library name expected"); |
| + while (CurrentToken() == Token::kPERIOD) { |
| + ConsumeToken(); |
| + ExpectIdentifier("library name part expected after dot"); |
|
srdjan
2012/11/30 22:54:42
ditto
hausner
2012/11/30 23:10:02
ditto
|
| + } |
| ExpectSemicolon(); |
| } else { |
| SetPosition(metadata_pos); |