| 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 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 return c - 55; | 992 return c - 55; |
| 993 } else { | 993 } else { |
| 994 return -1; | 994 return -1; |
| 995 } | 995 } |
| 996 } | 996 } |
| 997 | 997 |
| 998 static int parseHex(String hex) { | 998 static int parseHex(String hex) { |
| 999 var result = 0; | 999 var result = 0; |
| 1000 | 1000 |
| 1001 for (int i = 0; i < hex.length; i++) { | 1001 for (int i = 0; i < hex.length; i++) { |
| 1002 var digit = _hexDigit(hex.charCodeAt(i)); | 1002 var digit = _hexDigit(hex.codeUnitAt(i)); |
| 1003 if (digit < 0) { | 1003 if (digit < 0) { |
| 1004 throw new HexNumberException(); | 1004 throw new HexNumberException(); |
| 1005 } | 1005 } |
| 1006 result = (result << 4) + digit; | 1006 result = (result << 4) + digit; |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 return result; | 1009 return result; |
| 1010 } | 1010 } |
| 1011 } | 1011 } |
| 1012 | 1012 |
| 1013 /** Not a hex number. */ | 1013 /** Not a hex number. */ |
| 1014 class HexNumberException implements Exception { | 1014 class HexNumberException implements Exception { |
| 1015 HexNumberException(); | 1015 HexNumberException(); |
| 1016 } | 1016 } |
| 1017 | 1017 |
| OLD | NEW |