Commit 8a1b2bb
committed
Auto merge of #369 - rust-lang:ag-fix-353, r=BurntSushi
compiler: fix RegexSet bug
When compiling a RegexSet, it was possible for the jump locations to
become incorrect if the last regex in the set had a starting location
that didn't correspond to the beginning of its program. This can happen
in simple cases like when your set consists of the regexes `a` and `β`.
In particular, the program for `β` is:
0: Bytes(\xB2) (goto 2)
1: Bytes(\xCE) (goto 0)
2: MATCH
Where the entry point is `1` instead of `0`. To fix this, we compile a
set of regexes similarly to how we compile `a|β`, where we handle the
holes produced by sub-expressions correctly.
Fixes #3532 files changed
+6
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| 181 | + | |
181 | 182 | | |
| 183 | + | |
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
185 | 187 | | |
186 | 188 | | |
187 | | - | |
188 | | - | |
189 | | - | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
| 193 | + | |
193 | 194 | | |
194 | 195 | | |
195 | 196 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
0 commit comments