| 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.testing.html_factory; | 8 library engine.testing.html_factory; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/html.dart'; | 10 import 'package:analyzer/src/generated/html.dart'; |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * Utility methods to create HTML nodes. | 13 * Utility methods to create HTML nodes. |
| 14 */ | 14 */ |
| 15 class HtmlFactory { | 15 class HtmlFactory { |
| 16 static XmlAttributeNode attribute(String name, String value) { | 16 static XmlAttributeNode attribute(String name, String value) { |
| 17 Token nameToken = stringToken(name); | 17 Token nameToken = stringToken(name); |
| 18 Token equalsToken = new Token.con1(TokenType.EQ, 0); | 18 Token equalsToken = new Token.con1(TokenType.EQ, 0); |
| 19 Token valueToken = stringToken(value); | 19 Token valueToken = stringToken(value); |
| 20 return new XmlAttributeNode(nameToken, equalsToken, valueToken); | 20 return new XmlAttributeNode(nameToken, equalsToken, valueToken); |
| 21 } | 21 } |
| 22 | 22 |
| 23 static Token gtToken() { | 23 static Token gtToken() { |
| 24 return new Token.con1(TokenType.GT, 0); | 24 return new Token.con1(TokenType.GT, 0); |
| 25 } | 25 } |
| 26 | 26 |
| 27 static Token ltsToken() { |
| 28 return new Token.con1(TokenType.LT_SLASH, 0); |
| 29 } |
| 30 |
| 27 static Token ltToken() { | 31 static Token ltToken() { |
| 28 return new Token.con1(TokenType.LT, 0); | 32 return new Token.con1(TokenType.LT, 0); |
| 29 } | 33 } |
| 30 | 34 |
| 31 static Token ltsToken() { | 35 static HtmlScriptTagNode scriptTag([List<XmlAttributeNode> attributes = |
| 32 return new Token.con1(TokenType.LT_SLASH, 0); | 36 XmlAttributeNode.EMPTY_LIST]) { |
| 33 } | |
| 34 | |
| 35 static HtmlScriptTagNode scriptTag([List<XmlAttributeNode> attributes = XmlAtt
ributeNode.EMPTY_LIST]) { | |
| 36 return new HtmlScriptTagNode( | 37 return new HtmlScriptTagNode( |
| 37 ltToken(), | 38 ltToken(), |
| 38 stringToken("script"), | 39 stringToken("script"), |
| 39 attributes, | 40 attributes, |
| 40 sgtToken(), | 41 sgtToken(), |
| 41 null, | 42 null, |
| 42 null, | 43 null, |
| 43 null, | 44 null, |
| 44 null); | 45 null); |
| 45 } | 46 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 63 } | 64 } |
| 64 | 65 |
| 65 static Token sgtToken() { | 66 static Token sgtToken() { |
| 66 return new Token.con1(TokenType.SLASH_GT, 0); | 67 return new Token.con1(TokenType.SLASH_GT, 0); |
| 67 } | 68 } |
| 68 | 69 |
| 69 static Token stringToken(String value) { | 70 static Token stringToken(String value) { |
| 70 return new Token.con2(TokenType.STRING, 0, value); | 71 return new Token.con2(TokenType.STRING, 0, value); |
| 71 } | 72 } |
| 72 | 73 |
| 73 static XmlTagNode tagNode(String name, [List<XmlAttributeNode> attributes = Xm
lAttributeNode.EMPTY_LIST]) { | 74 static XmlTagNode tagNode(String name, [List<XmlAttributeNode> attributes = |
| 75 XmlAttributeNode.EMPTY_LIST]) { |
| 74 return new XmlTagNode( | 76 return new XmlTagNode( |
| 75 ltToken(), | 77 ltToken(), |
| 76 stringToken(name), | 78 stringToken(name), |
| 77 attributes, | 79 attributes, |
| 78 sgtToken(), | 80 sgtToken(), |
| 79 null, | 81 null, |
| 80 null, | 82 null, |
| 81 null, | 83 null, |
| 82 null); | 84 null); |
| 83 } | 85 } |
| 84 } | 86 } |
| OLD | NEW |