Skip to content

Unify lookahead nameing between parser and lexer #26

Closed
@matklad

Description

@matklad

We use Ptr to access characters and Parser to access tokens. Unfortunately, they use different method names for lookups, bumping, etc. Lets unify them? The names in Parser are, in general, better:

  • at(&self, kind: T) -> bool -- checks current token. This might use some fancy overloading for lookahead for more than one token/symbol:.at(b"->").
  • current(&self) -> T -- returns current token.
  • nth(&self, n: u32) -> T -- like current, but for n tokens ahead.
  • bump(&mut self) -- bumps current position by one token .

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