Skip to content

Grammar and AST support for the ^ reverse / parent navigation key #73

Description

@jtnelson

Tracks the CCL side of reverse / parent navigation. Parent feature:
cinchapi/concourse#781.

Summary

Add a reverse-navigation marker ^ to navigation keys so a stop can be
traversed backward, to the parent: the records that link to the current
record. ^ alone means the parent via any key; ^key means the parent via
that key. Reverse stops compose with forward stops, the transitive * suffix,
per-stop bracket timestamps, and scope prefixes.

Scope

  • Lexer: accept a leading ^ on navigation-key segments in the key-bearing
    tokens (PERIOD_SEPARATED_STRING, ASTERISK_SUFFIXED_STRING,
    NAVIGATION_SCOPE_OPEN) and a standalone ^ segment. Disambiguate a ^-led
    key from a ^-led unquoted value.
  • AST: add a reverse direction to NavigationKeyStop (alongside the transitive
    flag and timestamp), with the key optional for bare ^; propagate through
    NavigationKeySymbol (stop parsing, components, base key, parameter
    stripping, scope-prefix parsing).
  • Regenerate the parser from the grammar; do not hand-edit generated sources.
  • Update CCL_REFERENCE.md (Navigation Keys section).

Behavior / contract

  • ^key round-trips through parse and toString; ^ is a valid single-segment
    navigation key.
  • Composes: ^.a, ^key.a, ^*, ^[t], ^.(...).
  • The reverse marker names the source key, or none for bare ^. There is no
    auto-paired inverse.

Acceptance Criteria

  • Grammar accepts ^, ^key, and reverse stops mixed with forward stops,
    *, [t], and scope prefixes.
  • NavigationKeyStop and NavigationKeySymbol model the reverse direction
    and round-trip.
  • An unquoted value beginning with ^ still parses, or is documented to
    require quoting.
  • Tests and CCL_REFERENCE.md updated.

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