| 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 | 3 |
| 4 /** | 4 /** |
| 5 * A simple recursive descent parser for CSS. | 5 * A simple recursive descent parser for CSS. |
| 6 */ | 6 */ |
| 7 class Parser { | 7 class Parser { |
| 8 Tokenizer tokenizer; | 8 Tokenizer tokenizer; |
| 9 | 9 |
| 10 var _fs; // If non-null filesystem to read files. | 10 var _fs; // If non-null filesystem to read files. |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 } else { | 753 } else { |
| 754 _errorExpected("hex number"); | 754 _errorExpected("hex number"); |
| 755 } | 755 } |
| 756 | 756 |
| 757 try { | 757 try { |
| 758 int hexValue = parseHex(hexText); | 758 int hexValue = parseHex(hexText); |
| 759 return new HexColorTerm(hexValue, hexText, _makeSpan(start)); | 759 return new HexColorTerm(hexValue, hexText, _makeSpan(start)); |
| 760 } catch (HexNumberException hne) { | 760 } catch (HexNumberException hne) { |
| 761 _error('Bad hex number', _makeSpan(start)); | 761 _error('Bad hex number', _makeSpan(start)); |
| 762 } | 762 } |
| 763 break; |
| 763 case TokenKind.INTEGER: | 764 case TokenKind.INTEGER: |
| 764 t = _next(); | 765 t = _next(); |
| 765 value = Math.parseInt("${unary}${t.text}"); | 766 value = Math.parseInt("${unary}${t.text}"); |
| 766 break; | 767 break; |
| 767 case TokenKind.DOUBLE: | 768 case TokenKind.DOUBLE: |
| 768 t = _next(); | 769 t = _next(); |
| 769 value = Math.parseDouble("${unary}${t.text}"); | 770 value = Math.parseDouble("${unary}${t.text}"); |
| 770 break; | 771 break; |
| 771 case TokenKind.SINGLE_QUOTE: | 772 case TokenKind.SINGLE_QUOTE: |
| 772 case TokenKind.DOUBLE_QUOTE: | 773 case TokenKind.DOUBLE_QUOTE: |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 | 1008 |
| 1008 return result; | 1009 return result; |
| 1009 } | 1010 } |
| 1010 } | 1011 } |
| 1011 | 1012 |
| 1012 /** Not a hex number. */ | 1013 /** Not a hex number. */ |
| 1013 class HexNumberException implements Exception { | 1014 class HexNumberException implements Exception { |
| 1014 HexNumberException(); | 1015 HexNumberException(); |
| 1015 } | 1016 } |
| 1016 | 1017 |
| OLD | NEW |