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

Side by Side Diff: pkg/compiler/lib/src/tree/nodes.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
« no previous file with comments | « pkg/compiler/lib/src/string_validator.dart ('k') | pkg/compiler/lib/src/tree/prettyprint.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 'dart:collection' show IterableMixin; 5 import 'dart:collection' show IterableMixin;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../elements/elements.dart' show MetadataAnnotation; 8 import '../elements/elements.dart' show MetadataAnnotation;
9 import '../resolution/secret_tree_element.dart' 9 import '../resolution/secret_tree_element.dart'
10 show NullTreeElementMixin, StoredTreeElementMixin; 10 show NullTreeElementMixin, StoredTreeElementMixin;
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 1084
1085 visitChildren(Visitor visitor) {} 1085 visitChildren(Visitor visitor) {}
1086 1086
1087 visitChildren1(Visitor1 visitor, arg) {} 1087 visitChildren1(Visitor1 visitor, arg) {}
1088 1088
1089 Token getBeginToken() => asyncToken; 1089 Token getBeginToken() => asyncToken;
1090 1090
1091 Token getEndToken() => starToken != null ? starToken : asyncToken; 1091 Token getEndToken() => starToken != null ? starToken : asyncToken;
1092 1092
1093 /// Is `true` if this modifier is either `async` or `async*`. 1093 /// Is `true` if this modifier is either `async` or `async*`.
1094 bool get isAsynchronous => asyncToken.value == 'async'; 1094 bool get isAsynchronous => asyncToken.lexeme == 'async';
1095 1095
1096 /// Is `true` if this modifier is either `sync*` or `async*`. 1096 /// Is `true` if this modifier is either `sync*` or `async*`.
1097 bool get isYielding => starToken != null; 1097 bool get isYielding => starToken != null;
1098 } 1098 }
1099 1099
1100 class FunctionExpression extends Expression with StoredTreeElementMixin { 1100 class FunctionExpression extends Expression with StoredTreeElementMixin {
1101 final Node name; 1101 final Node name;
1102 final NodeList typeVariables; 1102 final NodeList typeVariables;
1103 1103
1104 /** 1104 /**
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 LiteralInt(Token token, DecodeErrorHandler handler) : super(token, handler); 1211 LiteralInt(Token token, DecodeErrorHandler handler) : super(token, handler);
1212 1212
1213 LiteralInt asLiteralInt() => this; 1213 LiteralInt asLiteralInt() => this;
1214 1214
1215 int get value { 1215 int get value {
1216 try { 1216 try {
1217 Token valueToken = token; 1217 Token valueToken = token;
1218 if (identical(valueToken.kind, Tokens.PLUS_TOKEN)) { 1218 if (identical(valueToken.kind, Tokens.PLUS_TOKEN)) {
1219 valueToken = valueToken.next; 1219 valueToken = valueToken.next;
1220 } 1220 }
1221 return int.parse(valueToken.value); 1221 return int.parse(valueToken.lexeme);
1222 } on FormatException catch (ex) { 1222 } on FormatException catch (ex) {
1223 (this.handler)(token, ex); 1223 (this.handler)(token, ex);
1224 } 1224 }
1225 } 1225 }
1226 1226
1227 accept(Visitor visitor) => visitor.visitLiteralInt(this); 1227 accept(Visitor visitor) => visitor.visitLiteralInt(this);
1228 1228
1229 accept1(Visitor1 visitor, arg) => visitor.visitLiteralInt(this, arg); 1229 accept1(Visitor1 visitor, arg) => visitor.visitLiteralInt(this, arg);
1230 } 1230 }
1231 1231
1232 class LiteralDouble extends Literal<double> { 1232 class LiteralDouble extends Literal<double> {
1233 LiteralDouble(Token token, DecodeErrorHandler handler) 1233 LiteralDouble(Token token, DecodeErrorHandler handler)
1234 : super(token, handler); 1234 : super(token, handler);
1235 1235
1236 LiteralDouble asLiteralDouble() => this; 1236 LiteralDouble asLiteralDouble() => this;
1237 1237
1238 double get value { 1238 double get value {
1239 try { 1239 try {
1240 Token valueToken = token; 1240 Token valueToken = token;
1241 if (identical(valueToken.kind, Tokens.PLUS_TOKEN)) { 1241 if (identical(valueToken.kind, Tokens.PLUS_TOKEN)) {
1242 valueToken = valueToken.next; 1242 valueToken = valueToken.next;
1243 } 1243 }
1244 return double.parse(valueToken.value); 1244 return double.parse(valueToken.lexeme);
1245 } on FormatException catch (ex) { 1245 } on FormatException catch (ex) {
1246 (this.handler)(token, ex); 1246 (this.handler)(token, ex);
1247 } 1247 }
1248 } 1248 }
1249 1249
1250 accept(Visitor visitor) => visitor.visitLiteralDouble(this); 1250 accept(Visitor visitor) => visitor.visitLiteralDouble(this);
1251 1251
1252 accept1(Visitor1 visitor, arg) => visitor.visitLiteralDouble(this, arg); 1252 accept1(Visitor1 visitor, arg) => visitor.visitLiteralDouble(this, arg);
1253 } 1253 }
1254 1254
1255 class LiteralBool extends Literal<bool> { 1255 class LiteralBool extends Literal<bool> {
1256 LiteralBool(Token token, DecodeErrorHandler handler) : super(token, handler); 1256 LiteralBool(Token token, DecodeErrorHandler handler) : super(token, handler);
1257 1257
1258 LiteralBool asLiteralBool() => this; 1258 LiteralBool asLiteralBool() => this;
1259 1259
1260 bool get value { 1260 bool get value {
1261 if (identical(token.stringValue, 'true')) return true; 1261 if (identical(token.stringValue, 'true')) return true;
1262 if (identical(token.stringValue, 'false')) return false; 1262 if (identical(token.stringValue, 'false')) return false;
1263 (this.handler)(token, "not a bool ${token.value}"); 1263 (this.handler)(token, "not a bool ${token.lexeme}");
1264 throw false; 1264 throw false;
1265 } 1265 }
1266 1266
1267 accept(Visitor visitor) => visitor.visitLiteralBool(this); 1267 accept(Visitor visitor) => visitor.visitLiteralBool(this);
1268 1268
1269 accept1(Visitor1 visitor, arg) => visitor.visitLiteralBool(this, arg); 1269 accept1(Visitor1 visitor, arg) => visitor.visitLiteralBool(this, arg);
1270 } 1270 }
1271 1271
1272 class StringQuoting { 1272 class StringQuoting {
1273 /// Cache of common quotings. 1273 /// Cache of common quotings.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 String get slowNameString { 1426 String get slowNameString {
1427 Unparser unparser = new Unparser(); 1427 Unparser unparser = new Unparser();
1428 unparser.unparseNodeListOfIdentifiers(identifiers); 1428 unparser.unparseNodeListOfIdentifiers(identifiers);
1429 return unparser.result; 1429 return unparser.result;
1430 } 1430 }
1431 } 1431 }
1432 1432
1433 class Identifier extends Expression with StoredTreeElementMixin { 1433 class Identifier extends Expression with StoredTreeElementMixin {
1434 final Token token; 1434 final Token token;
1435 1435
1436 String get source => token.value; 1436 String get source => token.lexeme;
1437 1437
1438 Identifier(Token this.token); 1438 Identifier(Token this.token);
1439 1439
1440 bool isThis() => identical(source, 'this'); 1440 bool isThis() => identical(source, 'this');
1441 1441
1442 bool isSuper() => identical(source, 'super'); 1442 bool isSuper() => identical(source, 'super');
1443 1443
1444 Identifier asIdentifier() => this; 1444 Identifier asIdentifier() => this;
1445 1445
1446 accept(Visitor visitor) => visitor.visitIdentifier(this); 1446 accept(Visitor visitor) => visitor.visitIdentifier(this);
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after
3217 get metadata => null; 3217 get metadata => null;
3218 get type => null; 3218 get type => null;
3219 3219
3220 // Typedef. 3220 // Typedef.
3221 get isGeneralizedTypeAlias => null; 3221 get isGeneralizedTypeAlias => null;
3222 get templateParameters => null; 3222 get templateParameters => null;
3223 get typeParameters => null; 3223 get typeParameters => null;
3224 get formals => null; 3224 get formals => null;
3225 get typedefKeyword => null; 3225 get typedefKeyword => null;
3226 } 3226 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/string_validator.dart ('k') | pkg/compiler/lib/src/tree/prettyprint.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698