Commit 6277335
committed
fix: span a binary condition's node from its left operand
Seven productions take their left operand as a parameter, so the caller has
already consumed those tokens when JJTree opens the node and the range starts at
the operator. A node for `a IN (1, 2)` covered only `IN (1, 2)`, and one for
`a = 1` only `= 1`, leaving anyone reading `jjtGetFirstToken()` a range that
excludes the operand the condition is about.
Comparisons are a regression from 1b51f05, which moved the left operand out of
RegularCondition and into the caller as part of the Pratt refactor. IN, LIKE,
SIMILAR TO and IS DISTINCT have taken their operand as a parameter for far
longer and were already reporting the narrow range, so before that refactor the
two halves of the family disagreed with each other.
Link those nodes through an overload that starts the range at the left operand,
which fixes the regression and makes the family consistent.
testDetectInExpressions asserted the narrow range and now expects the wider one.
Between, IsNullExpression, IsBooleanExpression, IsUnknownExpression,
MemberOfExpression and OverlapsCondition also take a left operand but build no
node at all, so they keep returning null and are left alone here.1 parent c9645d7 commit 6277335
2 files changed
Lines changed: 46 additions & 8 deletions
File tree
- src
- main/jjtree/net/sf/jsqlparser/parser
- test/java/net/sf/jsqlparser/statement/select
Lines changed: 22 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
153 | 168 | | |
154 | 169 | | |
155 | 170 | | |
| |||
8665 | 8680 | | |
8666 | 8681 | | |
8667 | 8682 | | |
8668 | | - | |
| 8683 | + | |
8669 | 8684 | | |
8670 | 8685 | | |
8671 | 8686 | | |
| |||
8754 | 8769 | | |
8755 | 8770 | | |
8756 | 8771 | | |
8757 | | - | |
| 8772 | + | |
8758 | 8773 | | |
8759 | 8774 | | |
8760 | 8775 | | |
| |||
8769 | 8784 | | |
8770 | 8785 | | |
8771 | 8786 | | |
8772 | | - | |
| 8787 | + | |
8773 | 8788 | | |
8774 | 8789 | | |
8775 | 8790 | | |
| |||
8784 | 8799 | | |
8785 | 8800 | | |
8786 | 8801 | | |
8787 | | - | |
| 8802 | + | |
8788 | 8803 | | |
8789 | 8804 | | |
8790 | 8805 | | |
| |||
8895 | 8910 | | |
8896 | 8911 | | |
8897 | 8912 | | |
8898 | | - | |
| 8913 | + | |
8899 | 8914 | | |
8900 | 8915 | | |
8901 | 8916 | | |
| |||
8922 | 8937 | | |
8923 | 8938 | | |
8924 | 8939 | | |
8925 | | - | |
| 8940 | + | |
8926 | 8941 | | |
8927 | 8942 | | |
8928 | 8943 | | |
| |||
8938 | 8953 | | |
8939 | 8954 | | |
8940 | 8955 | | |
8941 | | - | |
| 8956 | + | |
8942 | 8957 | | |
8943 | 8958 | | |
8944 | 8959 | | |
| |||
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
176 | 179 | | |
177 | 180 | | |
178 | 181 | | |
179 | | - | |
| 182 | + | |
| 183 | + | |
180 | 184 | | |
181 | 185 | | |
182 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
183 | 206 | | |
184 | 207 | | |
185 | 208 | | |
| |||
0 commit comments