Commit 05b65d5
Fix trailing
## Summary
In a form like,
```clojure
(if condition :bg-white :bg-black)
```
`:bg-black` will fail to extract, while `:bg-white` is extracted as
expected. This PR fixes this case, implements more comprehensive
candidate filtering, and supersedes a previous PR.
Having recently submitted a PR for handling another special case with
Clojure keywords (the presence of `:` inside of keywords), I thought it
best to invert the previous strategy: Instead of handling special cases
one by one, consume keywords according to the Clojure reader spec.
Consume nothing else, other than strings.
Because of this, this PR is a tad more invasive rather than additive,
for which I apologize. The strategy is this:
- Strings begin with a `"` and ends with an unescaped `"`. Consume
everything between these delimiters (existing case).
- Keywords begin with `:`, and end with whitespace, or one out of a
small set of specific reserved characters. Everything else is a valid
character in a keyword. Consume everything between these delimiters, and
apply the class splitting previously contained in the outer loop. My
previous special case handling of `:` inside of keywords in #18338 is
now redundant (and is removed), as this is a more general solution.
- Discard _everything else_.
I'm hoping that a strategy that is based on Clojure's definition of
strings and keywords will pre-empt any further issues with edge cases.
Closes #18344.
## Test plan
- Added failing tests.
- `cargo test` -> failure
- Added fix
- `cargo test` -> success
---------
Co-authored-by: Jordan Pittman <jordan@cryptica.me>) from interfering with extraction in Clojure keywords (#18345)1 parent 7946db0 commit 05b65d5
File tree
2 files changed
+112
-32
lines changed- crates/oxide/src/extractor/pre_processors
2 files changed
+112
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
8 | 25 | | |
9 | 26 | | |
10 | 27 | | |
| |||
18 | 35 | | |
19 | 36 | | |
20 | 37 | | |
| 38 | + | |
21 | 39 | | |
22 | 40 | | |
23 | 41 | | |
| |||
26 | 44 | | |
27 | 45 | | |
28 | 46 | | |
29 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
30 | 51 | | |
31 | 52 | | |
32 | 53 | | |
33 | 54 | | |
34 | 55 | | |
35 | 56 | | |
36 | 57 | | |
37 | | - | |
| 58 | + | |
38 | 59 | | |
39 | 60 | | |
40 | 61 | | |
| 62 | + | |
41 | 63 | | |
42 | 64 | | |
43 | 65 | | |
44 | 66 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
53 | 71 | | |
54 | | - | |
55 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
56 | 102 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
65 | 106 | | |
66 | | - | |
| 107 | + | |
| 108 | + | |
67 | 109 | | |
68 | 110 | | |
69 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
70 | 121 | | |
71 | 122 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | 123 | | |
76 | 124 | | |
77 | 125 | | |
| |||
92 | 140 | | |
93 | 141 | | |
94 | 142 | | |
95 | | - | |
| 143 | + | |
96 | 144 | | |
97 | | - | |
98 | | - | |
| 145 | + | |
| 146 | + | |
99 | 147 | | |
100 | 148 | | |
101 | | - | |
| 149 | + | |
102 | 150 | | |
103 | 151 | | |
104 | 152 | | |
105 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
106 | 159 | | |
107 | | - | |
108 | 160 | | |
109 | 161 | | |
110 | 162 | | |
| |||
198 | 250 | | |
199 | 251 | | |
200 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
201 | 277 | | |
202 | 278 | | |
203 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
204 | 283 | | |
205 | 284 | | |
0 commit comments