Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.scanner; | 5 library engine.scanner; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'error.dart'; | 9 import 'error.dart'; |
| 10 import 'instrumentation.dart'; | 10 import 'instrumentation.dart'; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 /** | 232 /** |
| 233 * A `CommentToken` is a token representing a comment. | 233 * A `CommentToken` is a token representing a comment. |
| 234 */ | 234 */ |
| 235 class CommentToken extends StringToken { | 235 class CommentToken extends StringToken { |
| 236 /** | 236 /** |
| 237 * The [Token] that contains this comment. | 237 * The [Token] that contains this comment. |
| 238 */ | 238 */ |
| 239 Token parent; | 239 Token parent; |
| 240 | 240 |
| 241 /** | 241 /** |
| 242 * The references embedded within the documentation comment. | |
| 243 * This list will be empty unless this is a documentation comment that has | |
| 244 * references embedded within it. | |
| 245 */ | |
| 246 final List<Token> references = <Token>[]; | |
|
Brian Wilkerson
2014/12/01 19:41:19
How hard would it be to have a subclass of Comment
scheglov
2014/12/01 22:49:22
https://codereview.chromium.org/768233002
| |
| 247 | |
| 248 /** | |
| 242 * Initialize a newly created token to represent a token of the given [type] | 249 * Initialize a newly created token to represent a token of the given [type] |
| 243 * with the given [value] at the given [offset]. | 250 * with the given [value] at the given [offset]. |
| 244 */ | 251 */ |
| 245 CommentToken(TokenType type, String value, int offset) | 252 CommentToken(TokenType type, String value, int offset) |
| 246 : super(type, value, offset); | 253 : super(type, value, offset); |
| 247 | 254 |
| 248 @override | 255 @override |
| 249 CommentToken copy() => new CommentToken(type, _value, offset); | 256 CommentToken copy() => new CommentToken(type, _value, offset); |
| 250 } | 257 } |
| 251 | 258 |
| (...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2015 /** | 2022 /** |
| 2016 * Return the first comment in the list of comments that precede this token, | 2023 * Return the first comment in the list of comments that precede this token, |
| 2017 * or `null` if there are no comments preceding this token. Additional | 2024 * or `null` if there are no comments preceding this token. Additional |
| 2018 * comments can be reached by following the token stream using [next] until | 2025 * comments can be reached by following the token stream using [next] until |
| 2019 * `null` is returned. | 2026 * `null` is returned. |
| 2020 * | 2027 * |
| 2021 * For example, if the original contents were "/* one */ /* two */ id", then | 2028 * For example, if the original contents were "/* one */ /* two */ id", then |
| 2022 * the first preceding comment token will have a lexeme of "/* one */" and | 2029 * the first preceding comment token will have a lexeme of "/* one */" and |
| 2023 * the next comment token will have a lexeme of "/* two */". | 2030 * the next comment token will have a lexeme of "/* two */". |
| 2024 */ | 2031 */ |
| 2025 Token get precedingComments => null; | 2032 CommentToken get precedingComments => null; |
| 2026 | 2033 |
| 2027 /** | 2034 /** |
| 2028 * Apply (add) the given [delta] to this token's offset. | 2035 * Apply (add) the given [delta] to this token's offset. |
| 2029 */ | 2036 */ |
| 2030 void applyDelta(int delta) { | 2037 void applyDelta(int delta) { |
| 2031 offset += delta; | 2038 offset += delta; |
| 2032 } | 2039 } |
| 2033 | 2040 |
| 2034 /** | 2041 /** |
| 2035 * Return a newly created token that is a copy of this token but that is not a | 2042 * Return a newly created token that is a copy of this token but that is not a |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2613 CommentToken get precedingComments => _precedingComment; | 2620 CommentToken get precedingComments => _precedingComment; |
| 2614 | 2621 |
| 2615 void set precedingComments(CommentToken comment) { | 2622 void set precedingComments(CommentToken comment) { |
| 2616 _precedingComment = comment; | 2623 _precedingComment = comment; |
| 2617 _setCommentParent(_precedingComment); | 2624 _setCommentParent(_precedingComment); |
| 2618 } | 2625 } |
| 2619 | 2626 |
| 2620 @override | 2627 @override |
| 2621 Token copy() => new TokenWithComment(type, offset, precedingComments); | 2628 Token copy() => new TokenWithComment(type, offset, precedingComments); |
| 2622 } | 2629 } |
| OLD | NEW |