Update code formatter
This commit is contained in:
parent
114a3e4309
commit
d0cffe7500
|
@ -1,8 +1,47 @@
|
||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<code_scheme name="Project" version="173">
|
<code_scheme name="Project" version="173">
|
||||||
|
<JavaCodeStyleSettings>
|
||||||
|
<option name="DO_NOT_WRAP_AFTER_SINGLE_ANNOTATION" value="true" />
|
||||||
|
<option name="ANNOTATION_PARAMETER_WRAP" value="5" />
|
||||||
|
<option name="ALIGN_MULTILINE_ANNOTATION_PARAMETERS" value="true" />
|
||||||
|
</JavaCodeStyleSettings>
|
||||||
<XML>
|
<XML>
|
||||||
<option name="XML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
<option name="XML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
||||||
</XML>
|
</XML>
|
||||||
|
<codeStyleSettings language="JAVA">
|
||||||
|
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
|
||||||
|
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
|
||||||
|
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
|
||||||
|
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
|
||||||
|
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
|
||||||
|
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||||
|
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
|
||||||
|
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
||||||
|
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
|
||||||
|
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
|
||||||
|
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
|
||||||
|
<option name="ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION" value="true" />
|
||||||
|
<option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACES" value="true" />
|
||||||
|
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
|
||||||
|
<option name="CALL_PARAMETERS_WRAP" value="5" />
|
||||||
|
<option name="METHOD_PARAMETERS_WRAP" value="5" />
|
||||||
|
<option name="RESOURCE_LIST_WRAP" value="5" />
|
||||||
|
<option name="EXTENDS_LIST_WRAP" value="5" />
|
||||||
|
<option name="THROWS_LIST_WRAP" value="5" />
|
||||||
|
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
|
||||||
|
<option name="THROWS_KEYWORD_WRAP" value="1" />
|
||||||
|
<option name="METHOD_CALL_CHAIN_WRAP" value="5" />
|
||||||
|
<option name="BINARY_OPERATION_WRAP" value="5" />
|
||||||
|
<option name="TERNARY_OPERATION_WRAP" value="1" />
|
||||||
|
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||||
|
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
|
||||||
|
<option name="KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE" value="true" />
|
||||||
|
<option name="KEEP_SIMPLE_CLASSES_IN_ONE_LINE" value="true" />
|
||||||
|
<option name="FOR_STATEMENT_WRAP" value="5" />
|
||||||
|
<option name="ARRAY_INITIALIZER_WRAP" value="5" />
|
||||||
|
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||||
|
<option name="ENUM_CONSTANTS_WRAP" value="5" />
|
||||||
|
</codeStyleSettings>
|
||||||
<codeStyleSettings language="XML">
|
<codeStyleSettings language="XML">
|
||||||
<indentOptions>
|
<indentOptions>
|
||||||
<option name="INDENT_SIZE" value="2" />
|
<option name="INDENT_SIZE" value="2" />
|
||||||
|
|
|
@ -152,5 +152,4 @@ public class LispMain {
|
||||||
|
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,5 +151,4 @@ public class RuntimeEnvironment {
|
||||||
public String decorateCriticalOutput(String criticalOutput) {
|
public String decorateCriticalOutput(String criticalOutput) {
|
||||||
return criticalOutputDecorator.apply(criticalOutput);
|
return criticalOutputDecorator.apply(criticalOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,5 +17,4 @@ public abstract class CriticalLineColumnException extends LineColumnException {
|
||||||
public Severity getSeverity() {
|
public Severity getSeverity() {
|
||||||
return CRITICAL;
|
return CRITICAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -12,5 +12,4 @@ public abstract class CriticalLispException extends LispException {
|
||||||
public Severity getSeverity() {
|
public Severity getSeverity() {
|
||||||
return CRITICAL;
|
return CRITICAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,6 @@ public class ErrorManager {
|
||||||
public static enum Severity {
|
public static enum Severity {
|
||||||
|
|
||||||
WARNING {
|
WARNING {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String decorate(String warningOutput, RuntimeEnvironment environment) {
|
public String decorate(String warningOutput, RuntimeEnvironment environment) {
|
||||||
return environment.decorateWarningOutput(warningOutput);
|
return environment.decorateWarningOutput(warningOutput);
|
||||||
|
@ -66,7 +65,6 @@ public class ErrorManager {
|
||||||
},
|
},
|
||||||
|
|
||||||
ERROR {
|
ERROR {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String decorate(String errorOutput, RuntimeEnvironment environment) {
|
public String decorate(String errorOutput, RuntimeEnvironment environment) {
|
||||||
return environment.decorateErrorOutput(errorOutput);
|
return environment.decorateErrorOutput(errorOutput);
|
||||||
|
@ -79,7 +77,6 @@ public class ErrorManager {
|
||||||
},
|
},
|
||||||
|
|
||||||
CRITICAL {
|
CRITICAL {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String decorate(String criticalOutput, RuntimeEnvironment environment) {
|
public String decorate(String criticalOutput, RuntimeEnvironment environment) {
|
||||||
return environment.decorateCriticalOutput(criticalOutput);
|
return environment.decorateCriticalOutput(criticalOutput);
|
||||||
|
@ -95,5 +92,4 @@ public class ErrorManager {
|
||||||
|
|
||||||
public abstract String toDisplayString();
|
public abstract String toDisplayString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,5 +22,4 @@ public abstract class LineColumnException extends LispException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract String getMessagePrefix();
|
public abstract String getMessagePrefix();
|
||||||
|
|
||||||
}
|
}
|
|
@ -11,5 +11,4 @@ public abstract class LispException extends RuntimeException {
|
||||||
public Severity getSeverity() {
|
public Severity getSeverity() {
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,4 @@ public abstract class LispWarning extends LispException {
|
||||||
public Severity getSeverity() {
|
public Severity getSeverity() {
|
||||||
return WARNING;
|
return WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,5 +29,4 @@ public class FilePosition {
|
||||||
public void setColumnNumber(int columnNumber) {
|
public void setColumnNumber(int columnNumber) {
|
||||||
this.columnNumber = columnNumber;
|
this.columnNumber = columnNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -28,5 +28,4 @@ public class FilePositionTracker {
|
||||||
lineNumber++;
|
lineNumber++;
|
||||||
columnNumber = 0;
|
columnNumber = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -231,5 +231,4 @@ public class ArgumentValidator {
|
||||||
return (displayName == null) ? "unknown" : displayName.value();
|
return (displayName == null) ? "unknown" : displayName.value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,5 +10,4 @@ import java.lang.annotation.Target;
|
||||||
public @interface FunctionNames {
|
public @interface FunctionNames {
|
||||||
|
|
||||||
String[] value();
|
String[] value();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,5 +14,4 @@ public abstract class LispFunction {
|
||||||
public boolean isMacro() {
|
public boolean isMacro() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,5 +6,4 @@ public abstract class LispSpecialFunction extends LispFunction {
|
||||||
public boolean isArgumentListEvaluated() {
|
public boolean isArgumentListEvaluated() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,5 +166,4 @@ public class UserDefinedFunction extends LispFunction {
|
||||||
parameters);
|
parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,4 @@ public class UserDefinedMacro extends UserDefinedSpecialFunction {
|
||||||
public boolean isMacro() {
|
public boolean isMacro() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,4 @@ public class UserDefinedSpecialFunction extends UserDefinedFunction {
|
||||||
public boolean isArgumentListEvaluated() {
|
public boolean isArgumentListEvaluated() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,5 +36,4 @@ public class APPLY extends LispFunction {
|
||||||
|
|
||||||
return applyFunction(function, functionArguments);
|
return applyFunction(function, functionArguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,5 +201,4 @@ class BackquoteEvaluator {
|
||||||
return "at sign did not evaluate to a list";
|
return "at sign did not evaluate to a list";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,5 +228,4 @@ public class EVAL extends LispFunction {
|
||||||
return "unmatched at sign";
|
return "unmatched at sign";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,5 +28,4 @@ public class EXIT extends LispFunction {
|
||||||
|
|
||||||
return NIL;
|
return NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,4 @@ public class FUNCALL extends LispFunction {
|
||||||
|
|
||||||
return apply(applyArgs);
|
return apply(applyArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,5 +32,4 @@ public class FUSE extends LispFunction {
|
||||||
|
|
||||||
return new Symbol(left.toString() + SEPARATOR + right.toString());
|
return new Symbol(left.toString() + SEPARATOR + right.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,5 +39,4 @@ public class GENSYM extends LispFunction {
|
||||||
|
|
||||||
return generateSymbol();
|
return generateSymbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,5 +114,4 @@ public class LOAD extends LispFunction {
|
||||||
return format("could not load ''{0}''", fileName);
|
return format("could not load ''{0}''", fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,5 +27,4 @@ public class PRINT extends LispFunction {
|
||||||
|
|
||||||
return argument;
|
return argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,5 +54,4 @@ public class SET extends LispFunction {
|
||||||
private boolean isSymbolInTable(SExpression symbol, SymbolTable table) {
|
private boolean isSymbolInTable(SExpression symbol, SymbolTable table) {
|
||||||
return table.contains(symbol.toString());
|
return table.contains(symbol.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,5 +25,4 @@ public class SYMBOLS extends LispFunction {
|
||||||
|
|
||||||
return executionContext.toList();
|
return executionContext.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,5 +60,4 @@ public class SYMBOL_FUNCTION extends LispFunction {
|
||||||
return format("SYMBOL-FUNCTION: undefined function: {0}", function);
|
return format("SYMBOL-FUNCTION: undefined function: {0}", function);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,4 @@ public class CONS extends LispFunction {
|
||||||
|
|
||||||
return new Cons(firstArgument, secondArgument);
|
return new Cons(firstArgument, secondArgument);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,5 +24,4 @@ public class FIRST extends LispFunction {
|
||||||
|
|
||||||
return argument.getFirst();
|
return argument.getFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,5 +62,4 @@ public class LENGTH extends LispFunction {
|
||||||
private BigInteger increment(BigInteger number) {
|
private BigInteger increment(BigInteger number) {
|
||||||
return number.add(BigInteger.ONE);
|
return number.add(BigInteger.ONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,5 +27,4 @@ public class LIST extends LispFunction {
|
||||||
|
|
||||||
return argumentList;
|
return argumentList;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,5 +24,4 @@ public class REST extends LispFunction {
|
||||||
|
|
||||||
return argument.getRest();
|
return argument.getRest();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,5 +50,4 @@ public class DIVIDE extends LispFunction {
|
||||||
return "divide by zero";
|
return "divide by zero";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,5 +35,4 @@ public class MINUS extends LispFunction {
|
||||||
private LispNumber subtract(LispNumber number1, LispNumber number2) {
|
private LispNumber subtract(LispNumber number1, LispNumber number2) {
|
||||||
return new LispNumber(number1.getValue().subtract(number2.getValue()));
|
return new LispNumber(number1.getValue().subtract(number2.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,5 +41,4 @@ public class MODULO extends LispFunction {
|
||||||
return "modulus not positive";
|
return "modulus not positive";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,5 +30,4 @@ public class MULTIPLY extends LispFunction {
|
||||||
private LispNumber multiply(LispNumber number1, LispNumber number2) {
|
private LispNumber multiply(LispNumber number1, LispNumber number2) {
|
||||||
return new LispNumber(number1.getValue().multiply(number2.getValue()));
|
return new LispNumber(number1.getValue().multiply(number2.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,5 +40,4 @@ class MathFunction {
|
||||||
|
|
||||||
return tailCall(() -> callTailRecursive(new Cons(operationResult, remainingNumbers)));
|
return tailCall(() -> callTailRecursive(new Cons(operationResult, remainingNumbers)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,5 +30,4 @@ public class PLUS extends LispFunction {
|
||||||
private LispNumber add(LispNumber number1, LispNumber number2) {
|
private LispNumber add(LispNumber number1, LispNumber number2) {
|
||||||
return new LispNumber(number1.getValue().add(number2.getValue()));
|
return new LispNumber(number1.getValue().add(number2.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,5 +31,4 @@ public class REMAINDER extends LispFunction {
|
||||||
throw new DivideByZeroException();
|
throw new DivideByZeroException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,4 @@ public class ATOM extends LispFunction {
|
||||||
|
|
||||||
return argument.isAtom() ? T : NIL;
|
return argument.isAtom() ? T : NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,5 +52,4 @@ public class EQ extends LispFunction {
|
||||||
private SExpression listEq(SExpression firstArgument, SExpression secondArgument) {
|
private SExpression listEq(SExpression firstArgument, SExpression secondArgument) {
|
||||||
return (firstArgument == secondArgument) ? T : NIL;
|
return (firstArgument == secondArgument) ? T : NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,5 +37,4 @@ public class EQUAL extends LispFunction {
|
||||||
private SExpression equal(SExpression firstArgument, SExpression secondArgument) {
|
private SExpression equal(SExpression firstArgument, SExpression secondArgument) {
|
||||||
return isEqual(firstArgument, secondArgument) ? T : NIL;
|
return isEqual(firstArgument, secondArgument) ? T : NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,5 +97,4 @@ public class GENSYM_EQUAL extends LispFunction {
|
||||||
return equalizedExpression;
|
return equalizedExpression;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,5 +25,4 @@ public class LISTP extends LispFunction {
|
||||||
|
|
||||||
return argumentList.getFirst().isList() ? T : NIL;
|
return argumentList.getFirst().isList() ? T : NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,5 +25,4 @@ public class NULL extends LispFunction {
|
||||||
|
|
||||||
return argumentList.getFirst().isNull() ? T : NIL;
|
return argumentList.getFirst().isNull() ? T : NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,5 +51,4 @@ public class NUMERIC_EQUAL extends LispFunction {
|
||||||
private boolean isEqual(LispNumber number1, LispNumber number2) {
|
private boolean isEqual(LispNumber number1, LispNumber number2) {
|
||||||
return number1.getValue().equals(number2.getValue());
|
return number1.getValue().equals(number2.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,5 +51,4 @@ public class NUMERIC_GREATER extends LispFunction {
|
||||||
private boolean isFirstGreater(LispNumber number1, LispNumber number2) {
|
private boolean isFirstGreater(LispNumber number1, LispNumber number2) {
|
||||||
return number1.getValue().compareTo(number2.getValue()) > 0;
|
return number1.getValue().compareTo(number2.getValue()) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,5 +51,4 @@ public class NUMERIC_LESS extends LispFunction {
|
||||||
private boolean isFirstLesser(LispNumber number1, LispNumber number2) {
|
private boolean isFirstLesser(LispNumber number1, LispNumber number2) {
|
||||||
return number1.getValue().compareTo(number2.getValue()) < 0;
|
return number1.getValue().compareTo(number2.getValue()) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,5 +40,4 @@ public class AND extends LispSpecialFunction {
|
||||||
|
|
||||||
return tailCall(() -> callTailRecursive(remainingValues, currentValue));
|
return tailCall(() -> callTailRecursive(remainingValues, currentValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,5 +82,4 @@ public class CASE extends LispSpecialFunction {
|
||||||
|
|
||||||
return lastConsequentValue;
|
return lastConsequentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,5 +65,4 @@ public class COND extends LispSpecialFunction {
|
||||||
private SExpression getFirst(SExpression knownCons) {
|
private SExpression getFirst(SExpression knownCons) {
|
||||||
return ((Cons) knownCons).getFirst();
|
return ((Cons) knownCons).getFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,5 +17,4 @@ public class DEFINE_SPECIAL extends Define {
|
||||||
protected UserDefinedFunction createFunction(SExpression functionName, Cons lambdaList, Cons functionBody) {
|
protected UserDefinedFunction createFunction(SExpression functionName, Cons lambdaList, Cons functionBody) {
|
||||||
return new UserDefinedSpecialFunction(functionName.toString(), lambdaList, functionBody);
|
return new UserDefinedSpecialFunction(functionName.toString(), lambdaList, functionBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,5 +17,4 @@ public class DEFMACRO extends Define {
|
||||||
protected UserDefinedFunction createFunction(SExpression functionName, Cons lambdaList, Cons functionBody) {
|
protected UserDefinedFunction createFunction(SExpression functionName, Cons lambdaList, Cons functionBody) {
|
||||||
return new UserDefinedMacro(functionName.toString(), lambdaList, functionBody);
|
return new UserDefinedMacro(functionName.toString(), lambdaList, functionBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,5 +16,4 @@ public class DEFUN extends Define {
|
||||||
protected UserDefinedFunction createFunction(SExpression functionName, Cons lambdaList, Cons functionBody) {
|
protected UserDefinedFunction createFunction(SExpression functionName, Cons lambdaList, Cons functionBody) {
|
||||||
return new UserDefinedFunction(functionName.toString(), lambdaList, functionBody);
|
return new UserDefinedFunction(functionName.toString(), lambdaList, functionBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,5 +74,4 @@ public abstract class Define extends LispSpecialFunction {
|
||||||
return format("redefining function {0}", functionName);
|
return format("redefining function {0}", functionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,5 +49,4 @@ public class IF extends LispSpecialFunction {
|
||||||
|
|
||||||
return getRestOfList(expressions).getFirst();
|
return getRestOfList(expressions).getFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,5 +66,4 @@ public class LAMBDA extends LispSpecialFunction {
|
||||||
private Cons makeOriginalLambdaExpression(Cons argumentList) {
|
private Cons makeOriginalLambdaExpression(Cons argumentList) {
|
||||||
return new Cons(new Symbol("LAMBDA"), argumentList);
|
return new Cons(new Symbol("LAMBDA"), argumentList);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,5 +90,4 @@ public class LET extends LispSpecialFunction {
|
||||||
private void restorePreviousScope(SymbolTable localScope) {
|
private void restorePreviousScope(SymbolTable localScope) {
|
||||||
executionContext.setScope(localScope.getParent());
|
executionContext.setScope(localScope.getParent());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,5 +19,4 @@ public class LET_STAR extends LET {
|
||||||
|
|
||||||
return localScope;
|
return localScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,5 +36,4 @@ public class OR extends LispSpecialFunction {
|
||||||
|
|
||||||
return tailCall(() -> callTailRecursive(remainingValues));
|
return tailCall(() -> callTailRecursive(remainingValues));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,5 +37,4 @@ public class PROGN extends LispSpecialFunction {
|
||||||
|
|
||||||
return tailCall(() -> callTailRecursive(remainingValues, currentValue));
|
return tailCall(() -> callTailRecursive(remainingValues, currentValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,5 +22,4 @@ public class QUOTE extends LispSpecialFunction {
|
||||||
|
|
||||||
return argumentList.getFirst();
|
return argumentList.getFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,5 +87,4 @@ public class RECUR extends LispSpecialFunction {
|
||||||
return "recur not in tail position";
|
return "recur not in tail position";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,5 +35,4 @@ public class SETQ extends LispSpecialFunction {
|
||||||
|
|
||||||
return new Cons(argumentList.getFirst(), makeList(value));
|
return new Cons(argumentList.getFirst(), makeList(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,5 +25,4 @@ public class FileLispInterpreter extends LispInterpreter {
|
||||||
|
|
||||||
super.applyFinishingTouches();
|
super.applyFinishingTouches();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,4 @@ public class InteractiveLispInterpreter extends LispInterpreter {
|
||||||
environment.getOutput().println(environment.decoratePrompt(""));
|
environment.getOutput().println(environment.decoratePrompt(""));
|
||||||
environment.getOutput().flush();
|
environment.getOutput().flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,5 +90,4 @@ public class LispInterpreter {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,5 +35,4 @@ public interface LispInterpreterBuilder {
|
||||||
LispInterpreter build();
|
LispInterpreter build();
|
||||||
|
|
||||||
default void reset() {}
|
default void reset() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,6 @@ public class LispInterpreterBuilderImpl implements LispInterpreterBuilder {
|
||||||
@Override
|
@Override
|
||||||
public void setOutput(PrintStream outputStream) {
|
public void setOutput(PrintStream outputStream) {
|
||||||
this.outputStream = outputStream;
|
this.outputStream = outputStream;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -115,13 +114,11 @@ public class LispInterpreterBuilderImpl implements LispInterpreterBuilder {
|
||||||
@Override
|
@Override
|
||||||
public void setWarningOutputDecorator(Function<String, String> decorator) {
|
public void setWarningOutputDecorator(Function<String, String> decorator) {
|
||||||
this.warningOutputDecorator = decorator;
|
this.warningOutputDecorator = decorator;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setErrorOutputDecorator(Function<String, String> decorator) {
|
public void setErrorOutputDecorator(Function<String, String> decorator) {
|
||||||
this.errorOutputDecorator = decorator;
|
this.errorOutputDecorator = decorator;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -217,5 +214,4 @@ public class LispInterpreterBuilderImpl implements LispInterpreterBuilder {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,5 +60,4 @@ public class LispParser {
|
||||||
throw exceptionToThrow;
|
throw exceptionToThrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,4 @@ public interface TailCall<T> {
|
||||||
|
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,5 +25,4 @@ public class TailCalls {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -80,5 +80,4 @@ public class LispCommentRemovingInputStream implements LispInputStream {
|
||||||
|
|
||||||
this.rereadLastCharacter = true;
|
this.rereadLastCharacter = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,4 @@ public interface LispInputStream {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,5 +183,4 @@ public class LispScanner {
|
||||||
return "unterminated quoted string";
|
return "unterminated quoted string";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,4 @@ public class AtSignExpression extends SExpression {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "@" + expression;
|
return "@" + expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,5 +18,4 @@ public abstract class Atom extends SExpression {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,4 @@ public class BackquoteExpression extends SExpression {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "`" + expression;
|
return "`" + expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,4 @@ public class CommaExpression extends SExpression {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "," + expression;
|
return "," + expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,5 +53,4 @@ public class Cons extends SExpression {
|
||||||
|
|
||||||
return done(leadingString.append(" . " + rest.toString() + ")").toString());
|
return done(leadingString.append(" . " + rest.toString() + ")").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,5 +10,4 @@ import java.lang.annotation.Target;
|
||||||
public @interface DisplayName {
|
public @interface DisplayName {
|
||||||
|
|
||||||
String value();
|
String value();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,5 +30,4 @@ public class LambdaExpression extends SExpression {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return lambdaExpression.toString();
|
return lambdaExpression.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,5 +53,4 @@ public class LispNumber extends Atom {
|
||||||
return format("{0} is not a valid integer", text);
|
return format("{0} is not a valid integer", text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,5 +11,4 @@ public class LispString extends Atom {
|
||||||
public boolean isString() {
|
public boolean isString() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,5 +48,4 @@ public class Nil extends Cons {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "NIL";
|
return "NIL";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,5 +46,4 @@ public abstract class SExpression {
|
||||||
public boolean isAtSign() {
|
public boolean isAtSign() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,5 +19,4 @@ public class Symbol extends Atom {
|
||||||
public boolean isSymbol() {
|
public boolean isSymbol() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,5 +29,4 @@ public class SafeInputStream {
|
||||||
throw new UncheckedIOException(e);
|
throw new UncheckedIOException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -35,5 +35,4 @@ public class SafeOutputStream {
|
||||||
throw new UncheckedIOException(e);
|
throw new UncheckedIOException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -17,5 +17,4 @@ public class UncheckedIOException extends CriticalLispException {
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return exception.getMessage();
|
return exception.getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -197,5 +197,4 @@ public class FunctionTable {
|
||||||
return format("Could not create an instance of ''{0}''", functionName);
|
return format("Could not create an instance of ''{0}''", functionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,5 +63,4 @@ public class SymbolTable {
|
||||||
private Cons makeSymbolValuePair(Entry<String, SExpression> binding) {
|
private Cons makeSymbolValuePair(Entry<String, SExpression> binding) {
|
||||||
return new Cons(new Symbol(binding.getKey()), makeList(binding.getValue()));
|
return new Cons(new Symbol(binding.getKey()), makeList(binding.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,5 +57,4 @@ class ControlSequenceHandler {
|
||||||
private boolean isPartOfCode() {
|
private boolean isPartOfCode() {
|
||||||
return isCharacter() && isDigit((char) currentCharacter);
|
return isCharacter() && isDigit((char) currentCharacter);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,5 +31,4 @@ public class ControlSequenceLookup {
|
||||||
|
|
||||||
return codes.getOrDefault(code, new NullControlSequence());
|
return codes.getOrDefault(code, new NullControlSequence());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -210,7 +210,8 @@ public class LispTerminal {
|
||||||
TerminalPosition cursorPosition = terminal.getCursorPosition();
|
TerminalPosition cursorPosition = terminal.getCursorPosition();
|
||||||
terminal.putCharacter(character);
|
terminal.putCharacter(character);
|
||||||
moveCursorToNextRow(cursorPosition);
|
moveCursorToNextRow(cursorPosition);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
terminal.putCharacter(character);
|
terminal.putCharacter(character);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,7 +394,8 @@ public class LispTerminal {
|
||||||
private void takeNap() {
|
private void takeNap() {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1);
|
Thread.sleep(1);
|
||||||
} catch (InterruptedException ignored) {}
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeOutput() {
|
private void writeOutput() {
|
||||||
|
@ -458,5 +460,4 @@ public class LispTerminal {
|
||||||
isStopped = true;
|
isStopped = true;
|
||||||
inputWriter.close();
|
inputWriter.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import com.googlecode.lanterna.terminal.IOSafeTerminal;
|
||||||
public enum SelectGraphicRendition implements ControlSequence {
|
public enum SelectGraphicRendition implements ControlSequence {
|
||||||
|
|
||||||
RESET {
|
RESET {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return "0";
|
return "0";
|
||||||
|
@ -19,7 +18,6 @@ public enum SelectGraphicRendition implements ControlSequence {
|
||||||
},
|
},
|
||||||
|
|
||||||
RED {
|
RED {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return "31";
|
return "31";
|
||||||
|
@ -32,7 +30,6 @@ public enum SelectGraphicRendition implements ControlSequence {
|
||||||
},
|
},
|
||||||
|
|
||||||
GREEN {
|
GREEN {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return "32";
|
return "32";
|
||||||
|
@ -45,7 +42,6 @@ public enum SelectGraphicRendition implements ControlSequence {
|
||||||
},
|
},
|
||||||
|
|
||||||
YELLOW {
|
YELLOW {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return "33";
|
return "33";
|
||||||
|
@ -58,7 +54,6 @@ public enum SelectGraphicRendition implements ControlSequence {
|
||||||
},
|
},
|
||||||
|
|
||||||
PURPLE {
|
PURPLE {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return "35";
|
return "35";
|
||||||
|
|
|
@ -67,5 +67,4 @@ public class TerminalConfiguration {
|
||||||
public IOSafeTerminal getTerminal() {
|
public IOSafeTerminal getTerminal() {
|
||||||
return terminal;
|
return terminal;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue