diff --git a/src/environment/RuntimeEnvironment.java b/src/environment/RuntimeEnvironment.java index 83b9b21..867f11d 100644 --- a/src/environment/RuntimeEnvironment.java +++ b/src/environment/RuntimeEnvironment.java @@ -57,7 +57,7 @@ public class RuntimeEnvironment { public void terminateSuccessfully() { terminationFunction.run(); } - + public void terminateExceptionally() { errorTerminationFunction.run(); } diff --git a/src/error/LispException.java b/src/error/LispException.java index f6fb7b3..41e499b 100644 --- a/src/error/LispException.java +++ b/src/error/LispException.java @@ -3,9 +3,9 @@ package error; public abstract class LispException extends RuntimeException { private static final long serialVersionUID = 1L; - + public int getSeverity() { return 0; } - + } diff --git a/src/file/FilePositionTracker.java b/src/file/FilePositionTracker.java index eea5156..6b8074b 100644 --- a/src/file/FilePositionTracker.java +++ b/src/file/FilePositionTracker.java @@ -19,11 +19,11 @@ public class FilePositionTracker { return currentPosition; } - + public void incrementColumn() { columnNumber++; } - + public void incrementLine() { lineNumber++; columnNumber = 0; diff --git a/src/function/builtin/LOAD.java b/src/function/builtin/LOAD.java index 205a8bb..2036696 100644 --- a/src/function/builtin/LOAD.java +++ b/src/function/builtin/LOAD.java @@ -67,7 +67,7 @@ public class LOAD extends LispFunction { return false; } } - + return true; } diff --git a/src/function/builtin/SYMBOL_FUNCTION.java b/src/function/builtin/SYMBOL_FUNCTION.java index 20327b8..b029831 100644 --- a/src/function/builtin/SYMBOL_FUNCTION.java +++ b/src/function/builtin/SYMBOL_FUNCTION.java @@ -29,7 +29,7 @@ public class SYMBOL_FUNCTION extends LispFunction { return new Symbol(MessageFormat.format("#", symbol.toString())); } - + throw new UndefinedSymbolFunctionException(symbol); } diff --git a/src/sexpression/LispNumber.java b/src/sexpression/LispNumber.java index 6ceb8b9..dd90034 100644 --- a/src/sexpression/LispNumber.java +++ b/src/sexpression/LispNumber.java @@ -7,7 +7,7 @@ import error.LispException; @DisplayName("number") public class LispNumber extends Atom { - + public static final LispNumber ZERO = new LispNumber(BigInteger.ZERO); public static final LispNumber ONE = new LispNumber(BigInteger.ONE); diff --git a/src/sexpression/Symbol.java b/src/sexpression/Symbol.java index d4f618a..289589a 100644 --- a/src/sexpression/Symbol.java +++ b/src/sexpression/Symbol.java @@ -4,7 +4,7 @@ package sexpression; public class Symbol extends Atom { public static final Symbol T = new Symbol("T"); - + public static Symbol createQuote() { return new Symbol("QUOTE"); } diff --git a/src/table/ExecutionContext.java b/src/table/ExecutionContext.java index 7d94ad0..3b7a57a 100644 --- a/src/table/ExecutionContext.java +++ b/src/table/ExecutionContext.java @@ -5,13 +5,13 @@ import sexpression.SExpression; public class ExecutionContext { private static ExecutionContext uniqueInstance = new ExecutionContext(); - + public static ExecutionContext getInstance() { return uniqueInstance; } - + private SymbolTable scope; - + private ExecutionContext() { this.scope = new SymbolTable(); } @@ -19,11 +19,11 @@ public class ExecutionContext { public SymbolTable getScope() { return scope; } - + public void setScope(SymbolTable scope) { this.scope = scope; } - + public void clearContext() { this.scope = new SymbolTable(); } diff --git a/src/table/FunctionTable.java b/src/table/FunctionTable.java index d00388a..60dd539 100644 --- a/src/table/FunctionTable.java +++ b/src/table/FunctionTable.java @@ -10,25 +10,25 @@ import function.builtin.predicate.*; import function.builtin.special.*; public class FunctionTable { - + private static FunctionTable uniqueInstance = new FunctionTable(); - + public static LispFunction lookupFunction(String functionName) { return uniqueInstance.functionTable.get(functionName); } - + public static boolean isAlreadyDefined(String functionName) { return uniqueInstance.functionTable.containsKey(functionName); } - + public static void defineFunction(String functionName, LispFunction function) { uniqueInstance.functionTable.put(functionName, function); } - + public static void reset() { uniqueInstance.initializeFunctionTable(); } - + private HashMap functionTable; private FunctionTable() { diff --git a/src/token/Token.java b/src/token/Token.java index 5a211e3..90a9451 100644 --- a/src/token/Token.java +++ b/src/token/Token.java @@ -21,7 +21,7 @@ public abstract class Token { public String getText() { return text; } - + public FilePosition getPosition() { return position; } diff --git a/test/function/UserDefinedFunctionTester.java b/test/function/UserDefinedFunctionTester.java index 7ba85ea..fa32469 100644 --- a/test/function/UserDefinedFunctionTester.java +++ b/test/function/UserDefinedFunctionTester.java @@ -33,8 +33,7 @@ public class UserDefinedFunctionTester { public void testNilFunctionToString() { UserDefinedFunction function = createNoArgumentFunctionThatReturnsNil(); Cons expected = new Cons(new Symbol(FUNCTION_NAME), - new Cons(Nil.getInstance(), - new Cons(Nil.getInstance(), Nil.getInstance()))); + new Cons(Nil.getInstance(), new Cons(Nil.getInstance(), Nil.getInstance()))); assertSExpressionsMatch(expected, function.getLambdaExpression()); } diff --git a/test/function/builtin/cons/CONSTester.java b/test/function/builtin/cons/CONSTester.java index 98f06f2..4cc868b 100644 --- a/test/function/builtin/cons/CONSTester.java +++ b/test/function/builtin/cons/CONSTester.java @@ -29,6 +29,7 @@ public class CONSTester { assertSExpressionsMatch(parseString("(1 2 3)"), evaluateString(input)); } + @Test public void testConsWithTwoLists() { String input = "(cons '(1 2) '(3 4))"; @@ -36,7 +37,6 @@ public class CONSTester { assertSExpressionsMatch(parseString("((1 2) 3 4)"), evaluateString(input)); } - @Test public void testConsWithList() { String input = "(cons nil '(2 3))";