OLD | NEW |
1 library constants; | 1 library constants; |
2 | 2 |
3 import 'utils.dart'; | 3 import 'utils.dart'; |
4 | 4 |
5 // TODO(jmesserly): fix up the const lists. For the bigger ones, we need faster | 5 // TODO(jmesserly): fix up the const lists. For the bigger ones, we need faster |
6 // lookup than linear search "contains". In the Python code they were | 6 // lookup than linear search "contains". In the Python code they were |
7 // frozensets. | 7 // frozensets. |
8 | 8 |
9 final String EOF = null; | 9 final String EOF = null; |
10 | 10 |
11 class ReparseException implements Exception { | 11 class ReparseException implements Exception { |
12 final String message; | 12 final String message; |
13 ReparseException(this.message); | 13 ReparseException(this.message); |
14 String toString() => "ReparseException: $message"; | 14 String toString() => "ReparseException: $message"; |
15 } | 15 } |
16 | 16 |
17 // TODO(jmesserly): assuming the programmatic name is not important, it would be | 17 // TODO(jmesserly): assuming the programmatic name is not important, it would be |
18 // good to make these "static const" fields on an ErrorMessage class. | 18 // good to make these "static const" fields on an ErrorMessage class. |
19 /** | 19 /// These are error messages emitted by [HtmlParser]. The values use Python |
20 * These are error messages emitted by [HtmlParser]. The values use Python style | 20 /// style string formatting, as implemented by [formatStr]. That function only |
21 * string formatting, as implemented by [formatStr]. That function only supports | 21 /// supports the subset of format functionality used here. |
22 * the subset of format functionality used here. | |
23 */ | |
24 const Map<String, String> errorMessages = const { | 22 const Map<String, String> errorMessages = const { |
25 "null-character": | 23 "null-character": |
26 "Null character in input stream, replaced with U+FFFD.", | 24 "Null character in input stream, replaced with U+FFFD.", |
27 "invalid-codepoint": | 25 "invalid-codepoint": |
28 "Invalid codepoint in stream.", | 26 "Invalid codepoint in stream.", |
29 "incorrectly-placed-solidus": | 27 "incorrectly-placed-solidus": |
30 "Solidus (/) incorrectly placed in tag.", | 28 "Solidus (/) incorrectly placed in tag.", |
31 "incorrect-cr-newline-entity": | 29 "incorrect-cr-newline-entity": |
32 "Incorrect CR newline entity, replaced with LF.", | 30 "Incorrect CR newline entity, replaced with LF.", |
33 "illegal-windows-1252-entity": | 31 "illegal-windows-1252-entity": |
(...skipping 3081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3115 'windows1252': 'cp1252', | 3113 'windows1252': 'cp1252', |
3116 'windows1253': 'cp1253', | 3114 'windows1253': 'cp1253', |
3117 'windows1254': 'cp1254', | 3115 'windows1254': 'cp1254', |
3118 'windows1255': 'cp1255', | 3116 'windows1255': 'cp1255', |
3119 'windows1256': 'cp1256', | 3117 'windows1256': 'cp1256', |
3120 'windows1257': 'cp1257', | 3118 'windows1257': 'cp1257', |
3121 'windows1258': 'cp1258', | 3119 'windows1258': 'cp1258', |
3122 'windows936': 'gbk', | 3120 'windows936': 'gbk', |
3123 'x-x-big5': 'big5' | 3121 'x-x-big5': 'big5' |
3124 }; | 3122 }; |
OLD | NEW |