OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'package:front_end/src/fasta/errors.dart'; | 5 import 'package:front_end/src/fasta/errors.dart'; |
6 import 'package:front_end/src/fasta/scanner/precedence.dart'; | |
7 import 'package:front_end/src/fasta/scanner/token.dart'; | 6 import 'package:front_end/src/fasta/scanner/token.dart'; |
8 | 7 |
9 /// Provides the capability of inserting tokens into a token stream by rewriting | 8 /// Provides the capability of inserting tokens into a token stream by rewriting |
10 /// the previous token to point to the inserted token. | 9 /// the previous token to point to the inserted token. |
11 /// | 10 /// |
12 /// This class has been designed to take advantage of "previousToken" pointers | 11 /// This class has been designed to take advantage of "previousToken" pointers |
13 /// when they are present, but not to depend on them. When they are not | 12 /// when they are present, but not to depend on them. When they are not |
14 /// present, it uses heuristics to try to find the find the previous token as | 13 /// present, it uses heuristics to try to find the find the previous token as |
15 /// quickly as possible by walking through tokens starting at the start of the | 14 /// quickly as possible by walking through tokens starting at the start of the |
16 /// file. | 15 /// file. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 nextPos = pos.next; | 96 nextPos = pos.next; |
98 if (nextPos == null || nextPos.charOffset > target.charOffset) { | 97 if (nextPos == null || nextPos.charOffset > target.charOffset) { |
99 return null; | 98 return null; |
100 } | 99 } |
101 } | 100 } |
102 pos = nextPos; | 101 pos = nextPos; |
103 } | 102 } |
104 return pos; | 103 return pos; |
105 } | 104 } |
106 } | 105 } |
OLD | NEW |