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'; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 * the source code has been scanned. | 76 * the source code has been scanned. |
77 * | 77 * |
78 * @return the current offset of the scanner in the source | 78 * @return the current offset of the scanner in the source |
79 */ | 79 */ |
80 int get offset; | 80 int get offset; |
81 | 81 |
82 /** | 82 /** |
83 * Set array of element tags for which the content between tags should be cons
ider a single token. | 83 * Set array of element tags for which the content between tags should be cons
ider a single token. |
84 */ | 84 */ |
85 void set passThroughElements(List<String> passThroughElements) { | 85 void set passThroughElements(List<String> passThroughElements) { |
86 this._passThroughElements = | 86 this._passThroughElements = passThroughElements != null |
87 passThroughElements != null ? passThroughElements : _NO_PASS_THROUGH_ELE
MENTS; | 87 ? passThroughElements |
| 88 : _NO_PASS_THROUGH_ELEMENTS; |
88 } | 89 } |
89 | 90 |
90 /** | 91 /** |
91 * Advance the current position and return the character at the new current po
sition. | 92 * Advance the current position and return the character at the new current po
sition. |
92 * | 93 * |
93 * @return the character at the new current position | 94 * @return the character at the new current position |
94 */ | 95 */ |
95 int advance(); | 96 int advance(); |
96 | 97 |
97 /** | 98 /** |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 355 |
355 static String _APPLICATION_DART_IN_SINGLE_QUOTES = "'application/dart'"; | 356 static String _APPLICATION_DART_IN_SINGLE_QUOTES = "'application/dart'"; |
356 | 357 |
357 static String _SCRIPT = "script"; | 358 static String _SCRIPT = "script"; |
358 | 359 |
359 static String _TYPE = "type"; | 360 static String _TYPE = "type"; |
360 | 361 |
361 /** | 362 /** |
362 * A set containing the names of tags that do not have a closing tag. | 363 * A set containing the names of tags that do not have a closing tag. |
363 */ | 364 */ |
364 static Set<String> SELF_CLOSING = new HashSet<String>.from( | 365 static Set<String> SELF_CLOSING = new HashSet<String>.from(<String>[ |
365 <String>[ | 366 "area", |
366 "area", | 367 "base", |
367 "base", | 368 "basefont", |
368 "basefont", | 369 "br", |
369 "br", | 370 "col", |
370 "col", | 371 "frame", |
371 "frame", | 372 "hr", |
372 "hr", | 373 "img", |
373 "img", | 374 "input", |
374 "input", | 375 "link", |
375 "link", | 376 "meta", |
376 "meta", | 377 "param", |
377 "param", | 378 "!" |
378 "!"]); | 379 ]); |
379 | 380 |
380 /** | 381 /** |
381 * The line information associated with the source being parsed. | 382 * The line information associated with the source being parsed. |
382 */ | 383 */ |
383 LineInfo _lineInfo; | 384 LineInfo _lineInfo; |
384 | 385 |
385 /** | 386 /** |
386 * The error listener to which errors will be reported. | 387 * The error listener to which errors will be reported. |
387 */ | 388 */ |
388 final AnalysisErrorListener _errorListener; | 389 final AnalysisErrorListener _errorListener; |
389 | 390 |
390 /** | 391 /** |
391 * Construct a parser for the specified source. | 392 * Construct a parser for the specified source. |
392 * | 393 * |
393 * @param source the source being parsed | 394 * @param source the source being parsed |
394 * @param errorListener the error listener to which errors will be reported | 395 * @param errorListener the error listener to which errors will be reported |
395 */ | 396 */ |
396 HtmlParser(Source source, this._errorListener) : super(source); | 397 HtmlParser(Source source, this._errorListener) : super(source); |
397 | 398 |
398 @override | 399 @override |
399 XmlAttributeNode createAttributeNode(Token name, Token equals, Token value) => | 400 XmlAttributeNode createAttributeNode(Token name, Token equals, Token value) => |
400 new XmlAttributeNode(name, equals, value); | 401 new XmlAttributeNode(name, equals, value); |
401 | 402 |
402 @override | 403 @override |
403 XmlTagNode createTagNode(Token nodeStart, Token tag, | 404 XmlTagNode createTagNode(Token nodeStart, Token tag, |
404 List<XmlAttributeNode> attributes, Token attributeEnd, | 405 List<XmlAttributeNode> attributes, Token attributeEnd, |
405 List<XmlTagNode> tagNodes, Token contentEnd, Token closingTag, Token nodeE
nd) { | 406 List<XmlTagNode> tagNodes, Token contentEnd, Token closingTag, |
| 407 Token nodeEnd) { |
406 if (_isScriptNode(tag, attributes, tagNodes)) { | 408 if (_isScriptNode(tag, attributes, tagNodes)) { |
407 HtmlScriptTagNode tagNode = new HtmlScriptTagNode( | 409 HtmlScriptTagNode tagNode = new HtmlScriptTagNode(nodeStart, tag, |
408 nodeStart, | 410 attributes, attributeEnd, tagNodes, contentEnd, closingTag, nodeEnd); |
409 tag, | |
410 attributes, | |
411 attributeEnd, | |
412 tagNodes, | |
413 contentEnd, | |
414 closingTag, | |
415 nodeEnd); | |
416 String contents = tagNode.content; | 411 String contents = tagNode.content; |
417 int contentOffset = attributeEnd.end; | 412 int contentOffset = attributeEnd.end; |
418 LineInfo_Location location = _lineInfo.getLocation(contentOffset); | 413 LineInfo_Location location = _lineInfo.getLocation(contentOffset); |
419 sc.Scanner scanner = new sc.Scanner( | 414 sc.Scanner scanner = new sc.Scanner(source, |
420 source, | 415 new sc.SubSequenceReader(contents, contentOffset), _errorListener); |
421 new sc.SubSequenceReader(contents, contentOffset), | |
422 _errorListener); | |
423 scanner.setSourceStart(location.lineNumber, location.columnNumber); | 416 scanner.setSourceStart(location.lineNumber, location.columnNumber); |
424 sc.Token firstToken = scanner.tokenize(); | 417 sc.Token firstToken = scanner.tokenize(); |
425 Parser parser = new Parser(source, _errorListener); | 418 Parser parser = new Parser(source, _errorListener); |
426 CompilationUnit unit = parser.parseCompilationUnit(firstToken); | 419 CompilationUnit unit = parser.parseCompilationUnit(firstToken); |
427 unit.lineInfo = _lineInfo; | 420 unit.lineInfo = _lineInfo; |
428 tagNode.script = unit; | 421 tagNode.script = unit; |
429 return tagNode; | 422 return tagNode; |
430 } | 423 } |
431 return new XmlTagNode( | 424 return new XmlTagNode(nodeStart, tag, attributes, attributeEnd, tagNodes, |
432 nodeStart, | 425 contentEnd, closingTag, nodeEnd); |
433 tag, | |
434 attributes, | |
435 attributeEnd, | |
436 tagNodes, | |
437 contentEnd, | |
438 closingTag, | |
439 nodeEnd); | |
440 } | 426 } |
441 | 427 |
442 @override | 428 @override |
443 bool isSelfClosing(Token tag) => SELF_CLOSING.contains(tag.lexeme); | 429 bool isSelfClosing(Token tag) => SELF_CLOSING.contains(tag.lexeme); |
444 | 430 |
445 /** | 431 /** |
446 * Parse the given tokens. | 432 * Parse the given tokens. |
447 * | 433 * |
448 * @param token the first token in the stream of tokens to be parsed | 434 * @param token the first token in the stream of tokens to be parsed |
449 * @param lineInfo the line information created by the scanner | 435 * @param lineInfo the line information created by the scanner |
450 * @return the parse result (not `null`) | 436 * @return the parse result (not `null`) |
451 */ | 437 */ |
452 HtmlUnit parse(Token token, LineInfo lineInfo) { | 438 HtmlUnit parse(Token token, LineInfo lineInfo) { |
453 this._lineInfo = lineInfo; | 439 this._lineInfo = lineInfo; |
454 List<XmlTagNode> tagNodes = parseTopTagNodes(token); | 440 List<XmlTagNode> tagNodes = parseTopTagNodes(token); |
455 return new HtmlUnit(token, tagNodes, currentToken); | 441 return new HtmlUnit(token, tagNodes, currentToken); |
456 } | 442 } |
457 | 443 |
458 /** | 444 /** |
459 * Determine if the specified node is a Dart script. | 445 * Determine if the specified node is a Dart script. |
460 * | 446 * |
461 * @param node the node to be tested (not `null`) | 447 * @param node the node to be tested (not `null`) |
462 * @return `true` if the node is a Dart script | 448 * @return `true` if the node is a Dart script |
463 */ | 449 */ |
464 bool _isScriptNode(Token tag, List<XmlAttributeNode> attributes, | 450 bool _isScriptNode( |
465 List<XmlTagNode> tagNodes) { | 451 Token tag, List<XmlAttributeNode> attributes, List<XmlTagNode> tagNodes) { |
466 if (tagNodes.length != 0 || tag.lexeme != _SCRIPT) { | 452 if (tagNodes.length != 0 || tag.lexeme != _SCRIPT) { |
467 return false; | 453 return false; |
468 } | 454 } |
469 for (XmlAttributeNode attribute in attributes) { | 455 for (XmlAttributeNode attribute in attributes) { |
470 if (attribute.name == _TYPE) { | 456 if (attribute.name == _TYPE) { |
471 Token valueToken = attribute.valueToken; | 457 Token valueToken = attribute.valueToken; |
472 if (valueToken != null) { | 458 if (valueToken != null) { |
473 String value = valueToken.lexeme; | 459 String value = valueToken.lexeme; |
474 if (value == _APPLICATION_DART_IN_DOUBLE_QUOTES || | 460 if (value == _APPLICATION_DART_IN_DOUBLE_QUOTES || |
475 value == _APPLICATION_DART_IN_SINGLE_QUOTES) { | 461 value == _APPLICATION_DART_IN_SINGLE_QUOTES) { |
476 return true; | 462 return true; |
477 } | 463 } |
478 } | 464 } |
479 } | 465 } |
480 } | 466 } |
481 return false; | 467 return false; |
482 } | 468 } |
483 | 469 |
484 /** | 470 /** |
485 * Given the contents of an embedded expression that occurs at the given offse
t, parse it as a | 471 * Given the contents of an embedded expression that occurs at the given offse
t, parse it as a |
486 * Dart expression. The contents should not include the expression's delimiter
s. | 472 * Dart expression. The contents should not include the expression's delimiter
s. |
487 * | 473 * |
488 * @param source the source that contains that given token | 474 * @param source the source that contains that given token |
489 * @param token the token to start parsing from | 475 * @param token the token to start parsing from |
490 * @return the Dart expression that was parsed | 476 * @return the Dart expression that was parsed |
491 */ | 477 */ |
492 static Expression parseEmbeddedExpression(Source source, sc.Token token, | 478 static Expression parseEmbeddedExpression( |
493 AnalysisErrorListener errorListener) { | 479 Source source, sc.Token token, AnalysisErrorListener errorListener) { |
494 Parser parser = new Parser(source, errorListener); | 480 Parser parser = new Parser(source, errorListener); |
495 return parser.parseExpression(token); | 481 return parser.parseExpression(token); |
496 } | 482 } |
497 | 483 |
498 /** | 484 /** |
499 * Given the contents of an embedded expression that occurs at the given offse
t, scans it as a | 485 * Given the contents of an embedded expression that occurs at the given offse
t, scans it as a |
500 * Dart code. | 486 * Dart code. |
501 * | 487 * |
502 * @param source the source of that contains the given contents | 488 * @param source the source of that contains the given contents |
503 * @param contents the contents to scan | 489 * @param contents the contents to scan |
504 * @param contentOffset the offset of the contents in the larger file | 490 * @param contentOffset the offset of the contents in the larger file |
505 * @return the first Dart token | 491 * @return the first Dart token |
506 */ | 492 */ |
507 static sc.Token scanDartSource(Source source, LineInfo lineInfo, | 493 static sc.Token scanDartSource(Source source, LineInfo lineInfo, |
508 String contents, int contentOffset, AnalysisErrorListener errorListener) { | 494 String contents, int contentOffset, AnalysisErrorListener errorListener) { |
509 LineInfo_Location location = lineInfo.getLocation(contentOffset); | 495 LineInfo_Location location = lineInfo.getLocation(contentOffset); |
510 sc.Scanner scanner = new sc.Scanner( | 496 sc.Scanner scanner = new sc.Scanner(source, |
511 source, | 497 new sc.SubSequenceReader(contents, contentOffset), errorListener); |
512 new sc.SubSequenceReader(contents, contentOffset), | |
513 errorListener); | |
514 scanner.setSourceStart(location.lineNumber, location.columnNumber); | 498 scanner.setSourceStart(location.lineNumber, location.columnNumber); |
515 return scanner.tokenize(); | 499 return scanner.tokenize(); |
516 } | 500 } |
517 } | 501 } |
518 | 502 |
519 /** | 503 /** |
520 * Instances of the class `HtmlScriptTagNode` represent a script tag within an H
TML file that | 504 * Instances of the class `HtmlScriptTagNode` represent a script tag within an H
TML file that |
521 * references a Dart script. | 505 * references a Dart script. |
522 */ | 506 */ |
523 class HtmlScriptTagNode extends XmlTagNode { | 507 class HtmlScriptTagNode extends XmlTagNode { |
(...skipping 15 matching lines...) Expand all Loading... |
539 * @param tag the name of the tag | 523 * @param tag the name of the tag |
540 * @param attributes the attributes in the tag | 524 * @param attributes the attributes in the tag |
541 * @param attributeEnd the token terminating the region where attributes can b
e | 525 * @param attributeEnd the token terminating the region where attributes can b
e |
542 * @param tagNodes the children of the tag | 526 * @param tagNodes the children of the tag |
543 * @param contentEnd the token that starts the closing tag | 527 * @param contentEnd the token that starts the closing tag |
544 * @param closingTag the name of the tag that occurs in the closing tag | 528 * @param closingTag the name of the tag that occurs in the closing tag |
545 * @param nodeEnd the last token in the tag | 529 * @param nodeEnd the last token in the tag |
546 */ | 530 */ |
547 HtmlScriptTagNode(Token nodeStart, Token tag, | 531 HtmlScriptTagNode(Token nodeStart, Token tag, |
548 List<XmlAttributeNode> attributes, Token attributeEnd, | 532 List<XmlAttributeNode> attributes, Token attributeEnd, |
549 List<XmlTagNode> tagNodes, Token contentEnd, Token closingTag, Token nodeE
nd) | 533 List<XmlTagNode> tagNodes, Token contentEnd, Token closingTag, |
550 : super( | 534 Token nodeEnd) |
551 nodeStart, | 535 : super(nodeStart, tag, attributes, attributeEnd, tagNodes, contentEnd, |
552 tag, | 536 closingTag, nodeEnd); |
553 attributes, | |
554 attributeEnd, | |
555 tagNodes, | |
556 contentEnd, | |
557 closingTag, | |
558 nodeEnd); | |
559 | 537 |
560 /** | 538 /** |
561 * Return the AST structure representing the Dart code within this tag, or `nu
ll` if this | 539 * Return the AST structure representing the Dart code within this tag, or `nu
ll` if this |
562 * tag references an external script. | 540 * tag references an external script. |
563 * | 541 * |
564 * @return the AST structure representing the Dart code within this tag | 542 * @return the AST structure representing the Dart code within this tag |
565 */ | 543 */ |
566 CompilationUnit get script => _script; | 544 CompilationUnit get script => _script; |
567 | 545 |
568 /** | 546 /** |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 | 871 |
894 static const TokenType DIRECTIVE = const TokenType('DIRECTIVE', 8, null); | 872 static const TokenType DIRECTIVE = const TokenType('DIRECTIVE', 8, null); |
895 | 873 |
896 static const TokenType STRING = const TokenType('STRING', 9, null); | 874 static const TokenType STRING = const TokenType('STRING', 9, null); |
897 | 875 |
898 static const TokenType TAG = const TokenType('TAG', 10, null); | 876 static const TokenType TAG = const TokenType('TAG', 10, null); |
899 | 877 |
900 static const TokenType TEXT = const TokenType('TEXT', 11, null); | 878 static const TokenType TEXT = const TokenType('TEXT', 11, null); |
901 | 879 |
902 static const List<TokenType> values = const [ | 880 static const List<TokenType> values = const [ |
903 EOF, | 881 EOF, |
904 EQ, | 882 EQ, |
905 GT, | 883 GT, |
906 LT_SLASH, | 884 LT_SLASH, |
907 LT, | 885 LT, |
908 SLASH_GT, | 886 SLASH_GT, |
909 COMMENT, | 887 COMMENT, |
910 DECLARATION, | 888 DECLARATION, |
911 DIRECTIVE, | 889 DIRECTIVE, |
912 STRING, | 890 STRING, |
913 TAG, | 891 TAG, |
914 TEXT]; | 892 TEXT |
| 893 ]; |
915 | 894 |
916 /** | 895 /** |
917 * The lexeme that defines this type of token, or `null` if there is more than
one possible | 896 * The lexeme that defines this type of token, or `null` if there is more than
one possible |
918 * lexeme for this type of token. | 897 * lexeme for this type of token. |
919 */ | 898 */ |
920 final String lexeme; | 899 final String lexeme; |
921 | 900 |
922 const TokenType(String name, int ordinal, this.lexeme) : super(name, ordinal); | 901 const TokenType(String name, int ordinal, this.lexeme) : super(name, ordinal); |
923 } | 902 } |
924 | 903 |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 * @param attributes the attributes in the tag | 1418 * @param attributes the attributes in the tag |
1440 * @param attributeEnd the token terminating the region where attributes can b
e | 1419 * @param attributeEnd the token terminating the region where attributes can b
e |
1441 * @param tagNodes the children of the tag | 1420 * @param tagNodes the children of the tag |
1442 * @param contentEnd the token that starts the closing tag | 1421 * @param contentEnd the token that starts the closing tag |
1443 * @param closingTag the name of the tag that occurs in the closing tag | 1422 * @param closingTag the name of the tag that occurs in the closing tag |
1444 * @param nodeEnd the last token in the tag | 1423 * @param nodeEnd the last token in the tag |
1445 * @return the node that was created | 1424 * @return the node that was created |
1446 */ | 1425 */ |
1447 XmlTagNode createTagNode(Token nodeStart, Token tag, | 1426 XmlTagNode createTagNode(Token nodeStart, Token tag, |
1448 List<XmlAttributeNode> attributes, Token attributeEnd, | 1427 List<XmlAttributeNode> attributes, Token attributeEnd, |
1449 List<XmlTagNode> tagNodes, Token contentEnd, Token closingTag, Token nodeE
nd) => | 1428 List<XmlTagNode> tagNodes, Token contentEnd, Token closingTag, |
1450 new XmlTagNode( | 1429 Token nodeEnd) => new XmlTagNode(nodeStart, tag, attributes, attributeEnd, |
1451 nodeStart, | 1430 tagNodes, contentEnd, closingTag, nodeEnd); |
1452 tag, | |
1453 attributes, | |
1454 attributeEnd, | |
1455 tagNodes, | |
1456 contentEnd, | |
1457 closingTag, | |
1458 nodeEnd); | |
1459 | 1431 |
1460 /** | 1432 /** |
1461 * Answer `true` if the specified tag is self closing and thus should never ha
ve content or | 1433 * Answer `true` if the specified tag is self closing and thus should never ha
ve content or |
1462 * child tag nodes. | 1434 * child tag nodes. |
1463 * | 1435 * |
1464 * @param tag the tag (not `null`) | 1436 * @param tag the tag (not `null`) |
1465 * @return `true` if self closing | 1437 * @return `true` if self closing |
1466 */ | 1438 */ |
1467 bool isSelfClosing(Token tag) => false; | 1439 bool isSelfClosing(Token tag) => false; |
1468 | 1440 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 if (_currentToken.type == TokenType.GT || | 1590 if (_currentToken.type == TokenType.GT || |
1619 _currentToken.type == TokenType.SLASH_GT) { | 1591 _currentToken.type == TokenType.SLASH_GT) { |
1620 attributeEnd = _currentToken; | 1592 attributeEnd = _currentToken; |
1621 _currentToken = _currentToken.next; | 1593 _currentToken = _currentToken.next; |
1622 } else { | 1594 } else { |
1623 _reportUnexpectedToken(); | 1595 _reportUnexpectedToken(); |
1624 attributeEnd = _insertSyntheticToken(TokenType.SLASH_GT); | 1596 attributeEnd = _insertSyntheticToken(TokenType.SLASH_GT); |
1625 } | 1597 } |
1626 // If the node has no children, then return the node | 1598 // If the node has no children, then return the node |
1627 if (attributeEnd.type == TokenType.SLASH_GT || isSelfClosing(tag)) { | 1599 if (attributeEnd.type == TokenType.SLASH_GT || isSelfClosing(tag)) { |
1628 return createTagNode( | 1600 return createTagNode(nodeStart, tag, attributes, attributeEnd, |
1629 nodeStart, | 1601 XmlTagNode.NO_TAG_NODES, _currentToken, null, attributeEnd); |
1630 tag, | |
1631 attributes, | |
1632 attributeEnd, | |
1633 XmlTagNode.NO_TAG_NODES, | |
1634 _currentToken, | |
1635 null, | |
1636 attributeEnd); | |
1637 } | 1602 } |
1638 // Parse the child tag nodes | 1603 // Parse the child tag nodes |
1639 List<XmlTagNode> tagNodes = _parseChildTagNodes(); | 1604 List<XmlTagNode> tagNodes = _parseChildTagNodes(); |
1640 // Token ending child tag nodes | 1605 // Token ending child tag nodes |
1641 Token contentEnd; | 1606 Token contentEnd; |
1642 if (_currentToken.type == TokenType.LT_SLASH) { | 1607 if (_currentToken.type == TokenType.LT_SLASH) { |
1643 contentEnd = _currentToken; | 1608 contentEnd = _currentToken; |
1644 _currentToken = _currentToken.next; | 1609 _currentToken = _currentToken.next; |
1645 } else { | 1610 } else { |
1646 // TODO (danrubel): handle self closing HTML elements by inserting | 1611 // TODO (danrubel): handle self closing HTML elements by inserting |
(...skipping 12 matching lines...) Expand all Loading... |
1659 } | 1624 } |
1660 // Token ending node | 1625 // Token ending node |
1661 Token nodeEnd; | 1626 Token nodeEnd; |
1662 if (_currentToken.type == TokenType.GT) { | 1627 if (_currentToken.type == TokenType.GT) { |
1663 nodeEnd = _currentToken; | 1628 nodeEnd = _currentToken; |
1664 _currentToken = _currentToken.next; | 1629 _currentToken = _currentToken.next; |
1665 } else { | 1630 } else { |
1666 _reportUnexpectedToken(); | 1631 _reportUnexpectedToken(); |
1667 nodeEnd = _insertSyntheticToken(TokenType.GT); | 1632 nodeEnd = _insertSyntheticToken(TokenType.GT); |
1668 } | 1633 } |
1669 return createTagNode( | 1634 return createTagNode(nodeStart, tag, attributes, attributeEnd, tagNodes, |
1670 nodeStart, | 1635 contentEnd, closingTag, nodeEnd); |
1671 tag, | |
1672 attributes, | |
1673 attributeEnd, | |
1674 tagNodes, | |
1675 contentEnd, | |
1676 closingTag, | |
1677 nodeEnd); | |
1678 } | 1636 } |
1679 | 1637 |
1680 /** | 1638 /** |
1681 * Report the current token as unexpected | 1639 * Report the current token as unexpected |
1682 */ | 1640 */ |
1683 void _reportUnexpectedToken() { | 1641 void _reportUnexpectedToken() { |
1684 // TODO (danrubel): report unexpected token | 1642 // TODO (danrubel): report unexpected token |
1685 } | 1643 } |
1686 } | 1644 } |
1687 | 1645 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1774 * self closing or the attributeEnd is [TokenType.SLASH_GT], or | 1732 * self closing or the attributeEnd is [TokenType.SLASH_GT], or |
1775 * * (3) [TokenType.EOF] if the node does not have a closing tag and
is the last | 1733 * * (3) [TokenType.EOF] if the node does not have a closing tag and
is the last |
1776 * node in the stream [TokenType.LT_SLASH] token after the content, o
r `null` | 1734 * node in the stream [TokenType.LT_SLASH] token after the content, o
r `null` |
1777 * if there is no content and the attributes ended with [TokenType.SL
ASH_GT]. | 1735 * if there is no content and the attributes ended with [TokenType.SL
ASH_GT]. |
1778 * @param closingTag the closing [TokenType.TAG] after the child elements or `
null` if | 1736 * @param closingTag the closing [TokenType.TAG] after the child elements or `
null` if |
1779 * there is no content and the attributes ended with [TokenType.SLASH
_GT] | 1737 * there is no content and the attributes ended with [TokenType.SLASH
_GT] |
1780 * @param nodeEnd the ending [TokenType.GT] or [TokenType.SLASH_GT] token (not | 1738 * @param nodeEnd the ending [TokenType.GT] or [TokenType.SLASH_GT] token (not |
1781 * `null`) | 1739 * `null`) |
1782 */ | 1740 */ |
1783 XmlTagNode(this.nodeStart, this._tag, List<XmlAttributeNode> attributes, | 1741 XmlTagNode(this.nodeStart, this._tag, List<XmlAttributeNode> attributes, |
1784 this.attributeEnd, List<XmlTagNode> tagNodes, this.contentEnd, this.closin
gTag, | 1742 this.attributeEnd, List<XmlTagNode> tagNodes, this.contentEnd, |
1785 this.nodeEnd) { | 1743 this.closingTag, this.nodeEnd) { |
1786 this._attributes = becomeParentOfAll(attributes, ifEmpty: NO_ATTRIBUTES); | 1744 this._attributes = becomeParentOfAll(attributes, ifEmpty: NO_ATTRIBUTES); |
1787 this._tagNodes = becomeParentOfAll(tagNodes, ifEmpty: NO_TAG_NODES); | 1745 this._tagNodes = becomeParentOfAll(tagNodes, ifEmpty: NO_TAG_NODES); |
1788 } | 1746 } |
1789 | 1747 |
1790 /** | 1748 /** |
1791 * Answer the receiver's attributes. Callers should not manipulate the returne
d list to edit the | 1749 * Answer the receiver's attributes. Callers should not manipulate the returne
d list to edit the |
1792 * AST structure. | 1750 * AST structure. |
1793 * | 1751 * |
1794 * @return the attributes (not `null`, contains no `null`s) | 1752 * @return the attributes (not `null`, contains no `null`s) |
1795 */ | 1753 */ |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 */ | 1876 */ |
1919 abstract class XmlVisitor<R> { | 1877 abstract class XmlVisitor<R> { |
1920 R visitHtmlScriptTagNode(HtmlScriptTagNode node); | 1878 R visitHtmlScriptTagNode(HtmlScriptTagNode node); |
1921 | 1879 |
1922 R visitHtmlUnit(HtmlUnit htmlUnit); | 1880 R visitHtmlUnit(HtmlUnit htmlUnit); |
1923 | 1881 |
1924 R visitXmlAttributeNode(XmlAttributeNode xmlAttributeNode); | 1882 R visitXmlAttributeNode(XmlAttributeNode xmlAttributeNode); |
1925 | 1883 |
1926 R visitXmlTagNode(XmlTagNode xmlTagNode); | 1884 R visitXmlTagNode(XmlTagNode xmlTagNode); |
1927 } | 1885 } |
OLD | NEW |