Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: pkg/third_party/html5lib/lib/parser.dart

Issue 157983005: pkg/third_party/html5lib: lots of cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: const Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /** 1 /**
2 * This library has a parser for HTML5 documents, that lets you parse HTML 2 * This library has a parser for HTML5 documents, that lets you parse HTML
3 * easily from a script or server side application: 3 * easily from a script or server side application:
4 * 4 *
5 * import 'package:html5lib/parser.dart' show parse; 5 * import 'package:html5lib/parser.dart' show parse;
6 * import 'package:html5lib/dom.dart'; 6 * import 'package:html5lib/dom.dart';
7 * main() { 7 * main() {
8 * var document = parse( 8 * var document = parse(
9 * '<body>Hello world! <a href="www.html5rocks.com">HTML5 rocks!'); 9 * '<body>Hello world! <a href="www.html5rocks.com">HTML5 rocks!');
10 * print(document.outerHtml); 10 * print(document.outerHtml);
11 * } 11 * }
12 * 12 *
13 * The resulting document you get back has a DOM-like API for easy tree 13 * The resulting document you get back has a DOM-like API for easy tree
14 * traversal and manipulation. 14 * traversal and manipulation.
15 */ 15 */
16 library parser; 16 library parser;
17 17
18 import 'dart:collection'; 18 import 'dart:collection';
19 import 'dart:math'; 19 import 'dart:math';
20 import 'package:source_maps/span.dart' show Span, FileSpan; 20 import 'package:source_maps/span.dart' show Span, FileSpan;
21 21
22 import 'src/treebuilder.dart'; 22 import 'src/treebuilder.dart';
23 import 'src/constants.dart'; 23 import 'src/constants.dart';
24 import 'src/encoding_parser.dart'; 24 import 'src/encoding_parser.dart';
25 import 'src/token.dart'; 25 import 'src/token.dart';
26 import 'src/tokenizer.dart'; 26 import 'src/tokenizer.dart';
27 import 'src/utils.dart'; 27 import 'src/utils.dart';
28 import 'dom.dart'; 28 import 'dom.dart';
29 import 'dom_parsing.dart';
30 29
31 /** 30 /**
32 * Parse the [input] html5 document into a tree. The [input] can be 31 * Parse the [input] html5 document into a tree. The [input] can be
33 * a [String], [List<int>] of bytes or an [HtmlTokenizer]. 32 * a [String], [List<int>] of bytes or an [HtmlTokenizer].
34 * 33 *
35 * If [input] is not a [HtmlTokenizer], you can optionally specify the file's 34 * If [input] is not a [HtmlTokenizer], you can optionally specify the file's
36 * [encoding], which must be a string. If specified, that encoding will be used, 35 * [encoding], which must be a string. If specified, that encoding will be used,
37 * regardless of any BOM or later declaration (such as in a meta element). 36 * regardless of any BOM or later declaration (such as in a meta element).
38 * 37 *
39 * Set [generateSpans] if you want to generate [Span]s, otherwise the 38 * Set [generateSpans] if you want to generate [Span]s, otherwise the
(...skipping 3296 matching lines...) Expand 10 before | Expand all | Expand 10 after
3336 * [span.getLocationMessage] will not show any source url information, but 3335 * [span.getLocationMessage] will not show any source url information, but
3337 * [toString] will include 'ParserError:' as a prefix. 3336 * [toString] will include 'ParserError:' as a prefix.
3338 */ 3337 */
3339 String get message => formatStr(errorMessages[errorCode], data); 3338 String get message => formatStr(errorMessages[errorCode], data);
3340 3339
3341 String toString() { 3340 String toString() {
3342 var res = span.getLocationMessage(message); 3341 var res = span.getLocationMessage(message);
3343 return span.sourceUrl == null ? 'ParserError$res' : res; 3342 return span.sourceUrl == null ? 'ParserError$res' : res;
3344 } 3343 }
3345 } 3344 }
OLDNEW
« no previous file with comments | « pkg/third_party/html5lib/lib/dom_parsing.dart ('k') | pkg/third_party/html5lib/lib/src/constants.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698