cleanup and added requirement for floats to start with 0.2

This commit is contained in:
gnembon committed 2019-10-05 02:23:53 -03:00
1 parent 974aa51e2a
commit dab9c5debe
4 files changed
+6 -17

No files matched your search

+2 -2
View File
@@ -1900,7 +1900,7 @@ public class Expression implements Cloneable
addUnaryFunction("pairs", v -> {
if (v instanceof MapValue)
return new ListValue(((MapValue) v).getMap().entrySet().stream().map(
return ListValue.wrap(((MapValue) v).getMap().entrySet().stream().map(
(p) -> ListValue.of(p.getKey(), p.getValue())
).collect(Collectors.toList()));
throw new InternalExpressionException("pairs applies only to maps");
@@ -1920,7 +1920,7 @@ public class Expression implements Cloneable
throw new InternalExpressionException("Cannot access elements of a non-container");
});
//Deprecated, use "get" instead
//Deprecated, use "get" instead, or . operator
addBinaryFunction("element", (v1, v2) ->
{
if (!(v1 instanceof ListValue))
+2 -1
View File
@@ -94,7 +94,8 @@ public class Tokenizer implements Iterator<Tokenizer.Token>
boolean isHex = false;
if (Character.isDigit(ch) || (ch == decimalSeparator && Character.isDigit(peekNextChar())))
if (Character.isDigit(ch)) // || (ch == decimalSeparator && Character.isDigit(peekNextChar())))
// decided to no support this notation to favour element access via . operator
{
if (ch == '0' && (peekNextChar() == 'x' || peekNextChar() == 'X'))
isHex = true;
@@ -216,14 +216,7 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf
{
if (o instanceof ListValue)
{
ListValue ol = (ListValue)o;
int this_size = this.getItems().size();
int o_size = ol.getItems().size();
if (this_size != o_size) return false;
if (this_size == 0) return true;
for (int i = 0; i < this_size; i++)
if (!this.items.get(i).equals(ol.items.get(i))) return false;
return true;
return getItems().equals(((ListValue) o).getItems());
}
return false;
}
@@ -124,12 +124,7 @@ public class MapValue extends AbstractListValue implements ContainerValueInterfa
{
if (o instanceof MapValue)
{
MapValue ol = (MapValue)o;
int this_size = this.map.keySet().size();
int o_size = ol.map.keySet().size();
if (this_size != o_size) return false;
if (this_size == 0) return true;
return this.map.keySet().equals(ol.map.keySet());
return map.equals(((MapValue) o).map);
}
return false;
}