| 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 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 int next = _reader.advance(); | 933 int next = _reader.advance(); |
| 934 while (next != -1) { | 934 while (next != -1) { |
| 935 tokenCounter++; | 935 tokenCounter++; |
| 936 next = bigSwitch(next); | 936 next = bigSwitch(next); |
| 937 } | 937 } |
| 938 _appendEofToken(); | 938 _appendEofToken(); |
| 939 instrumentation.metric2("tokensCount", tokenCounter); | 939 instrumentation.metric2("tokensCount", tokenCounter); |
| 940 return firstToken; | 940 return firstToken; |
| 941 } finally { | 941 } finally { |
| 942 instrumentation.log2(2); | 942 instrumentation.log2(2); |
| 943 //Log if over 1ms |
| 943 } | 944 } |
| 944 } | 945 } |
| 945 | 946 |
| 946 /** | 947 /** |
| 947 * Append the given token to the end of the token stream being scanned. This m
ethod is intended to | 948 * Append the given token to the end of the token stream being scanned. This m
ethod is intended to |
| 948 * be used by subclasses that copy existing tokens and should not normally be
used because it will | 949 * be used by subclasses that copy existing tokens and should not normally be
used because it will |
| 949 * fail to correctly associate any comments with the token being passed in. | 950 * fail to correctly associate any comments with the token being passed in. |
| 950 * | 951 * |
| 951 * @param token the token to be appended | 952 * @param token the token to be appended |
| 952 */ | 953 */ |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1170 } else { | 1171 } else { |
| 1171 eofToken = new TokenWithComment(TokenType.EOF, _reader.offset + 1, _firstC
omment); | 1172 eofToken = new TokenWithComment(TokenType.EOF, _reader.offset + 1, _firstC
omment); |
| 1172 _firstComment = null; | 1173 _firstComment = null; |
| 1173 _lastComment = null; | 1174 _lastComment = null; |
| 1174 } | 1175 } |
| 1175 // The EOF token points to itself so that there is always infinite look-ahea
d. | 1176 // The EOF token points to itself so that there is always infinite look-ahea
d. |
| 1176 eofToken.setNext(eofToken); | 1177 eofToken.setNext(eofToken); |
| 1177 _tail = _tail.setNext(eofToken); | 1178 _tail = _tail.setNext(eofToken); |
| 1178 if (_stackEnd >= 0) { | 1179 if (_stackEnd >= 0) { |
| 1179 _hasUnmatchedGroups = true; | 1180 _hasUnmatchedGroups = true; |
| 1181 // TODO(brianwilkerson) Fix the ungrouped tokens? |
| 1180 } | 1182 } |
| 1181 } | 1183 } |
| 1182 | 1184 |
| 1183 void _appendKeywordToken(Keyword keyword) { | 1185 void _appendKeywordToken(Keyword keyword) { |
| 1184 if (_firstComment == null) { | 1186 if (_firstComment == null) { |
| 1185 _tail = _tail.setNext(new KeywordToken(keyword, _tokenStart)); | 1187 _tail = _tail.setNext(new KeywordToken(keyword, _tokenStart)); |
| 1186 } else { | 1188 } else { |
| 1187 _tail = _tail.setNext(new KeywordTokenWithComment(keyword, _tokenStart, _f
irstComment)); | 1189 _tail = _tail.setNext(new KeywordTokenWithComment(keyword, _tokenStart, _f
irstComment)); |
| 1188 _firstComment = null; | 1190 _firstComment = null; |
| 1189 _lastComment = null; | 1191 _lastComment = null; |
| (...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2695 * @param precedingComment the first comment in the list of comments that prec
ede this token | 2697 * @param precedingComment the first comment in the list of comments that prec
ede this token |
| 2696 */ | 2698 */ |
| 2697 TokenWithComment(TokenType type, int offset, this._precedingComment) : super(t
ype, offset); | 2699 TokenWithComment(TokenType type, int offset, this._precedingComment) : super(t
ype, offset); |
| 2698 | 2700 |
| 2699 @override | 2701 @override |
| 2700 Token copy() => new TokenWithComment(type, offset, _precedingComment); | 2702 Token copy() => new TokenWithComment(type, offset, _precedingComment); |
| 2701 | 2703 |
| 2702 @override | 2704 @override |
| 2703 Token get precedingComments => _precedingComment; | 2705 Token get precedingComments => _precedingComment; |
| 2704 } | 2706 } |
| OLD | NEW |