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

Side by Side Diff: pkg/front_end/lib/src/fasta/scanner/recover.dart

Issue 2738313002: rename fasta.Token.value --> lexeme (Closed)
Patch Set: merge Created 3 years, 9 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
OLDNEW
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 StringToken, Token; 7 import 'token.dart' show StringToken, Token;
8 8
9 import 'error_token.dart' show NonAsciiIdentifierToken, ErrorKind, ErrorToken; 9 import 'error_token.dart' show NonAsciiIdentifierToken, ErrorKind, ErrorToken;
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 goodTail.charEnd == first.charOffset) { 76 goodTail.charEnd == first.charOffset) {
77 prepend = true; 77 prepend = true;
78 } 78 }
79 } 79 }
80 Token next = errorTail.next; 80 Token next = errorTail.next;
81 if (next.info == Precedence.IDENTIFIER_INFO && 81 if (next.info == Precedence.IDENTIFIER_INFO &&
82 errorTail.charOffset + 1 == next.charOffset) { 82 errorTail.charOffset + 1 == next.charOffset) {
83 append = true; 83 append = true;
84 } 84 }
85 if (prepend) { 85 if (prepend) {
86 codeUnits.addAll(goodTail.value.codeUnits); 86 codeUnits.addAll(goodTail.lexeme.codeUnits);
87 } 87 }
88 NonAsciiIdentifierToken current = first; 88 NonAsciiIdentifierToken current = first;
89 while (current != errorTail) { 89 while (current != errorTail) {
90 codeUnits.add(current.character); 90 codeUnits.add(current.character);
91 current = current.next; 91 current = current.next;
92 } 92 }
93 codeUnits.add(errorTail.character); 93 codeUnits.add(errorTail.character);
94 int charOffset = first.charOffset; 94 int charOffset = first.charOffset;
95 if (prepend) { 95 if (prepend) {
96 charOffset = goodTail.charOffset; 96 charOffset = goodTail.charOffset;
97 if (beforeGoodTail == null) { 97 if (beforeGoodTail == null) {
98 // We're prepending the first good token, so the new token will become 98 // We're prepending the first good token, so the new token will become
99 // the first good token. 99 // the first good token.
100 good = null; 100 good = null;
101 goodTail = null; 101 goodTail = null;
102 beforeGoodTail = null; 102 beforeGoodTail = null;
103 } else { 103 } else {
104 goodTail = beforeGoodTail; 104 goodTail = beforeGoodTail;
105 } 105 }
106 } 106 }
107 if (append) { 107 if (append) {
108 codeUnits.addAll(next.value.codeUnits); 108 codeUnits.addAll(next.lexeme.codeUnits);
109 next = next.next; 109 next = next.next;
110 } 110 }
111 String value = new String.fromCharCodes(codeUnits); 111 String value = new String.fromCharCodes(codeUnits);
112 return synthesizeToken(charOffset, value, Precedence.IDENTIFIER_INFO) 112 return synthesizeToken(charOffset, value, Precedence.IDENTIFIER_INFO)
113 ..next = next; 113 ..next = next;
114 } 114 }
115 115
116 recoverExponent() { 116 recoverExponent() {
117 return synthesizeToken(errorTail.charOffset, "NaN", Precedence.DOUBLE_INFO) 117 return synthesizeToken(errorTail.charOffset, "NaN", Precedence.DOUBLE_INFO)
118 ..next = errorTail.next; 118 ..next = errorTail.next;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 235
236 String closeBraceFor(String openBrace) { 236 String closeBraceFor(String openBrace) {
237 return const { 237 return const {
238 '(': ')', 238 '(': ')',
239 '[': ']', 239 '[': ']',
240 '{': '}', 240 '{': '}',
241 '<': '>', 241 '<': '>',
242 r'${': '}', 242 r'${': '}',
243 }[openBrace]; 243 }[openBrace];
244 } 244 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/error_token.dart ('k') | pkg/front_end/lib/src/fasta/scanner/token.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698