Skip to content

Commit 6660480

Browse files
committed
generate: update for grammer::forest::typed using generics over <'i, G, I> now.
1 parent 0a877a4 commit 6660480

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ doctest = false
2929
test = false
3030

3131
[patch.'crates-io']
32-
grammer = { git = "https://github.com/lykenware/grammer", rev = "5bb946aaa198b9c16d1a3a00545c643dcc04bed6" }
32+
grammer = { git = "https://github.com/lykenware/grammer", rev = "eecb1b16cd234408d066fabec63786003925452d" }
3333

3434
[workspace]
3535
members = [

src/generate/rust.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,10 +1116,10 @@ where
11161116
where I: gll::grammer::input::Input,
11171117
{
11181118
type Shape = _forest::typed::shape!(#shape);
1119-
type State = [usize; <_forest::typed::shape!(#shape) as _forest::typed::ShapeStateLen>::STATE_LEN];
1119+
type State = [usize; <_forest::typed::shape!(#shape) as _forest::typed::Shape>::STATE_LEN];
11201120
}
11211121
impl<'a, 'i, I>
1122-
_forest::typed::FromShapeFields<'a, _forest::ParseForest<'i, _G, I>, Node<'i, _G>>
1122+
_forest::typed::FromShapeFields<'a, 'i, _G, I>
11231123
for #ident<'a, 'i, I>
11241124
where I: gll::grammer::input::Input,
11251125
{

src/generate/templates/header.rs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ impl<'a, I: gll::grammer::input::Input, T: ?Sized> Handle<'a, '_, I, T> {
4040
}
4141
}
4242

43-
impl<'a, 'i, I, T: ?Sized>
44-
_forest::typed::FromShapeFields<'a, _forest::ParseForest<'i, _G, I>, Node<'i, _G>>
45-
for Handle<'a, 'i, I, T>
43+
impl<'a, 'i, I, T: ?Sized> _forest::typed::FromShapeFields<'a, 'i, _G, I> for Handle<'a, 'i, I, T>
4644
where
4745
I: gll::grammer::input::Input,
4846
{
@@ -89,9 +87,7 @@ impl<'a, 'i, I: gll::grammer::input::Input, T> fmt::Debug for Handle<'a, 'i, I,
8987
where
9088
// FIXME(eddyb) this should be `Handle<'a, 'i, I, T>: fmt::Debug` but that
9189
// runs into overflows looking for `Handle<I, [[[...[[[_]]]...]]]>`.
92-
T: _forest::typed::Shaped
93-
+ _forest::typed::FromShapeFields<'a, _forest::ParseForest<'i, _G, I>, Node<'i, _G>>,
94-
T::Shape: _forest::typed::Shape<_forest::ParseForest<'i, _G, I>, Node<'i, _G>>,
90+
T: _forest::typed::Shaped + _forest::typed::FromShapeFields<'a, 'i, _G, I>,
9591
T::Output: fmt::Debug,
9692
{
9793
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -250,9 +246,7 @@ impl<'a, 'i, I: gll::grammer::input::Input, T> Handle<'a, 'i, I, [T]> {
250246
impl<'a, 'i, I, T> fmt::Debug for Handle<'a, 'i, I, T>
251247
where
252248
I: gll::grammer::input::Input,
253-
T: _forest::typed::Shaped
254-
+ _forest::typed::FromShapeFields<'a, _forest::ParseForest<'i, _G, I>, Node<'i, _G>>,
255-
T::Shape: _forest::typed::Shape<_forest::ParseForest<'i, _G, I>, Node<'i, _G>>,
249+
T: _forest::typed::Shaped + _forest::typed::FromShapeFields<'a, 'i, _G, I>,
256250
T::Output: fmt::Debug,
257251
{
258252
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -276,18 +270,14 @@ where
276270
impl<'a, 'i, I, T> Handle<'a, 'i, I, T>
277271
where
278272
I: gll::grammer::input::Input,
279-
T: _forest::typed::Shaped
280-
+ _forest::typed::FromShapeFields<'a, _forest::ParseForest<'i, _G, I>, Node<'i, _G>>,
281-
T::Shape: _forest::typed::Shape<_forest::ParseForest<'i, _G, I>, Node<'i, _G>>,
273+
T: _forest::typed::Shaped + _forest::typed::FromShapeFields<'a, 'i, _G, I>,
282274
{
283275
pub fn one(self) -> Result<T::Output, Ambiguity<Self>> {
284276
T::one(self.forest, self.forest.unpack_alias(self.node))
285277
.map_err(|_forest::MoreThanOne| Ambiguity(self))
286278
}
287279

288-
pub fn all(
289-
self,
290-
) -> _forest::typed::ShapedAllIter<'a, T, _forest::ParseForest<'i, _G, I>, Node<'i, _G>> {
280+
pub fn all(self) -> _forest::typed::ShapedAllIter<'a, 'i, _G, I, T> {
291281
T::all(self.forest, self.forest.unpack_alias(self.node))
292282
}
293283
}

0 commit comments

Comments
 (0)