Skip to content

Keep pretty-printer character variable local - #22

Open
dajiaohuang wants to merge 1 commit into
andremm:mainfrom
dajiaohuang:fix-pretty-printer-global-char
Open

dajiaohuang wants to merge 1 commit into
andremm:mainfrom
dajiaohuang:fix-pretty-printer-global-char

Conversation

@dajiaohuang

Copy link
Copy Markdown

Calling the documented pp.tostring API on an AST containing a string assigns each byte to the global char, overwriting a caller's existing value or creating a new global.

Make the character variable local to the loop. Adds a standalone pretty-printer regression, also invoked by test.lua, checking both an existing global sentinel and an absent global while preserving output.

Validation: the regression fails on the original implementation and passes with this fix under isolated embedded Lua 5.1, 5.3 and 5.4 runtimes (Lupa). Fixtures are self-created ASTs only. Native Lua was not on PATH and LPegLabel was unavailable in that isolated environment, so the full parser/luacov suite and the complete CI runtime matrix were not run. No user code or real applications were executed.

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