| 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 part of scanner; | 5 part of scanner; |
| 6 | 6 |
| 7 const int EOF_TOKEN = 0; | 7 const int EOF_TOKEN = 0; |
| 8 | 8 |
| 9 const int KEYWORD_TOKEN = $k; | 9 const int KEYWORD_TOKEN = $k; |
| 10 const int IDENTIFIER_TOKEN = $a; | 10 const int IDENTIFIER_TOKEN = $a; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // instead of the size of the length of the error message. | 162 // instead of the size of the length of the error message. |
| 163 return 1; | 163 return 1; |
| 164 } else { | 164 } else { |
| 165 return value.length; | 165 return value.length; |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 int get hashCode => computeHashCode(charOffset, info, value); | 169 int get hashCode => computeHashCode(charOffset, info, value); |
| 170 } | 170 } |
| 171 | 171 |
| 172 /// A pair of tokens marking the beginning and the end of a span. Use for error |
| 173 /// reporting. |
| 174 class TokenPair implements Spannable { |
| 175 final Token begin; |
| 176 final Token end; |
| 177 |
| 178 TokenPair(this.begin, this.end); |
| 179 } |
| 180 |
| 172 /** | 181 /** |
| 173 * A [SymbolToken] represents the symbol in its precendence info. | 182 * A [SymbolToken] represents the symbol in its precendence info. |
| 174 * Also used for end of file with EOF_INFO. | 183 * Also used for end of file with EOF_INFO. |
| 175 */ | 184 */ |
| 176 class SymbolToken extends Token { | 185 class SymbolToken extends Token { |
| 177 | 186 |
| 178 final PrecedenceInfo info; | 187 final PrecedenceInfo info; |
| 179 | 188 |
| 180 SymbolToken(this.info, int charOffset) : super(charOffset); | 189 SymbolToken(this.info, int charOffset) : super(charOffset); |
| 181 | 190 |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 | 722 |
| 714 const PrecedenceInfo STRING_INTERPOLATION_IDENTIFIER_INFO = | 723 const PrecedenceInfo STRING_INTERPOLATION_IDENTIFIER_INFO = |
| 715 const PrecedenceInfo('\$', 0, | 724 const PrecedenceInfo('\$', 0, |
| 716 STRING_INTERPOLATION_IDENTIFIER_TOKEN); | 725 STRING_INTERPOLATION_IDENTIFIER_TOKEN); |
| 717 | 726 |
| 718 const PrecedenceInfo HEXADECIMAL_INFO = | 727 const PrecedenceInfo HEXADECIMAL_INFO = |
| 719 const PrecedenceInfo('hexadecimal', 0, HEXADECIMAL_TOKEN); | 728 const PrecedenceInfo('hexadecimal', 0, HEXADECIMAL_TOKEN); |
| 720 | 729 |
| 721 const PrecedenceInfo COMMENT_INFO = | 730 const PrecedenceInfo COMMENT_INFO = |
| 722 const PrecedenceInfo('comment', 0, COMMENT_TOKEN); | 731 const PrecedenceInfo('comment', 0, COMMENT_TOKEN); |
| OLD | NEW |