| 269 | // we cache the field because the next run of astEnter should be on the field's value, and we need the field |
| 270 | let fieldCache: QueryString | QueryRegex | undefined |
| 271 | function attachQuery( |
| 272 | node: SyntaxNodeRef, |
| 273 | label: Label | undefined, |
| 274 | context: Context, |
| 275 | queryOrField: QueryString | QueryRegex, |
| 276 | ) { |
| 277 | if (label === field) { |
| 278 | if (node.node.parent?.type.is(qt.FieldName) === true) { |
| 279 | fieldCache = queryOrField |
| 280 | } else { |
| 281 | console.assert(fieldCache, 'query.Field should have a value!') |
| 282 | queryOrField.field = fieldCache |
| 283 | context.current.attach(queryOrField) |
| 284 | fieldCache = undefined |
| 285 | } |
| 286 | } else { |
| 287 | context.current.attach(queryOrField) |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | function astEnter(input: string, node: SyntaxNodeRef, context: Context) { |
| 292 | if (node.type.isError) return |