class TextElementMatchers {

    static TextElementMatcher byTokenType(int tokenType) {
        return textElement -> textElement.isToken(tokenType);
    }

    static TextElementMatcher byNode(final Node node) {<FILL_FUNCTION_BODY>}
}

        return new TextElementMatcher() {

            @Override
            public boolean match(TextElement textElement) {
                return textElement.isNode(node);
            }

            @Override
            public String toString() {
                return "match node " + node;
            }
        };
    
<no_super_class>