refactored scan to also take pos arguments.

This commit is contained in:
gnembon committed 2020-04-16 22:33:53 -03:00
1 parent 17b15b4893
commit 56749f731a
5 files changed
+70 -33

No files matched your search

@@ -77,7 +77,7 @@ public class BlockArgument extends Argument
}
catch (IndexOutOfBoundsException e)
{
throw new InternalExpressionException("Block should be defined either by three coordinates, a block value, or a proper string");
throw handleError(optional, acceptString);
}
}
@@ -127,7 +127,18 @@ public class BlockArgument extends Argument
}
catch (IndexOutOfBoundsException e)
{
throw new InternalExpressionException("Block should be defined either by three coordinates, a block value, or a proper string");
throw handleError(optional, acceptString);
}
}
private static InternalExpressionException handleError(boolean optional, boolean acceptString)
{
String message = "Block-type argument should be defined either by three coordinates (a triple or by three arguments), or a block value";
if (acceptString)
message+=", or a string with block description";
if (optional)
message+=", or null";
return new InternalExpressionException(message);
}
}