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

Unified Diff: runtime/vm/parser.cc

Issue 10989010: Implement part header (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/parser.h ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 12845)
+++ runtime/vm/parser.cc (working copy)
@@ -4353,6 +4353,31 @@
}
+void Parser::ParsePartHeader() {
+ intptr_t metadata_pos = TokenPos();
+ SkipMetadata();
+ // TODO(hausner): Once support for old #source directive is removed
+ // from the compiler, add an error message here if we don't find
+ // a 'part of' directive.
+ if (IsLiteral("part")) {
+ ConsumeToken();
+ if (!IsLiteral("of")) {
+ 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");
+ ExpectSemicolon();
+ } else {
+ SetPosition(metadata_pos);
+ }
+}
+
+
void Parser::ParseTopLevel() {
TRACE_PARSER("ParseTopLevel");
// Collect the classes found at the top level in this growable array.
@@ -4371,6 +4396,8 @@
if (is_library_source()) {
ParseLibraryDefinition();
+ } else if (is_part_source()) {
+ ParsePartHeader();
}
while (true) {
« no previous file with comments | « runtime/vm/parser.h ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698