mikefarah / yq

yq is a portable command-line YAML, JSON, XML, CSV, TOML and properties processor
https://mikefarah.gitbook.io/yq/
MIT License
12.37k stars 603 forks source link

fix out of range panic #2112

Closed AdamKorcz closed 2 weeks ago

AdamKorcz commented 4 months ago

I am getting a case where index is 0 and the line therefore attempts to access tokens[-1].

mikefarah commented 4 months ago

Thanks for the PR! Are you able to add a test as well? Probably lexer_participle_test would be a good spot... Otherwise if you let me know what the scenario was, I can add one myself as well.