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 licenset hat can be found in the LICENSE file. | 3 // BSD-style licenset hat can be found in the LICENSE file. |
4 | 4 |
5 library fasta.scanner.recover; | 5 library fasta.scanner.recover; |
6 | 6 |
7 import 'token.dart' show | 7 import 'token.dart' show |
8 StringToken, | 8 StringToken, |
9 Token; | 9 Token; |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 /// Used for appending to [good]. | 47 /// Used for appending to [good]. |
48 Token goodTail; | 48 Token goodTail; |
49 | 49 |
50 /// The previous token appended to [good]. Since tokens are single linked | 50 /// The previous token appended to [good]. Since tokens are single linked |
51 /// lists, this allows us to rewrite the current token without scanning all | 51 /// lists, this allows us to rewrite the current token without scanning all |
52 /// of [good]. This is supposed to be the token immediately before | 52 /// of [good]. This is supposed to be the token immediately before |
53 /// [goodTail], that is, `beforeGoodTail.next == goodTail`. | 53 /// [goodTail], that is, `beforeGoodTail.next == goodTail`. |
54 Token beforeGoodTail; | 54 Token beforeGoodTail; |
55 | 55 |
56 recoverIdentifier(NonAsciiIdentifierToken first) { | 56 recoverIdentifier(NonAsciiIdentifierToken first) { |
57 List codeUnits = <int>[]; | 57 var codeUnits = <int>[]; |
ahe
2017/02/07 11:03:08
Restore type.
Siggi Cherem (dart-lang)
2017/02/07 21:59:26
Done.
Not sure if you know: in strong mode `var`
ahe
2017/02/08 19:59:24
Thank you. I prefer for types to be explicit as I
| |
58 | 58 |
59 // True if the previous good token is an identifier and ends right where | 59 // True if the previous good token is an identifier and ends right where |
60 // [first] starts. This is the case for input like `blåbærgrød`. In this | 60 // [first] starts. This is the case for input like `blåbærgrød`. In this |
61 // case, the scanner produces this sequence of tokens: | 61 // case, the scanner produces this sequence of tokens: |
62 // | 62 // |
63 // [ | 63 // [ |
64 // StringToken("bl"), | 64 // StringToken("bl"), |
65 // NonAsciiIdentifierToken("å"), | 65 // NonAsciiIdentifierToken("å"), |
66 // StringToken("b"), | 66 // StringToken("b"), |
67 // NonAsciiIdentifierToken("æ"), | 67 // NonAsciiIdentifierToken("æ"), |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 | 239 |
240 String closeBraceFor(String openBrace) { | 240 String closeBraceFor(String openBrace) { |
241 return const { | 241 return const { |
242 '(': ')', | 242 '(': ')', |
243 '[': ']', | 243 '[': ']', |
244 '{': '}', | 244 '{': '}', |
245 '<': '>', | 245 '<': '>', |
246 r'${': '}', | 246 r'${': '}', |
247 }[openBrace]; | 247 }[openBrace]; |
248 } | 248 } |
OLD | NEW |