OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library analyzer.src.task.html; | 5 library analyzer.src.task.html; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/src/context/cache.dart'; | 9 import 'package:analyzer/src/context/cache.dart'; |
10 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; | 10 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 } else { | 315 } else { |
316 HtmlParser parser = new HtmlParser(content, generateSpans: true); | 316 HtmlParser parser = new HtmlParser(content, generateSpans: true); |
317 parser.compatMode = 'quirks'; | 317 parser.compatMode = 'quirks'; |
318 Document document = parser.parse(); | 318 Document document = parser.parse(); |
319 // | 319 // |
320 // Convert errors. | 320 // Convert errors. |
321 // | 321 // |
322 List<ParseError> parseErrors = parser.errors; | 322 List<ParseError> parseErrors = parser.errors; |
323 List<AnalysisError> errors = <AnalysisError>[]; | 323 List<AnalysisError> errors = <AnalysisError>[]; |
324 for (ParseError parseError in parseErrors) { | 324 for (ParseError parseError in parseErrors) { |
| 325 if (parseError.errorCode == 'expected-doctype-but-got-start-tag') { |
| 326 continue; |
| 327 } |
325 SourceSpan span = parseError.span; | 328 SourceSpan span = parseError.span; |
326 errors.add(new AnalysisError(target.source, span.start.offset, | 329 errors.add(new AnalysisError(target.source, span.start.offset, |
327 span.length, HtmlErrorCode.PARSE_ERROR, [parseError.message])); | 330 span.length, HtmlErrorCode.PARSE_ERROR, [parseError.message])); |
328 } | 331 } |
329 // | 332 // |
330 // Record outputs. | 333 // Record outputs. |
331 // | 334 // |
332 outputs[HTML_DOCUMENT] = document; | 335 outputs[HTML_DOCUMENT] = document; |
333 outputs[HTML_DOCUMENT_ERRORS] = errors; | 336 outputs[HTML_DOCUMENT_ERRORS] = errors; |
334 outputs[LINE_INFO] = _computeLineInfo(content); | 337 outputs[LINE_INFO] = _computeLineInfo(content); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 * The content of the fragment. | 394 * The content of the fragment. |
392 */ | 395 */ |
393 final String content; | 396 final String content; |
394 | 397 |
395 /** | 398 /** |
396 * Initialize a newly created script fragment to have the given [offset] and | 399 * Initialize a newly created script fragment to have the given [offset] and |
397 * [content]. | 400 * [content]. |
398 */ | 401 */ |
399 ScriptFragment(this.offset, this.line, this.column, this.content); | 402 ScriptFragment(this.offset, this.line, this.column, this.content); |
400 } | 403 } |
OLD | NEW |