OLD | NEW |
1 library tokenizer; | 1 library tokenizer; |
2 | 2 |
3 import 'dart:collection'; | 3 import 'dart:collection'; |
4 import 'dart:math'; | 4 import 'dart:math'; |
5 import 'package:html5lib/parser.dart' show HtmlParser; | 5 import 'package:html5lib/parser.dart' show HtmlParser; |
6 import 'package:source_maps/span.dart' show Span, FileSpan; | 6 import 'package:source_maps/span.dart' show Span, FileSpan; |
7 import 'constants.dart'; | 7 import 'constants.dart'; |
8 import 'inputstream.dart'; | 8 import 'inputstream.dart'; |
9 import 'token.dart'; | 9 import 'token.dart'; |
10 import 'utils.dart'; | 10 import 'utils.dart'; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 HtmlParser parser; | 52 HtmlParser parser; |
53 | 53 |
54 final Queue<Token> tokenQueue; | 54 final Queue<Token> tokenQueue; |
55 | 55 |
56 /** Holds the token that is currently being processed. */ | 56 /** Holds the token that is currently being processed. */ |
57 Token currentToken; | 57 Token currentToken; |
58 | 58 |
59 /** | 59 /** |
60 * Holds a reference to the method to be invoked for the next parser state. | 60 * Holds a reference to the method to be invoked for the next parser state. |
61 */ | 61 */ |
62 Predicate state; | 62 // TODO(jmesserly): the type should be "Predicate" but a dart2js checked mode |
| 63 // bug prevents us from doing that. See http://dartbug.com/12465 |
| 64 Function state; |
63 | 65 |
64 String temporaryBuffer; | 66 String temporaryBuffer; |
65 | 67 |
66 int _lastOffset; | 68 int _lastOffset; |
67 | 69 |
68 // TODO(jmesserly): ideally this would be a LinkedHashMap and we wouldn't add | 70 // TODO(jmesserly): ideally this would be a LinkedHashMap and we wouldn't add |
69 // an item until it's ready. But the code doesn't have a clear notion of when | 71 // an item until it's ready. But the code doesn't have a clear notion of when |
70 // it's "done" with the attribute. | 72 // it's "done" with the attribute. |
71 List<TagAttribute> _attributes; | 73 List<TagAttribute> _attributes; |
72 Set<String> _attributeNames; | 74 Set<String> _attributeNames; |
(...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1891 } | 1893 } |
1892 | 1894 |
1893 if (data.length > 0) { | 1895 if (data.length > 0) { |
1894 _addToken(new CharactersToken(data.join())); | 1896 _addToken(new CharactersToken(data.join())); |
1895 } | 1897 } |
1896 state = dataState; | 1898 state = dataState; |
1897 return true; | 1899 return true; |
1898 } | 1900 } |
1899 } | 1901 } |
1900 | 1902 |
OLD | NEW |