Skip to content

Make TokenSet faster #11

Closed
Closed
@matklad

Description

@matklad

We have a TokenSet abstraction over here: https://github.com/matklad/libsyntax2/blob/c8cf1d8cdac48f48caf9505bd5dc20dd2b962317/src/parser/event_parser/parser.rs#L70-L92

It is a set of SyntaxKinds, which is used during parsing for error recovery: the idea is to define TokenSets for things like FIRST(item) and then, when an error occurs, skip tokens until a token from this set is encountered.

  • move TokenSet to a separate file
  • use [u64; 4] to represet a bit-set of tokens
  • add macros to declare and union const TokenSet

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions