docs
This commit is contained in:
1 parent
edca3fb131
commit
bed9e2c60a
6 files changed
+56
-21
No files matched your search
@@ -93,7 +93,7 @@ public class Functions {
|
||||
});
|
||||
|
||||
// lazy because of typed evaluation of the argument
|
||||
expression.addLazyUnaryOperator("...", Operators.precedence.get("def->..."), false, (c, t, lv) ->
|
||||
expression.addLazyUnaryOperator("...", Operators.precedence.get("unary+-!..."), false, (c, t, lv) ->
|
||||
{
|
||||
if (t == Context.LOCALIZATION)
|
||||
return (cc, tt) -> new FunctionAnnotationValue(lv.evalValue(c), FunctionAnnotationValue.Type.VARARG);
|
||||
@@ -116,7 +116,7 @@ public class Functions {
|
||||
|
||||
//assigns const procedure to the lhs, returning its previous value
|
||||
// must be lazy due to RHS being an expression to save to execute
|
||||
expression.addLazyBinaryOperatorWithDelegation("->", Operators.precedence.get("def->..."), false, (c, type, e, t, lv1, lv2) ->
|
||||
expression.addLazyBinaryOperatorWithDelegation("->", Operators.precedence.get("def->"), false, (c, type, e, t, lv1, lv2) ->
|
||||
{
|
||||
if (type == Context.MAPDEF)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.Map;
|
||||
public class Operators {
|
||||
public static final Map<String, Integer> precedence = new HashMap<String,Integer>() {{
|
||||
put("attribute~:", 80);
|
||||
put("unary+-!", 60);
|
||||
put("unary+-!...", 60);
|
||||
put("exponent^", 40);
|
||||
put("multiplication*/%", 30);
|
||||
put("addition+-", 20);
|
||||
@@ -29,7 +29,7 @@ public class Operators {
|
||||
put("and&&", 5);
|
||||
put("or||", 4);
|
||||
put("assign=<>", 3);
|
||||
put("def->...", 2);
|
||||
put("def->", 2);
|
||||
put("nextop;", 1);
|
||||
}};
|
||||
|
||||
@@ -216,7 +216,9 @@ public class Operators {
|
||||
expression.addUnaryOperator("+", false, NumericValue::asNumber);
|
||||
|
||||
// could be non-lazy, but who cares - its a small one.
|
||||
expression.addLazyUnaryOperator("!", precedence.get("unary+-!"), false, (c, t, lv)-> lv.evalValue(c, Context.BOOLEAN).getBoolean() ? (cc, tt)-> Value.FALSE : (cc, tt) -> Value.TRUE); // might need context boolean
|
||||
expression.addLazyUnaryOperator("!", precedence.get("unary+-!..."), false, (c, t, lv) ->
|
||||
lv.evalValue(c, Context.BOOLEAN).getBoolean() ? (cc, tt)-> Value.FALSE : (cc, tt) -> Value.TRUE
|
||||
); // might need context boolean
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user