}
@Override
- final public void accept(ExpressionVisitor visitor) {
+ public void accept(ExpressionVisitor visitor) {
throw new InternalCompilerError(getClass().getSimpleName() + " does not support accept.");
}
public Expression accept(ExpressionTransformer transformer) {
return transformer.transform(this);
}
-
+
+ @Override
+ public void accept(ExpressionVisitor visitor) {
+ visitor.visit(this);
+ }
}
return 0;
return ((GuardStatement)lastStatement).value.getSyntacticFunctionArity();
}
+
+ @Override
+ public void accept(ExpressionVisitor visitor) {
+ visitor.visit(this);
+ }
}
public int getSyntacticFunctionArity() {
return in.getSyntacticFunctionArity();
}
-
+
+ @Override
+ public void accept(ExpressionVisitor visitor) {
+ visitor.visit(this);
+ }
}
import org.simantics.scl.compiler.errors.Locations;
public class ERange extends ASTExpression {
- Expression from;
- Expression to;
+ public Expression from;
+ public Expression to;
public ERange(Expression from, Expression to) {
this.from = from;
public Expression accept(ExpressionTransformer transformer) {
return transformer.transform(this);
}
-
+
+ @Override
+ public void accept(ExpressionVisitor visitor) {
+ visitor.visit(this);
+ }
}
public Expression accept(ExpressionTransformer transformer) {
return transformer.transform(this);
}
-
+
+ @Override
+ public void accept(ExpressionVisitor visitor) {
+ visitor.visit(this);
+ }
}
public class EStringLiteral extends ASTExpression {
- String[] strings;
- Expression[] expressions;
+ public String[] strings;
+ public Expression[] expressions;
public EStringLiteral(String[] strings, Expression[] expressions) {
this.strings = strings;
return new EApply(new ELiteral(new StringInterpolation(strings)), expressions);
}
-
+ @Override
+ public void accept(ExpressionVisitor visitor) {
+ visitor.visit(this);
+ }
}
import java.util.ArrayList;
+import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;
import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
import org.simantics.scl.compiler.elaboration.errors.NotPatternException;
import org.simantics.scl.compiler.elaboration.expressions.lhstype.FunctionDefinitionLhs;
public Expression accept(ExpressionTransformer transformer) {
return transformer.transform(this);
}
+
+ @Override
+ public void accept(ExpressionVisitor visitor) {
+ visitor.visit(this);
+ }
}
void visit(EApply expression);
void visit(EApplyType expression);
void visit(EAsPattern expression);
+ void visit(EBinary expression);
void visit(EBind expression);
+ void visit(EBlock expression);
void visit(ECHRRuleset echrRuleset);
void visit(EConstant expression);
void visit(ECoveringBranchPoint expression);
void visit(ELiteral expression);
void visit(EMatch expression);
void visit(EPlaceholder expression);
+ void visit(EPreLet expression);
+ void visit(ERange expression);
void visit(ERealLiteral expression);
+ void visit(ERecord expression);
void visit(ERuleset expression);
void visit(ESelect expression);
void visit(ESimpleLambda expression);
void visit(ESimpleLet expression);
+ void visit(EStringLiteral expression);
void visit(ETransformation expression);
void visit(ETypeAnnotation expression);
+ void visit(EVar expression);
void visit(EVariable expression);
void visit(EViewPattern expression);
void visit(EWhen expression);
import org.simantics.scl.compiler.elaboration.expressions.accessor.FieldAccessorVisitor;
import org.simantics.scl.compiler.elaboration.expressions.accessor.IdAccessor;
import org.simantics.scl.compiler.elaboration.expressions.accessor.StringAccessor;
+import org.simantics.scl.compiler.elaboration.expressions.block.BindStatement;
+import org.simantics.scl.compiler.elaboration.expressions.block.GuardStatement;
+import org.simantics.scl.compiler.elaboration.expressions.block.LetStatement;
+import org.simantics.scl.compiler.elaboration.expressions.block.RuleStatement;
+import org.simantics.scl.compiler.elaboration.expressions.block.Statement;
+import org.simantics.scl.compiler.elaboration.expressions.block.StatementVisitor;
import org.simantics.scl.compiler.elaboration.expressions.list.ListAssignment;
import org.simantics.scl.compiler.elaboration.expressions.list.ListGenerator;
import org.simantics.scl.compiler.elaboration.expressions.list.ListGuard;
import org.simantics.scl.compiler.elaboration.expressions.list.ListQualifierVisitor;
import org.simantics.scl.compiler.elaboration.expressions.list.ListSeq;
import org.simantics.scl.compiler.elaboration.expressions.list.ListThen;
+import org.simantics.scl.compiler.elaboration.expressions.records.FieldAssignment;
import org.simantics.scl.compiler.elaboration.query.QAlternative;
import org.simantics.scl.compiler.elaboration.query.QAtom;
import org.simantics.scl.compiler.elaboration.query.QConjunction;
public class StandardExpressionVisitor implements
ExpressionVisitor, QueryVisitor, FieldAccessorVisitor, ListQualifierVisitor,
-EquationVisitor {
+EquationVisitor, StatementVisitor {
@Override
public void visit(EApply expression) {
expression.value.accept(this);
}
+ @Override
+ public void visit(EVar expression) {
+ }
+
@Override
public void visit(EVariable expression) {
}
ruleset.in.accept(this);
}
+ @Override
+ public void visit(EBinary expression) {
+ expression.left.accept(this);
+ for(EBinaryRightSide right : expression.rights)
+ right.right.accept(this);
+ }
+
+ @Override
+ public void visit(EBlock expression) {
+ for(Statement stat : expression.statements)
+ stat.accept(this);
+ }
+
+ @Override
+ public void visit(EPreLet expression) {
+ for(LetStatement stat : expression.assignments) {
+ stat.pattern.accept(this);
+ stat.value.accept(this);
+ }
+ expression.in.accept(this);
+ }
+
+ @Override
+ public void visit(ERange expression) {
+ expression.from.accept(this);
+ expression.to.accept(this);
+ }
+
+ @Override
+ public void visit(ERecord expression) {
+ for(FieldAssignment assignment : expression.fields)
+ assignment.value.accept(this);
+
+ }
+
+ @Override
+ public void visit(EStringLiteral expression) {
+ for(Expression exp : expression.expressions)
+ exp.accept(this);
+ }
+
+ @Override
+ public void visit(BindStatement statement) {
+ statement.pattern.accept(this);
+ statement.value.accept(this);
+ }
+
+ @Override
+ public void visit(GuardStatement statement) {
+ statement.value.accept(this);
+ }
+
+ @Override
+ public void visit(LetStatement statement) {
+ statement.value.accept(this);
+ }
+
+ @Override
+ public void visit(RuleStatement statement) {
+ statement.head.accept(this);
+ statement.body.accept(this);
+ }
+
}
import org.simantics.scl.compiler.elaboration.expressions.EApply;
import org.simantics.scl.compiler.elaboration.expressions.EApplyType;
import org.simantics.scl.compiler.elaboration.expressions.EAsPattern;
+import org.simantics.scl.compiler.elaboration.expressions.EBinary;
import org.simantics.scl.compiler.elaboration.expressions.EBind;
+import org.simantics.scl.compiler.elaboration.expressions.EBlock;
import org.simantics.scl.compiler.elaboration.expressions.ECHRRuleset;
import org.simantics.scl.compiler.elaboration.expressions.EConstant;
import org.simantics.scl.compiler.elaboration.expressions.ECoveringBranchPoint;
import org.simantics.scl.compiler.elaboration.expressions.ELiteral;
import org.simantics.scl.compiler.elaboration.expressions.EMatch;
import org.simantics.scl.compiler.elaboration.expressions.EPlaceholder;
+import org.simantics.scl.compiler.elaboration.expressions.EPreLet;
+import org.simantics.scl.compiler.elaboration.expressions.ERange;
import org.simantics.scl.compiler.elaboration.expressions.ERealLiteral;
+import org.simantics.scl.compiler.elaboration.expressions.ERecord;
import org.simantics.scl.compiler.elaboration.expressions.ERuleset;
import org.simantics.scl.compiler.elaboration.expressions.ESelect;
import org.simantics.scl.compiler.elaboration.expressions.ESimpleLambda;
import org.simantics.scl.compiler.elaboration.expressions.ESimpleLet;
+import org.simantics.scl.compiler.elaboration.expressions.EStringLiteral;
import org.simantics.scl.compiler.elaboration.expressions.ETransformation;
import org.simantics.scl.compiler.elaboration.expressions.ETypeAnnotation;
+import org.simantics.scl.compiler.elaboration.expressions.EVar;
import org.simantics.scl.compiler.elaboration.expressions.EVariable;
import org.simantics.scl.compiler.elaboration.expressions.EViewPattern;
import org.simantics.scl.compiler.elaboration.expressions.EWhen;
expression.getValue().accept(this);
}
+ @Override
+ public void visit(EVar expression) {
+ b.append(expression.name);
+ }
+
@Override
public void visit(EVariable expression) {
show(expression.getVariable());
showPar(parameter);
}
}
+
+ @Override
+ public void visit(EBinary expression) {
+ b.append("<EBinary>");
+ }
+
+ @Override
+ public void visit(EBlock expression) {
+ b.append("<EBlock>");
+ }
+
+ @Override
+ public void visit(EPreLet expression) {
+ b.append("<EPreLet>");
+ }
+
+ @Override
+ public void visit(ERange expression) {
+ b.append('[');
+ expression.from.accept(this);
+ b.append("..");
+ expression.to.accept(this);
+ b.append(']');
+ }
+
+ @Override
+ public void visit(ERecord expression) {
+ b.append("<ERecord>");
+ }
+
+ @Override
+ public void visit(EStringLiteral expression) {
+ b.append('"');
+ for(int i=0;i<expression.strings.length;++i) {
+ b.append(expression.strings[i]);
+ if(i < expression.expressions.length) {
+ b.append("\\(");
+ expression.expressions[i].accept(this);
+ b.append(')');
+ }
+ }
+ b.append('"');
+ }
}
*/
//@Test public void CityoptSetup() { test(); }
+
+ @Test public void Bug6989() { test(); }
}
import org.simantics.scl.osgi.SCLOsgi;
public class InitialRepository {
+ public static final boolean NO_PRELUDE = false;
+
private static ModuleRepository MODULE_REPOSITORY1 = new ModuleRepository(
new CompositeModuleSourceRepository(
SourceRepositories.BUILTIN_SOURCE_REPOSITORY,
));
public static ModuleRepository getInitialRepository() {
- if(MODULE_REPOSITORY1.getModule("Prelude").didSucceed())
+ if(NO_PRELUDE)
+ return new ModuleRepository(SourceRepositories.BUILTIN_SOURCE_REPOSITORY);
+ else if(MODULE_REPOSITORY1.getModule("Prelude").didSucceed())
return MODULE_REPOSITORY1;
else
return SCLOsgi.MODULE_REPOSITORY;
--- /dev/null
+main = ()
+ where
+ test = "foo","bar"
+--
+()
\ No newline at end of file