use of org.sonar.channel.Channel in project sonar-web by SonarSource.
the class PageLexer method parse.
/**
* Parse the input into a list of tokens, with parent/child relations between the tokens.
*/
public List<Node> parse(Reader reader) {
// CodeReader reads the file stream
CodeReader codeReader = new CodeReader(reader);
// ArrayList collects the nodes
List<Node> nodeList = new ArrayList<>();
// ChannelDispatcher manages the tokenizers
ChannelDispatcher<List<Node>> channelDispatcher = ChannelDispatcher.builder().addChannels((Channel[]) tokenizers.toArray(new Channel[tokenizers.size()])).build();
channelDispatcher.consume(codeReader, nodeList);
createNodeHierarchy(nodeList);
return nodeList;
}