| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 fasta.scanner.token; | 5 library fasta.scanner.token; |
| 6 | 6 |
| 7 import '../../scanner/token.dart' as analyzer; | 7 import '../../scanner/token.dart' as analyzer; |
| 8 import '../../scanner/token.dart' show Token, TokenType; | 8 import '../../scanner/token.dart' show Token, TokenType; |
| 9 | 9 |
| 10 import 'token_constants.dart' show IDENTIFIER_TOKEN; | 10 import 'token_constants.dart' show IDENTIFIER_TOKEN; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 if (!canonicalize) return s; | 111 if (!canonicalize) return s; |
| 112 return canonicalizer.canonicalize(s, start, end, false); | 112 return canonicalizer.canonicalize(s, start, end, false); |
| 113 } | 113 } |
| 114 | 114 |
| 115 static String decodeUtf8(List<int> data, int start, int end, bool asciiOnly) { | 115 static String decodeUtf8(List<int> data, int start, int end, bool asciiOnly) { |
| 116 return canonicalizer.canonicalize(data, start, end, asciiOnly); | 116 return canonicalizer.canonicalize(data, start, end, asciiOnly); |
| 117 } | 117 } |
| 118 | 118 |
| 119 @override | 119 @override |
| 120 Token copy() => new StringToken._( | 120 Token copy() => new StringToken._( |
| 121 type, valueOrLazySubstring, charOffset, precedingComments); | 121 type, valueOrLazySubstring, charOffset, copyComments(precedingComments)); |
| 122 | 122 |
| 123 @override | 123 @override |
| 124 String value() => lexeme; | 124 String value() => lexeme; |
| 125 } | 125 } |
| 126 | 126 |
| 127 /** | 127 /** |
| 128 * A String-valued token that does not exist in the original source. | 128 * A String-valued token that does not exist in the original source. |
| 129 */ | 129 */ |
| 130 class SyntheticStringToken extends StringToken | 130 class SyntheticStringToken extends StringToken |
| 131 implements analyzer.SyntheticStringToken { | 131 implements analyzer.SyntheticStringToken { |
| 132 SyntheticStringToken(TokenType type, String value, int offset, | 132 SyntheticStringToken(TokenType type, String value, int offset, |
| 133 [analyzer.CommentToken precedingComments]) | 133 [analyzer.CommentToken precedingComments]) |
| 134 : super._(type, value, offset, precedingComments); | 134 : super._(type, value, offset, precedingComments); |
| 135 | 135 |
| 136 @override | 136 @override |
| 137 int get length => 0; | 137 int get length => 0; |
| 138 | 138 |
| 139 @override | 139 @override |
| 140 Token copy() => new SyntheticStringToken( | 140 Token copy() => new SyntheticStringToken( |
| 141 type, valueOrLazySubstring, offset, precedingComments); | 141 type, valueOrLazySubstring, offset, copyComments(precedingComments)); |
| 142 } | 142 } |
| 143 | 143 |
| 144 class CommentToken extends StringToken implements analyzer.CommentToken { | 144 class CommentToken extends StringToken implements analyzer.CommentToken { |
| 145 @override | 145 @override |
| 146 analyzer.TokenWithComment parent; | 146 analyzer.TokenWithComment parent; |
| 147 | 147 |
| 148 /** | 148 /** |
| 149 * Creates a lazy comment token. If [canonicalize] is true, the string | 149 * Creates a lazy comment token. If [canonicalize] is true, the string |
| 150 * is canonicalized before the token is created. | 150 * is canonicalized before the token is created. |
| 151 */ | 151 */ |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 identical(value, "<=") || | 312 identical(value, "<=") || |
| 313 identical(value, "<") || | 313 identical(value, "<") || |
| 314 identical(value, "&") || | 314 identical(value, "&") || |
| 315 identical(value, "^") || | 315 identical(value, "^") || |
| 316 identical(value, "|"); | 316 identical(value, "|"); |
| 317 } | 317 } |
| 318 | 318 |
| 319 bool isTernaryOperator(String value) => identical(value, "[]="); | 319 bool isTernaryOperator(String value) => identical(value, "[]="); |
| 320 | 320 |
| 321 bool isMinusOperator(String value) => identical(value, "-"); | 321 bool isMinusOperator(String value) => identical(value, "-"); |
| OLD | NEW |