You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For an aspect of parsing CBOR with the peg crate, I find myself in need to capture in a single rule both details and the full input, because the parser output gets post-processed differently. In a simplified example:
pub rule basenumber() -> NumberParts<'input>
= sign:sign()? "0" parts:(
/ ['x'|'X']"." postdot:$(HEXDIG()+)['p'|'P'] expsign:sign()? exp:$(DIGIT()+){(16,"",Some(postdot), expsign,Some(exp))}
/ ['o'|'O'] predot:$(ODIGIT()+){(8, predot,None,None,None)}
/ /.../
){let(base, predot, postdot, expsign, exp) = parts;NumberParts{
base,
sign,
/.../,// would like to have the full input here as well}}
but then I can only get access to the full result and not to sign any more.
Is there an existing trick I'm missing, or could this be made available in a compatible way, eg. by providing a part's inner variables transparently by declaring them in the generated code, such that they might be shadowed by the outer assignments?
The text was updated successfully, but these errors were encountered:
For an aspect of parsing CBOR with the peg crate, I find myself in need to capture in a single rule both details and the full input, because the parser output gets post-processed differently. In a simplified example:
It would be convenient to write
but then I can only get access to the
full
result and not tosign
any more.Is there an existing trick I'm missing, or could this be made available in a compatible way, eg. by providing a part's inner variables transparently by declaring them in the generated code, such that they might be shadowed by the outer assignments?
The text was updated successfully, but these errors were encountered: