Permalink
Browse files

Don't enforce traditional separators on MODIFY (#4356)

Necessary because logical items like || trigger a false positive
Note: If a var is a boolean and the formula is A || B that will fail.
It will need to be written as (A || B) ... with the parenthesis
In that way, ParsingSeparator will detect the || as logical OR
  • Loading branch information...
thpr authored and karianna committed Nov 6, 2018
1 parent 604de6e commit 84fbac2b9c486bf40071e04e7f380925013b60a6
@@ -36,7 +36,7 @@
import pcgen.cdom.formula.scope.PCGenScope;
import pcgen.core.Campaign;
import pcgen.rules.context.LoadContext;
import pcgen.rules.persistence.token.AbstractTokenWithSeparator;
import pcgen.rules.persistence.token.AbstractNonEmptyToken;
import pcgen.rules.persistence.token.CDOMInterfaceToken;
import pcgen.rules.persistence.token.CDOMPrimaryToken;
import pcgen.rules.persistence.token.ParseResult;
@@ -45,7 +45,7 @@
* The MODIFY token defined by ModifyLst defines a calculation to be performed in the
* (new) formula system.
*/
public class ModifyLst extends AbstractTokenWithSeparator<VarHolder>
public class ModifyLst extends AbstractNonEmptyToken<VarHolder>
implements CDOMInterfaceToken<VarContainer, VarHolder>, CDOMPrimaryToken<VarHolder>
{
@@ -56,13 +56,7 @@ public String getTokenName()
}
@Override
protected char separator()
{
return '|';
}
@Override
protected ParseResult parseTokenWithSeparator(LoadContext context, VarHolder obj, String value)
public ParseResult parseNonEmptyToken(LoadContext context, VarHolder obj, String value)
{
//TODO These instanceof checks will fail - the VarHolder is a proxy :(
if (obj instanceof Ungranted)
@@ -41,7 +41,7 @@
import pcgen.cdom.grouping.GroupingCollection;
import pcgen.core.Campaign;
import pcgen.rules.context.LoadContext;
import pcgen.rules.persistence.token.AbstractTokenWithSeparator;
import pcgen.rules.persistence.token.AbstractNonEmptyToken;
import pcgen.rules.persistence.token.CDOMInterfaceToken;
import pcgen.rules.persistence.token.CDOMPrimaryToken;
import pcgen.rules.persistence.token.ParseResult;
@@ -50,7 +50,7 @@
* Implements the MODIFYOTHER token for remotely modifying variables in the new variable
* system.
*/
public class ModifyOtherLst extends AbstractTokenWithSeparator<VarHolder>
public class ModifyOtherLst extends AbstractNonEmptyToken<VarHolder>
implements CDOMInterfaceToken<VarContainer, VarHolder>, CDOMPrimaryToken<VarHolder>
{
@@ -60,15 +60,9 @@ public String getTokenName()
return "MODIFYOTHER";
}
@Override
protected char separator()
{
return '|';
}
//MODIFYOTHER:EQUIPMENT|GROUP=Martial|EqCritRange|ADD|1
@Override
protected ParseResult parseTokenWithSeparator(LoadContext context, VarHolder obj, String value)
public ParseResult parseNonEmptyToken(LoadContext context, VarHolder obj, String value)
{
//TODO These instanceof checks will fail - the VarHolder is a proxy :(
if (obj instanceof Ungranted)

0 comments on commit 84fbac2

Please sign in to comment.