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

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

Issue 2794833003: Use SubStringScanner to scan generic comments. (Closed)
Patch Set: Revert formatting changes. Created 3 years, 8 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 | « pkg/front_end/lib/src/fasta/parser/parser.dart ('k') | no next file » | 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) 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
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 DartDocToken createDartDocToken( 63 DartDocToken createDartDocToken(
64 PrecedenceInfo info, int start, bool asciiOnly, 64 PrecedenceInfo info, int start, bool asciiOnly,
65 [int extraOffset = 0]) { 65 [int extraOffset = 0]) {
66 return new DartDocToken.fromSubstring( 66 return new DartDocToken.fromSubstring(
67 info, string, start, scanOffset + extraOffset, tokenStart, 67 info, string, start, scanOffset + extraOffset, tokenStart,
68 canonicalize: true); 68 canonicalize: true);
69 } 69 }
70 70
71 bool atEndOfFile() => scanOffset >= string.length - 1; 71 bool atEndOfFile() => scanOffset >= string.length - 1;
72 } 72 }
73
74 /**
75 * Scanner that creates tokens for a part of a larger [String], where the part
76 * starts at the [baseOffset].
77 */
78 class SubStringScanner extends StringScanner {
79 final int baseOffset;
80
81 SubStringScanner(this.baseOffset, String string,
82 {bool includeComments: false})
83 : super(string, includeComments: includeComments);
84
85 @override
86 void beginToken() {
87 tokenStart = baseOffset + stringOffset;
88 }
89 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698