diff --git a/src/env.c b/src/env.c index 9520a7a..fbd7967 100644 --- a/src/env.c +++ b/src/env.c @@ -278,7 +278,24 @@ char* getHelp(const char* symbol) for (int ti = 0; ti < h.testCount; ti += 2) { const char* test = h.tests[ti]; const char* expected = h.tests[ti + 1]; - textCursor += sprintf(textCursor, "\n %s => %s", test, expected); + textCursor += sprintf(textCursor, "\n "); + int c = 0; + int depth = 0; + while(test[c]) { + if (test[c] == '(') { + depth += 1; + textCursor += sprintf(textCursor, "[3%dm", depth + 2); + } else if (test[c] == ')') { + depth -= 1; + textCursor += sprintf(textCursor, ")[3%dm", depth + 2); + c++; + continue; + } + textCursor += sprintf(textCursor, "%c", test[c]); + c++; + } + //textCursor += sprintf(textCursor, "\n %s => %s", test, expected); + textCursor += sprintf(textCursor, " => %s", expected); } return text; } diff --git a/src/plfunc.h b/src/plfunc.h index 8069a14..e740a3d 100644 --- a/src/plfunc.h +++ b/src/plfunc.h @@ -77,9 +77,10 @@ fn(isNum, "(isnum 1) => T\n(isnum \"Hello\") => F") (Object test, Object ignore, struct Environment* ignore2); fn(isList, - "(islist (1 2 3)) => T\n" - "(islist ()) => T\n" - "(islist \"Stringy\") => F" + "Returns `T` only if the argument is a list.", + "(islist (1 2 3))", "T", + "(islist ())", "T", + "(islist \"Stringy\")", "F", )(Object test, Object ignore, struct Environment* ignore2); fn(isString,