Skip to content

Commit 34ca2cc

Browse files
committed
generalise Program::nonterminals
1 parent 963cf02 commit 34ca2cc

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

core/src/lang/mod.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,15 @@ impl Program<'static> {
202202
}
203203
}
204204

205-
impl Program<'static> {
206-
/// Construct a known [`Program`] at compile-time -- for use in generated code only.
205+
impl<'source> Program<'source> {
206+
/// Extract the nonterminal definitions and their right-hand sides.
207207
#[must_use]
208-
pub fn nonterminals(
209-
&'static self,
210-
) -> HashMap<FandangoNode<'static, 'static>, FandangoNode<'static, 'static>> {
208+
pub fn nonterminals<'program>(
209+
&'program self,
210+
) -> HashMap<FandangoNode<'program, 'source>, FandangoNode<'program, 'source>>
211+
where
212+
'source: 'program,
213+
{
211214
self.statements()
212215
.iter()
213216
.filter_map(|s| match s.inner() {

0 commit comments

Comments
 (0)