| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.scanner; | 8 library engine.scanner; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2050 * The previous token in the token stream. | 2050 * The previous token in the token stream. |
| 2051 */ | 2051 */ |
| 2052 Token previous; | 2052 Token previous; |
| 2053 | 2053 |
| 2054 /** | 2054 /** |
| 2055 * The next token in the token stream. | 2055 * The next token in the token stream. |
| 2056 */ | 2056 */ |
| 2057 Token _next; | 2057 Token _next; |
| 2058 | 2058 |
| 2059 /** | 2059 /** |
| 2060 * Compare the given [tokens] to find the token that appears first in the |
| 2061 * source being parsed. That is, return the left-most of all of the tokens. |
| 2062 * The list must be non-`null`, but the elements of the list are allowed to be |
| 2063 * `null`. Return the token with the smallest offset, or `null` if there are |
| 2064 * no tokens or if all of the tokens are `null`. |
| 2065 */ |
| 2066 static Token lexicallyFirst(List<Token> tokens) { |
| 2067 Token first = null; |
| 2068 int offset = -1; |
| 2069 for (Token token in tokens) { |
| 2070 if (token != null && (offset < 0 || token.offset < offset)) { |
| 2071 first = token; |
| 2072 offset = token.offset; |
| 2073 } |
| 2074 } |
| 2075 return first; |
| 2076 } |
| 2077 |
| 2078 |
| 2079 /** |
| 2060 * Initialize a newly created token to have the given type and offset. | 2080 * Initialize a newly created token to have the given type and offset. |
| 2061 * | 2081 * |
| 2062 * @param type the type of the token | 2082 * @param type the type of the token |
| 2063 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 2083 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 2064 */ | 2084 */ |
| 2065 Token(this.type, int offset) { | 2085 Token(this.type, int offset) { |
| 2066 this.offset = offset; | 2086 this.offset = offset; |
| 2067 } | 2087 } |
| 2068 | 2088 |
| 2069 /** | 2089 /** |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2683 * @param precedingComment the first comment in the list of comments that prec
ede this token | 2703 * @param precedingComment the first comment in the list of comments that prec
ede this token |
| 2684 */ | 2704 */ |
| 2685 TokenWithComment(TokenType type, int offset, this._precedingComment) : super(t
ype, offset); | 2705 TokenWithComment(TokenType type, int offset, this._precedingComment) : super(t
ype, offset); |
| 2686 | 2706 |
| 2687 @override | 2707 @override |
| 2688 Token copy() => new TokenWithComment(type, offset, _precedingComment); | 2708 Token copy() => new TokenWithComment(type, offset, _precedingComment); |
| 2689 | 2709 |
| 2690 @override | 2710 @override |
| 2691 Token get precedingComments => _precedingComment; | 2711 Token get precedingComments => _precedingComment; |
| 2692 } | 2712 } |
| OLD | NEW |