Parsing Bug in Formula

Description

In working on making (and/or fixing) some temporary bonuses for certain psionic powers, I ran across some strange behavior.

I tried to use the following tag:
BONUS:COMBAT|REACH|if((SIZE==3)||(SIZE==4),5,0)|PREAPPLYC
and it always gave a bonus of 0.0 to REACH. On the other hand, if I typed the following in the console:
if((SIZE==3)||(SIZE==4),5,0)
it gave the appropriate 5.0 result.

I got the result I wanted by using the following two tags:
BONUS:COMBAT|REACH|if(SIZE==3,5,0)|PREAPPLYC
BONUS:COMBAT|REACH|if(SIZE==4,5,0)|PREAPPLYC

I also tried parentheses around (SIZE==3)||(SIZE==4), and that didn't change anything.

Is there some reason this shouldn't work in a LST file, but does work in the console?

[And perhaps I should have used PRESIZExx instead, but this should work too, yes?]

Distant Scholar

===

PCGen Code Base (July 22): A parsing bug was spotted yesterday in BONUS, related to handling the pipe separator hidden within an IF statement. The IF, part of a larger Formula, had not previously been considered a threat to pipe-based token separation.

The bug, immune to most normal attacks, including indexOf and the powerful StringTokenizer, was seen wreaking havoc. Residents of DEFINE were concerned and also felt they were vulnerable to the issue. The bug seemed supremely confident that it would persist long into the future.

At the last report, the PCGen Architecture lead (a notorious "Code Reuse" caster) was seen memorizing pcgen.core.utils.ParsingSeparator from his "Built for CHOOSE" Spellbook. When asked to comment about the bug, he smiled, and waved his hand, "Let them tracker it, for like others, it deserves to be recorded... but it will discover the tokens it inhabits were isolated in 5.16, and its parenthesis provide no protection against the ParsingSeparator. It will be closed soon."

Unconfirmed reports indicate the bug might be destroyed by both 5.16.3 and 5.17.4, although confirmation from the Code lead would be required to ensure appropriate stability of the 5.16 release for such a late change.

thpr

Environment

None

Activity

Show:
Tom Parker
July 25, 2010, 6:54 AM

Revision: 12667 (5.16)

Tom Parker
July 25, 2010, 7:01 AM

Committed revision 12668. (5.17)

Fixed

Assignee

Tom Parker

Reporter

Andrew Maitland

Labels

None

Theme

None

Epic/Theme

None

Pending User Input

None

Components

Fix versions

Priority

Minor
Configure