org.snapscript.parse.SpaceGrammar Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap Show documentation
Show all versions of snap Show documentation
Dynamic scripting for the JVM
package org.snapscript.parse;
public class SpaceGrammar implements Grammar {
private final GrammarMatcher matcher;
public SpaceGrammar() {
this.matcher = new SpaceMatcher();
}
@Override
public GrammarMatcher create(GrammarCache cache, int length) {
return matcher;
}
private static class SpaceMatcher implements GrammarMatcher {
@Override
public boolean check(SyntaxChecker checker, int depth) {
return checker.space();
}
@Override
public boolean build(SyntaxBuilder builder, int depth) {
return builder.space();
}
@Override
public String toString() {
return "_";
}
}
}