diff --git a/README.md b/README.md index d717366..81ec6c5 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,6 @@ JSchemeMin 是又一个JVM平台上的Scheme语言实现。 目前,JSchemeMin 只提供解释器而非编译器。基本的性能监视机制已经存在。调试器和覆盖率工具也已经提供。 -性能并非JSchemeMin的主要设计目标,大部公情况下用明显的实现方式,不为性能牺牲实现的简单性,但相信足以满足预期的需要。 +性能并非JSchemeMin的主要设计目标,大部分情况下用明显的实现方式,不为性能牺牲实现的简单性,但相信足以满足预期的需要。 本软件为自由软件: 你可以在自由软件基金会的GNU通用公共许可,版本3或按你的意愿更新的版本,的条款下再分发它和/或修改它。 diff --git a/doc/first.tex b/doc/first.tex index 6b3812e..1590787 100644 --- a/doc/first.tex +++ b/doc/first.tex @@ -12,7 +12,8 @@ \multicolumn{3}{c}{陈颂光 (\textit{Revisor})} \\ \multicolumn{3}{c}{A\authorsc{LEX} S\authorsc{HINN}, J\authorsc{OHN} C\authorsc{OWAN}, \authorsc{AND} -A\authorsc{RTHUR} A. G\authorsc{LECKLER} (\textit{Editors})} \\ +A\authorsc{RTHUR} A. G\authorsc{LECKLER} } \\ +\multicolumn{3}{c}{\textit{(Editors, Revised$^{\mathit{7}}$ Report on the Algorithmic Language Scheme)}} \\ \\ S\authorsc{TEVEN} G\authorsc{ANZ} & A\authorsc{LEXEY} R\authorsc{ADUL} & diff --git a/doc/r7rs.tex b/doc/r7rs.tex index 627893e..b5b76e4 100644 --- a/doc/r7rs.tex +++ b/doc/r7rs.tex @@ -8,7 +8,7 @@ \makeindex \input{commands} -\def\headertitle{Revised$^{7}$ Scheme} +\def\headertitle{JSchemeMin User Manual} \def\integerversion{7} % Sizes and dimensions diff --git a/src/com/github/chungkwong/jschememin/Debugger.java b/src/com/github/chungkwong/jschememin/Debugger.java index d2ef8f6..c836edd 100644 --- a/src/com/github/chungkwong/jschememin/Debugger.java +++ b/src/com/github/chungkwong/jschememin/Debugger.java @@ -85,9 +85,6 @@ private boolean isCaredPoint(){ return cont.hasNext()&&cont.getCurrentEvaluable()instanceof ExpressionEvaluator&& caredExpressions.containsKey(cont.getCurrentValue()); } - private boolean isFinished(){ - return cont.hasNext(); - } public ScmObject eval(ScmObject obj){ return new Evaluator(cont.getCurrentEnvironment()).eval(obj); } diff --git a/src/com/github/chungkwong/jschememin/lib/Java.java b/src/com/github/chungkwong/jschememin/lib/Java.java index ed7cd69..ea78d5a 100644 --- a/src/com/github/chungkwong/jschememin/lib/Java.java +++ b/src/com/github/chungkwong/jschememin/lib/Java.java @@ -21,11 +21,9 @@ import static com.github.chungkwong.jschememin.lib.Utility.car; import static com.github.chungkwong.jschememin.lib.Utility.cdr; import com.github.chungkwong.jschememin.type.*; -import java.lang.invoke.*; import java.lang.reflect.*; import java.math.*; import java.util.*; -import java.util.stream.*; /** * * @author Chan Chung Kwong <1m02math@126.com> @@ -118,7 +116,6 @@ private static ScmObject invoke(ScmObject param)throws ClassNotFoundException Object[] arguments=toArray(((ScmPair)param).getCddr()); Class[] paraType=toClassArray(arguments); Method m=(Method)selectMethod(cls.getMethods(),method,paraType); - MethodHandle handle=MethodHandles.lookup().unreflect(m); if(m!=null) try{ return new ScmJavaObject(m.invoke(obj,adjustForVarargs(arguments,m))); @@ -165,9 +162,6 @@ private static Object[] adjustForVarargs(Object[] args,Executable m){ private static ScmObject cast(ScmObject param) throws ClassNotFoundException{ return new ScmJavaObject(Class.forName(((ScmSymbol)cadr(param)).getValue()).cast(((ScmJavaObject)car(param)).getJavaObject())); } - private static Set getPossibleReturnType(Class cls,String method){ - return Arrays.stream(cls.getMethods()).filter((m)->m.getName().equals(method)).map((m)->m.getReturnType()).collect(Collectors.toSet()); - } private static Executable selectMethod(Executable[] choices,String name,Class[] argsType){ Executable best=null; Class[] bestParameterTypes=null; diff --git a/src/com/github/chungkwong/jschememin/type/ScmSymbol.java b/src/com/github/chungkwong/jschememin/type/ScmSymbol.java index d26d4f2..bed9792 100644 --- a/src/com/github/chungkwong/jschememin/type/ScmSymbol.java +++ b/src/com/github/chungkwong/jschememin/type/ScmSymbol.java @@ -25,7 +25,7 @@ public String getValue(){ } @Override public boolean equals(Object obj){ - return getClass().equals(obj.getClass())&&((ScmSymbol)obj).id.equals(id); + return obj!=null&&getClass().equals(obj.getClass())&&((ScmSymbol)obj).id.equals(id); } @Override public int hashCode(){ diff --git a/test/com/github/chungkwong/jschememin/LexTest.java b/test/com/github/chungkwong/jschememin/LexTest.java index c1a8103..e64f22c 100644 --- a/test/com/github/chungkwong/jschememin/LexTest.java +++ b/test/com/github/chungkwong/jschememin/LexTest.java @@ -169,7 +169,7 @@ public void testRealNumber(){ check("1.e-10)",new ScmFloatingPointNumber(new BigDecimal("1e-10")),SimpleToken.getToken(")")); Assert.assertSame(new Lex("+nan.0)").nextToken(),ScmSpecialReal.POSITIVE_NAN); try{ - Assert.assertSame(new Lex("+nan.0)").getRemainingTokens().size(),2); + Assert.assertEquals(new Lex("+nan.0)").getRemainingTokens().size(),2); Assert.assertEquals(new Lex("+nan.0)").getRemainingTokens().get(1),SimpleToken.getToken(")")); }catch(IOException ex){ Assert.assertTrue(false);