@Test public void javaScriptWithNestedTags() throws FileNotFoundException { String fileName = "src/test/resources/lexer/javascript-nestedtags.jsp"; PageLexer lexer = new PageLexer(); List<Node> nodeList = lexer.parse(new FileReader(fileName)); assertEquals(12, nodeList.size()); Node node = nodeList.get(2); assertTrue(node instanceof TagNode); TagNode scriptNode = (TagNode) node; assertEquals("script", scriptNode.getNodeName()); assertEquals(0, scriptNode.getChildren().size()); }
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);  }