Skip to content

Fix handling of integer special variables#279

Merged
benhoyt merged 4 commits into
masterfrom
fix-special-values
Apr 11, 2026
Merged

Fix handling of integer special variables#279
benhoyt merged 4 commits into
masterfrom
fix-special-values

Conversation

@benhoyt
Copy link
Copy Markdown
Owner

@benhoyt benhoyt commented Apr 9, 2026

Currently if you do something like:

BEGIN { NR = "x"; print x }

GoAWK prints "0" instead "x" because we store integer special variables like NR and FNR as Go ints. To fix, we should store as AWK value types.

benhoyt added 2 commits April 11, 2026 14:48
BEGIN { NR = "x"; print NR }

GoAWK prints "0" instead "x" because we store integer special variables
like NR and FNR as Go ints. To fix, we should store as AWK value types.

This is just a draft to fix NR and FNR, but all the others (at least
integer ones?) need to be fixed as well.
@benhoyt benhoyt force-pushed the fix-special-values branch from 47f3448 to 58eb9a6 Compare April 11, 2026 02:57
@benhoyt benhoyt changed the title Fix handling of int special variables like NR Fix handling of integer special variables Apr 11, 2026
@benhoyt benhoyt marked this pull request as ready for review April 11, 2026 04:54
@benhoyt benhoyt merged commit 1001a46 into master Apr 11, 2026
9 checks passed
@benhoyt benhoyt deleted the fix-special-values branch April 11, 2026 05: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