Skip to content

Commit

Permalink
Make build again
Browse files Browse the repository at this point in the history
  • Loading branch information
CraftSpider committed Mar 10, 2023
1 parent 743282e commit 084f57b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion examples/zero-copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn parser<'a>() -> impl Parser<'a, &'a str, [(SimpleSpan<usize>, Token<'a>); 6]>
.collect_exactly()
}

fn bad_parser() -> impl for<'a> Parser<'a, str, Vec<()>, extra::Err<Rich<str>>> + Problems {
fn bad_parser<'a>() -> impl Parser<'a, &'a str, Vec<()>, extra::Err<Rich<'a, char>>> + Problems {
just("").or(just("b"))
.or_not()
.separated_by(just(""))
Expand Down
2 changes: 1 addition & 1 deletion src/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ where
/// See [`choice`].
#[derive(Copy, Clone)]
pub struct Choice<T> {
parsers: T,
pub(crate) parsers: T,
}

/// Parse using a tuple of many parsers, producing the output of the first to successfully parse.
Expand Down
2 changes: 1 addition & 1 deletion src/problems.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! TODO
use crate::zero_copy::visit::{ParserInfo, ParserVisitor, Visitable};
use crate::visit::{ParserInfo, ParserVisitor, Visitable};

#[derive(Clone, PartialEq)]
enum CheckState {
Expand Down
29 changes: 13 additions & 16 deletions src/visit.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::convert::TryFrom;
use crate::zero_copy::combinator::*;
use crate::zero_copy::container::OrderedSeq;
use crate::zero_copy::input::Input;
use crate::zero_copy::primitive::Just;
use super::*;
use crate::primitive::*;
use crate::combinator::*;

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct SizeHint {
Expand Down Expand Up @@ -123,9 +122,9 @@ where
}
}

impl<T, I: ?Sized + Input, E> Visitable for Just<T, I, E>
impl<'a, T, I: Input<'a>, E> Visitable for Just<T, I, E>
where
T: OrderedSeq<I::Token>,
T: OrderedSeq<'a, I::Token>,
{
fn info(&self) -> ParserInfo<'_, Self> {
let size = self.seq.seq_iter()
Expand All @@ -148,15 +147,15 @@ where
self,
"or",
SizeHint::or(
self.parser_a.info().size_hint,
self.parser_b.info().size_hint,
self.choice.parsers.0.info().size_hint,
self.choice.parsers.1.info().size_hint,
)
)
}

fn visit_children<V: ParserVisitor>(&self, visitor: &mut V) {
self.parser_a.visit(visitor);
self.parser_b.visit(visitor);
self.choice.parsers.0.visit(visitor);
self.choice.parsers.1.visit(visitor);
}
}

Expand All @@ -177,7 +176,7 @@ where
}
}

impl<A, OA, I: ?Sized, E> Visitable for Repeated<A, OA, I, E>
impl<A, OA, I, E> Visitable for Repeated<A, OA, I, E>
where
A: Visitable,
{
Expand All @@ -203,7 +202,7 @@ where
}
}

impl<A, B, OA, OB, I: ?Sized, E> Visitable for SeparatedBy<A, B, OA, OB, I, E>
impl<A, B, OA, OB, I, E> Visitable for SeparatedBy<A, B, OA, OB, I, E>
where
A: Visitable,
B: Visitable,
Expand Down Expand Up @@ -244,22 +243,20 @@ where
}
}

impl<A, B, OB, C, const N: usize> Visitable for SeparatedByExactly<A, B, OB, C, N>
impl<A, O, C> Visitable for CollectExactly<A, O, C>
where
A: Visitable,
B: Visitable,
{
fn info(&self) -> ParserInfo<'_, Self> {
ParserInfo::new(
self,
"separated_by_exactly",
"collect_exactly",
todo!(),
)
}

fn visit_children<V: ParserVisitor>(&self, visitor: &mut V) {
self.parser.visit(visitor);
self.separator.visit(visitor);
}
}

Expand Down

0 comments on commit 084f57b

Please sign in to comment.