
com.laamella.sexpression.model.Comment Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of s-expressions Show documentation
Show all versions of s-expressions Show documentation
S-Expression support for Java
package com.laamella.sexpression.model;
import com.laamella.sexpression.visitor.Visitor;
import java.util.function.Consumer;
public class Comment implements Node {
public final String text;
public Comment(String text) {
this.text = text;
}
@Override
public R visit(Visitor visitor, A arg) throws Exception {
return visitor.accept(this, arg);
}
@Override
public Otherwise whenList(Consumer action) {
return new Otherwise(true);
}
@Override
public Otherwise whenAtom(Consumer action) {
return new Otherwise(true);
}
@Override
public Otherwise whenComment(Consumer action) {
action.accept(this);
return new Otherwise(false);
}
@Override
public boolean isAtom() {
return false;
}
@Override
public boolean isList() {
return false;
}
@Override
public boolean isComment() {
return true;
}
@Override
public Atom toAtom() {
throw new IllegalStateException();
}
@Override
public AtomList toList() {
throw new IllegalStateException();
}
@Override
public Comment toComment() {
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy