All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kefirsf.bb.proc.PatternJunk Maven / Gradle / Ivy

Go to download

KefirBB is a Java-library for text processing. Initially it was developed for BB2HTML translation. But flexible configuration allows to use it in different cases. For example for parsing Markdown, Textile, and for HTML filtration.

The newest version!
package org.kefirsf.bb.proc;

/**
 * @author Vitalii Samolovskikh aka Kefir
 */
public class PatternJunk implements ProcPatternElement {
    public boolean parse(Context context, ProcPatternElement terminator) {
        Source source = context.getSource();
        int offset = source.getOffset();

        int end;
        if (terminator != null) {
            end = terminator.findIn(context.getSource());
        } else {
            end = context.getSource().length();
        }

        if (end >= 0) {
            source.incOffset(end - offset);
            return true;
        } else {
            return false;
        }
    }

    public boolean isNextIn(Context context) {
        return false;
    }

    public int findIn(Source source) {
        return -1;
    }

    @Override
    public String toString() {
        return "";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy