Skip to content

Remove lookahead from lexer? #81

@overlookmotel

Description

@overlookmotel

@lucab mentioned in oxc-project/oxc#4534 that checking lookahead came up as a hotspot when he was profiling the lexer.

I wonder if we can remove the lookahead from the lexer entirely and move lookahead logic purely into the parser in the places where it needs it?

As I understand it, lookahead is only required for a few things (arrow functions and TS type params mostly) but currently every single time we get a token (any token) we have to pass through this code. I don't know the parser well enough to know how difficult it'd be to move the logic though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions