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

Side by Side Diff: lib/dartdoc/frog/reader.dart

Issue 10696191: Frog removed from dartdoc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /**
6 * An code reader that abstracts away the distinction between internal and user
7 * libraries.
8 */
9 class LibraryReader {
10 Map _specialLibs;
11 LibraryReader() {
12 if (options.config == 'dev') {
13 _specialLibs = {
14 'dart:core': joinPaths(options.libDir,
15 'dartdoc/frog/lib/corelib.dart'),
16 'dart:coreimpl': joinPaths(options.libDir,
17 'dartdoc/frog/lib/corelib_impl.dart'),
18 'dart:html': joinPaths(options.libDir,
19 'dartdoc/frog/lib/html_frog.dart'),
20 'dart:dom_deprecated': joinPaths(options.libDir,
21 'dom/frog/dom_frog.dart'),
22 'dart:crypto': joinPaths(options.libDir,
23 'crypto/crypto.dart'),
24 'dart:json': joinPaths(options.libDir,
25 'json/json_frog.dart'),
26 'dart:io': joinPaths(options.libDir,
27 'compiler/implementation/lib/io.dart'),
28 'dart:isolate': joinPaths(options.libDir,
29 'isolate/isolate_frog.dart'),
30 'dart:uri': joinPaths(options.libDir,
31 'uri/uri.dart'),
32 'dart:utf': joinPaths(options.libDir,
33 'utf/utf.dart'),
34 'dart:web': joinPaths(options.libDir,
35 'web/web.dart'),
36 };
37 } else if (options.config == 'sdk') {
38 _specialLibs = {
39 'dart:core': joinPaths(options.libDir,
40 'dartdoc/frog/lib/corelib.dart'),
41 'dart:coreimpl': joinPaths(options.libDir,
42 'dartdoc/frog/lib/corelib_impl.dart'),
43 'dart:html': joinPaths(options.libDir,
44 'dartdoc/frog/lib/html_frog.dart'),
45 'dart:dom_deprecated': joinPaths(options.libDir,
46 'dom/dom_frog.dart'),
47 // TODO(rnystrom): How should we handle dart:io here?
48 'dart:isolate': joinPaths(options.libDir,
49 'isolate/isolate_frog.dart'),
50 'dart:crypto': joinPaths(options.libDir,
51 'crypto/crypto.dart'),
52 'dart:json': joinPaths(options.libDir,
53 'json/json_frog.dart'),
54 'dart:uri': joinPaths(options.libDir,
55 'uri/uri.dart'),
56 'dart:utf': joinPaths(options.libDir,
57 'utf/utf.dart'),
58 'dart:web': joinPaths(options.libDir,
59 'web/web.dart'),
60 };
61 } else {
62 world.error('Invalid configuration ${options.config}');
63 }
64 }
65
66 SourceFile readFile(String fullName) {
67 String filename;
68
69
70 if (fullName.startsWith('package:')) {
71 String name = fullName.substring('package:'.length);
72 if (options.packageRoot !== null) {
73 filename = joinPaths(options.packageRoot, name);
74 } else {
75 filename = joinPaths(dirname(options.dartScript),
76 joinPaths('packages', name));
77 }
78 } else {
79 filename = _specialLibs[fullName];
80 }
81
82 if (filename == null) {
83 filename = fullName;
84 }
85
86 if (world.files.fileExists(filename)) {
87 // TODO(jimhug): Should we cache these based on time stamps here?
88 return new SourceFile(filename, world.files.readAll(filename));
89 } else {
90 world.error('File not found: $filename', null);
91 return new SourceFile(filename, '');
92 }
93 }
94 }
OLDNEW
« no previous file with comments | « lib/dartdoc/frog/parser.dart ('k') | lib/dartdoc/frog/source.dart » ('j') | tools/create_sdk.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698