Saturday 29 November 2014

Ruby Parser Milestone: Successfully Parsing A Games Scripts

Huzzah! I can now actually parse a games scripts and extract everything that should be translated (or at least, that's what I believe; it certainly looks like it, but I'm obviously not checking by hand). That's a very significant milestone. The nastiest issue I've faced is Ruby ambiguous /, which is either the beginning of a Regex (which is technically translateable, and can mess with parsing strings etc) or division (which can't)

What next? Well, the Ruby parser is still not actually feature complete. There's a couple of more obscure features which need to be implemented, but most of these are easier. The only difficult one is embedded Ruby code, but hopefully there's some clever hack to work around it. Then there's the matter of finalising version 3 of the patch file format, implementing VX patching in RPGMaker Trans and also improving communication methods between Ruby and Python components (currently using temp files, but would like to use sockets).

Tuesday 18 November 2014

Returning to Action and Heredocs

Wow, where'd the time go.

Well, I can answer that. Short answer is I've had a lot to do at work (kinda expected), in studies (finishing a PhD dissertation), and health problems (yay anaemia!)

Good news is that I'm back in action.

Bad news is that I've decided that Ruby Heredocs are the ungodly spawn of Satan. Who decided that it was a good idea to be able to define multiple heredocs in a single statement? With the capability to mix different types of heredoc? I know that Heredocs are inherited from PHP/Bourne Shell, but seriously, there should be a limit to the number of syntacticly daft ideas that are being kept around because "other more respected languages did them". It doesn't matter when a dumb idea was made, or who did it, it remains dumb.

Yes, that's a rant. Quite a big one, and mainly from the perspective of someone trying to parse a language rather than using it. No offence intended for people who like heredocs, but I just don't see why a simple string would not suffice.

In any case, I've done a quick scan over the suite of VX games I'm using for compatibility testing and can't find any. Hence Heredocs won't be implemented in the first version of the Ruby parser, and that's the end of that.

And as a parting shot on Heredocs: remember custom string delimiters? They don't play nice with Heredocs. <<-%q"END" is a fun one; valid syntax, but I don't think there's a way to end the Heredoc (incidentally, <<%q"END" is invalid syntax). If anyone knows how to finish that Heredoc, answers on the back of a postcard (or in the comments)