Class ReturnUtils
java.lang.Object
io.github.lukebemish.brainfrick.lang.runtime.ReturnUtils
Contains utility methods used by brainfrick to handle casting to return types.
-
Method Summary
-
Method Details
-
fromChars
Creates a string from a buffer. If the buffer contains a string at the top, that string should be returned. Otherwise, each element of the buffer should be converted to a character and the output string assembled from those. Called at the end of brainfrick methods returning aString
- Parameters:
list
- The buffer to assemble a string from.- Returns:
- A string to be returned by the brainfrick method.
- Throws:
BufferTooSmallException
- if the buffer does not contain at least one item.ImproperTypeException
- if a member of the buffer cannot be converted to a character.
-
fromBuffer
Gets a value to return from the top of a buffer. Called at the end of brainfrick methods whose return tyoes do not have special cases.- Parameters:
list
- The buffer to assemble a string from.- Returns:
- An object to be returned, after type conversion, by the brainfrick method.
- Throws:
BufferTooSmallException
- if the buffer does not contain at least one item.- See Also:
-