use of cz.cuni.mff.d3s.trupple.language.runtime.exceptions.PascalRuntimeException in project TrufflePascal by Aspect26.
the class ProgramArgumentAssignmentNode method assignFile.
private void assignFile(VirtualFrame frame, String filePath) {
try {
FileValue file = (FileValue) frame.getObject(targetSlot);
file.assignFilePath(filePath);
} catch (FrameSlotTypeException e) {
throw new PascalRuntimeException("Something went wrong");
}
}
use of cz.cuni.mff.d3s.trupple.language.runtime.exceptions.PascalRuntimeException in project TrufflePascal by Aspect26.
the class ForNode method executeVoid.
@Override
public void executeVoid(VirtualFrame frame) {
try {
ControlInterface controlInterface = null;
switch(controlSlot.getKind()) {
case Int:
controlInterface = this.createIntControlInterface(frame);
break;
case Long:
controlInterface = this.createLongControlInterface(frame);
break;
case Byte:
controlInterface = this.createCharControlInterface(frame);
break;
case Object:
Object controlValue = frame.getObject(controlSlot);
if (controlValue instanceof EnumValue) {
controlInterface = this.createEnumControlInterface(frame);
break;
} else {
throw new PascalRuntimeException("Unsupported control variable type");
}
}
this.execute(frame, controlInterface, ascending);
} catch (FrameSlotTypeException | UnexpectedResultException e) {
throw new PascalRuntimeException("Something went wrong.");
}
}
use of cz.cuni.mff.d3s.trupple.language.runtime.exceptions.PascalRuntimeException in project TrufflePascal by Aspect26.
the class IdentifiersTableTP method addBuiltinFunctions.
@Override
protected void addBuiltinFunctions() {
super.addBuiltinFunctions();
try {
this.registerNewIdentifier("random", new RandomSubroutineDescriptor());
this.registerNewIdentifier("randomize", new RandomizeSubroutineDescriptor());
this.registerNewIdentifier("assign", new AssignSubroutineDescriptor());
} catch (LexicalException e) {
throw new PascalRuntimeException("Could not initialize extension builtin functions: " + e.getMessage());
}
}
Aggregations