@Test public void testRuby() throws FileNotFoundException { String fileName = "src/test/resources/src/main/webapp/select_user.html.erb"; PageLexer lexer = new PageLexer(); List<Node> nodeList = lexer.parse(new FileReader(fileName)); assertTrue(nodeList.size() > 50); }
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);  }