Wednesday, September 29, 2021

Stewpid O'Clock with Basic in Vim

I wasn't expecting to do this. I never wanted to do this.

But I had to. I felt compelled to.

And so, it is done. Here we have it running in QuickBASIC syntax mode:
Font of Vim (see previous post for details) and retro light-gray text on dark blue background aside, what I had done over the past few hours was to painstakingly define the various highlight groups needed for highlighting the various keywords that QuickBASIC has (there are many). I derived this list from the handy index page of the built-in QuickBASIC help file.

On a whim, I decided to pull up the QBasic help file and check out what keywords it didn't support and incorporate a check in the syntax highlighting definition list to display them as an error. And here is how it looks like with that applied:
Notice how the COMMAND$ is now highlighted in error-red. That's because QBasic does not support that keyword which returns the arguments that were passed from the command line.

Notice also the more subtle effect of '$INCLUDE: 'FILEPAK.BI'. In QuickBASIC mode, it shares the same metacommand syntax highlight as '$DYNAMIC, but in QBasic mode, it is treated as nothing more than a regular comment. The colour change is very subtle, and it is there---in fact, I had to edit this post after publishing just to state this, because I didn't even notice it myself while writing this.

It works well as compared to whatever was being distributed in regular Vim or even in Vim-polyglot. I think there might be some other edge cases that I have overlooked, but c'mon, it's stupid o'clock now. I gotta go crash out before I start to massively hallucinate.

Peace.

No comments: