Commit cc67a09
committed
Refactor Symbol and Keyword as nodes (#67)
Refactor the previous implementation of `Symbol`/`Keyword` handling to
treat them as first-class nodes in the build configuration.
`Keyword` and `Symbol` represent identifiers (interned strings), not
traditional AST nodes. However, the C parser defines them in
`rbs_node_type` (as `RBS_KEYWORD` and `RBS_AST_SYMBOL`) and treats them
as nodes (`rbs_node_t*`) in many contexts (lists, hashes).
Instead of manually defining `RBSSymbol`/`RBSKeyword` structs, we now
inject them into the `config.yml` node list in `build.rs`. This allows
them to be generated as `SymbolNode`/`KeywordNode` variants in the
`Node` enum, enabling polymorphic handling (in Node lists and Hashes)1 parent 0446053 commit cc67a09
2 files changed
Lines changed: 22 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
40 | 56 | | |
41 | 57 | | |
42 | 58 | | |
| |||
148 | 164 | | |
149 | 165 | | |
150 | 166 | | |
151 | | - | |
| 167 | + | |
152 | 168 | | |
153 | 169 | | |
154 | | - | |
| 170 | + | |
155 | 171 | | |
156 | 172 | | |
157 | 173 | | |
| |||
212 | 228 | | |
213 | 229 | | |
214 | 230 | | |
215 | | - | |
| 231 | + | |
216 | 232 | | |
217 | 233 | | |
218 | | - | |
| 234 | + | |
219 | 235 | | |
220 | 236 | | |
221 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
| 172 | + | |
182 | 173 | | |
183 | 174 | | |
184 | 175 | | |
| |||
195 | 186 | | |
196 | 187 | | |
197 | 188 | | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
| 189 | + | |
208 | 190 | | |
209 | 191 | | |
210 | 192 | | |
| |||
0 commit comments