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

Side by Side Diff: pkg/analyzer/lib/src/dart/scanner/scanner.dart

Issue 2948473002: integrating fasta parser (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | pkg/analyzer/lib/src/generated/parser.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 analyzer.src.dart.scanner.scanner; 5 library analyzer.src.dart.scanner.scanner;
6 6
7 import 'package:analyzer/error/error.dart'; 7 import 'package:analyzer/error/error.dart';
8 import 'package:analyzer/error/listener.dart'; 8 import 'package:analyzer/error/listener.dart';
9 import 'package:analyzer/src/dart/error/syntactic_errors.dart'; 9 import 'package:analyzer/src/dart/error/syntactic_errors.dart';
10 import 'package:analyzer/src/dart/scanner/reader.dart'; 10 import 'package:analyzer/src/dart/scanner/reader.dart';
(...skipping 30 matching lines...) Expand all
41 41
42 /** 42 /**
43 * Initialize a newly created scanner to scan characters from the given 43 * Initialize a newly created scanner to scan characters from the given
44 * [source]. The given character [reader] will be used to read the characters 44 * [source]. The given character [reader] will be used to read the characters
45 * in the source. The given [_errorListener] will be informed of any errors 45 * in the source. The given [_errorListener] will be informed of any errors
46 * that are found. 46 * that are found.
47 */ 47 */
48 factory Scanner(Source source, CharacterReader reader, 48 factory Scanner(Source source, CharacterReader reader,
49 AnalysisErrorListener errorListener) => 49 AnalysisErrorListener errorListener) =>
50 fe.Scanner.useFasta 50 fe.Scanner.useFasta
51 ? new _Scanner2( 51 ? new Scanner.fasta(source, errorListener,
52 source, reader.getContents(), reader.offset, errorListener) 52 contents: reader.getContents(), offset: reader.offset)
53 : new Scanner._(source, reader, errorListener); 53 : new Scanner._(source, reader, errorListener);
54 54
55 factory Scanner.fasta(Source source, AnalysisErrorListener errorListener,
56 {String contents, int offset: 0}) {
57 return new _Scanner2(
58 source, contents ?? source.contents.data, offset, errorListener);
59 }
60
55 Scanner._(this.source, CharacterReader reader, this._errorListener) 61 Scanner._(this.source, CharacterReader reader, this._errorListener)
56 : super.create(reader); 62 : super.create(reader);
57 63
58 @override 64 @override
59 void reportError( 65 void reportError(
60 ScannerErrorCode errorCode, int offset, List<Object> arguments) { 66 ScannerErrorCode errorCode, int offset, List<Object> arguments) {
61 _errorListener 67 _errorListener
62 .onError(new AnalysisError(source, offset, 1, errorCode, arguments)); 68 .onError(new AnalysisError(source, offset, 1, errorCode, arguments));
63 } 69 }
64 } 70 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 if (_readerOffset != -1) { 190 if (_readerOffset != -1) {
185 final int delta = _readerOffset + 1; 191 final int delta = _readerOffset + 1;
186 do { 192 do {
187 token.offset += delta; 193 token.offset += delta;
188 token = token.next; 194 token = token.next;
189 } while (!token.isEof); 195 } while (!token.isEof);
190 } 196 }
191 return firstToken; 197 return firstToken;
192 } 198 }
193 } 199 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698