dansanderson / picotool

Tools and Python libraries for manipulating Pico-8 game files. http://www.lexaloffle.com/pico-8.php
MIT License
371 stars 45 forks source link

Support "?" short-print statements #39

Closed dansanderson closed 5 years ago

dansanderson commented 6 years ago

Pico-8 has another preprocessor macro that treats

? x,y,z

as

print(x,y,z)

As with short-if, this requires that the statement be on its own line. Short-print is mostly intended for use at the command prompt, but some carts use it in cart code because it's one token shorter than print with parens, and fewer chars.

For completeness, maybe Picotool should attempt to support this. I probably wouldn't want to do this unless I remove short-if from the grammar and more properly treat both macros as actual preprocessing steps--taking extra care to flag the AST so it dumps the original short-form statement.

hsandt commented 5 years ago

So is https://github.com/dansanderson/picotool/commit/e4b402c9b135a92db24734aa5339718cc9482d77 fixing it?

dansanderson commented 5 years ago

Looks like it. :) Let me know if it doesn't.