Skip to content

Preserve and validate redeclared token metadata - #825

Merged
ydah merged 1 commit into
masterfrom
fix/token-redeclaration-metadata
Oct 28, 2026
Merged

ydah merged 1 commit into
masterfrom
fix/token-redeclaration-metadata

Conversation

@ydah

@ydah ydah commented Oct 24, 2026

Copy link
Copy Markdown
Member

This change uses Bison 3.8.2 as the reference for token redeclaration behavior.

Declaring %left PLUS before %token <i> PLUS "+" previously discarded the alias and type. Preserve metadata across declarations, including repeated explicit token numbers.

Following Bison's behavior, reject repeated type declarations—even with the same type—and changes to an assigned token number. Warn about repeated token declarations and aliases. Keep the first alias and treat additional strings as anonymous tokens that can be named later.

Comment thread spec/lrama/context_spec.rb Resolved
@ydah
ydah force-pushed the fix/token-redeclaration-metadata branch 4 times, most recently from 5f24453 to c9e4561 Compare October 28, 2026 13:56
@ydah
ydah force-pushed the fix/token-redeclaration-metadata branch from c9e4561 to bdcb4ac Compare October 28, 2026 14:13
@ydah
ydah merged commit 5d52ce7 into master Oct 28, 2026
45 checks passed
@ydah
ydah deleted the fix/token-redeclaration-metadata branch October 28, 2026 14:26
@ydah
ydah restored the fix/token-redeclaration-metadata branch October 28, 2026 14:56
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.

2 participants