예제 #1
0
 @Subroutine("read-from-string")
 public static LispList readFromString(
     LispString string,
     @Optional @Nullable LispObject start,
     @Optional @Nullable LispObject finish) {
   int begin = getInt(start, 0);
   int end = getInt(finish, string.size());
   try {
     String code = string.getData().substring(begin, end);
     ForwardParser forwardParser = new ForwardParser();
     LispObject read = Core.thisOrNil(forwardParser.parseLine(code));
     return LispList.cons(read, new LispInteger(begin + forwardParser.getCurrentIndex()));
   } catch (StringIndexOutOfBoundsException e) {
     throw new ArgumentOutOfRange(string, begin, end);
   }
 }
예제 #2
0
 @Subroutine("current-message")
 public static LispObject currentMessage() {
   return Core.thisOrNil(myCurrentMessage);
 }