ID:111479
 
Keywords: dmsquish, tool
I've been working on a neat tool lately called DMSquish (.NET 4.0 required). It compresses DM code by removing unnecessary characters. Unlike some similar projects I've seen, it does a pretty good job of not breaking your code in the process (although I haven't tested every single odd syntax DM supports, so it might have trouble if you're doing something strange). Generally it can get rid of about 20% of characters, and up to 50% for files with lots of comments. The idea is to help with contests like the Cartridge Classic (which coincidentally ends today IIRC) and possibly serve as an obfuscator if one ever becomes necessary. There's still room for improvement - I'd especially like to add support for parsing dme files to automatically compress a project - but give it a try and comment if you have any problems!
I pasted this into it and got this.

It gives me the following error:

_code\_core\_admintest.dm:1:error: expected ':'

...I'm not entirely sure where it's missing the : at though.

I also notice that it mangled my ? operator use partially.
Nice catch, I must not have tested the ternary operator.
It should work now, although nesting ?:'s within each other or using the : operator in one (neither of which are common) may be problematic.
Unlike some similar projects I've seen, it does a pretty good job of not breaking your code

Hehe, hope that's not me. But I like it, maybe I should have tried making it using C#.
Sorry, that sentence does sound harsher than I meant it to. This kind of thing tends to work well for small code snippets, but starts to become less reliable with more complex files.

I don't think using C# or DM would make a huge difference, and am not even sure why I picked the former for this. I tend to use .NET when a good interface is important (like in my logging utility) because BYOND skins are a major pain compared to WinForms.

And I'm glad you like it :)