Right. I’ve successfully managed to replace strtok with a custom Ragel scanner. The code is a bit yucky still, I’ll tidy it up before I push it to my parser branch. Basically I extracted out a match_token function from parse, then replaced parse with Ragel code, while keeping match_token.
One quick question, should we commit the Ragel generated .c files? Or put it in the .gitignore file? My preferences is to not commit it, Ragel appears to be available in all Unix package managers, as well as Homebrew and MSYS2/MinGW on Windows. I expect it’s also available under the Windows Subsystem for Linux.
Secondly, what to do about the : separator? Currently we put a space on either side of it (due to how strtok works). Options are:
- Keep it as it is, space on either side
- Only have a space after the
:, gain an extra character per line
- No spaces surrounding the
: but maybe render it dimmer on the LCD, gain 2 extra characters!
If we do change it, the old format will still be accepted for input, but any extra spaces will be removed. We’ll need to update print_command to output the command correctly.
I favour either option 2 or 3. One weirdness, currently fonts are rendered propertionataly on the teletype! : is 1 pixel wide, ; is 2.