erick-alcachofa 8dd75e3b8a
feat(parser): support turbofish operator and specialize access expressions
Signed-off-by: erick-alcachofa <erick@artichoke.dev>

Overhaul the AST and parser logic to support explicit generic
instantiation in expressions (e.g., `Result::<u32, u32>::Ok(0)`). This
is achieved by implementing the "turbofish" operator (`::<>`) and
specializing how member and module access are handled.

* Added `GenericExpression` to represent generic instantiations in
  expressions.
* Updated the Pratt parser to look for `<` immediately following a `::`
  (ModuleAccess) operator. If found, it parses a `GenericExpression`
  containing the generic arguments.
* This change resolves the ambiguity between generic lists and
  comparison operators in the expression parser.

* Renamed `PointerAccessExpression` to `PointerMemberAccessExpression`.
* Refactored `MemberAccessExpression` and
  `PointerMemberAccessExpression` to store the member as an
  `ExpressionNode`. This allows the right-hand side of a `.` or `->` to
  be a complex expression (like a generic call).
* Simplified `ModuleAccessExpression` to a binary `left`/`right`
  structure, separating scope resolution from generic instantiation.

* Flattened the `Type` AST: replaced recursive `baseType` structures
  with a `Vector<TypeExpressionNode>` (`typeNodes`) to represent
  namespaced paths (e.g., `std::collections::Map`) more efficiently.
* Removed redundant `NamespacedType` and `NamespacedIdentifier` nodes.
* Simplified `GenericType` and `IdentifierType` to use direct `String`
  type names.

* Refactored `parseType` to iterate through namespaced components and
  populate the new flattened `typeNodes` vector.
* Updated the Pratt infix loop to correctly dispatch to `ModuleAccess`,
  `MemberAccess`, or `GenericExpression` based on the operator and
  lookahead tokens.
* Adjusted `toDot` and `toString` visitors to match the new AST
  definitions.
2025-12-27 23:08:26 -06:00
..