| 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 | 8 |
| 9 import 'keyword.dart' show Keyword; | 9 import 'keyword.dart' show Keyword; |
| 10 | 10 |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 | 456 |
| 457 @override | 457 @override |
| 458 Token copyWithoutComments() => | 458 Token copyWithoutComments() => |
| 459 new StringToken._(info, valueOrLazySubstring, charOffset); | 459 new StringToken._(info, valueOrLazySubstring, charOffset); |
| 460 | 460 |
| 461 @override | 461 @override |
| 462 String value() => lexeme; | 462 String value() => lexeme; |
| 463 } | 463 } |
| 464 | 464 |
| 465 class CommentToken extends StringToken implements analyzer.CommentToken { | 465 class CommentToken extends StringToken implements analyzer.CommentToken { |
| 466 @override |
| 467 analyzer.TokenWithComment parent; |
| 468 |
| 466 /** | 469 /** |
| 467 * Creates a lazy comment token. If [canonicalize] is true, the string | 470 * Creates a lazy comment token. If [canonicalize] is true, the string |
| 468 * is canonicalized before the token is created. | 471 * is canonicalized before the token is created. |
| 469 */ | 472 */ |
| 470 CommentToken.fromSubstring( | 473 CommentToken.fromSubstring( |
| 471 PrecedenceInfo info, String data, int start, int end, int charOffset, | 474 PrecedenceInfo info, String data, int start, int end, int charOffset, |
| 472 {bool canonicalize: false}) | 475 {bool canonicalize: false}) |
| 473 : super.fromSubstring(info, data, start, end, charOffset, | 476 : super.fromSubstring(info, data, start, end, charOffset, |
| 474 canonicalize: canonicalize); | 477 canonicalize: canonicalize); |
| 475 | 478 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 488 : super.fromUtf8Bytes(info, data, start, end, asciiOnly, charOffset); | 491 : super.fromUtf8Bytes(info, data, start, end, asciiOnly, charOffset); |
| 489 | 492 |
| 490 CommentToken._(PrecedenceInfo info, valueOrLazySubstring, int charOffset) | 493 CommentToken._(PrecedenceInfo info, valueOrLazySubstring, int charOffset) |
| 491 : super._(info, valueOrLazySubstring, charOffset); | 494 : super._(info, valueOrLazySubstring, charOffset); |
| 492 | 495 |
| 493 @override | 496 @override |
| 494 CommentToken copy() => | 497 CommentToken copy() => |
| 495 new CommentToken._(info, valueOrLazySubstring, charOffset); | 498 new CommentToken._(info, valueOrLazySubstring, charOffset); |
| 496 | 499 |
| 497 @override | 500 @override |
| 498 analyzer.TokenWithComment get parent { | 501 void remove() { |
| 499 Token token = next; | 502 if (previous != null) { |
| 500 while (token is CommentToken) { | 503 previous.setNextWithoutSettingPrevious(next); |
| 501 token = token.next; | 504 next?.previous = previous; |
| 505 } else { |
| 506 assert(parent.precedingComments == this); |
| 507 parent.precedingComments = next as CommentToken; |
| 502 } | 508 } |
| 503 return token; | |
| 504 } | |
| 505 | |
| 506 @override | |
| 507 void set parent(analyzer.TokenWithComment ignored) { | |
| 508 throw 'unsupported operation'; | |
| 509 } | |
| 510 | |
| 511 @override | |
| 512 void remove() { | |
| 513 // TODO: implement remove | |
| 514 throw 'not implemented yet'; | |
| 515 } | 509 } |
| 516 } | 510 } |
| 517 | 511 |
| 518 class DartDocToken extends CommentToken | 512 class DartDocToken extends CommentToken |
| 519 implements analyzer.DocumentationCommentToken { | 513 implements analyzer.DocumentationCommentToken { |
| 520 /** | 514 /** |
| 521 * The references embedded within the documentation comment. | 515 * The references embedded within the documentation comment. |
| 522 * This list will be empty unless this is a documentation comment that has | 516 * This list will be empty unless this is a documentation comment that has |
| 523 * references embedded within it. | 517 * references embedded within it. |
| 524 */ | 518 */ |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 identical(value, "<=") || | 637 identical(value, "<=") || |
| 644 identical(value, "<") || | 638 identical(value, "<") || |
| 645 identical(value, "&") || | 639 identical(value, "&") || |
| 646 identical(value, "^") || | 640 identical(value, "^") || |
| 647 identical(value, "|"); | 641 identical(value, "|"); |
| 648 } | 642 } |
| 649 | 643 |
| 650 bool isTernaryOperator(String value) => identical(value, "[]="); | 644 bool isTernaryOperator(String value) => identical(value, "[]="); |
| 651 | 645 |
| 652 bool isMinusOperator(String value) => identical(value, "-"); | 646 bool isMinusOperator(String value) => identical(value, "-"); |
| OLD | NEW |