Skip to content

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

Merged
ydah merged 1 commit into
masterfrom
fix/token-enum-commas
Oct 27, 2026
Merged

ydah merged 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.

@ydah
ydah merged commit fb303ed into master Oct 27, 2026
45 checks passed
@ydah
ydah deleted the fix/token-enum-commas branch October 27, 2026 00:32
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