OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
7 | 7 |
8 library engine.html; | 8 library engine.html; |
9 | 9 |
10 import 'dart:collection'; | 10 import 'dart:collection'; |
11 | 11 |
12 import 'ast.dart'; | 12 import 'ast.dart'; |
13 import 'element.dart'; | 13 import 'element.dart'; |
14 import 'engine.dart' show AnalysisEngine; | 14 import 'engine.dart' show AnalysisOptions, AnalysisEngine; |
15 import 'error.dart' show AnalysisErrorListener; | 15 import 'error.dart' show AnalysisErrorListener; |
16 import 'java_core.dart'; | 16 import 'java_core.dart'; |
17 import 'java_engine.dart'; | 17 import 'java_engine.dart'; |
18 import 'parser.dart' show Parser; | 18 import 'parser.dart' show Parser; |
19 import 'scanner.dart' as sc show Scanner, SubSequenceReader, Token; | 19 import 'scanner.dart' as sc show Scanner, SubSequenceReader, Token; |
20 import 'source.dart'; | 20 import 'source.dart'; |
21 | 21 |
22 /** | 22 /** |
23 * The abstract class `AbstractScanner` implements a scanner for HTML code. Subc
lasses are | 23 * The abstract class `AbstractScanner` implements a scanner for HTML code. Subc
lasses are |
24 * required to implement the interface used to access the characters being scann
ed. | 24 * required to implement the interface used to access the characters being scann
ed. |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 /** | 381 /** |
382 * The line information associated with the source being parsed. | 382 * The line information associated with the source being parsed. |
383 */ | 383 */ |
384 LineInfo _lineInfo; | 384 LineInfo _lineInfo; |
385 | 385 |
386 /** | 386 /** |
387 * The error listener to which errors will be reported. | 387 * The error listener to which errors will be reported. |
388 */ | 388 */ |
389 final AnalysisErrorListener _errorListener; | 389 final AnalysisErrorListener _errorListener; |
390 | 390 |
| 391 final AnalysisOptions _options; |
| 392 |
391 /** | 393 /** |
392 * Construct a parser for the specified source. | 394 * Construct a parser for the specified source. |
393 * | 395 * |
394 * @param source the source being parsed | 396 * [source] is the source being parsed. [_errorListener] is the error |
395 * @param errorListener the error listener to which errors will be reported | 397 * listener to which errors will be reported. [_options] is the analysis |
| 398 * options which should be used for parsing. |
396 */ | 399 */ |
397 HtmlParser(Source source, this._errorListener) : super(source); | 400 HtmlParser(Source source, this._errorListener, this._options) : super(source); |
398 | 401 |
399 @override | 402 @override |
400 XmlAttributeNode createAttributeNode(Token name, Token equals, Token value) => | 403 XmlAttributeNode createAttributeNode(Token name, Token equals, Token value) => |
401 new XmlAttributeNode(name, equals, value); | 404 new XmlAttributeNode(name, equals, value); |
402 | 405 |
403 @override | 406 @override |
404 XmlTagNode createTagNode(Token nodeStart, Token tag, | 407 XmlTagNode createTagNode(Token nodeStart, Token tag, |
405 List<XmlAttributeNode> attributes, Token attributeEnd, | 408 List<XmlAttributeNode> attributes, Token attributeEnd, |
406 List<XmlTagNode> tagNodes, Token contentEnd, Token closingTag, | 409 List<XmlTagNode> tagNodes, Token contentEnd, Token closingTag, |
407 Token nodeEnd) { | 410 Token nodeEnd) { |
408 if (_isScriptNode(tag, attributes, tagNodes)) { | 411 if (_isScriptNode(tag, attributes, tagNodes)) { |
409 HtmlScriptTagNode tagNode = new HtmlScriptTagNode(nodeStart, tag, | 412 HtmlScriptTagNode tagNode = new HtmlScriptTagNode(nodeStart, tag, |
410 attributes, attributeEnd, tagNodes, contentEnd, closingTag, nodeEnd); | 413 attributes, attributeEnd, tagNodes, contentEnd, closingTag, nodeEnd); |
411 String contents = tagNode.content; | 414 String contents = tagNode.content; |
412 int contentOffset = attributeEnd.end; | 415 int contentOffset = attributeEnd.end; |
413 LineInfo_Location location = _lineInfo.getLocation(contentOffset); | 416 LineInfo_Location location = _lineInfo.getLocation(contentOffset); |
414 sc.Scanner scanner = new sc.Scanner(source, | 417 sc.Scanner scanner = new sc.Scanner(source, |
415 new sc.SubSequenceReader(contents, contentOffset), _errorListener); | 418 new sc.SubSequenceReader(contents, contentOffset), _errorListener); |
| 419 scanner.enableNullAwareOperators = _options.enableNullAwareOperators; |
416 scanner.setSourceStart(location.lineNumber, location.columnNumber); | 420 scanner.setSourceStart(location.lineNumber, location.columnNumber); |
417 sc.Token firstToken = scanner.tokenize(); | 421 sc.Token firstToken = scanner.tokenize(); |
418 Parser parser = new Parser(source, _errorListener); | 422 Parser parser = new Parser(source, _errorListener); |
419 CompilationUnit unit = parser.parseCompilationUnit(firstToken); | 423 CompilationUnit unit = parser.parseCompilationUnit(firstToken); |
420 unit.lineInfo = _lineInfo; | 424 unit.lineInfo = _lineInfo; |
421 tagNode.script = unit; | 425 tagNode.script = unit; |
422 return tagNode; | 426 return tagNode; |
423 } | 427 } |
424 return new XmlTagNode(nodeStart, tag, attributes, attributeEnd, tagNodes, | 428 return new XmlTagNode(nodeStart, tag, attributes, attributeEnd, tagNodes, |
425 contentEnd, closingTag, nodeEnd); | 429 contentEnd, closingTag, nodeEnd); |
(...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 */ | 1880 */ |
1877 abstract class XmlVisitor<R> { | 1881 abstract class XmlVisitor<R> { |
1878 R visitHtmlScriptTagNode(HtmlScriptTagNode node); | 1882 R visitHtmlScriptTagNode(HtmlScriptTagNode node); |
1879 | 1883 |
1880 R visitHtmlUnit(HtmlUnit htmlUnit); | 1884 R visitHtmlUnit(HtmlUnit htmlUnit); |
1881 | 1885 |
1882 R visitXmlAttributeNode(XmlAttributeNode xmlAttributeNode); | 1886 R visitXmlAttributeNode(XmlAttributeNode xmlAttributeNode); |
1883 | 1887 |
1884 R visitXmlTagNode(XmlTagNode xmlTagNode); | 1888 R visitXmlTagNode(XmlTagNode xmlTagNode); |
1885 } | 1889 } |
OLD | NEW |