Skip to content

Fix parser reference expression edge cases #20

Description

@grian32

Problem

parseReference parses a full expression after & but only stores it if the result is an identifier. For any other expression, ReferenceExpression.Var remains nil and later String/Position can panic.

Tasks

  • Decide whether & is restricted to identifiers or supports broader lvalues.
  • If restricted, emit a parser/checker error for non-ident references.
  • If broader, change AST to store an expression/lvalue.
  • Add tests for &(x), &p.field, &arr[i], and invalid cases.

Refs: parser/expr_prefix.go:21, parser/ast.go:328.

Related: #4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcheckerChecker and semantic analysisparserParser and lexer

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions