Skip to content

Preserve enum commas when token IDs are out of order - #823

Open
ydah wants to merge 1 commit into
masterfrom
fix/token-enum-commas
Open

ydah wants to merge 1 commit into
masterfrom
fix/token-enum-commas

Conversation

@ydah

@ydah ydah commented Oct 21, 2026

Copy link
Copy Markdown
Member

Declaring %token A 300 followed by %token B omitted the comma after A = 300, producing invalid C. The emitter treated the maximum token ID as the last enumerator, although output order can differ from numeric order.

Omit the comma only for the final emitted entry. Add regression coverage for an explicit high token ID followed by an automatically assigned ID.

Verified generated parsers compile and run as C and C++, with and without a separate header.

This branch has not been deployed

No deployments
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