@Test public void testAttributeWithoutQuotes() { final StringReader reader = new StringReader("<img src=http: final PageLexer lexer = new PageLexer(); final List<Node> nodeList = lexer.parse(reader); assertEquals(1, nodeList.size()); assertTrue(nodeList.get(0) instanceof TagNode); final TagNode node = (TagNode) nodeList.get(0); assertEquals(4, node.getAttributes().size()); final Attribute attribute = node.getAttributes().get(0); assertEquals("src", attribute.getName()); assertEquals("http: final Attribute attributeA = node.getAttributes().get(1); assertEquals("a", attributeA.getName()); assertEquals("1", attributeA.getValue()); final Attribute attributeB = node.getAttributes().get(2); assertEquals("b", attributeB.getName()); assertEquals("2", attributeB.getValue()); final Attribute attributeC = node.getAttributes().get(3); assertEquals("c", attributeC.getName()); assertEquals("3", attributeC.getValue()); }
public List<Node> parse(Reader reader) { CodeReader codeReader = new CodeReader(reader); List<Node> nodeList = new ArrayList<>(); ChannelDispatcher<List<Node>> channelDispatcher = ChannelDispatcher.builder().addChannels((Channel[]) tokenizers.toArray(new Channel[tokenizers.size()])).build(); channelDispatcher.consume(codeReader, nodeList); createNodeHierarchy(nodeList); return nodeList; }
PageLexer { public List<Node> parse(Reader reader) { CodeReader codeReader = new CodeReader(reader); List<Node> nodeList = new ArrayList<>(); ChannelDispatcher<List<Node>> channelDispatcher = ChannelDispatcher.builder().addChannels((Channel[]) tokenizers.toArray(new Channel[tokenizers.size()])).build(); channelDispatcher.consume(codeReader, nodeList); createNodeHierarchy(nodeList); return nodeList; } }
PageLexer { public List<Node> parse(Reader reader) { CodeReader codeReader = new CodeReader(reader); List<Node> nodeList = new ArrayList<>(); ChannelDispatcher<List<Node>> channelDispatcher = ChannelDispatcher.builder().addChannels((Channel[]) tokenizers.toArray(new Channel[tokenizers.size()])).build(); channelDispatcher.consume(codeReader, nodeList); createNodeHierarchy(nodeList); return nodeList; }  }
PageLexer { public List<Node> parse(Reader reader) { CodeReader codeReader = new CodeReader(reader); List<Node> nodeList = new ArrayList<>(); ChannelDispatcher<List<Node>> channelDispatcher = ChannelDispatcher.builder().addChannels((Channel[]) tokenizers.toArray(new Channel[tokenizers.size()])).build(); channelDispatcher.consume(codeReader, nodeList); createNodeHierarchy(nodeList); return nodeList; }  @SuppressWarnings("rawtypes") List<Node> nestedParse(CodeReader reader); List<Node> parse(Reader reader); }
PageLexer { public List<Node> parse(Reader reader) { CodeReader codeReader = new CodeReader(reader); List<Node> nodeList = new ArrayList<>(); ChannelDispatcher<List<Node>> channelDispatcher = ChannelDispatcher.builder().addChannels((Channel[]) tokenizers.toArray(new Channel[tokenizers.size()])).build(); channelDispatcher.consume(codeReader, nodeList); createNodeHierarchy(nodeList); return nodeList; }  @SuppressWarnings("rawtypes") List<Node> nestedParse(CodeReader reader); List<Node> parse(Reader reader);  }