OLD | NEW |
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 @override | 131 @override |
132 void reportError( | 132 void reportError( |
133 ScannerErrorCode errorCode, int offset, List<Object> arguments) { | 133 ScannerErrorCode errorCode, int offset, List<Object> arguments) { |
134 _errorListener | 134 _errorListener |
135 .onError(new AnalysisError(source, offset, 1, errorCode, arguments)); | 135 .onError(new AnalysisError(source, offset, 1, errorCode, arguments)); |
136 } | 136 } |
137 | 137 |
138 @override | 138 @override |
139 void setSourceStart(int line, int column) { | 139 void setSourceStart(int line, int column) { |
140 lineStarts.removeAt(0); | |
141 int offset = _readerOffset; | 140 int offset = _readerOffset; |
142 if (line < 1 || column < 1 || offset < 0 || (line + column - 2) >= offset) { | 141 if (line < 1 || column < 1 || offset < 0 || (line + column - 2) >= offset) { |
143 return; | 142 return; |
144 } | 143 } |
| 144 lineStarts.removeAt(0); |
145 for (int i = 2; i < line; i++) { | 145 for (int i = 2; i < line; i++) { |
146 lineStarts.add(1); | 146 lineStarts.add(1); |
147 } | 147 } |
148 lineStarts.add(offset - column + 1); | 148 lineStarts.add(offset - column + 1); |
149 } | 149 } |
150 | 150 |
151 @override | 151 @override |
152 Token get tail { | 152 Token get tail { |
153 throw 'unsupported operation'; | 153 throw 'unsupported operation'; |
154 } | 154 } |
(...skipping 29 matching lines...) Expand all Loading... |
184 } while (!token.isEof); | 184 } while (!token.isEof); |
185 } | 185 } |
186 return firstToken; | 186 return firstToken; |
187 } | 187 } |
188 | 188 |
189 @override | 189 @override |
190 set preserveComments(bool preserveComments) { | 190 set preserveComments(bool preserveComments) { |
191 this._preserveComments = preserveComments; | 191 this._preserveComments = preserveComments; |
192 } | 192 } |
193 } | 193 } |
OLD | NEW |