Skip to content

simplify creating a parser from a token tree #15306

Closed
@erickt

Description

@erickt

Syntax extensions are pretty painful to write. One of the main reasons is that the API is pretty messy. For example, this pattern is littered across multiple syntax extensions:

    let mut p = parse::new_parser_from_tts(cx.parse_sess(),
                                           cx.cfg(),
                                           tts.iter()
                                              .map(|x| (*x).clone())
                                              .collect());

But all that line noise is pretty unnecessary. It could be easily slimmed down to:

    let mut p = cx.new_parser_from_tts(tts);

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions