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

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

Issue 2832403002: merge PrecedenceInfo into TokenType and update all refs (Closed)
Patch Set: rebase 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 | « no previous file | pkg/analyzer/lib/src/fasta/ast_builder.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';
11 import 'package:analyzer/src/generated/source.dart'; 11 import 'package:analyzer/src/generated/source.dart';
12 import 'package:front_end/src/fasta/scanner.dart' as fasta; 12 import 'package:front_end/src/fasta/scanner.dart' as fasta;
13 import 'package:front_end/src/fasta/scanner/precedence.dart' as fasta;
14 import 'package:front_end/src/scanner/errors.dart' show translateErrorToken; 13 import 'package:front_end/src/scanner/errors.dart' show translateErrorToken;
15 import 'package:front_end/src/scanner/scanner.dart' as fe; 14 import 'package:front_end/src/scanner/scanner.dart' as fe;
16 import 'package:front_end/src/scanner/token.dart' show Token; 15 import 'package:front_end/src/scanner/token.dart' show Token, TokenType;
17 16
18 export 'package:analyzer/src/dart/error/syntactic_errors.dart'; 17 export 'package:analyzer/src/dart/error/syntactic_errors.dart';
19 export 'package:front_end/src/scanner/scanner.dart' show KeywordState; 18 export 'package:front_end/src/scanner/scanner.dart' show KeywordState;
20 19
21 /** 20 /**
22 * The class `Scanner` implements a scanner for Dart code. 21 * The class `Scanner` implements a scanner for Dart code.
23 * 22 *
24 * The lexical structure of Dart is ambiguous without knowledge of the context 23 * The lexical structure of Dart is ambiguous without knowledge of the context
25 * in which a token is being scanned. For example, without context we cannot 24 * in which a token is being scanned. For example, without context we cannot
26 * determine whether source of the form "<<" should be scanned as a single 25 * determine whether source of the form "<<" should be scanned as a single
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 throw 'No generic method comment support in Fasta'; 148 throw 'No generic method comment support in Fasta';
150 } 149 }
151 fasta.ScannerResult result = 150 fasta.ScannerResult result =
152 fasta.scanString(_contents, includeComments: _preserveComments); 151 fasta.scanString(_contents, includeComments: _preserveComments);
153 // fasta pretends there is an additional line at EOF 152 // fasta pretends there is an additional line at EOF
154 lineStarts 153 lineStarts
155 .addAll(result.lineStarts.sublist(1, result.lineStarts.length - 1)); 154 .addAll(result.lineStarts.sublist(1, result.lineStarts.length - 1));
156 fasta.Token token = result.tokens; 155 fasta.Token token = result.tokens;
157 // The default recovery strategy used by scanString 156 // The default recovery strategy used by scanString
158 // places all error tokens at the head of the stream. 157 // places all error tokens at the head of the stream.
159 while (token.info == fasta.BAD_INPUT_INFO) { 158 while (token.info == TokenType.BAD_INPUT) {
160 translateErrorToken(token, reportError); 159 translateErrorToken(token, reportError);
161 token = token.next; 160 token = token.next;
162 } 161 }
163 firstToken = token; 162 firstToken = token;
164 return firstToken; 163 return firstToken;
165 } 164 }
166 165
167 @override 166 @override
168 set preserveComments(bool preserveComments) { 167 set preserveComments(bool preserveComments) {
169 this._preserveComments = preserveComments; 168 this._preserveComments = preserveComments;
170 } 169 }
171 } 170 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/fasta/ast_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698