vsariola / pakettic

TIC-80 cartridge packer
MIT License
20 stars 4 forks source link

Allow identifiers to start with an underscore #2

Closed wojciech-graj closed 1 year ago

wojciech-graj commented 1 year ago

The following code fails to parse function TIC() _a = 0 end because the identifier _a begins with an underscore. The Lua manual section 3.1 states

Names (also called identifiers) in Lua can be any string of letters, digits, and underscores, not beginning with a digit and not being a reserved word.

This PR fixes this behavior.

vsariola commented 1 year ago

Oops! I even had tests to ensure that it would fail :D Oh well, merged, and changed the tests to test against the correct behavior. Thanks for fixing!