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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 _error('unexpected string', _makeSpan(start)); | 917 _error('unexpected string', _makeSpan(start)); |
918 } | 918 } |
919 } | 919 } |
920 | 920 |
921 StringBuffer stringValue = new StringBuffer(); | 921 StringBuffer stringValue = new StringBuffer(); |
922 | 922 |
923 // Gobble up everything until we hit our stop token. | 923 // Gobble up everything until we hit our stop token. |
924 int runningStart = _peekToken.start; | 924 int runningStart = _peekToken.start; |
925 while (_peek() != stopToken && _peek() != TokenKind.END_OF_FILE) { | 925 while (_peek() != stopToken && _peek() != TokenKind.END_OF_FILE) { |
926 var tok = _next(); | 926 var tok = _next(); |
927 stringValue.add(tok.text); | 927 stringValue.write(tok.text); |
928 } | 928 } |
929 | 929 |
930 if (stopToken != TokenKind.RPAREN) { | 930 if (stopToken != TokenKind.RPAREN) { |
931 _next(); // Skip the SINGLE_QUOTE or DOUBLE_QUOTE; | 931 _next(); // Skip the SINGLE_QUOTE or DOUBLE_QUOTE; |
932 } | 932 } |
933 | 933 |
934 return stringValue.toString(); | 934 return stringValue.toString(); |
935 } | 935 } |
936 | 936 |
937 // Function grammar: | 937 // Function grammar: |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |