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

Side by Side Diff: lib/src/directive_parser.dart

Issue 12096106: work in progress: observable implementation using detailed change records (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: Created 7 years, 10 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
« no previous file with comments | « lib/src/dart_parser.dart ('k') | lib/src/emitters.dart » ('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 /** 5 /**
6 * A mini parser that extracts top-level directives (library, imports, exports, 6 * A mini parser that extracts top-level directives (library, imports, exports,
7 * and parts) from a dart source file. 7 * and parts) from a dart source file.
8 */ 8 */
9 library directive_parser; 9 library directive_parser;
10 10
11 import 'info.dart' show DartCodeInfo, DartDirectiveInfo; 11 import 'info.dart' show DartCodeInfo, DartDirectiveInfo;
12 import 'messages.dart' show Messages; 12 import 'messages.dart' show Messages;
13 import 'file_system/path.dart'; 13 import 'file_system/path.dart';
14 14
15 /** 15 /**
16 * Parse and extract top-level directives from [code]. 16 * Parse and extract top-level directives from [code].
17 * 17 *
18 * Adds emitted error/warning messages to [messages], if [messages] is 18 * Adds emitted error/warning messages to [messages], if [messages] is
19 * supplied. 19 * supplied.
20 */ 20 */
21 DartCodeInfo parseDartCode(String code, Path file, {Messages messages}) { 21 DartCodeInfo parseDartCode(String code, Path file, {Messages messages}) {
22 messages = messages == null ? new Messages.silent() : messages; 22 messages = messages == null ? new Messages.silent() : messages;
23 return new _DirectiveParser(messages, file).parse(code); 23 return new _DirectiveParser(messages, file).parse(code);
24 } 24 }
25 25
26 /** A parser that extracts top-level directives. */ 26 /** A parser that extracts top-level directives. */
27 // TODO(sigmund): add source-span to error messages 27 // TODO(sigmund): add source-span to error messages.
28 // TODO(jmesserly): replace this with something based on compiler_unsupported.
28 class _DirectiveParser { 29 class _DirectiveParser {
29 /** Path to the source file containing the code (for error messages). */ 30 /** Path to the source file containing the code (for error messages). */
30 Path file; 31 Path file;
31 32
32 /** Tokenizer used to parse the input until the end of the directives. */ 33 /** Tokenizer used to parse the input until the end of the directives. */
33 _DirectiveTokenizer tokenizer; 34 _DirectiveTokenizer tokenizer;
34 35
35 /** Extracted library identifier, if any. */ 36 /** Extracted library identifier, if any. */
36 String libraryName; 37 String libraryName;
37 38
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 static const int _ZERO = 48; // 0 380 static const int _ZERO = 48; // 0
380 static const int _NINE = 57; // 9 381 static const int _NINE = 57; // 9
381 static const int _SEMICOLON = 59; // ; 382 static const int _SEMICOLON = 59; // ;
382 static const int _UPPER_A = 65; // A 383 static const int _UPPER_A = 65; // A
383 static const int _UPPER_Z = 90; // Z 384 static const int _UPPER_Z = 90; // Z
384 static const int _BACKSLASH = 92; // \ 385 static const int _BACKSLASH = 92; // \
385 static const int _UNDERSCORE = 95; // _ 386 static const int _UNDERSCORE = 95; // _
386 static const int _LOWER_A = 97; // a 387 static const int _LOWER_A = 97; // a
387 static const int _LOWER_Z = 122; // z 388 static const int _LOWER_Z = 122; // z
388 } 389 }
OLDNEW
« no previous file with comments | « lib/src/dart_parser.dart ('k') | lib/src/emitters.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698