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

Side by Side Diff: pkg/front_end/lib/src/fasta/scanner/string_scanner.dart

Issue 2763833002: fasta.CommentToken implement analyzer.CommentToken (Closed)
Patch Set: merge Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 library dart2js.scanner.string_scanner; 5 library dart2js.scanner.string_scanner;
6 6
7 import 'array_based_scanner.dart' show ArrayBasedScanner; 7 import 'array_based_scanner.dart' show ArrayBasedScanner;
8 8
9 import 'precedence.dart' show PrecedenceInfo; 9 import 'precedence.dart' show PrecedenceInfo;
10 10
11 import 'token.dart' show StringToken; 11 import 'token.dart' show CommentToken, DartDocToken, StringToken;
12 12
13 /** 13 /**
14 * Scanner that reads from a String and creates tokens that points to 14 * Scanner that reads from a String and creates tokens that points to
15 * substrings. 15 * substrings.
16 */ 16 */
17 class StringScanner extends ArrayBasedScanner { 17 class StringScanner extends ArrayBasedScanner {
18 /** The file content. */ 18 /** The file content. */
19 String string; 19 String string;
20 20
21 /** The current offset in [string]. */ 21 /** The current offset in [string]. */
(...skipping 21 matching lines...) Expand all
43 43
44 @override 44 @override
45 StringToken createSubstringToken( 45 StringToken createSubstringToken(
46 PrecedenceInfo info, int start, bool asciiOnly, 46 PrecedenceInfo info, int start, bool asciiOnly,
47 [int extraOffset = 0]) { 47 [int extraOffset = 0]) {
48 return new StringToken.fromSubstring( 48 return new StringToken.fromSubstring(
49 info, string, start, scanOffset + extraOffset, tokenStart, 49 info, string, start, scanOffset + extraOffset, tokenStart,
50 canonicalize: true); 50 canonicalize: true);
51 } 51 }
52 52
53 @override
54 CommentToken createCommentToken(
55 PrecedenceInfo info, int start, bool asciiOnly,
56 [int extraOffset = 0]) {
57 return new CommentToken.fromSubstring(
58 info, string, start, scanOffset + extraOffset, tokenStart,
59 canonicalize: true);
60 }
61
62 @override
63 DartDocToken createDartDocToken(
64 PrecedenceInfo info, int start, bool asciiOnly,
65 [int extraOffset = 0]) {
66 return new DartDocToken.fromSubstring(
67 info, string, start, scanOffset + extraOffset, tokenStart,
68 canonicalize: true);
69 }
70
53 bool atEndOfFile() => scanOffset >= string.length - 1; 71 bool atEndOfFile() => scanOffset >= string.length - 1;
54 } 72 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart ('k') | pkg/front_end/lib/src/fasta/scanner/token.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698