Skip to content

Add support for EEP 79 native records syntax#126

Merged
sile merged 1 commit intomasterfrom
support-eep0079
Feb 12, 2026
Merged

Add support for EEP 79 native records syntax#126
sile merged 1 commit intomasterfrom
support-eep0079

Conversation

@sile
Copy link
Owner

@sile sile commented Feb 12, 2026

This PR implements parser and formatter support for Erlang EEP 79 native records, which introduces an alternative record syntax with module qualification and anonymous record operations.

Key Changes

Record Expressions (expressions/records.rs):

  • Introduce RecordName struct to accept atoms, keywords, or variables as record names (excluding underscore)
  • Introduce QualifiedRecordName struct to support module-qualified names like #mod:state{}
  • Introduce RecordNameRef enum to handle both named and anonymous (#_{}) record references
  • Update RecordConstructExpr, RecordIndexExpr, and RecordUpdateExpr to use the new name types
  • Add comprehensive test cases for qualified and anonymous record syntax

Record Declarations (forms.rs):

  • Split RecordDecl into two variants: TupleRecordDecl (traditional syntax) and NativeRecordDecl (new syntax)
  • Introduce NativeRecordName struct (similar to expression names)
  • Implement native record declarations with syntax: -record #Name(TVar1, ...) { fields }.
  • Support optional type parameters for native records
  • Add accessor methods: is_native() and type_params()
  • Add test cases for native record declarations including keywords and variables as names

Import Changes:

  • Remove unused Either import from expressions.rs
  • Add ColonSymbol and SharpSymbol imports to forms.rs
  • Add KeywordToken imports where needed

This implementation aligns with EEP 79 specification while maintaining backward compatibility with existing tuple-based record syntax.

@sile sile merged commit 201937e into master Feb 12, 2026
8 checks passed
@sile sile deleted the support-eep0079 branch February 12, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant