1 package org.simantics.scl.compiler.elaboration.chr.ast;
3 import java.util.ArrayList;
5 import org.simantics.scl.compiler.elaboration.chr.CHRLiteral;
6 import org.simantics.scl.compiler.elaboration.chr.CHRQuery;
7 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
8 import org.simantics.scl.compiler.internal.parsing.Symbol;
10 public abstract class CHRAstQuery extends Symbol {
11 public CHRQuery translate(TranslationContext context, CHRQueryTranslationMode mode) {
12 ArrayList<CHRLiteral> literals = new ArrayList<CHRLiteral>();
13 translate(context, mode, literals);
14 return new CHRQuery(literals.toArray(new CHRLiteral[literals.size()]));
17 protected abstract void translate(TranslationContext context, CHRQueryTranslationMode mode, ArrayList<CHRLiteral> literals);
19 public abstract void accept(CHRAstQueryVisitor visitor);