Search in sources :

Example 1 with Channel

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;
}
Also used : TagNode(org.sonar.plugins.web.node.TagNode) Node(org.sonar.plugins.web.node.Node) Channel(org.sonar.channel.Channel) ArrayList(java.util.ArrayList) CodeReader(org.sonar.channel.CodeReader) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 Channel (org.sonar.channel.Channel)1 CodeReader (org.sonar.channel.CodeReader)1 Node (org.sonar.plugins.web.node.Node)1 TagNode (org.sonar.plugins.web.node.TagNode)1