class JavaLexed implements AutoCloseable {

    public int replace(MatchResult result, List<LexicalElement>... lists) {
        assertOpen();
        if (result == null) {
            throw new IllegalArgumentException("Illegal sequence of invocation, there is no match result.");
        }
        if (result.matches) {
            return replace(result.start, result.end, lists);
        }
        return -1;
    }

    public  JavaLexed(Source source);

}