minor cleanups

This commit is contained in:
cozis
2022-08-17 19:54:28 +02:00
parent 6ba7fd21ef
commit e4bc4fe253
3 changed files with 30 additions and 32 deletions
+5 -2
View File
@@ -1,6 +1,8 @@
fun isSpace(c: String)
return c == " " or c == "\t" or c == "\n";
return c == " "
or c == "\t"
or c == "\n";
fun isDigit(c: String) {
u = unicode(c);
@@ -125,7 +127,7 @@ fun parseIntegerOrFloating(context: Map) {
# Is the first digit sequence followed by a dot
# and then one or more digits?
k = skip(context, isDigit);
if k+1 < count(context.str) and context.str[k] == "." and isDigit(context.str[k+1]):
# It's a floating point value, then!
@@ -232,6 +234,7 @@ fun parseValue(context: Map) {
}
fun parse(str: String) {
context = {str: str, cur: 0};
skipSpaces(context);
val, err = parseValue(context);
+1 -1
View File
@@ -59,4 +59,4 @@ assert(z == 1);
assert(w == none);
Stack_Print(stack);
print("\n");
print("\n");