Skip to content

Conversation

@zesterer
Copy link
Owner

@zesterer zesterer commented Jun 7, 2023

Currently unsound if passed an incorrectly sized slice.

@Amejonah1200
Copy link

It would be nice to have also a lasso integration.
This would allow making calls like ident().intern() possible.

Comment on lines 34 to 38
#[regex(r"[ \t\f\n]+", logos::skip)]
Whitespace,
Copy link

@Amejonah1200 Amejonah1200 Aug 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be moved under the #[derive(...)] using #[logos(skip r"[ \t\f\n]+")]

) -> impl Parser<'a, I, SExpr, extra::Err<Rich<'a, Token<'a>>>> {
fn parser<'a, I>() -> impl Parser<'a, I, SExpr, extra::Err<Rich<'a, Token<'a>>>>
where
I: ValueInput<'a, Token = Token<'a>, Span = SimpleSpan> + SliceInput<'a, Slice = &'a str>,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbf, to avaid humongous types, trait "aliases" should be used.

pub type TokenParserExtra<'a> = Full<Rich<'a, Token>, (), ()>;

pub trait TokenInput<'a>: ValueInput<'a, Token = Token, Span = SimpleSpan> {}
impl<'a, T> TokenInput<'a> for T where T: ValueInput<'a, Token = Token, Span = SimpleSpan> {}

pub trait TokenParser<'a, I: TokenInput<'a>, O>:
    Parser<'a, I, O, TokenParserExtra<'a>> + Clone {
}
impl<'a, I: TokenInput<'a>, O, T> TokenParser<'a, I, O> for T where T: Parser<'a, I, O, TokenParserExtra<'a>> + Clone {}

until real trait aliases are available

@Zij-IT
Copy link
Contributor

Zij-IT commented Aug 25, 2023

It would be nice to have also a lasso integration. This would allow making calls like ident().intern() possible.

Would this not be equivalent to:

ident().map_with_state(|i, _, rodeo: &Rodeo| rodeo.get_or_intern(i))

@Amejonah1200
Copy link

It would be nice to have also a lasso integration. This would allow making calls like ident().intern() possible.

Would this not be equivalent to:

ident().map_with_state(|i, _, rodeo: &Rodeo| rodeo.get_or_intern(i))

Yes, I will use trait extensions for that then.

@zesterer zesterer force-pushed the main branch 5 times, most recently from 38bb88c to 02a1373 Compare May 26, 2025 14:11
@zesterer zesterer force-pushed the main branch 2 times, most recently from 0f2b61a to e350fc6 Compare November 5, 2025 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants