Commit 4a6464a
committed
add another rule for removing brackets involving subtraction
This rule exists to cover a really fiddly case which emerges because of how unary minus is handled inside a product.
When looking for additive terms in the expression `-a - 2*b`, the second term is rewritten so that the unary minus is at the bottom of the tree: `(-2) * b` instead of `-(2*b)`.
This means that the expression ends up looking like `-a + ((-2)*b)`, so it doesn't match the rule `(-?;b - ?;c)`, because the unary minus is too deep.
I've spent a while trying to get the matcher to look deeper for unary minus, but that led to a lot of other things breaking.
In the end, I've added another version of the rule which deals with a `+` inside the brackets instead of a `-`.1 parent 1a89f9b commit 4a6464a
File tree
4 files changed
+11
-0
lines changed- runtime/scripts
- tests
- jme
4 files changed
+11
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2054 | 2054 | | |
2055 | 2055 | | |
2056 | 2056 | | |
| 2057 | + | |
2057 | 2058 | | |
2058 | 2059 | | |
2059 | 2060 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8244 | 8244 | | |
8245 | 8245 | | |
8246 | 8246 | | |
| 8247 | + | |
8247 | 8248 | | |
8248 | 8249 | | |
8249 | 8250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2184 | 2184 | | |
2185 | 2185 | | |
2186 | 2186 | | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
2187 | 2195 | | |
2188 | 2196 | | |
2189 | 2197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7835 | 7835 | | |
7836 | 7836 | | |
7837 | 7837 | | |
| 7838 | + | |
7838 | 7839 | | |
7839 | 7840 | | |
7840 | 7841 | | |
| |||
0 commit comments