Skip to content

Clean up parser diagnostics and token positions #21

Description

@grian32

Problem

Several parser/lexer diagnostic details are misleading. currError reports the peek token instead of current token, double-character tokens initialize EndCol with a line number, and struct init errors mention ].

Tasks

  • Fix currError to report currToken.Type.
  • Fix double-char token position initialization.
  • Fix struct init parse error text.
  • Add tests that assert diagnostic messages/positions for representative parse errors.

Refs: parser/helpers.go:57, lexer/lexer.go:270, parser/expr_infix.go:124.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingparserParser and lexertestsTesting coverage

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions