From b96ac994e86451383b5293bd31725dfaaecea15f Mon Sep 17 00:00:00 2001 From: Arkin Solomon Date: Fri, 27 Jan 2023 17:45:20 -0500 Subject: [PATCH] Fix some bugs (#15) in prep for v1.0.4 * Update develop from master (prep for v1.0.3) (#11) * Fix potential operator precedence bug (#8) * v1.0.2 * Update README.md * Update develop (#12) * Fix potential operator precedence bug (#8) * v1.0.2 * Update README.md * Revert "Update develop (#12)" (#13) This reverts commit c6f5c2e342dd25cdad38d43fdb7ee48c697b1b5d. * Fix a few bugs, move things around --- README.md | 2 +- pom.xml | 2 +- .../sakurainterpreter/SakuraInterpreter.java | 11 ++++++++--- .../{functions => execution}/RangeIterable.java | 5 +---- .../sakurainterpreter/functions/RangeFunction.java | 1 + 5 files changed, 12 insertions(+), 9 deletions(-) rename src/main/java/net/arkinsolomon/sakurainterpreter/{functions => execution}/RangeIterable.java (87%) diff --git a/README.md b/README.md index 11752c6..09c7f7d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Sakura Interpreter -- Java - [![Tests](https://github.com/ArkinSolomon/sakura-interpreter-java/actions/workflows/test-all.yml/badge.svg)](https://github.com/ArkinSolomon/sakura-interpreter-java/actions/workflows/test-all.yml) [![javadoc](https://javadoc.io/badge2/net.arkinsolomon/sakurainterpreter/javadoc.svg)](https://javadoc.io/doc/net.arkinsolomon/sakurainterpreter) + [![Tests](https://github.com/ArkinSolomon/sakura-interpreter-java/actions/workflows/test-all.yml/badge.svg)](https://github.com/ArkinSolomon/sakura-interpreter-java/actions/workflows/test-all.yml) [![javadoc](https://javadoc.io/badge2/net.arkinsolomon/sakurainterpreter/javadoc.svg)](https://javadoc.io/doc/net.arkinsolomon/sakurainterpreter) Sakura Interpreter written in Java. diff --git a/pom.xml b/pom.xml index 5e995f0..c68df78 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.arkinsolomon sakurainterpreter - 1.0.3 + 1.0.4 jar Sakura Interpreter diff --git a/src/main/java/net/arkinsolomon/sakurainterpreter/SakuraInterpreter.java b/src/main/java/net/arkinsolomon/sakurainterpreter/SakuraInterpreter.java index b0c1472..519d13f 100644 --- a/src/main/java/net/arkinsolomon/sakurainterpreter/SakuraInterpreter.java +++ b/src/main/java/net/arkinsolomon/sakurainterpreter/SakuraInterpreter.java @@ -51,7 +51,7 @@ public class SakuraInterpreter { public static final String LANG_VERSION = "0.1.0-beta-2"; - public static final String INTERPRETER_VERSION = "1.0.3"; + public static final String INTERPRETER_VERSION = "1.0.4"; private final InterpreterOptions options; @@ -173,8 +173,13 @@ private static InterpreterOptions parseConfig(File configFile) { if (configObj.containsKey("root")) { Object root = configObj.get("root"); if (!(root instanceof String)) - throw new RuntimeException("If provided in the configuration file, \"root\" must be a string (which represents path to a file)"); - opts.setExecutor((String) root); + throw new RuntimeException("If provided in the configuration file, \"root\" must be a string (which represents path to a directory)"); + + File rootFile = new File((String) root); + + if (!rootFile.isDirectory()) + throw new RuntimeException("If provided in the configuration file, \"root\" must be a path to a directory (a path to a file was provided)"); + opts.setRoot(rootFile); } if (configObj.containsKey("allowRead")) { diff --git a/src/main/java/net/arkinsolomon/sakurainterpreter/functions/RangeIterable.java b/src/main/java/net/arkinsolomon/sakurainterpreter/execution/RangeIterable.java similarity index 87% rename from src/main/java/net/arkinsolomon/sakurainterpreter/functions/RangeIterable.java rename to src/main/java/net/arkinsolomon/sakurainterpreter/execution/RangeIterable.java index f0545ce..9fcbe35 100644 --- a/src/main/java/net/arkinsolomon/sakurainterpreter/functions/RangeIterable.java +++ b/src/main/java/net/arkinsolomon/sakurainterpreter/execution/RangeIterable.java @@ -13,12 +13,9 @@ * either express or implied limitations under the License. */ -package net.arkinsolomon.sakurainterpreter.functions; +package net.arkinsolomon.sakurainterpreter.execution; import net.arkinsolomon.sakurainterpreter.exceptions.SakuraException; -import net.arkinsolomon.sakurainterpreter.execution.DataType; -import net.arkinsolomon.sakurainterpreter.execution.Iterable; -import net.arkinsolomon.sakurainterpreter.execution.Value; /** * An iterator for a certain range. diff --git a/src/main/java/net/arkinsolomon/sakurainterpreter/functions/RangeFunction.java b/src/main/java/net/arkinsolomon/sakurainterpreter/functions/RangeFunction.java index 47082ee..245729a 100644 --- a/src/main/java/net/arkinsolomon/sakurainterpreter/functions/RangeFunction.java +++ b/src/main/java/net/arkinsolomon/sakurainterpreter/functions/RangeFunction.java @@ -17,6 +17,7 @@ import net.arkinsolomon.sakurainterpreter.exceptions.SakuraException; import net.arkinsolomon.sakurainterpreter.execution.DataType; +import net.arkinsolomon.sakurainterpreter.execution.RangeIterable; import net.arkinsolomon.sakurainterpreter.execution.Value; import java.util.List;