@@ -214,7 +214,7 @@ yeast::tree!(ctx,
214214``` rust
215215yeast :: trees! (ctx ,
216216 (assignment left : {tmp } right : {right })
217- {.. body }
217+ {body }
218218)
219219```
220220
@@ -256,12 +256,26 @@ occurrences of the same `$name` within one `BuildCtx` share the same value:
256256
257257### Embedded Rust expressions
258258
259- ` {expr} ` embeds a Rust expression that returns a single node ` Id ` :
259+ ` {expr} ` embeds a Rust expression whose value is appended to the
260+ enclosing field (or to the rule body's id list). Dispatch happens via
261+ the [ ` IntoFieldIds ` ] trait, which is implemented for:
262+
263+ - ` Id ` — pushes the single id.
264+ - Any ` IntoIterator<Item: Into<Id>> ` — extends with all yielded ids
265+ (covers ` Vec<Id> ` , ` Option<Id> ` , iterator chains, etc.).
266+
267+ So the same ` {expr} ` syntax handles single ids, splices, and zero-or-many
268+ options uniformly:
260269
261270``` rust
262271(assignment
263- left : {some_node_id } // insert a pre-built node
264- right : {rhs } // insert a captured value (inside rule!)
272+ left : {some_node_id } // a single Id
273+ right : {rhs } // a captured value (inside rule!)
274+ )
275+
276+ yeast :: trees! (ctx ,
277+ (assignment left : {tmp } right : {right })
278+ {extra_nodes } // splices a Vec<Id>
265279)
266280```
267281
@@ -277,21 +291,17 @@ expressions (with `let` bindings) work too:
277291 })
278292```
279293
280- ` {..expr} ` splices a ` Vec<Id> ` (or any iterable of ` Id ` ); the contents
281- are likewise a Rust block, so the splice can be the result of arbitrary
282- computation:
294+ Inside ` rule! ` , captures are Rust variables — ` {name} ` works for
295+ single, optional, and repeated captures alike:
283296
284297``` rust
285- yeast :: trees! (ctx ,
286- (assignment left : {tmp } right : {right })
287- {.. extra_nodes } // splice a Vec<Id>
298+ rule! (
299+ (assignment left : @ lhs right : _ * @ parts )
300+ =>
301+ (assignment left : {lhs } right : (block stmt : {parts }))
288302)
289303```
290304
291- Inside ` rule! ` , captures are Rust variables, so ` {name} ` inserts a
292- single capture (` Id ` ) and ` {..name} ` splices a repeated capture
293- (` Vec<Id> ` ).
294-
295305### Raw captures (` @@name ` )
296306
297307The default ` @name ` capture marker is * auto-translated* : in OneShot
@@ -302,15 +312,15 @@ already conforms to the output schema.
302312For rules that need the raw (input-schema) capture — typically to read
303313its source text or to translate it explicitly with mutable context
304314state between calls — use ` @@name ` instead. The body sees the original
305- input-schema ` NodeRef ` :
315+ input-schema ` Id ` :
306316
307317``` rust
308318yeast :: rule! (
309319 (assignment left : (_ ) @@ raw_lhs right : (_ ) @ rhs )
310320 =>
311321 {
312322 // raw_lhs is untranslated: read its original source text.
313- let text = ctx . ast. source_text (raw_lhs . into () );
323+ let text = ctx . ast. source_text (raw_lhs );
314324 // rhs is already translated by the auto-translate prefix.
315325 tree! ((call
316326 method : (identifier #{text . as_str ()})
0 commit comments