Search in sources :

Example 1 with CantReadInputException

use of cz.cuni.mff.d3s.trupple.language.runtime.exceptions.CantReadInputException in project TrufflePascal by Aspect26.

the class ReadBuiltinNode method readOneToReference.

private void readOneToReference(FileValue file, Reference reference) {
    try {
        switch(reference.getFrameSlot().getKind()) {
            case Int:
                int intValue = readInt(file);
                this.setReferenceInt(reference, intValue);
                break;
            case Byte:
                char charValue = readChar(file);
                this.setReferenceChar(reference, charValue);
                break;
            case Double:
                double doubleValue = readDouble(file);
                this.setReferenceDouble(reference, doubleValue);
                break;
            case Long:
                long longValue = readLong(file);
                this.setReferenceLong(reference, longValue);
                break;
            case Object:
                Object objectValue = readObject(file, reference);
                this.setReferenceObject(reference, objectValue);
                break;
            default:
                throw new PascalRuntimeException("Wrong value passed to read.");
        }
    } catch (IOException e) {
        throw new CantReadInputException(e);
    }
}
Also used : CantReadInputException(cz.cuni.mff.d3s.trupple.language.runtime.exceptions.CantReadInputException) PascalRuntimeException(cz.cuni.mff.d3s.trupple.language.runtime.exceptions.PascalRuntimeException) IOException(java.io.IOException)

Aggregations

CantReadInputException (cz.cuni.mff.d3s.trupple.language.runtime.exceptions.CantReadInputException)1 PascalRuntimeException (cz.cuni.mff.d3s.trupple.language.runtime.exceptions.PascalRuntimeException)1 IOException (java.io.IOException)1