| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 target.source, 0, 0, ScannerErrorCode.UNABLE_GET_CONTENT, [message]) | 312 target.source, 0, 0, ScannerErrorCode.UNABLE_GET_CONTENT, [message]) |
| 313 ]; | 313 ]; |
| 314 outputs[LINE_INFO] = new LineInfo(<int>[0]); | 314 outputs[LINE_INFO] = new LineInfo(<int>[0]); |
| 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; | |
| 323 List<AnalysisError> errors = <AnalysisError>[]; | 322 List<AnalysisError> errors = <AnalysisError>[]; |
| 324 for (ParseError parseError in parseErrors) { | 323 // TODO(scheglov) https://github.com/dart-lang/sdk/issues/24643 |
| 325 if (parseError.errorCode == 'expected-doctype-but-got-start-tag') { | 324 // List<ParseError> parseErrors = parser.errors; |
| 326 continue; | 325 // for (ParseError parseError in parseErrors) { |
| 327 } | 326 // if (parseError.errorCode == 'expected-doctype-but-got-start-tag') { |
| 328 SourceSpan span = parseError.span; | 327 // continue; |
| 329 errors.add(new AnalysisError(target.source, span.start.offset, | 328 // } |
| 330 span.length, HtmlErrorCode.PARSE_ERROR, [parseError.message])); | 329 // SourceSpan span = parseError.span; |
| 331 } | 330 // errors.add(new AnalysisError(target.source, span.start.offset, |
| 331 // span.length, HtmlErrorCode.PARSE_ERROR, [parseError.message])); |
| 332 // } |
| 332 // | 333 // |
| 333 // Record outputs. | 334 // Record outputs. |
| 334 // | 335 // |
| 335 outputs[HTML_DOCUMENT] = document; | 336 outputs[HTML_DOCUMENT] = document; |
| 336 outputs[HTML_DOCUMENT_ERRORS] = errors; | 337 outputs[HTML_DOCUMENT_ERRORS] = errors; |
| 337 outputs[LINE_INFO] = _computeLineInfo(content); | 338 outputs[LINE_INFO] = _computeLineInfo(content); |
| 338 } | 339 } |
| 339 } | 340 } |
| 340 | 341 |
| 341 /** | 342 /** |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 * The content of the fragment. | 395 * The content of the fragment. |
| 395 */ | 396 */ |
| 396 final String content; | 397 final String content; |
| 397 | 398 |
| 398 /** | 399 /** |
| 399 * Initialize a newly created script fragment to have the given [offset] and | 400 * Initialize a newly created script fragment to have the given [offset] and |
| 400 * [content]. | 401 * [content]. |
| 401 */ | 402 */ |
| 402 ScriptFragment(this.offset, this.line, this.column, this.content); | 403 ScriptFragment(this.offset, this.line, this.column, this.content); |
| 403 } | 404 } |
| OLD | NEW |